Loading packages/SystemUI/src/com/android/systemui/shade/PanelViewController.java +9 −13 Original line number Diff line number Diff line Loading @@ -171,6 +171,7 @@ public abstract class PanelViewController { private float mInitialTouchY; private float mInitialTouchX; private boolean mTouchDisabled; private boolean mInitialTouchFromKeyguard; /** * Whether or not the PanelView can be expanded or collapsed with a drag. Loading Loading @@ -395,6 +396,7 @@ public abstract class PanelViewController { mInitialOffsetOnTouch = expandedHeight; mInitialTouchY = newY; mInitialTouchX = newX; mInitialTouchFromKeyguard = mStatusBarStateController.getState() == StatusBarState.KEYGUARD; if (startTracking) { mTouchSlopExceeded = true; setExpandedHeight(mInitialOffsetOnTouch); Loading @@ -417,20 +419,14 @@ public abstract class PanelViewController { mStatusBarStateController.getState() == StatusBarState.KEYGUARD; final boolean expand; if (event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel) { // If the keyguard is fading away, don't expand it again. This can happen if you're // swiping to unlock, the app below the keyguard is in landscape, and the screen // rotates while your finger is still down after the swipe to unlock. if (mKeyguardStateController.isKeyguardFadingAway()) { if (mKeyguardStateController.isKeyguardFadingAway() || (mInitialTouchFromKeyguard && !onKeyguard)) { // Don't expand for any touches that started from the keyguard and ended after the // keyguard is gone. expand = false; } else if (onKeyguard) { } else if (event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel) { if (onKeyguard) { expand = true; } else if (mKeyguardStateController.isKeyguardFadingAway()) { // If we're in the middle of dismissing the keyguard, don't expand due to the // cancelled gesture. Gesture cancellation during an unlock is expected in some // situations, such keeping your finger down while swiping to unlock to an app // that is locked in landscape (the rotation will cancel the touch event). expand = false; } else if (mCentralSurfaces.isBouncerShowingOverDream()) { expand = false; } else { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +4 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import static android.view.WindowInsets.Type.navigationBars; import static com.android.systemui.plugins.ActivityStarter.OnDismissAction; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_DISMISS_BOUNCER; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_COLLAPSING; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING; Loading Loading @@ -387,6 +388,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } else if (mShowing && !hideBouncerOverDream) { if (!isWakeAndUnlocking() && !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER) && !mCentralSurfaces.isInLaunchTransition() && !isUnlockCollapsing()) { mBouncer.setExpansion(fraction); Loading @@ -398,9 +400,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } } else if (!mShowing && mBouncer.inTransit()) { // Keyguard is not visible anymore, but expansion animation was still running. // We need to keep propagating the expansion state to the bouncer, otherwise it will be // stuck in transit. mBouncer.setExpansion(fraction); // We need to hide the bouncer, otherwise it will be stuck in transit. mBouncer.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 packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -202,12 +202,12 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { } @Test public void onPanelExpansionChanged_propagatesToBouncer_evenAfterHidden() { public void onPanelExpansionChanged_hideBouncer_afterKeyguardHidden() { mStatusBarKeyguardViewManager.hide(0, 0); when(mBouncer.inTransit()).thenReturn(true); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); verify(mBouncer).setExpansion(eq(EXPANSION_EVENT.getFraction())); verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN)); } @Test Loading Loading @@ -248,6 +248,23 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { verify(mBouncer, never()).setExpansion(anyFloat()); } @Test public void onPanelExpansionChanged_neverTranslatesBouncerWhenDismissBouncer() { // Since KeyguardBouncer.EXPANSION_VISIBLE = 0 panel expansion, if the unlock is dismissing // the bouncer, there may be an onPanelExpansionChanged(0) call to collapse the panel // which would mistakenly cause the bouncer to show briefly before its visibility // is set to hide. Therefore, we don't want to propagate panelExpansionChanged to the // bouncer if the bouncer is dismissing as a result of a biometric unlock. when(mBiometricUnlockController.getMode()) .thenReturn(BiometricUnlockController.MODE_DISMISS_BOUNCER); mStatusBarKeyguardViewManager.onPanelExpansionChanged( expansionEvent( /* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE, /* expanded= */ true, /* tracking= */ false)); verify(mBouncer, never()).setExpansion(anyFloat()); } @Test public void onPanelExpansionChanged_neverTranslatesBouncerWhenLaunchingApp() { when(mCentralSurfaces.isInLaunchTransition()).thenReturn(true); Loading Loading
packages/SystemUI/src/com/android/systemui/shade/PanelViewController.java +9 −13 Original line number Diff line number Diff line Loading @@ -171,6 +171,7 @@ public abstract class PanelViewController { private float mInitialTouchY; private float mInitialTouchX; private boolean mTouchDisabled; private boolean mInitialTouchFromKeyguard; /** * Whether or not the PanelView can be expanded or collapsed with a drag. Loading Loading @@ -395,6 +396,7 @@ public abstract class PanelViewController { mInitialOffsetOnTouch = expandedHeight; mInitialTouchY = newY; mInitialTouchX = newX; mInitialTouchFromKeyguard = mStatusBarStateController.getState() == StatusBarState.KEYGUARD; if (startTracking) { mTouchSlopExceeded = true; setExpandedHeight(mInitialOffsetOnTouch); Loading @@ -417,20 +419,14 @@ public abstract class PanelViewController { mStatusBarStateController.getState() == StatusBarState.KEYGUARD; final boolean expand; if (event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel) { // If the keyguard is fading away, don't expand it again. This can happen if you're // swiping to unlock, the app below the keyguard is in landscape, and the screen // rotates while your finger is still down after the swipe to unlock. if (mKeyguardStateController.isKeyguardFadingAway()) { if (mKeyguardStateController.isKeyguardFadingAway() || (mInitialTouchFromKeyguard && !onKeyguard)) { // Don't expand for any touches that started from the keyguard and ended after the // keyguard is gone. expand = false; } else if (onKeyguard) { } else if (event.getActionMasked() == MotionEvent.ACTION_CANCEL || forceCancel) { if (onKeyguard) { expand = true; } else if (mKeyguardStateController.isKeyguardFadingAway()) { // If we're in the middle of dismissing the keyguard, don't expand due to the // cancelled gesture. Gesture cancellation during an unlock is expected in some // situations, such keeping your finger down while swiping to unlock to an app // that is locked in landscape (the rotation will cancel the touch event). expand = false; } else if (mCentralSurfaces.isBouncerShowingOverDream()) { expand = false; } else { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +4 −3 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone; import static android.view.WindowInsets.Type.navigationBars; import static com.android.systemui.plugins.ActivityStarter.OnDismissAction; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_DISMISS_BOUNCER; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_UNLOCK_COLLAPSING; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK; import static com.android.systemui.statusbar.phone.BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING; Loading Loading @@ -387,6 +388,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } else if (mShowing && !hideBouncerOverDream) { if (!isWakeAndUnlocking() && !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER) && !mCentralSurfaces.isInLaunchTransition() && !isUnlockCollapsing()) { mBouncer.setExpansion(fraction); Loading @@ -398,9 +400,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } } else if (!mShowing && mBouncer.inTransit()) { // Keyguard is not visible anymore, but expansion animation was still running. // We need to keep propagating the expansion state to the bouncer, otherwise it will be // stuck in transit. mBouncer.setExpansion(fraction); // We need to hide the bouncer, otherwise it will be stuck in transit. mBouncer.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
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -202,12 +202,12 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { } @Test public void onPanelExpansionChanged_propagatesToBouncer_evenAfterHidden() { public void onPanelExpansionChanged_hideBouncer_afterKeyguardHidden() { mStatusBarKeyguardViewManager.hide(0, 0); when(mBouncer.inTransit()).thenReturn(true); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); verify(mBouncer).setExpansion(eq(EXPANSION_EVENT.getFraction())); verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN)); } @Test Loading Loading @@ -248,6 +248,23 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { verify(mBouncer, never()).setExpansion(anyFloat()); } @Test public void onPanelExpansionChanged_neverTranslatesBouncerWhenDismissBouncer() { // Since KeyguardBouncer.EXPANSION_VISIBLE = 0 panel expansion, if the unlock is dismissing // the bouncer, there may be an onPanelExpansionChanged(0) call to collapse the panel // which would mistakenly cause the bouncer to show briefly before its visibility // is set to hide. Therefore, we don't want to propagate panelExpansionChanged to the // bouncer if the bouncer is dismissing as a result of a biometric unlock. when(mBiometricUnlockController.getMode()) .thenReturn(BiometricUnlockController.MODE_DISMISS_BOUNCER); mStatusBarKeyguardViewManager.onPanelExpansionChanged( expansionEvent( /* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE, /* expanded= */ true, /* tracking= */ false)); verify(mBouncer, never()).setExpansion(anyFloat()); } @Test public void onPanelExpansionChanged_neverTranslatesBouncerWhenLaunchingApp() { when(mCentralSurfaces.isInLaunchTransition()).thenReturn(true); Loading