summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/res/res/values/config.xml3
-rw-r--r--core/res/res/values/symbols.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java19
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java12
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java39
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java21
6 files changed, 86 insertions, 11 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index c7226f69340b..444a2fd281af 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -6555,6 +6555,9 @@
Off by default, since OEMs may have had a similar feature on their devices. -->
<bool name="config_repairModeSupported">false</bool>
+ <!-- Whether unlocking and waking a device are sequenced -->
+ <bool name="config_orderUnlockAndWake">false</bool>
+
<!-- Enables or disables the "Share" action item shown in the context menu that appears upon
long-pressing on selected text. Enabled by default. -->
<bool name="config_textShareSupported">true</bool>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 655892da9b9a..b30d1a012f97 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -5161,4 +5161,7 @@
<java-symbol type="drawable" name="focus_event_pressed_key_background" />
<java-symbol type="string" name="lockscreen_too_many_failed_attempts_countdown" />
+
+ <!-- Whether we order unlocking and waking -->
+ <java-symbol type="bool" name="config_orderUnlockAndWake" />
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index a55cfa7c066d..8344285376f2 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -480,6 +480,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
private final int mDreamOpenAnimationDuration;
/**
+ * Whether unlock and wake should be sequenced.
+ */
+ private final boolean mOrderUnlockAndWake;
+
+ /**
* The animation used for hiding keyguard. This is used to fetch the animation timings if
* WindowManager is not providing us with them.
*/
@@ -1455,6 +1460,9 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
mDreamingToLockscreenTransitionViewModel = dreamingToLockscreenTransitionViewModel;
mWmLockscreenVisibilityManager = wmLockscreenVisibilityManager;
mMainDispatcher = mainDispatcher;
+
+ mOrderUnlockAndWake = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_orderUnlockAndWake);
}
public void userActivity() {
@@ -2835,6 +2843,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
private void setUnlockAndWakeFromDream(boolean updatedValue,
@WakeAndUnlockUpdateReason int reason) {
+ if (!mOrderUnlockAndWake) {
+ return;
+ }
+
if (updatedValue == mUnlockingAndWakingFromDream) {
return;
}
@@ -2917,6 +2929,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
null /* nonApps */, null /* finishedCallback */);
});
}
+
+ // It's possible that the device was unlocked (via BOUNCER or Fingerprint) while
+ // dreaming. It's time to wake up.
+ if ((mDreamOverlayShowing || mUpdateMonitor.isDreaming()) && !mOrderUnlockAndWake) {
+ mPM.wakeUp(mSystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
+ "com.android.systemui:UNLOCK_DREAMING");
+ }
}
Trace.endSection();
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
index adff681bb53b..3e99bc31441a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java
@@ -177,6 +177,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private final VibratorHelper mVibratorHelper;
private final BiometricUnlockLogger mLogger;
private final SystemClock mSystemClock;
+ private final boolean mOrderUnlockAndWake;
private long mLastFpFailureUptimeMillis;
private int mNumConsecutiveFpFailures;
@@ -316,6 +317,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mLogger = biometricUnlockLogger;
mSystemClock = systemClock;
mFeatureFlags = featureFlags;
+ mOrderUnlockAndWake = resources.getBoolean(
+ com.android.internal.R.bool.config_orderUnlockAndWake);
dumpManager.registerDumpable(getClass().getName(), this);
}
@@ -470,10 +473,11 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
Trace.endSection();
};
- final boolean wakingFromDream = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM
- && mPowerManager.isInteractive();
+ final boolean wakeInKeyguard = mMode == MODE_WAKE_AND_UNLOCK_FROM_DREAM
+ && mPowerManager.isInteractive() && mOrderUnlockAndWake
+ && mOrderUnlockAndWake;
- if (mMode != MODE_NONE && !wakingFromDream) {
+ if (mMode != MODE_NONE && !wakeInKeyguard) {
wakeUp.run();
}
switch (mMode) {
@@ -509,7 +513,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
// later to awaken.
}
mNotificationShadeWindowController.setNotificationShadeFocusable(false);
- mKeyguardViewMediator.onWakeAndUnlocking(wakingFromDream);
+ mKeyguardViewMediator.onWakeAndUnlocking(wakeInKeyguard);
Trace.endSection();
break;
case MODE_ONLY_WAKE:
diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
index b05de48ae224..ab3d44f02ee4 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java
@@ -333,10 +333,34 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
@Test
@TestableLooper.RunWithLooper(setAsMainLooper = true)
- public void wakeupFromDreamingWhenKeyguardHides() {
+ public void wakeupFromDreamingWhenKeyguardHides_orderUnlockAndWakeOff() {
+ createAndStartViewMediator(false);
+
mViewMediator.onSystemReady();
TestableLooper.get(this).processAllMessages();
+ // Given device is dreaming
+ when(mUpdateMonitor.isDreaming()).thenReturn(true);
+
+ // When keyguard is going away
+ mKeyguardStateController.notifyKeyguardGoingAway(true);
+
+ // And keyguard is disabled which will call #handleHide
+ mViewMediator.setKeyguardEnabled(false);
+ TestableLooper.get(this).processAllMessages();
+
+ // Then dream should wake up
+ verify(mPowerManager).wakeUp(anyLong(), anyInt(),
+ eq("com.android.systemui:UNLOCK_DREAMING"));
+ }
+
+ @Test
+ @TestableLooper.RunWithLooper(setAsMainLooper = true)
+ public void wakeupFromDreamingWhenKeyguardHides_orderUnlockAndWakeOn() {
+ createAndStartViewMediator(true);
+
+ mViewMediator.onSystemReady();
+ TestableLooper.get(this).processAllMessages();
when(mPowerManager.isInteractive()).thenReturn(true);
// Given device is dreaming
@@ -726,6 +750,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
@Test
public void testWakeAndUnlockingOverDream() {
+ // Ensure ordering unlock and wake is enabled.
+ createAndStartViewMediator(true);
+
// Send signal to wake
mViewMediator.onWakeAndUnlocking(true);
@@ -755,6 +782,9 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
@Test
public void testWakeAndUnlockingOverDream_signalAuthenticateIfStillShowing() {
+ // Ensure ordering unlock and wake is enabled.
+ createAndStartViewMediator(true);
+
// Send signal to wake
mViewMediator.onWakeAndUnlocking(true);
@@ -916,6 +946,13 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
verify(mStatusBarKeyguardViewManager).reset(true);
}
private void createAndStartViewMediator() {
+ createAndStartViewMediator(false);
+ }
+
+ private void createAndStartViewMediator(boolean orderUnlockAndWake) {
+ mContext.getOrCreateTestableResources().addOverride(
+ com.android.internal.R.bool.config_orderUnlockAndWake, orderUnlockAndWake);
+
mViewMediator = new KeyguardViewMediator(
mContext,
mUiEventLogger,
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
index 481f7f7858b4..5107ecc6bc1a 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java
@@ -135,7 +135,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mFeatureFlags = new FakeFeatureFlags();
mFeatureFlags.set(FP_LISTEN_OCCLUDING_APPS, false);
mFeatureFlags.set(ONE_WAY_HAPTICS_API_MIGRATION, false);
- TestableResources res = getContext().getOrCreateTestableResources();
when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
@@ -145,7 +144,16 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
when(mAuthController.isUdfpsFingerDown()).thenReturn(false);
when(mVibratorHelper.hasVibrator()).thenReturn(true);
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
- mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController,
+ mBiometricUnlockController = createController(false);
+ when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker);
+ when(mStatusBarKeyguardViewManager.getViewRootImpl()).thenReturn(mViewRootImpl);
+ }
+
+ BiometricUnlockController createController(boolean orderUnlockAndWake) {
+ TestableResources res = getContext().getOrCreateTestableResources();
+ res.addOverride(com.android.internal.R.bool.config_orderUnlockAndWake, orderUnlockAndWake);
+ BiometricUnlockController biometricUnlockController = new BiometricUnlockController(
+ mDozeScrimController,
mKeyguardViewMediator,
mNotificationShadeWindowController, mKeyguardStateController, mHandler,
mUpdateMonitor, res.getResources(), mKeyguardBypassController,
@@ -156,10 +164,10 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mSystemClock,
mFeatureFlags
);
- mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
- mBiometricUnlockController.addListener(mBiometricUnlockEventsListener);
- when(mUpdateMonitor.getStrongAuthTracker()).thenReturn(mStrongAuthTracker);
- when(mStatusBarKeyguardViewManager.getViewRootImpl()).thenReturn(mViewRootImpl);
+ biometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
+ biometricUnlockController.addListener(mBiometricUnlockEventsListener);
+
+ return biometricUnlockController;
}
@Test
@@ -667,6 +675,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
}
@Test
public void onSideFingerprintSuccess_dreaming_unlockNoWake() {
+ mBiometricUnlockController = createController(true);
when(mAuthController.isSfpsEnrolled(anyInt())).thenReturn(true);
when(mWakefulnessLifecycle.getLastWakeReason())
.thenReturn(PowerManager.WAKE_REASON_POWER_BUTTON);