diff options
author | Beverly <beverlyt@google.com> | 2021-05-19 10:36:18 -0400 |
---|---|---|
committer | Beverly Tai <beverlyt@google.com> | 2021-05-20 19:10:52 +0000 |
commit | bc67508d6d04c54d08d513f8ed303e3055835e31 (patch) | |
tree | 84adda724d0df92022126429f8582bb560f02be3 /packages/SystemUI/src | |
parent | fd4d01d8a0da9fdb4c7e243a040036c32938ac72 (diff) |
Udfps icon, udfps bouncer, and lockicon/button bug fixes
- Delay updating visibility of the LockIcon/Button when the FPS running
state changes to false. The fingeprint listening state may be cancelled on
screen off and immediately restarted on entering AOD. During this brief
moment, we don't want to flash the grey button (affordance for bouncer
when fps isn't running).
- Remove keyguard visibility check from UdfpsKeyguardViewController -
this was delaying showing the udfps icon on AOD since the visibilty
changes too late.
- Update udfps bouncer logic - only show the generic bouncer from
showBouncerIfKeyguard if we're on the keyguard and bouncer isn't about
to show (from swiping up from the bottom).
- Reset leaveOpenOnKeyguardHide when a user exits the bouncer from a
backpress. We don't want this state to linger into the next auth
attempt.
Test: manual
Fixes: 188605736
Fixes: 187131910
Fixes: 185951882
Change-Id: Ibcddccdde0173b312404ea33741adc6a15efab6b
Diffstat (limited to 'packages/SystemUI/src')
4 files changed, 71 insertions, 39 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 44df02a9023a..07c3bef6d6aa 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -2145,7 +2145,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab && !isEncryptedOrLockdown(getCurrentUser()) && mStrongAuthTracker.hasUserAuthenticatedSinceBoot() && userDoesNotHaveTrust); - return shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState && shouldListenUdfpsState; } @@ -3270,7 +3269,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab pw.println(" disabled(DPM)=" + isFingerprintDisabled(userId)); pw.println(" possible=" + isUnlockWithFingerprintPossible(userId)); pw.println(" listening: actual=" + mFingerprintRunningState - + " expected=" + (shouldListenForFingerprint(false) ? 1 : 0)); + + " expected=" + (shouldListenForFingerprint(isUdfpsEnrolled()) ? 1 : 0)); pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags)); pw.println(" trustManaged=" + getUserTrustIsManaged(userId)); pw.println(" udfpsEnrolled=" + isUdfpsEnrolled()); diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index 0ea01fdb0bf6..6b85ba8420fc 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -40,6 +40,7 @@ import com.android.settingslib.Utils; import com.android.systemui.Dumpable; import com.android.systemui.R; import com.android.systemui.biometrics.AuthController; +import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dump.DumpManager; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -48,6 +49,7 @@ import com.android.systemui.statusbar.phone.dagger.StatusBarComponent; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.util.ViewController; +import com.android.systemui.util.concurrency.DelayableExecutor; import java.io.FileDescriptor; import java.io.PrintWriter; @@ -70,6 +72,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull private final AuthController mAuthController; @NonNull private final AccessibilityManager mAccessibilityManager; @NonNull private final ConfigurationController mConfigurationController; + @NonNull private final DelayableExecutor mExecutor; private boolean mHasUdfpsOrFaceAuthFeatures; private boolean mUdfpsEnrolled; @@ -90,6 +93,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme private int mStatusBarState; private boolean mIsKeyguardShowing; private boolean mUserUnlockedWithBiometric; + private Runnable mCancelDelayedUpdateVisibilityRunnable; private boolean mShowButton; private boolean mShowUnlockIcon; @@ -106,7 +110,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @NonNull AuthController authController, @NonNull DumpManager dumpManager, @NonNull AccessibilityManager accessibilityManager, - @NonNull ConfigurationController configurationController + @NonNull ConfigurationController configurationController, + @NonNull @Main DelayableExecutor executor ) { super(view); mStatusBarStateController = statusBarStateController; @@ -117,6 +122,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mFalsingManager = falsingManager; mAccessibilityManager = accessibilityManager; mConfigurationController = configurationController; + mExecutor = executor; final Context context = view.getContext(); mButton = context.getResources().getDrawable( @@ -202,6 +208,11 @@ public class LockIconViewController extends ViewController<LockIconView> impleme mKeyguardStateController.removeCallback(mKeyguardStateCallback); mAccessibilityManager.removeTouchExplorationStateChangeListener( mTouchExplorationStateChangeListener); + + if (mCancelDelayedUpdateVisibilityRunnable != null) { + mCancelDelayedUpdateVisibilityRunnable.run(); + mCancelDelayedUpdateVisibilityRunnable = null; + } } public float getTop() { @@ -213,8 +224,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme return false; } - // pre-emptively set to false to hide view - mIsKeyguardShowing = false; + // pre-emptively set to true to hide view + mIsBouncerShowing = true; updateVisibility(); mKeyguardViewController.showBouncer(/* scrim */ true); return true; @@ -229,6 +240,11 @@ public class LockIconViewController extends ViewController<LockIconView> impleme } private void updateVisibility() { + if (mCancelDelayedUpdateVisibilityRunnable != null) { + mCancelDelayedUpdateVisibilityRunnable.run(); + mCancelDelayedUpdateVisibilityRunnable = null; + } + if (!mIsKeyguardShowing || (!mUdfpsEnrolled && !mFaceAuthEnrolled)) { mView.setVisibility(View.INVISIBLE); return; @@ -318,13 +334,13 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) { - pw.println(" mShowBouncerButton: " + mShowButton); - pw.println(" mShowUnlockIcon: " + mShowUnlockIcon); - pw.println(" mShowLockIcon: " + mShowLockIcon); - pw.println(" mHasUdfpsOrFaceAuthFeatures: " + mHasUdfpsOrFaceAuthFeatures); - pw.println(" mUdfpsEnrolled: " + mUdfpsEnrolled); - pw.println(" mFaceAuthEnrolled: " + mFaceAuthEnrolled); - pw.println(" mIsKeyguardShowing: " + mIsKeyguardShowing); + pw.println("mHasUdfpsOrFaceAuthFeatures: " + mHasUdfpsOrFaceAuthFeatures); + pw.println("mUdfpsEnrolled: " + mUdfpsEnrolled); + pw.println("mFaceAuthEnrolled: " + mFaceAuthEnrolled); + pw.println("mIsKeyguardShowing: " + mIsKeyguardShowing); + pw.println(" mShowBouncerButton: " + mShowButton); + pw.println(" mShowUnlockIcon: " + mShowUnlockIcon); + pw.println(" mShowLockIcon: " + mShowLockIcon); pw.println(" mIsDozing: " + mIsDozing); pw.println(" mIsBouncerShowing: " + mIsBouncerShowing); pw.println(" mUserUnlockedWithBiometric: " + mUserUnlockedWithBiometric); @@ -352,6 +368,14 @@ public class LockIconViewController extends ViewController<LockIconView> impleme private final KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() { @Override + public void onKeyguardVisibilityChanged(boolean showing) { + // reset mIsBouncerShowing state in case it was preemptively set + // onAffordanceClick + mIsBouncerShowing = mKeyguardViewController.isBouncerShowing(); + updateVisibility(); + } + + @Override public void onKeyguardBouncerChanged(boolean bouncer) { mIsBouncerShowing = bouncer; updateVisibility(); @@ -366,7 +390,19 @@ public class LockIconViewController extends ViewController<LockIconView> impleme if (biometricSourceType == FINGERPRINT) { mRunningFPS = running; - updateVisibility(); + if (!mRunningFPS) { + if (mCancelDelayedUpdateVisibilityRunnable != null) { + mCancelDelayedUpdateVisibilityRunnable.run(); + } + + // For some devices, auth is cancelled immediately on screen off but + // before dozing state is set. We want to avoid briefly showing the + // button in this case, so we delay updating the visibility by 50ms. + mCancelDelayedUpdateVisibilityRunnable = + mExecutor.executeDelayed(() -> updateVisibility(), 50); + } else { + updateVisibility(); + } } } }; diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java index 78588b2b5cc4..2b4c1aba59b6 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.java @@ -56,7 +56,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud @NonNull private final KeyguardViewMediator mKeyguardViewMediator; @NonNull private final UdfpsController mUdfpsController; - @Nullable private Runnable mCancelRunnable; + @Nullable private Runnable mCancelDelayedHintRunnable; private boolean mShowingUdfpsBouncer; private boolean mUdfpsRequested; private boolean mQsExpanded; @@ -64,7 +64,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud private boolean mHintShown; private boolean mTransitioningFromHome; private int mStatusBarState; - private boolean mKeyguardIsVisible; /** * hidden amount of pin/pattern/password bouncer @@ -111,7 +110,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud mUdfpsRequested = false; mStatusBarState = mStatusBarStateController.getState(); mQsExpanded = mKeyguardViewManager.isQsExpanded(); - mKeyguardIsVisible = mKeyguardUpdateMonitor.isKeyguardVisible(); mInputBouncerHiddenAmount = KeyguardBouncer.EXPANSION_HIDDEN; updateAlpha(); updatePauseAuth(); @@ -131,9 +129,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud mTransitioningFromHome = false; mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false); - if (mCancelRunnable != null) { - mCancelRunnable.run(); - mCancelRunnable = null; + if (mCancelDelayedHintRunnable != null) { + mCancelDelayedHintRunnable.run(); + mCancelDelayedHintRunnable = null; } } @@ -145,7 +143,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud pw.println("mTransitioningFromHomeToKeyguard=" + mTransitioningFromHome); pw.println("mStatusBarState=" + StatusBarState.toShortString(mStatusBarState)); pw.println("mQsExpanded=" + mQsExpanded); - pw.println("mKeyguardVisible=" + mKeyguardIsVisible); pw.println("mIsBouncerVisible=" + mIsBouncerVisible); pw.println("mInputBouncerHiddenAmount=" + mInputBouncerHiddenAmount); pw.println("mAlpha=" + mView.getAlpha()); @@ -205,11 +202,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud return true; } - if (!mKeyguardIsVisible) { - return true; - } - - if (mInputBouncerHiddenAmount < .4f) { + if (mInputBouncerHiddenAmount < .4f || mIsBouncerVisible) { return true; } @@ -240,9 +233,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud } private void cancelDelayedHint() { - if (mCancelRunnable != null) { - mCancelRunnable.run(); - mCancelRunnable = null; + if (mCancelDelayedHintRunnable != null) { + mCancelDelayedHintRunnable.run(); + mCancelDelayedHintRunnable = null; } } @@ -252,9 +245,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud } // show udfps hint a few seconds after face auth started running - if (!mFaceDetectRunning && running && !mHintShown && mCancelRunnable == null) { + if (!mFaceDetectRunning && running && !mHintShown && mCancelDelayedHintRunnable == null) { // Face detect started running, show udfps hint after a delay - mCancelRunnable = mExecutor.executeDelayed(() -> showHint(false), + mCancelDelayedHintRunnable = mExecutor.executeDelayed(() -> showHint(false), AFTER_FACE_AUTH_HINT_DELAY); } @@ -328,11 +321,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud cancelDelayedHint(); } } - - public void onKeyguardVisibilityChangedRaw(boolean showing) { - mKeyguardIsVisible = showing; - updatePauseAuth(); - } }; private final StatusBarKeyguardViewManager.AlternateAuthInterceptor mAlternateAuthInterceptor = @@ -385,6 +373,9 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud @Override public void onBouncerVisibilityChanged() { mIsBouncerVisible = mKeyguardViewManager.bouncerIsOrWillBeShowing(); + if (!mIsBouncerVisible) { + mInputBouncerHiddenAmount = 1f; + } updatePauseAuth(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 9c6d6238d406..ddd849c1ab4d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3669,7 +3669,9 @@ public class StatusBar extends SystemUI implements DemoMode, public boolean onBackPressed() { boolean isScrimmedBouncer = mScrimController.getState() == ScrimState.BOUNCER_SCRIMMED; if (mStatusBarKeyguardViewManager.onBackPressed(isScrimmedBouncer /* hideImmediately */)) { - if (!isScrimmedBouncer) { + if (isScrimmedBouncer) { + mStatusBarStateController.setLeaveOpenOnKeyguardHide(false); + } else { mNotificationPanelViewController.expandWithoutQs(); } return true; @@ -3704,9 +3706,13 @@ public class StatusBar extends SystemUI implements DemoMode, } private void showBouncerIfKeyguard() { - if ((mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) - && !mKeyguardViewMediator.isHiding()) { - mStatusBarKeyguardViewManager.showGenericBouncer(true /* scrimmed */); + if (!mKeyguardViewMediator.isHiding()) { + if (mState == StatusBarState.KEYGUARD + && !mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()) { + mStatusBarKeyguardViewManager.showGenericBouncer(true /* scrimmed */); + } else if (mState == StatusBarState.SHADE_LOCKED) { + mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); + } } } |