Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e84159f authored by Doug Zongker's avatar Doug Zongker Committed by Android Git Automerger
Browse files

am 36c051c7: am a695cbc9: am 0fe27cf5: make android_id random seed depend on...

am 36c051c7: am a695cbc9: am 0fe27cf5: make android_id random seed depend on time as well as ro.serialno

Merge commit '36c051c7'

* commit '36c051c7':
  make android_id random seed depend on time as well as ro.serialno
parents 349250f3 36c051c7
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -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);