File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed
packages/SettingsProvider/src/com/android/providers/settings Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change @@ -222,16 +222,11 @@ private boolean ensureAndroidIdIsSet() {
222222 final String value = c .moveToNext () ? c .getString (0 ) : null ;
223223 if (value == null ) {
224224 final SecureRandom random = SecureRandom .getInstance ("SHA1PRNG" );
225- String serial = SystemProperties .get ("ro.serialno" );
226- if (serial != null ) {
227- try {
228- random .setSeed (serial .getBytes ("UTF-8" ));
229- } catch (UnsupportedEncodingException ignore ) {
230- // stick with default seed
231- }
232- }
225+ String serial = SystemProperties .get ("ro.serialno" , "" );
226+ random .setSeed (
227+ (serial + System .nanoTime () + new SecureRandom ().nextLong ()).getBytes ());
233228 final String newAndroidIdValue = Long .toHexString (random .nextLong ());
234- Log .d (TAG , "Generated and saved new ANDROID_ID" );
229+ Log .d (TAG , "Generated and saved new ANDROID_ID [" + newAndroidIdValue + "] " );
235230 final ContentValues values = new ContentValues ();
236231 values .put (Settings .NameValueTable .NAME , Settings .Secure .ANDROID_ID );
237232 values .put (Settings .NameValueTable .VALUE , newAndroidIdValue );
You can’t perform that action at this time.
0 commit comments