OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.identity; | 5 package org.chromium.chrome.browser.identity; |
6 | 6 |
7 import android.annotation.SuppressLint; | |
7 import android.content.Context; | 8 import android.content.Context; |
8 import android.provider.Settings; | 9 import android.provider.Settings; |
9 | 10 |
10 import org.chromium.base.VisibleForTesting; | 11 import org.chromium.base.VisibleForTesting; |
11 import org.chromium.chrome.browser.util.HashUtil; | 12 import org.chromium.chrome.browser.util.HashUtil; |
12 | 13 |
13 import javax.annotation.Nullable; | 14 import javax.annotation.Nullable; |
14 | 15 |
15 /** | 16 /** |
16 * Unique identificator implementation that uses the Settings.Secure.ANDROID_ID field and MD5 | 17 * Unique identificator implementation that uses the Settings.Secure.ANDROID_ID field and MD5 |
(...skipping 15 matching lines...) Expand all Loading... | |
32 String androidId = getAndroidId(); | 33 String androidId = getAndroidId(); |
33 if (androidId == null) { | 34 if (androidId == null) { |
34 return ""; | 35 return ""; |
35 } | 36 } |
36 | 37 |
37 String md5Hash = HashUtil.getMd5Hash( | 38 String md5Hash = HashUtil.getMd5Hash( |
38 new HashUtil.Params(androidId).withSalt(salt)); | 39 new HashUtil.Params(androidId).withSalt(salt)); |
39 return md5Hash == null ? "" : md5Hash; | 40 return md5Hash == null ? "" : md5Hash; |
40 } | 41 } |
41 | 42 |
43 // TODO(crbug.com/635567): Fix this properly. | |
Ted C
2017/04/27 19:02:47
This class was designed around ANDROID_ID. Again,
F
2017/04/28 18:25:15
Done.
| |
44 @SuppressLint("HardwareIds") | |
42 @VisibleForTesting | 45 @VisibleForTesting |
43 String getAndroidId() { | 46 String getAndroidId() { |
44 return Settings.Secure.getString(mContext.getContentResolver(), Settings .Secure.ANDROID_ID); | 47 return Settings.Secure.getString(mContext.getContentResolver(), Settings .Secure.ANDROID_ID); |
45 } | 48 } |
46 } | 49 } |
OLD | NEW |