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

Commit ba267751 authored by Haining Chen's avatar Haining Chen
Browse files

Do not turn off screen before locking out device

Adaptive auth originally decided to turn off the screen before locking
out the device in order to always show the lockscreen on the foreground
with proper strings to explain why the device is being locked out.
Otherwise activities such as BiometricPrompt may take the foreground,
and users may have to dismiss such activities before seeing the
lockscreen.

UI becomes inconsistent depending on whether AOD is enabled. If AOD is
disabled, putting the device into sleep turns it into a black screen. If
AOD is enabled, AOD is shown but sometimes the lockscreen is shown
because the screen is turned back on due to different wake reasons (e.g.
WAKE_REASON_BIOMETRIC, WAKE_REASON_LIFT, etc.).

To avoid inconsistent UI and potential user confusions (due to the black
screen), this fix changes to not turn off the screen.

Flag: EXEMPT bugfix
Bug: 353869874
Test: atest AdaptiveAuthServiceTest
Test: With AOD disabled, trigger adaptive auth on an unlocked device by
      failing biometric auth 5 times on BiometricPrompt, and then verify
      that the lockscreen is immediately shown without seeing a black
      screen first. With AOD enabled, trigger adaptive auth and then
      verify that the lockscreen is immediately shown followed by AOD if
      the screen is off due to timeout.
Change-Id: I253dc9adcc011892549ebb9172bd64308bca12fc
parent c82d03c6
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.Log;
import android.util.Slog;
@@ -73,7 +72,6 @@ public class AdaptiveAuthService extends SystemService {
    private final LockSettingsInternal mLockSettings;
    private final BiometricManager mBiometricManager;
    private final KeyguardManager mKeyguardManager;
    private final PowerManager mPowerManager;
    private final WindowManagerInternal mWindowManager;
    private final UserManagerInternal mUserManager;
    @VisibleForTesting
@@ -93,7 +91,6 @@ public class AdaptiveAuthService extends SystemService {
        mBiometricManager = Objects.requireNonNull(
                context.getSystemService(BiometricManager.class));
        mKeyguardManager = Objects.requireNonNull(context.getSystemService(KeyguardManager.class));
        mPowerManager = Objects.requireNonNull(context.getSystemService(PowerManager.class));
        mWindowManager = Objects.requireNonNull(
                LocalServices.getService(WindowManagerInternal.class));
        mUserManager = Objects.requireNonNull(LocalServices.getService(UserManagerInternal.class));
@@ -290,9 +287,6 @@ public class AdaptiveAuthService extends SystemService {
                    parentUserId);
        }

        // Power off the display
        mPowerManager.goToSleep(SystemClock.uptimeMillis());

        // Lock the device
        mWindowManager.lockNow();