diff options
| author | 2023-06-26 16:50:13 +0000 | |
|---|---|---|
| committer | 2023-06-26 16:50:13 +0000 | |
| commit | 27ea6f0917118b362f9f3571eef0548a0ffeb99a (patch) | |
| tree | a2d4e035a32045f1e2fcae141ab87464be5dded9 | |
| parent | 2f97225163a3692dcf7950d1db09944a460adfba (diff) | |
| parent | 3bb092b408363e94eb15ce44cce41da5ede3c1d6 (diff) | |
Merge changes I8c2d2ccd,I9bc97666,I52783d0a into udc-qpr-dev
* changes:
Ensure swipe down works for bouncer to dismiss
Do not refetch pin length
Ensure that disappear animation callback is run.
9 files changed, 80 insertions, 40 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java index 3e16d559742d..6f596843bf9f 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinViewController.java @@ -43,6 +43,15 @@ public class KeyguardPinViewController private long mPinLength; private boolean mDisabledAutoConfirmation; + /** + * Responsible for identifying if PIN hinting is to be enabled or not + */ + private boolean mIsPinHinting; + + /** + * Responsible for identifying if auto confirm is enabled or not in Settings + */ + private boolean mIsAutoPinConfirmEnabledInSettings; protected KeyguardPinViewController(KeyguardPINView view, KeyguardUpdateMonitor keyguardUpdateMonitor, @@ -63,6 +72,9 @@ public class KeyguardPinViewController mFeatureFlags = featureFlags; mBackspaceKey = view.findViewById(R.id.delete_button); mPinLength = mLockPatternUtils.getPinLength(KeyguardUpdateMonitor.getCurrentUser()); + mIsPinHinting = mPinLength == DEFAULT_PIN_LENGTH; + mIsAutoPinConfirmEnabledInSettings = mLockPatternUtils.isAutoPinConfirmEnabled( + KeyguardUpdateMonitor.getCurrentUser()); } @Override @@ -82,7 +94,7 @@ public class KeyguardPinViewController protected void onUserInput() { super.onUserInput(); - if (isAutoPinConfirmEnabledInSettings()) { + if (mIsAutoPinConfirmEnabledInSettings) { updateAutoConfirmationState(); if (mPasswordEntry.getText().length() == mPinLength && mOkButton.getVisibility() == View.INVISIBLE) { @@ -130,7 +142,7 @@ public class KeyguardPinViewController * Updates the visibility of the OK button for auto confirm feature */ private void updateOKButtonVisibility() { - if (isAutoPinConfirmEnabledInSettings() && !mDisabledAutoConfirmation) { + if (mIsPinHinting && !mDisabledAutoConfirmation) { mOkButton.setVisibility(View.INVISIBLE); } else { mOkButton.setVisibility(View.VISIBLE); @@ -142,10 +154,9 @@ public class KeyguardPinViewController * Visibility changes are only for auto confirmation configuration. */ private void updateBackSpaceVisibility() { - boolean isAutoConfirmation = isAutoPinConfirmEnabledInSettings(); mBackspaceKey.setTransparentMode(/* isTransparentMode= */ - isAutoConfirmation && !mDisabledAutoConfirmation); - if (isAutoConfirmation) { + mIsAutoPinConfirmEnabledInSettings && !mDisabledAutoConfirmation); + if (mIsAutoPinConfirmEnabledInSettings) { if (mPasswordEntry.getText().length() > 0 || mDisabledAutoConfirmation) { mBackspaceKey.setVisibility(View.VISIBLE); @@ -155,24 +166,8 @@ public class KeyguardPinViewController } } /** Updates whether to use pin hinting or not. */ - void updatePinHinting() { - mPasswordEntry.setIsPinHinting(isAutoPinConfirmEnabledInSettings() && isPinHinting() + private void updatePinHinting() { + mPasswordEntry.setIsPinHinting(mIsAutoPinConfirmEnabledInSettings && mIsPinHinting && !mDisabledAutoConfirmation); } - - /** - * Responsible for identifying if PIN hinting is to be enabled or not - */ - private boolean isPinHinting() { - return mLockPatternUtils.getPinLength(KeyguardUpdateMonitor.getCurrentUser()) - == DEFAULT_PIN_LENGTH; - } - - /** - * Responsible for identifying if auto confirm is enabled or not in Settings - */ - private boolean isAutoPinConfirmEnabledInSettings() { - //Checks if user has enabled the auto confirm in Settings - return mLockPatternUtils.isAutoPinConfirmEnabled(KeyguardUpdateMonitor.getCurrentUser()); - } } diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java index 841b5b3a1e82..6853f815a1ff 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainer.java @@ -281,6 +281,8 @@ public class KeyguardSecurityContainer extends ConstraintLayout { public interface SwipeListener { void onSwipeUp(); + /** */ + void onSwipeDown(); } @VisibleForTesting @@ -543,6 +545,11 @@ public class KeyguardSecurityContainer extends ConstraintLayout { if (mSwipeListener != null) { mSwipeListener.onSwipeUp(); } + } else if (getTranslationY() > TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, + MIN_DRAG_SIZE, getResources().getDisplayMetrics())) { + if (mSwipeListener != null) { + mSwipeListener.onSwipeDown(); + } } } return true; diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 7c511a32bb36..880f242c5938 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -70,11 +70,11 @@ import com.android.systemui.Gefingerpoken; import com.android.systemui.R; import com.android.systemui.biometrics.SideFpsController; import com.android.systemui.biometrics.SideFpsUiRequestSource; +import com.android.systemui.bouncer.domain.interactor.BouncerMessageInteractor; import com.android.systemui.classifier.FalsingA11yDelegate; import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; -import com.android.systemui.bouncer.domain.interactor.BouncerMessageInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardFaceAuthInteractor; import com.android.systemui.log.SessionTracker; import com.android.systemui.plugins.ActivityStarter; @@ -319,6 +319,11 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard "swipeUpOnBouncer"); } } + + @Override + public void onSwipeDown() { + mViewMediatorCallback.onBouncerSwipeDown(); + } }; private final ConfigurationController.ConfigurationListener mConfigurationListener = new ConfigurationController.ConfigurationListener() { diff --git a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java index 50f8f7e61230..14ec27ae6739 100644 --- a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java +++ b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java @@ -104,4 +104,9 @@ public interface ViewMediatorCallback { * Call when cancel button is pressed in bouncer. */ void onCancelClicked(); + + /** + * Determines if bouncer has swiped down. + */ + void onBouncerSwipeDown(); } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index c629ebf9496f..155e0231e9d2 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -835,6 +835,11 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } @Override + public void onBouncerSwipeDown() { + mKeyguardViewControllerLazy.get().reset(/* hideBouncerWhenShowing= */ true); + } + + @Override public void playTrustedSound() { KeyguardViewMediator.this.playTrustedSound(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index e63875b92b64..cb2a78d8be35 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -703,7 +703,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Override public void reset(boolean hideBouncerWhenShowing) { - if (mKeyguardStateController.isShowing()) { + if (mKeyguardStateController.isShowing() && !bouncerIsAnimatingAway()) { final boolean isOccluded = mKeyguardStateController.isOccluded(); // Hide quick settings. mShadeViewController.resetViews(/* animate= */ !isOccluded); diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt index d3b41902499c..5a56bafc1992 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardPinViewControllerTest.kt @@ -97,21 +97,7 @@ class KeyguardPinViewControllerTest : SysuiTestCase() { `when`(keyguardPinView.findViewById<NumPadButton>(R.id.delete_button)) .thenReturn(deleteButton) `when`(keyguardPinView.findViewById<View>(R.id.key_enter)).thenReturn(enterButton) - pinViewController = - KeyguardPinViewController( - keyguardPinView, - keyguardUpdateMonitor, - securityMode, - lockPatternUtils, - mKeyguardSecurityCallback, - keyguardMessageAreaControllerFactory, - mLatencyTracker, - liftToActivateListener, - mEmergencyButtonController, - falsingCollector, - postureController, - featureFlags - ) + constructViewController() } @Test @@ -135,8 +121,10 @@ class KeyguardPinViewControllerTest : SysuiTestCase() { `when`(lockPatternUtils.isAutoPinConfirmEnabled(anyInt())).thenReturn(true) `when`(lockPatternUtils.getCurrentFailedPasswordAttempts(anyInt())).thenReturn(3) `when`(passwordTextView.text).thenReturn("") + constructViewController() pinViewController.startAppearAnimation() + verify(deleteButton).visibility = View.INVISIBLE verify(enterButton).visibility = View.INVISIBLE verify(passwordTextView).setUsePinShapes(true) @@ -150,8 +138,10 @@ class KeyguardPinViewControllerTest : SysuiTestCase() { `when`(lockPatternUtils.isAutoPinConfirmEnabled(anyInt())).thenReturn(true) `when`(lockPatternUtils.getCurrentFailedPasswordAttempts(anyInt())).thenReturn(6) `when`(passwordTextView.text).thenReturn("") + constructViewController() pinViewController.startAppearAnimation() + verify(deleteButton).visibility = View.VISIBLE verify(enterButton).visibility = View.VISIBLE verify(passwordTextView).setUsePinShapes(true) @@ -163,4 +153,22 @@ class KeyguardPinViewControllerTest : SysuiTestCase() { pinViewController.handleAttemptLockout(0) verify(lockPatternUtils).getCurrentFailedPasswordAttempts(anyInt()) } + + fun constructViewController() { + pinViewController = + KeyguardPinViewController( + keyguardPinView, + keyguardUpdateMonitor, + securityMode, + lockPatternUtils, + mKeyguardSecurityCallback, + keyguardMessageAreaControllerFactory, + mLatencyTracker, + liftToActivateListener, + mEmergencyButtonController, + falsingCollector, + postureController, + featureFlags + ) + } } 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 12a9f942fcc8..6f7c217e4f3a 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java @@ -780,6 +780,11 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { assertTrue(mViewMediator.isShowingAndNotOccluded()); } + @Test + public void testBouncerSwipeDown() { + mViewMediator.getViewMediatorCallback().onBouncerSwipeDown(); + verify(mStatusBarKeyguardViewManager).reset(true); + } private void createAndStartViewMediator() { mViewMediator = new KeyguardViewMediator( mContext, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index 548e1b501d45..c7143debf8a8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -737,6 +737,16 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { } @Test + public void testResetBouncerAnimatingAway() { + reset(mPrimaryBouncerInteractor); + when(mPrimaryBouncerInteractor.isAnimatingAway()).thenReturn(true); + + mStatusBarKeyguardViewManager.reset(true); + + verify(mPrimaryBouncerInteractor, never()).hide(); + } + + @Test public void handleDispatchTouchEvent_alternateBouncerNotVisible() { mStatusBarKeyguardViewManager.addCallback(mCallback); |