diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 6a5290e..2e95932 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -222,16 +222,11 @@ public class SettingsProvider extends ContentProvider { final String value = c.moveToNext() ? c.getString(0) : null; if (value == null) { final SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); - String serial = SystemProperties.get("ro.serialno"); - if (serial != null) { - try { - random.setSeed(serial.getBytes("UTF-8")); - } catch (UnsupportedEncodingException ignore) { - // stick with default seed - } - } + String serial = SystemProperties.get("ro.serialno", ""); + random.setSeed( + (serial + System.nanoTime() + new SecureRandom().nextLong()).getBytes()); final String newAndroidIdValue = Long.toHexString(random.nextLong()); - Log.d(TAG, "Generated and saved new ANDROID_ID"); + Log.d(TAG, "Generated and saved new ANDROID_ID [" + newAndroidIdValue + "]"); final ContentValues values = new ContentValues(); values.put(Settings.NameValueTable.NAME, Settings.Secure.ANDROID_ID); values.put(Settings.NameValueTable.VALUE, newAndroidIdValue); |