From 435ee9b979dc21c5063bb5ffbfdb35c3f321bffc Mon Sep 17 00:00:00 2001 From: lbill Date: Wed, 26 Apr 2023 19:26:40 +0000 Subject: [PATCH] Disable 3-Button NavBar Recents key when launch secure camera In general, recents key is useless in double click power key launch camera CUJ, we can hide recents to prevent user click and invoke Keyguard face auth while the camera is running concurrently. And at the moment, face auth is not able to access camera, then fallback to fingerprint authentication. While user see dim beyond camera preview, and face auth not work bring bad UX to user, disable Recent key in the scenario sounds make sense. Bug: 268593702 Test: Double click to launch camera in 3-button Nav mode make sure recent key is hide Test: atest KeyguardViewMediatorTest Change-Id: I5cc50b8bb49725f6e53445bdd1c9e3a8d0a15a88 --- .../keyguard/KeyguardViewMediator.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 99a9bed5a2bbc..419ecf0fa1d28 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -1463,13 +1463,17 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, notifyFinishedGoingToSleep(); if (cameraGestureTriggered) { - // Just to make sure, make sure the device is awake. mContext.getSystemService(PowerManager.class).wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_CAMERA_LAUNCH, "com.android.systemui:CAMERA_GESTURE_PREVENT_LOCK"); setPendingLock(false); mPendingReset = false; + mPowerGestureIntercepted = true; + if (DEBUG) { + Log.d(TAG, "cameraGestureTriggered=" + cameraGestureTriggered + + ",mPowerGestureIntercepted=" + mPowerGestureIntercepted); + } } if (mPendingReset) { @@ -1668,7 +1672,13 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, mAnimatingScreenOff = false; cancelDoKeyguardLaterLocked(); cancelDoKeyguardForChildProfilesLocked(); - if (DEBUG) Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence); + if (cameraGestureTriggered) { + mPowerGestureIntercepted = true; + } + if (DEBUG) { + Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence + + ", mPowerGestureIntercepted = " + mPowerGestureIntercepted); + } notifyStartedWakingUp(); } mUpdateMonitor.dispatchStartedWakingUp(pmWakeReason); @@ -1884,12 +1894,19 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, startKeyguardExitAnimation(0, 0); } + mPowerGestureIntercepted = mUpdateMonitor.isSecureCameraLaunchedOverKeyguard(); + if (mOccluded != isOccluded) { mOccluded = isOccluded; mKeyguardViewControllerLazy.get().setOccluded(isOccluded, animate && mDeviceInteractive); adjustStatusBarLocked(); } + + if (DEBUG) { + Log.d(TAG, "isOccluded=" + isOccluded + ",mPowerGestureIntercepted=" + + mPowerGestureIntercepted); + } } Trace.endSection(); } @@ -2996,6 +3013,10 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, flags |= StatusBarManager.DISABLE_RECENT; } + if (mPowerGestureIntercepted) { + flags |= StatusBarManager.DISABLE_RECENT; + } + if (DEBUG) { Log.d(TAG, "adjustStatusBarLocked: mShowing=" + mShowing + " mOccluded=" + mOccluded + " isSecure=" + isSecure() + " force=" + forceHideHomeRecentsButtons