Loading packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ public interface KeyguardViewController { /** * Stop showing the alternate bouncer, if showing. */ void hideAlternateBouncer(boolean forceUpdateScrim); void hideAlternateBouncer(boolean updateScrim); // TODO: Deprecate registerStatusBar in KeyguardViewController interface. It is currently // only used for testing purposes in StatusBarKeyguardViewManager, and it prevents us from Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +0 −6 Original line number Diff line number Diff line Loading @@ -613,7 +613,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { private Runnable mLaunchTransitionEndRunnable; private Runnable mLaunchTransitionCancelRunnable; private boolean mLaunchingAffordance; private boolean mLaunchCameraWhenFinishedWaking; private boolean mLaunchCameraOnFinishedGoingToSleep; private boolean mLaunchEmergencyActionWhenFinishedWaking; Loading Loading @@ -3796,8 +3795,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mScrimController.setExpansionAffectsAlpha(!unlocking); boolean launchingAffordanceWithPreview = mLaunchingAffordance; mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview); if (mAlternateBouncerInteractor.isVisibleState()) { if ((!isOccluded() || isPanelExpanded()) && (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED Loading @@ -3816,9 +3813,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { ScrimState state = mStatusBarKeyguardViewManager.primaryBouncerNeedsScrimming() ? ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER; mScrimController.transitionTo(state); } else if (launchingAffordanceWithPreview) { // We want to avoid animating when launching with a preview. mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback); } else if (mBrightnessMirrorVisible) { mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR); } else if (mState == StatusBarState.SHADE_LOCKED) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +15 −11 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.unfold.FoldAodAnimationController; import com.android.systemui.unfold.SysUIUnfoldComponent; import dagger.Lazy; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; Loading @@ -94,8 +96,6 @@ import java.util.Set; import javax.inject.Inject; import dagger.Lazy; /** * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done, Loading Loading @@ -405,14 +405,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } /** * Sets a new legacy alternate bouncer. Only used if mdoern alternate bouncer is NOT enable. * Sets a new legacy alternate bouncer. Only used if modern alternate bouncer is NOT enabled. */ public void setLegacyAlternateBouncer(@NonNull LegacyAlternateBouncer alternateBouncerLegacy) { if (!mIsModernAlternateBouncerEnabled) { if (!Objects.equals(mAlternateBouncerInteractor.getLegacyAlternateBouncer(), alternateBouncerLegacy)) { mAlternateBouncerInteractor.setLegacyAlternateBouncer(alternateBouncerLegacy); hideAlternateBouncer(false); hideAlternateBouncer(true); } } Loading Loading @@ -640,7 +640,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb */ public void showPrimaryBouncer(boolean scrimmed) { hideAlternateBouncer(false); if (mKeyguardStateController.isShowing() && !isBouncerShowing()) { mPrimaryBouncerInteractor.show(scrimmed); } Loading Loading @@ -734,7 +733,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb showBouncerOrKeyguard(hideBouncerWhenShowing); } if (hideBouncerWhenShowing) { hideAlternateBouncer(false); hideAlternateBouncer(true); } mKeyguardUpdateManager.sendKeyguardReset(); updateStates(); Loading @@ -742,8 +741,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } @Override public void hideAlternateBouncer(boolean forceUpdateScrim) { updateAlternateBouncerShowing(mAlternateBouncerInteractor.hide() || forceUpdateScrim); public void hideAlternateBouncer(boolean updateScrim) { updateAlternateBouncerShowing(mAlternateBouncerInteractor.hide() && updateScrim); } private void updateAlternateBouncerShowing(boolean updateScrim) { Loading Loading @@ -1447,16 +1446,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * For any touches on the NPVC, show the primary bouncer if the alternate bouncer is currently * showing. */ public void onTouch(MotionEvent event) { if (mAlternateBouncerInteractor.isVisibleState() public boolean onTouch(MotionEvent event) { boolean handledTouch = false; if (event.getAction() == MotionEvent.ACTION_UP && mAlternateBouncerInteractor.isVisibleState() && mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()) { showPrimaryBouncer(true); handledTouch = true; } // Forward NPVC touches to callbacks in case they want to respond to touches for (KeyguardViewManagerCallback callback: mCallbacks) { callback.onTouch(event); } return handledTouch; } /** Update keyguard position based on a tapped X coordinate. */ Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +46 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import static com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN; import static com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; Loading @@ -35,6 +36,7 @@ import static org.mockito.Mockito.when; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewRootImpl; Loading Loading @@ -709,4 +711,48 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { // THEN alternate bouncer is NOT hidden verify(mAlternateBouncerInteractor, never()).hide(); } @Test public void testAlternateBouncerToShowPrimaryBouncer_updatesScrimControllerOnce() { // GIVEN the alternate bouncer has shown and calls to hide() will result in successfully // hiding it when(mAlternateBouncerInteractor.hide()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true); when(mPrimaryBouncerInteractor.isFullyShowing()).thenReturn(false); when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(false); // WHEN request to show primary bouncer mStatusBarKeyguardViewManager.showPrimaryBouncer(true); // THEN the scrim isn't updated from StatusBarKeyguardViewManager verify(mCentralSurfaces, never()).updateScrimController(); } @Test public void testAlternateBouncerOnTouch_actionDown_doesNotHandleTouch() { // GIVEN the alternate bouncer has shown for a minimum amount of time when(mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()).thenReturn(true); when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true); // WHEN ACTION_DOWN touch event comes boolean touchHandled = mStatusBarKeyguardViewManager.onTouch( MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)); // THEN the touch is not handled assertFalse(touchHandled); } @Test public void testAlternateBouncerOnTouch_actionUp_handlesTouch() { // GIVEN the alternate bouncer has shown for a minimum amount of time when(mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()).thenReturn(true); when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true); // WHEN ACTION_UP touch event comes boolean touchHandled = mStatusBarKeyguardViewManager.onTouch( MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_UP, 0f, 0f, 0)); // THEN the touch is handled assertTrue(touchHandled); } } Loading
packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ public interface KeyguardViewController { /** * Stop showing the alternate bouncer, if showing. */ void hideAlternateBouncer(boolean forceUpdateScrim); void hideAlternateBouncer(boolean updateScrim); // TODO: Deprecate registerStatusBar in KeyguardViewController interface. It is currently // only used for testing purposes in StatusBarKeyguardViewManager, and it prevents us from Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +0 −6 Original line number Diff line number Diff line Loading @@ -613,7 +613,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { private Runnable mLaunchTransitionEndRunnable; private Runnable mLaunchTransitionCancelRunnable; private boolean mLaunchingAffordance; private boolean mLaunchCameraWhenFinishedWaking; private boolean mLaunchCameraOnFinishedGoingToSleep; private boolean mLaunchEmergencyActionWhenFinishedWaking; Loading Loading @@ -3796,8 +3795,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mScrimController.setExpansionAffectsAlpha(!unlocking); boolean launchingAffordanceWithPreview = mLaunchingAffordance; mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview); if (mAlternateBouncerInteractor.isVisibleState()) { if ((!isOccluded() || isPanelExpanded()) && (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED Loading @@ -3816,9 +3813,6 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { ScrimState state = mStatusBarKeyguardViewManager.primaryBouncerNeedsScrimming() ? ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER; mScrimController.transitionTo(state); } else if (launchingAffordanceWithPreview) { // We want to avoid animating when launching with a preview. mScrimController.transitionTo(ScrimState.UNLOCKED, mUnlockScrimCallback); } else if (mBrightnessMirrorVisible) { mScrimController.transitionTo(ScrimState.BRIGHTNESS_MIRROR); } else if (mState == StatusBarState.SHADE_LOCKED) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +15 −11 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.unfold.FoldAodAnimationController; import com.android.systemui.unfold.SysUIUnfoldComponent; import dagger.Lazy; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashSet; Loading @@ -94,8 +96,6 @@ import java.util.Set; import javax.inject.Inject; import dagger.Lazy; /** * Manages creating, showing, hiding and resetting the keyguard within the status bar. Calls back * via {@link ViewMediatorCallback} to poke the wake lock and report that the keyguard is done, Loading Loading @@ -405,14 +405,14 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } /** * Sets a new legacy alternate bouncer. Only used if mdoern alternate bouncer is NOT enable. * Sets a new legacy alternate bouncer. Only used if modern alternate bouncer is NOT enabled. */ public void setLegacyAlternateBouncer(@NonNull LegacyAlternateBouncer alternateBouncerLegacy) { if (!mIsModernAlternateBouncerEnabled) { if (!Objects.equals(mAlternateBouncerInteractor.getLegacyAlternateBouncer(), alternateBouncerLegacy)) { mAlternateBouncerInteractor.setLegacyAlternateBouncer(alternateBouncerLegacy); hideAlternateBouncer(false); hideAlternateBouncer(true); } } Loading Loading @@ -640,7 +640,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb */ public void showPrimaryBouncer(boolean scrimmed) { hideAlternateBouncer(false); if (mKeyguardStateController.isShowing() && !isBouncerShowing()) { mPrimaryBouncerInteractor.show(scrimmed); } Loading Loading @@ -734,7 +733,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb showBouncerOrKeyguard(hideBouncerWhenShowing); } if (hideBouncerWhenShowing) { hideAlternateBouncer(false); hideAlternateBouncer(true); } mKeyguardUpdateManager.sendKeyguardReset(); updateStates(); Loading @@ -742,8 +741,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } @Override public void hideAlternateBouncer(boolean forceUpdateScrim) { updateAlternateBouncerShowing(mAlternateBouncerInteractor.hide() || forceUpdateScrim); public void hideAlternateBouncer(boolean updateScrim) { updateAlternateBouncerShowing(mAlternateBouncerInteractor.hide() && updateScrim); } private void updateAlternateBouncerShowing(boolean updateScrim) { Loading Loading @@ -1447,16 +1446,21 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * For any touches on the NPVC, show the primary bouncer if the alternate bouncer is currently * showing. */ public void onTouch(MotionEvent event) { if (mAlternateBouncerInteractor.isVisibleState() public boolean onTouch(MotionEvent event) { boolean handledTouch = false; if (event.getAction() == MotionEvent.ACTION_UP && mAlternateBouncerInteractor.isVisibleState() && mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()) { showPrimaryBouncer(true); handledTouch = true; } // Forward NPVC touches to callbacks in case they want to respond to touches for (KeyguardViewManagerCallback callback: mCallbacks) { callback.onTouch(event); } return handledTouch; } /** Update keyguard position based on a tapped X coordinate. */ Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +46 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import static com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN; import static com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; Loading @@ -35,6 +36,7 @@ import static org.mockito.Mockito.when; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewRootImpl; Loading Loading @@ -709,4 +711,48 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { // THEN alternate bouncer is NOT hidden verify(mAlternateBouncerInteractor, never()).hide(); } @Test public void testAlternateBouncerToShowPrimaryBouncer_updatesScrimControllerOnce() { // GIVEN the alternate bouncer has shown and calls to hide() will result in successfully // hiding it when(mAlternateBouncerInteractor.hide()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true); when(mPrimaryBouncerInteractor.isFullyShowing()).thenReturn(false); when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(false); // WHEN request to show primary bouncer mStatusBarKeyguardViewManager.showPrimaryBouncer(true); // THEN the scrim isn't updated from StatusBarKeyguardViewManager verify(mCentralSurfaces, never()).updateScrimController(); } @Test public void testAlternateBouncerOnTouch_actionDown_doesNotHandleTouch() { // GIVEN the alternate bouncer has shown for a minimum amount of time when(mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()).thenReturn(true); when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true); // WHEN ACTION_DOWN touch event comes boolean touchHandled = mStatusBarKeyguardViewManager.onTouch( MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_DOWN, 0f, 0f, 0)); // THEN the touch is not handled assertFalse(touchHandled); } @Test public void testAlternateBouncerOnTouch_actionUp_handlesTouch() { // GIVEN the alternate bouncer has shown for a minimum amount of time when(mAlternateBouncerInteractor.hasAlternateBouncerShownWithMinTime()).thenReturn(true); when(mAlternateBouncerInteractor.isVisibleState()).thenReturn(true); // WHEN ACTION_UP touch event comes boolean touchHandled = mStatusBarKeyguardViewManager.onTouch( MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_UP, 0f, 0f, 0)); // THEN the touch is handled assertTrue(touchHandled); } }