Merge "[Bouncer] Flag off bouncer interactor." into tm-qpr-dev am: 22ae4477ed am: 3872ce6adc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20131744

Change-Id: I3d009773ef2f83a50d6cf00e52ea86dd27f302bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Aaron Liu
2022-10-07 21:24:41 +00:00
committed by Automerger Merge Worker
2 changed files with 63 additions and 33 deletions

View File

@@ -407,8 +407,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);
}
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)
@@ -416,8 +417,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} else if (bouncerNeedsScrimming()) {
if (mBouncer != null) {
mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE);
} else {
mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE);
}
mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE);
} else if (mShowing && !hideBouncerOverDream) {
if (!isWakeAndUnlocking()
&& !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER)
@@ -425,8 +427,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
&& !isUnlockCollapsing()) {
if (mBouncer != null) {
mBouncer.setExpansion(fraction);
} else {
mBouncerInteractor.setExpansion(fraction);
}
mBouncerInteractor.setExpansion(fraction);
}
if (fraction != KeyguardBouncer.EXPANSION_HIDDEN && tracking
&& !mKeyguardStateController.canDismissLockScreen()
@@ -434,16 +437,18 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
&& !bouncerIsAnimatingAway()) {
if (mBouncer != null) {
mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */);
} else {
mBouncerInteractor.show(/* isScrimmed= */false);
}
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);
}
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.
@@ -489,8 +494,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mCentralSurfaces.hideKeyguard();
if (mBouncer != null) {
mBouncer.show(true /* resetSecuritySelection */);
} else {
mBouncerInteractor.show(true);
}
mBouncerInteractor.show(true);
} else {
mCentralSurfaces.showKeyguard();
if (hideBouncerWhenShowing) {
@@ -531,8 +537,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
void hideBouncer(boolean destroyView) {
if (mBouncer != null) {
mBouncer.hide(destroyView);
} else {
mBouncerInteractor.hide();
}
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.
@@ -553,8 +560,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (mShowing && !isBouncerShowing()) {
if (mBouncer != null) {
mBouncer.show(false /* resetSecuritySelection */, scrimmed);
} else {
mBouncerInteractor.show(scrimmed);
}
mBouncerInteractor.show(scrimmed);
}
updateStates();
}
@@ -590,9 +598,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (mBouncer != null) {
mBouncer.setDismissAction(mAfterKeyguardGoneAction,
mKeyguardGoneCancelAction);
} else {
mBouncerInteractor.setDismissAction(mAfterKeyguardGoneAction,
mKeyguardGoneCancelAction);
}
mBouncerInteractor.setDismissAction(mAfterKeyguardGoneAction,
mKeyguardGoneCancelAction);
mAfterKeyguardGoneAction = null;
mKeyguardGoneCancelAction = null;
}
@@ -605,17 +614,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (afterKeyguardGone) {
// we'll handle the dismiss action after keyguard is gone, so just show the
// bouncer
mBouncerInteractor.show(/* isScrimmed= */true);
if (mBouncer != null) mBouncer.show(false /* resetSecuritySelection */);
if (mBouncer != null) {
mBouncer.show(false /* resetSecuritySelection */);
} else {
mBouncerInteractor.show(/* isScrimmed= */true);
}
} 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;
@@ -719,8 +732,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void onFinishedGoingToSleep() {
if (mBouncer != null) {
mBouncer.onScreenTurnedOff();
} else {
mBouncerInteractor.onScreenTurnedOff();
}
mBouncerInteractor.onScreenTurnedOff();
}
@Override
@@ -832,8 +846,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (bouncerIsShowing()) {
if (mBouncer != null) {
mBouncer.startPreHideAnimation(finishRunnable);
} else {
mBouncerInteractor.startDisappearAnimation(finishRunnable);
}
mBouncerInteractor.startDisappearAnimation(finishRunnable);
mCentralSurfaces.onBouncerPreHideAnimation();
// We update the state (which will show the keyguard) only if an animation will run on
@@ -1106,13 +1121,15 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (bouncerDismissible || !showing || remoteInputActive) {
if (mBouncer != null) {
mBouncer.setBackButtonEnabled(true);
} else {
mBouncerInteractor.setBackButtonEnabled(true);
}
mBouncerInteractor.setBackButtonEnabled(true);
} else {
if (mBouncer != null) {
mBouncer.setBackButtonEnabled(false);
} else {
mBouncerInteractor.setBackButtonEnabled(false);
}
mBouncerInteractor.setBackButtonEnabled(false);
}
}
@@ -1278,8 +1295,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void notifyKeyguardAuthenticated(boolean strongAuth) {
if (mBouncer != null) {
mBouncer.notifyKeyguardAuthenticated(strongAuth);
} else {
mBouncerInteractor.notifyKeyguardAuthenticated(strongAuth);
}
mBouncerInteractor.notifyKeyguardAuthenticated(strongAuth);
if (mAlternateAuthInterceptor != null && isShowingAlternateAuthOrAnimating()) {
resetAlternateAuth(false);
@@ -1296,8 +1314,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} else {
if (mBouncer != null) {
mBouncer.showMessage(message, colorState);
} else {
mBouncerInteractor.showMessage(message, colorState);
}
mBouncerInteractor.showMessage(message, colorState);
}
}
@@ -1344,8 +1363,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void updateResources() {
if (mBouncer != null) {
mBouncer.updateResources();
} else {
mBouncerInteractor.updateResources();
}
mBouncerInteractor.updateResources();
}
public void dump(PrintWriter pw) {
@@ -1430,9 +1450,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void updateKeyguardPosition(float x) {
if (mBouncer != null) {
mBouncer.updateKeyguardPosition(x);
} else {
mBouncerInteractor.setKeyguardPosition(x);
}
mBouncerInteractor.setKeyguardPosition(x);
}
private static class DismissWithActionRequest {
@@ -1474,9 +1494,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public boolean isBouncerInTransit() {
if (mBouncer != null) {
return mBouncer.inTransit();
} else {
return mBouncerInteractor.isInTransit();
}
return mBouncerInteractor.isInTransit();
}
/**
@@ -1485,9 +1505,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public boolean bouncerIsShowing() {
if (mBouncer != null) {
return mBouncer.isShowing();
} else {
return mBouncerInteractor.isFullyShowing();
}
return mBouncerInteractor.isFullyShowing();
}
/**
@@ -1496,9 +1516,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public boolean bouncerIsScrimmed() {
if (mBouncer != null) {
return mBouncer.isScrimmed();
} else {
return mBouncerInteractor.isScrimmed();
}
return mBouncerInteractor.isScrimmed();
}
/**
@@ -1507,9 +1527,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public boolean bouncerIsAnimatingAway() {
if (mBouncer != null) {
return mBouncer.isAnimatingAway();
} else {
return mBouncerInteractor.isAnimatingAway();
}
return mBouncerInteractor.isAnimatingAway();
}
/**
@@ -1518,9 +1539,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public boolean bouncerWillDismissWithAction() {
if (mBouncer != null) {
return mBouncer.willDismissWithAction();
} else {
return mBouncerInteractor.willDismissWithAction();
}
return mBouncerInteractor.willDismissWithAction();
}
/**

View File

@@ -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;
@@ -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();
}
}