Remove password shards from memory
Force a garbage collection and zeroize some fields after Activity finishes Test: Goes through password change flow, then grab a heap dump via adb shell 'am dumpheap $(pidof com.android.settings) /data/local/tmp/settings.hprof' And grep for password in the dump Bug: 144537463 Change-Id: Idd0a04ada98900aeb2a6d20bb1270a4a4aec2cfd
This commit is contained in:
@@ -157,6 +157,16 @@ public abstract class ConfirmDeviceCredentialBaseActivity extends SettingsActivi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
// Force a garbage collection immediately to remove remnant of user password shards
|
||||
// from memory.
|
||||
System.gc();
|
||||
System.runFinalization();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
|
Reference in New Issue
Block a user