Cancel authentication when secure camera is launched on Keyguard

To decrease potential latency in starting the secure camera, rather than
waiting for keyguard to become occluded and canceling authentication, we
pre-emptively cancel face auth on keyguard when double tap is activated.
This saves hundreds of ms.

Fixes: 134613755

Test: With added logging, observed that cancel is now invoked immediately
      when double tap for camera is triggered.

Change-Id: I3740c55fb608cd1f8aa228768389f192cf18d557
This commit is contained in:
Kevin Chyn
2019-06-10 14:07:13 -07:00
parent 155cb7c247
commit 6951d3df6c
2 changed files with 22 additions and 1 deletions

View File

@@ -212,6 +212,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
private boolean mHasLockscreenWallpaper;
private boolean mAssistantVisible;
private boolean mKeyguardOccluded;
private boolean mSecureCameraLaunched;
@VisibleForTesting
protected boolean mTelephonyCapable;
@@ -522,6 +523,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
updateBiometricListeningState();
}
/**
* Invoked when the secure camera is launched.
*/
public void onCameraLaunched() {
mSecureCameraLaunched = true;
updateBiometricListeningState();
}
/**
* @return a cached version of DreamManager.isDreaming()
*/
@@ -1654,7 +1663,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
&& !mSwitchingUser && !getUserCanSkipBouncer(user) && !isFaceDisabled(user)
&& !mKeyguardGoingAway && mFaceSettingEnabledForUser && !mLockIconPressed
&& mUserManager.isUserUnlocked(user) && mIsPrimaryUser;
&& mUserManager.isUserUnlocked(user) && mIsPrimaryUser
&& !mSecureCameraLaunched;
}
/**
@@ -2102,6 +2112,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
checkIsHandlerThread();
Log.d(TAG, "onKeyguardVisibilityChanged(" + showing + ")");
mKeyguardIsVisible = showing;
if (showing) {
mSecureCameraLaunched = false;
}
for (int i = 0; i < mCallbacks.size(); i++) {
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
if (cb != null) {

View File

@@ -3770,6 +3770,12 @@ public class StatusBar extends SystemUI implements DemoMode,
"com.android.systemui:CAMERA_GESTURE");
}
vibrateForCameraGesture();
if (source == StatusBarManager.CAMERA_LAUNCH_SOURCE_POWER_DOUBLE_TAP) {
Log.v(TAG, "Camera launch");
mKeyguardUpdateMonitor.onCameraLaunched();
}
if (!mStatusBarKeyguardViewManager.isShowing()) {
startActivityDismissingKeyguard(KeyguardBottomAreaView.INSECURE_CAMERA_INTENT,
false /* onlyProvisioned */, true /* dismissShade */,