diff options
| author | 2019-11-13 15:25:42 +0000 | |
|---|---|---|
| committer | 2019-11-14 11:45:02 +0000 | |
| commit | 20aa6cd497a6677ce8c1f80142630624fa0b1c2f (patch) | |
| tree | d6afd997c991e473e77bc3b857a4f7168f6b3470 | |
| parent | d02b13334bcc241144307b3e612681ac2bcd9ae9 (diff) | |
Force a garbage collection after lockscreen verification
This is to attempt erasing any lockscreen password remnants from memory,
which is a NIAP certification requirement.
Bug: 142861621
Test: reboot device, enter lockscreen password, then use pmdump to dump
process memory for SystemUi, verify password does not exist in the dump.
Change-Id: Ifbec81a64e4c592b566f5653bd93fd7326693ec7
| -rw-r--r-- | packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index b9fe9334d14c..91b22d178b9f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -46,6 +46,7 @@ import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityModel.SecurityMode; +import com.android.settingslib.utils.ThreadUtils; import com.android.systemui.Dependency; import com.android.systemui.R; import com.android.systemui.SystemUIFactory; @@ -617,6 +618,15 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe StatsLog.write(StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED, StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__SUCCESS); mLockPatternUtils.reportSuccessfulPasswordAttempt(userId); + // Force a garbage collection in an attempt to erase any lockscreen password left in + // memory. Do it asynchronously with a 5-sec delay to avoid making the keyguard + // dismiss animation janky. + ThreadUtils.postOnBackgroundThread(() -> { + try { + Thread.sleep(5000); + } catch (InterruptedException ignored) { } + Runtime.getRuntime().gc(); + }); } else { StatsLog.write(StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED, StatsLog.KEYGUARD_BOUNCER_PASSWORD_ENTERED__RESULT__FAILURE); |