Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +54 −33 Original line number Diff line number Diff line Loading @@ -405,8 +405,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else if (mNotificationPanelViewController.isUnlockHintRunning()) { if (mBouncer != null) { mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else { mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED) { // Don't expand to the bouncer. Instead transition back to the lock screen (see // CentralSurfaces#showBouncerOrLockScreenIfKeyguard) Loading @@ -414,8 +415,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else if (bouncerNeedsScrimming()) { if (mBouncer != null) { mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } } else { mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } } else if (mShowing && !hideBouncerOverDream) { if (!isWakeAndUnlocking() && !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER) Loading @@ -423,25 +425,28 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb && !isUnlockCollapsing()) { if (mBouncer != null) { mBouncer.setExpansion(fraction); } } else { mBouncerInteractor.setExpansion(fraction); } } if (fraction != KeyguardBouncer.EXPANSION_HIDDEN && tracking && !mKeyguardStateController.canDismissLockScreen() && !bouncerIsShowing() && !bouncerIsAnimatingAway()) { if (mBouncer != null) { mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */); } } else { mBouncerInteractor.show(/* isScrimmed= */false); } } } else if (!mShowing && isBouncerInTransit()) { // Keyguard is not visible anymore, but expansion animation was still running. // We need to hide the bouncer, otherwise it will be stuck in transit. if (mBouncer != null) { mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else { mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else if (mPulsing && fraction == KeyguardBouncer.EXPANSION_VISIBLE) { // Panel expanded while pulsing but didn't translate the bouncer (because we are // unlocked.) Let's simply wake-up to dismiss the lock screen. Loading Loading @@ -487,8 +492,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mCentralSurfaces.hideKeyguard(); if (mBouncer != null) { mBouncer.show(true /* resetSecuritySelection */); } } else { mBouncerInteractor.show(true); } } else { mCentralSurfaces.showKeyguard(); if (hideBouncerWhenShowing) { Loading Loading @@ -529,8 +535,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb void hideBouncer(boolean destroyView) { if (mBouncer != null) { mBouncer.hide(destroyView); } } else { mBouncerInteractor.hide(); } if (mShowing) { // If we were showing the bouncer and then aborting, we need to also clear out any // potential actions unless we actually unlocked. Loading @@ -551,9 +558,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (mShowing && !isBouncerShowing()) { if (mBouncer != null) { mBouncer.show(false /* resetSecuritySelection */, scrimmed); } } else { mBouncerInteractor.show(scrimmed); } } updateStates(); } Loading Loading @@ -588,9 +596,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (mBouncer != null) { mBouncer.setDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } } else { mBouncerInteractor.setDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } mAfterKeyguardGoneAction = null; mKeyguardGoneCancelAction = null; } Loading @@ -603,17 +612,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (afterKeyguardGone) { // we'll handle the dismiss action after keyguard is gone, so just show the // bouncer if (mBouncer != null) { mBouncer.show(false /* resetSecuritySelection */); } else { mBouncerInteractor.show(/* isScrimmed= */true); if (mBouncer != null) mBouncer.show(false /* resetSecuritySelection */); } } else { // after authentication success, run dismiss action with the option to defer // hiding the keyguard based on the return value of the OnDismissAction mBouncerInteractor.setDismissAction( mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); mBouncerInteractor.show(/* isScrimmed= */true); if (mBouncer != null) { mBouncer.showWithDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } else { mBouncerInteractor.setDismissAction( mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); mBouncerInteractor.show(/* isScrimmed= */true); } // bouncer will handle the dismiss action, so we no longer need to track it here mAfterKeyguardGoneAction = null; Loading Loading @@ -717,9 +730,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void onFinishedGoingToSleep() { if (mBouncer != null) { mBouncer.onScreenTurnedOff(); } } else { mBouncerInteractor.onScreenTurnedOff(); } } @Override public void onRemoteInputActive(boolean active) { Loading Loading @@ -830,8 +844,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (bouncerIsShowing()) { if (mBouncer != null) { mBouncer.startPreHideAnimation(finishRunnable); } } else { mBouncerInteractor.startDisappearAnimation(finishRunnable); } mCentralSurfaces.onBouncerPreHideAnimation(); // We update the state (which will show the keyguard) only if an animation will run on Loading Loading @@ -1102,15 +1117,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (bouncerDismissible || !showing || remoteInputActive) { if (mBouncer != null) { mBouncer.setBackButtonEnabled(true); } } else { mBouncerInteractor.setBackButtonEnabled(true); } } else { if (mBouncer != null) { mBouncer.setBackButtonEnabled(false); } } else { mBouncerInteractor.setBackButtonEnabled(false); } } } boolean navBarVisible = isNavBarVisible(); boolean lastNavBarVisible = getLastNavBarVisible(); Loading Loading @@ -1274,8 +1291,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void notifyKeyguardAuthenticated(boolean strongAuth) { if (mBouncer != null) { mBouncer.notifyKeyguardAuthenticated(strongAuth); } } else { mBouncerInteractor.notifyKeyguardAuthenticated(strongAuth); } if (mAlternateAuthInterceptor != null && isShowingAlternateAuthOrAnimating()) { resetAlternateAuth(false); Loading @@ -1292,10 +1310,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else { if (mBouncer != null) { mBouncer.showMessage(message, colorState); } } else { mBouncerInteractor.showMessage(message, colorState); } } } @Override public ViewRootImpl getViewRootImpl() { Loading Loading @@ -1340,9 +1359,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void updateResources() { if (mBouncer != null) { mBouncer.updateResources(); } } else { mBouncerInteractor.updateResources(); } } public void dump(PrintWriter pw) { pw.println("StatusBarKeyguardViewManager:"); Loading Loading @@ -1426,10 +1446,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void updateKeyguardPosition(float x) { if (mBouncer != null) { mBouncer.updateKeyguardPosition(x); } } else { mBouncerInteractor.setKeyguardPosition(x); } } private static class DismissWithActionRequest { final OnDismissAction dismissAction; Loading Loading @@ -1470,10 +1490,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean isBouncerInTransit() { if (mBouncer != null) { return mBouncer.inTransit(); } } else { return mBouncerInteractor.isInTransit(); } } /** * Returns if bouncer is showing Loading @@ -1481,10 +1501,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerIsShowing() { if (mBouncer != null) { return mBouncer.isShowing(); } } else { return mBouncerInteractor.isFullyShowing(); } } /** * Returns if bouncer is scrimmed Loading @@ -1492,10 +1512,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerIsScrimmed() { if (mBouncer != null) { return mBouncer.isScrimmed(); } } else { return mBouncerInteractor.isScrimmed(); } } /** * Returns if bouncer is animating away Loading @@ -1503,9 +1523,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerIsAnimatingAway() { if (mBouncer != null) { return mBouncer.isAnimatingAway(); } else { return mBouncerInteractor.isAnimatingAway(); } return mBouncerInteractor.isAnimatingAway(); } /** Loading @@ -1514,10 +1535,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerWillDismissWithAction() { if (mBouncer != null) { return mBouncer.willDismissWithAction(); } } else { return mBouncerInteractor.willDismissWithAction(); } } /** * Returns if bouncer needs fullscreen bouncer. i.e. sim pin security method Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.phone; import static com.android.systemui.flags.Flags.MODERN_BOUNCER; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; Loading Loading @@ -525,4 +527,11 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mBouncerExpansionCallback.onVisibilityChanged(false); verify(mCentralSurfaces).setBouncerShowingOverDream(false); } @Test public void flag_off_DoesNotCallBouncerInteractor() { when(mFeatureFlags.isEnabled(MODERN_BOUNCER)).thenReturn(false); mStatusBarKeyguardViewManager.hideBouncer(false); verify(mBouncerInteractor, never()).hide(); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +54 −33 Original line number Diff line number Diff line Loading @@ -405,8 +405,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else if (mNotificationPanelViewController.isUnlockHintRunning()) { if (mBouncer != null) { mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else { mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED) { // Don't expand to the bouncer. Instead transition back to the lock screen (see // CentralSurfaces#showBouncerOrLockScreenIfKeyguard) Loading @@ -414,8 +415,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else if (bouncerNeedsScrimming()) { if (mBouncer != null) { mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } } else { mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } } else if (mShowing && !hideBouncerOverDream) { if (!isWakeAndUnlocking() && !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER) Loading @@ -423,25 +425,28 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb && !isUnlockCollapsing()) { if (mBouncer != null) { mBouncer.setExpansion(fraction); } } else { mBouncerInteractor.setExpansion(fraction); } } if (fraction != KeyguardBouncer.EXPANSION_HIDDEN && tracking && !mKeyguardStateController.canDismissLockScreen() && !bouncerIsShowing() && !bouncerIsAnimatingAway()) { if (mBouncer != null) { mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */); } } else { mBouncerInteractor.show(/* isScrimmed= */false); } } } else if (!mShowing && isBouncerInTransit()) { // Keyguard is not visible anymore, but expansion animation was still running. // We need to hide the bouncer, otherwise it will be stuck in transit. if (mBouncer != null) { mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else { mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else if (mPulsing && fraction == KeyguardBouncer.EXPANSION_VISIBLE) { // Panel expanded while pulsing but didn't translate the bouncer (because we are // unlocked.) Let's simply wake-up to dismiss the lock screen. Loading Loading @@ -487,8 +492,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mCentralSurfaces.hideKeyguard(); if (mBouncer != null) { mBouncer.show(true /* resetSecuritySelection */); } } else { mBouncerInteractor.show(true); } } else { mCentralSurfaces.showKeyguard(); if (hideBouncerWhenShowing) { Loading Loading @@ -529,8 +535,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb void hideBouncer(boolean destroyView) { if (mBouncer != null) { mBouncer.hide(destroyView); } } else { mBouncerInteractor.hide(); } if (mShowing) { // If we were showing the bouncer and then aborting, we need to also clear out any // potential actions unless we actually unlocked. Loading @@ -551,9 +558,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (mShowing && !isBouncerShowing()) { if (mBouncer != null) { mBouncer.show(false /* resetSecuritySelection */, scrimmed); } } else { mBouncerInteractor.show(scrimmed); } } updateStates(); } Loading Loading @@ -588,9 +596,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (mBouncer != null) { mBouncer.setDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } } else { mBouncerInteractor.setDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } mAfterKeyguardGoneAction = null; mKeyguardGoneCancelAction = null; } Loading @@ -603,17 +612,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (afterKeyguardGone) { // we'll handle the dismiss action after keyguard is gone, so just show the // bouncer if (mBouncer != null) { mBouncer.show(false /* resetSecuritySelection */); } else { mBouncerInteractor.show(/* isScrimmed= */true); if (mBouncer != null) mBouncer.show(false /* resetSecuritySelection */); } } else { // after authentication success, run dismiss action with the option to defer // hiding the keyguard based on the return value of the OnDismissAction mBouncerInteractor.setDismissAction( mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); mBouncerInteractor.show(/* isScrimmed= */true); if (mBouncer != null) { mBouncer.showWithDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } else { mBouncerInteractor.setDismissAction( mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); mBouncerInteractor.show(/* isScrimmed= */true); } // bouncer will handle the dismiss action, so we no longer need to track it here mAfterKeyguardGoneAction = null; Loading Loading @@ -717,9 +730,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void onFinishedGoingToSleep() { if (mBouncer != null) { mBouncer.onScreenTurnedOff(); } } else { mBouncerInteractor.onScreenTurnedOff(); } } @Override public void onRemoteInputActive(boolean active) { Loading Loading @@ -830,8 +844,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (bouncerIsShowing()) { if (mBouncer != null) { mBouncer.startPreHideAnimation(finishRunnable); } } else { mBouncerInteractor.startDisappearAnimation(finishRunnable); } mCentralSurfaces.onBouncerPreHideAnimation(); // We update the state (which will show the keyguard) only if an animation will run on Loading Loading @@ -1102,15 +1117,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (bouncerDismissible || !showing || remoteInputActive) { if (mBouncer != null) { mBouncer.setBackButtonEnabled(true); } } else { mBouncerInteractor.setBackButtonEnabled(true); } } else { if (mBouncer != null) { mBouncer.setBackButtonEnabled(false); } } else { mBouncerInteractor.setBackButtonEnabled(false); } } } boolean navBarVisible = isNavBarVisible(); boolean lastNavBarVisible = getLastNavBarVisible(); Loading Loading @@ -1274,8 +1291,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void notifyKeyguardAuthenticated(boolean strongAuth) { if (mBouncer != null) { mBouncer.notifyKeyguardAuthenticated(strongAuth); } } else { mBouncerInteractor.notifyKeyguardAuthenticated(strongAuth); } if (mAlternateAuthInterceptor != null && isShowingAlternateAuthOrAnimating()) { resetAlternateAuth(false); Loading @@ -1292,10 +1310,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else { if (mBouncer != null) { mBouncer.showMessage(message, colorState); } } else { mBouncerInteractor.showMessage(message, colorState); } } } @Override public ViewRootImpl getViewRootImpl() { Loading Loading @@ -1340,9 +1359,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void updateResources() { if (mBouncer != null) { mBouncer.updateResources(); } } else { mBouncerInteractor.updateResources(); } } public void dump(PrintWriter pw) { pw.println("StatusBarKeyguardViewManager:"); Loading Loading @@ -1426,10 +1446,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public void updateKeyguardPosition(float x) { if (mBouncer != null) { mBouncer.updateKeyguardPosition(x); } } else { mBouncerInteractor.setKeyguardPosition(x); } } private static class DismissWithActionRequest { final OnDismissAction dismissAction; Loading Loading @@ -1470,10 +1490,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean isBouncerInTransit() { if (mBouncer != null) { return mBouncer.inTransit(); } } else { return mBouncerInteractor.isInTransit(); } } /** * Returns if bouncer is showing Loading @@ -1481,10 +1501,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerIsShowing() { if (mBouncer != null) { return mBouncer.isShowing(); } } else { return mBouncerInteractor.isFullyShowing(); } } /** * Returns if bouncer is scrimmed Loading @@ -1492,10 +1512,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerIsScrimmed() { if (mBouncer != null) { return mBouncer.isScrimmed(); } } else { return mBouncerInteractor.isScrimmed(); } } /** * Returns if bouncer is animating away Loading @@ -1503,9 +1523,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerIsAnimatingAway() { if (mBouncer != null) { return mBouncer.isAnimatingAway(); } else { return mBouncerInteractor.isAnimatingAway(); } return mBouncerInteractor.isAnimatingAway(); } /** Loading @@ -1514,10 +1535,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb public boolean bouncerWillDismissWithAction() { if (mBouncer != null) { return mBouncer.willDismissWithAction(); } } else { return mBouncerInteractor.willDismissWithAction(); } } /** * Returns if bouncer needs fullscreen bouncer. i.e. sim pin security method Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.phone; import static com.android.systemui.flags.Flags.MODERN_BOUNCER; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; Loading Loading @@ -525,4 +527,11 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mBouncerExpansionCallback.onVisibilityChanged(false); verify(mCentralSurfaces).setBouncerShowingOverDream(false); } @Test public void flag_off_DoesNotCallBouncerInteractor() { when(mFeatureFlags.isEnabled(MODERN_BOUNCER)).thenReturn(false); mStatusBarKeyguardViewManager.hideBouncer(false); verify(mBouncerInteractor, never()).hide(); } }