Merge "[Status Bar Refactor] 2.2/N: Migrate StatusBar's panelExpansionChanged callback to the correct listener interface." into sc-v2-dev am: 56b6645afb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16092653 Change-Id: I4cb5b65e5fdee2f463082ec8f03f4438c2ecf73c
This commit is contained in:
@@ -329,7 +329,9 @@ class NotificationShadeDepthController @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* Update blurs when pulling down the shade
|
* Update blurs when pulling down the shade
|
||||||
*/
|
*/
|
||||||
override fun onPanelExpansionChanged(rawFraction: Float, tracking: Boolean) {
|
override fun onPanelExpansionChanged(
|
||||||
|
rawFraction: Float, expanded: Boolean, tracking: Boolean
|
||||||
|
) {
|
||||||
val timestamp = SystemClock.elapsedRealtimeNanos()
|
val timestamp = SystemClock.elapsedRealtimeNanos()
|
||||||
val expansion = MathUtils.saturate(
|
val expansion = MathUtils.saturate(
|
||||||
(rawFraction - panelPullDownMinFraction) / (1f - panelPullDownMinFraction))
|
(rawFraction - panelPullDownMinFraction) / (1f - panelPullDownMinFraction))
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
this.state = newState
|
this.state = newState
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPanelExpansionChanged(fraction: Float, tracking: Boolean) {
|
override fun onPanelExpansionChanged(fraction: Float, expanded: Boolean, tracking: Boolean) {
|
||||||
val collapsedEnough = fraction <= 0.9f
|
val collapsedEnough = fraction <= 0.9f
|
||||||
if (collapsedEnough != this.collapsedEnoughToHide) {
|
if (collapsedEnough != this.collapsedEnoughToHide) {
|
||||||
val couldShowPulsingHuns = canShowPulsingHuns
|
val couldShowPulsingHuns = canShowPulsingHuns
|
||||||
|
|||||||
@@ -1093,7 +1093,8 @@ public abstract class PanelViewController {
|
|||||||
mBar.panelExpansionChanged(mExpandedFraction, isExpanded());
|
mBar.panelExpansionChanged(mExpandedFraction, isExpanded());
|
||||||
}
|
}
|
||||||
updateVisibility();
|
updateVisibility();
|
||||||
mPanelExpansionStateManager.onPanelExpansionChanged(mExpandedFraction, mTracking);
|
mPanelExpansionStateManager.onPanelExpansionChanged(
|
||||||
|
mExpandedFraction, isExpanded(), mTracking);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isExpanded() {
|
public boolean isExpanded() {
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
panelExpansionStateManager.addListener(
|
panelExpansionStateManager.addListener(
|
||||||
(fraction, tracking) -> setRawPanelExpansionFraction(fraction)
|
(fraction, expanded, tracking) -> setRawPanelExpansionFraction(fraction)
|
||||||
);
|
);
|
||||||
|
|
||||||
mColors = new GradientColors();
|
mColors = new GradientColors();
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ public class StatusBar extends SystemUI implements
|
|||||||
lockscreenShadeTransitionController.setStatusbar(this);
|
lockscreenShadeTransitionController.setStatusbar(this);
|
||||||
|
|
||||||
mExpansionChangedListeners = new ArrayList<>();
|
mExpansionChangedListeners = new ArrayList<>();
|
||||||
addExpansionChangedListener(this::onPanelExpansionChanged);
|
mPanelExpansionStateManager.addListener(this::onPanelExpansionChanged);
|
||||||
|
|
||||||
mBubbleExpandListener =
|
mBubbleExpandListener =
|
||||||
(isExpanding, key) -> mContext.getMainExecutor().execute(() -> {
|
(isExpanding, key) -> mContext.getMainExecutor().execute(() -> {
|
||||||
@@ -1158,8 +1158,6 @@ public class StatusBar extends SystemUI implements
|
|||||||
|
|
||||||
mNotificationIconAreaController.setupShelf(mNotificationShelfController);
|
mNotificationIconAreaController.setupShelf(mNotificationShelfController);
|
||||||
mPanelExpansionStateManager.addListener(mWakeUpCoordinator);
|
mPanelExpansionStateManager.addListener(mWakeUpCoordinator);
|
||||||
mPanelExpansionStateManager.addListener(
|
|
||||||
this::dispatchPanelExpansionForKeyguardDismiss);
|
|
||||||
|
|
||||||
mUserSwitcherController.init(mNotificationShadeWindowView);
|
mUserSwitcherController.init(mNotificationShadeWindowView);
|
||||||
|
|
||||||
@@ -1425,15 +1423,15 @@ public class StatusBar extends SystemUI implements
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When swiping up to dismiss the lock screen, the panel expansion goes from 1f to 0f. This
|
* When swiping up to dismiss the lock screen, the panel expansion fraction goes from 1f to 0f.
|
||||||
* results in the clock/notifications/other content disappearing off the top of the screen.
|
* This results in the clock/notifications/other content disappearing off the top of the screen.
|
||||||
*
|
*
|
||||||
* We also use the expansion amount to animate in the app/launcher surface from the bottom of
|
* We also use the expansion fraction to animate in the app/launcher surface from the bottom of
|
||||||
* the screen, 'pushing' off the notifications and other content. To do this, we dispatch the
|
* the screen, 'pushing' off the notifications and other content. To do this, we dispatch the
|
||||||
* expansion amount to the KeyguardViewMediator if we're in the process of dismissing the
|
* expansion fraction to the KeyguardViewMediator if we're in the process of dismissing the
|
||||||
* keyguard.
|
* keyguard.
|
||||||
*/
|
*/
|
||||||
private void dispatchPanelExpansionForKeyguardDismiss(float expansion, boolean trackingTouch) {
|
private void dispatchPanelExpansionForKeyguardDismiss(float fraction, boolean trackingTouch) {
|
||||||
// Things that mean we're not dismissing the keyguard, and should ignore this expansion:
|
// Things that mean we're not dismissing the keyguard, and should ignore this expansion:
|
||||||
// - Keyguard isn't even visible.
|
// - Keyguard isn't even visible.
|
||||||
// - Keyguard is visible, but can't be dismissed (swiping up will show PIN/password prompt).
|
// - Keyguard is visible, but can't be dismissed (swiping up will show PIN/password prompt).
|
||||||
@@ -1452,12 +1450,14 @@ public class StatusBar extends SystemUI implements
|
|||||||
|| mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehindOrWillBe()
|
|| mKeyguardViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehindOrWillBe()
|
||||||
|| mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) {
|
|| mKeyguardUnlockAnimationController.isUnlockingWithSmartSpaceTransition()) {
|
||||||
mKeyguardStateController.notifyKeyguardDismissAmountChanged(
|
mKeyguardStateController.notifyKeyguardDismissAmountChanged(
|
||||||
1f - expansion, trackingTouch);
|
1f - fraction, trackingTouch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onPanelExpansionChanged(float frac, boolean expanded) {
|
private void onPanelExpansionChanged(float fraction, boolean expanded, boolean tracking) {
|
||||||
if (frac == 0 || frac == 1) {
|
dispatchPanelExpansionForKeyguardDismiss(fraction, tracking);
|
||||||
|
|
||||||
|
if (fraction == 0 || fraction == 1) {
|
||||||
if (getNavigationBarView() != null) {
|
if (getNavigationBarView() != null) {
|
||||||
getNavigationBarView().onStatusBarPanelStateChanged();
|
getNavigationBarView().onStatusBarPanelStateChanged();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,7 +328,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPanelExpansionChanged(float fraction, boolean tracking) {
|
public void onPanelExpansionChanged(float fraction, boolean expanded, boolean tracking) {
|
||||||
// We don't want to translate the bounce when:
|
// We don't want to translate the bounce when:
|
||||||
// • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to
|
// • Keyguard is occluded, because we're in a FLAG_SHOW_WHEN_LOCKED activity and need to
|
||||||
// conserve the original animation.
|
// conserve the original animation.
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ public interface PanelExpansionListener {
|
|||||||
* lock screen and swiping to pull down the notification shade.
|
* lock screen and swiping to pull down the notification shade.
|
||||||
*
|
*
|
||||||
* @param fraction 0 when collapsed, 1 when fully expanded.
|
* @param fraction 0 when collapsed, 1 when fully expanded.
|
||||||
|
* @param expanded true if the panel should be considered expanded.
|
||||||
* @param tracking {@code true} when the user is actively dragging the panel.
|
* @param tracking {@code true} when the user is actively dragging the panel.
|
||||||
*/
|
*/
|
||||||
void onPanelExpansionChanged(float fraction, boolean tracking);
|
void onPanelExpansionChanged(float fraction, boolean expanded, boolean tracking);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class PanelExpansionStateManager @Inject constructor() {
|
|||||||
private val listeners: MutableList<PanelExpansionListener> = mutableListOf()
|
private val listeners: MutableList<PanelExpansionListener> = mutableListOf()
|
||||||
|
|
||||||
@FloatRange(from = 0.0, to = 1.0) private var fraction: Float = 0f
|
@FloatRange(from = 0.0, to = 1.0) private var fraction: Float = 0f
|
||||||
|
private var expanded: Boolean = false
|
||||||
private var tracking: Boolean = false
|
private var tracking: Boolean = false
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,16 +42,18 @@ class PanelExpansionStateManager @Inject constructor() {
|
|||||||
*/
|
*/
|
||||||
fun addListener(listener: PanelExpansionListener) {
|
fun addListener(listener: PanelExpansionListener) {
|
||||||
listeners.add(listener)
|
listeners.add(listener)
|
||||||
listener.onPanelExpansionChanged(fraction, tracking)
|
listener.onPanelExpansionChanged(fraction, expanded, tracking)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called when the panel expansion has changed. Notifies all listeners of change. */
|
/** Called when the panel expansion has changed. Notifies all listeners of change. */
|
||||||
fun onPanelExpansionChanged(
|
fun onPanelExpansionChanged(
|
||||||
@FloatRange(from = 0.0, to = 1.0) fraction: Float,
|
@FloatRange(from = 0.0, to = 1.0) fraction: Float,
|
||||||
|
expanded: Boolean,
|
||||||
tracking: Boolean
|
tracking: Boolean
|
||||||
) {
|
) {
|
||||||
this.fraction = fraction
|
this.fraction = fraction
|
||||||
|
this.expanded = expanded
|
||||||
this.tracking = tracking
|
this.tracking = tracking
|
||||||
listeners.forEach { it.onPanelExpansionChanged(fraction, tracking) }
|
listeners.forEach { it.onPanelExpansionChanged(fraction, expanded, tracking) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,15 +119,17 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun onPanelExpansionChanged_apliesBlur_ifShade() {
|
fun onPanelExpansionChanged_apliesBlur_ifShade() {
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
false /* tracking */)
|
rawFraction = 1f, expanded = true, tracking = false
|
||||||
|
)
|
||||||
verify(shadeAnimation).animateTo(eq(maxBlur), any())
|
verify(shadeAnimation).animateTo(eq(maxBlur), any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun onPanelExpansionChanged_animatesBlurIn_ifShade() {
|
fun onPanelExpansionChanged_animatesBlurIn_ifShade() {
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(0.01f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
false /* tracking */)
|
rawFraction = 0.01f, expanded = false, tracking = false
|
||||||
|
)
|
||||||
verify(shadeAnimation).animateTo(eq(maxBlur), any())
|
verify(shadeAnimation).animateTo(eq(maxBlur), any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,8 +137,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
fun onPanelExpansionChanged_animatesBlurOut_ifShade() {
|
fun onPanelExpansionChanged_animatesBlurOut_ifShade() {
|
||||||
onPanelExpansionChanged_animatesBlurIn_ifShade()
|
onPanelExpansionChanged_animatesBlurIn_ifShade()
|
||||||
clearInvocations(shadeAnimation)
|
clearInvocations(shadeAnimation)
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(0f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
false /* tracking */)
|
rawFraction = 0f, expanded = false, tracking = false
|
||||||
|
)
|
||||||
verify(shadeAnimation).animateTo(eq(0), any())
|
verify(shadeAnimation).animateTo(eq(0), any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,16 +147,19 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
fun onPanelExpansionChanged_animatesBlurOut_ifFlick() {
|
fun onPanelExpansionChanged_animatesBlurOut_ifFlick() {
|
||||||
onPanelExpansionChanged_apliesBlur_ifShade()
|
onPanelExpansionChanged_apliesBlur_ifShade()
|
||||||
clearInvocations(shadeAnimation)
|
clearInvocations(shadeAnimation)
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
true /* tracking */)
|
rawFraction = 1f, expanded = true, tracking = true
|
||||||
|
)
|
||||||
verify(shadeAnimation, never()).animateTo(anyInt(), any())
|
verify(shadeAnimation, never()).animateTo(anyInt(), any())
|
||||||
|
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(0.9f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
true /* tracking */)
|
rawFraction = 0.9f, expanded = true, tracking = true
|
||||||
|
)
|
||||||
verify(shadeAnimation, never()).animateTo(anyInt(), any())
|
verify(shadeAnimation, never()).animateTo(anyInt(), any())
|
||||||
|
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(0.8f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
false /* tracking */)
|
rawFraction = 0.8f, expanded = true, tracking = false
|
||||||
|
)
|
||||||
verify(shadeAnimation).animateTo(eq(0), any())
|
verify(shadeAnimation).animateTo(eq(0), any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,24 +167,28 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
fun onPanelExpansionChanged_animatesBlurIn_ifFlickCancelled() {
|
fun onPanelExpansionChanged_animatesBlurIn_ifFlickCancelled() {
|
||||||
onPanelExpansionChanged_animatesBlurOut_ifFlick()
|
onPanelExpansionChanged_animatesBlurOut_ifFlick()
|
||||||
clearInvocations(shadeAnimation)
|
clearInvocations(shadeAnimation)
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(0.6f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
true /* tracking */)
|
rawFraction = 0.6f, expanded = true, tracking = true
|
||||||
|
)
|
||||||
verify(shadeAnimation).animateTo(eq(maxBlur), any())
|
verify(shadeAnimation).animateTo(eq(maxBlur), any())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun onPanelExpansionChanged_respectsMinPanelPullDownFraction() {
|
fun onPanelExpansionChanged_respectsMinPanelPullDownFraction() {
|
||||||
notificationShadeDepthController.panelPullDownMinFraction = 0.5f
|
notificationShadeDepthController.panelPullDownMinFraction = 0.5f
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(0.5f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
true /* tracking */)
|
rawFraction = 0.5f, expanded = true, tracking = true
|
||||||
|
)
|
||||||
assertThat(notificationShadeDepthController.shadeExpansion).isEqualTo(0f)
|
assertThat(notificationShadeDepthController.shadeExpansion).isEqualTo(0f)
|
||||||
|
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(0.75f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
true /* tracking */)
|
rawFraction = 0.75f, expanded = true, tracking = true
|
||||||
|
)
|
||||||
assertThat(notificationShadeDepthController.shadeExpansion).isEqualTo(0.5f)
|
assertThat(notificationShadeDepthController.shadeExpansion).isEqualTo(0.5f)
|
||||||
|
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f /* expansion */,
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
true /* tracking */)
|
rawFraction = 1f, expanded = true, tracking = true
|
||||||
|
)
|
||||||
assertThat(notificationShadeDepthController.shadeExpansion).isEqualTo(1f)
|
assertThat(notificationShadeDepthController.shadeExpansion).isEqualTo(1f)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +206,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
fun setQsPanelExpansion_appliesBlur() {
|
fun setQsPanelExpansion_appliesBlur() {
|
||||||
statusBarState = StatusBarState.KEYGUARD
|
statusBarState = StatusBarState.KEYGUARD
|
||||||
notificationShadeDepthController.qsPanelExpansion = 1f
|
notificationShadeDepthController.qsPanelExpansion = 1f
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f, tracking = false)
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
|
rawFraction = 1f, expanded = true, tracking = false
|
||||||
|
)
|
||||||
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
||||||
verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
|
verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
|
||||||
}
|
}
|
||||||
@@ -205,7 +217,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
fun setQsPanelExpansion_easing() {
|
fun setQsPanelExpansion_easing() {
|
||||||
statusBarState = StatusBarState.KEYGUARD
|
statusBarState = StatusBarState.KEYGUARD
|
||||||
notificationShadeDepthController.qsPanelExpansion = 0.25f
|
notificationShadeDepthController.qsPanelExpansion = 0.25f
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f, tracking = false)
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
|
rawFraction = 1f, expanded = true, tracking = false
|
||||||
|
)
|
||||||
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
||||||
verify(wallpaperController).setNotificationShadeZoom(
|
verify(wallpaperController).setNotificationShadeZoom(
|
||||||
eq(ShadeInterpolation.getNotificationScrimAlpha(0.25f)))
|
eq(ShadeInterpolation.getNotificationScrimAlpha(0.25f)))
|
||||||
@@ -261,7 +275,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun updateBlurCallback_setsBlur_whenExpanded() {
|
fun updateBlurCallback_setsBlur_whenExpanded() {
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f, false)
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
|
rawFraction = 1f, expanded = true, tracking = false
|
||||||
|
)
|
||||||
`when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
|
`when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
|
||||||
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
||||||
verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
|
verify(blurUtils).applyBlur(any(), eq(maxBlur), eq(false))
|
||||||
@@ -269,7 +285,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun updateBlurCallback_ignoreShadeBlurUntilHidden_overridesZoom() {
|
fun updateBlurCallback_ignoreShadeBlurUntilHidden_overridesZoom() {
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f, false)
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
|
rawFraction = 1f, expanded = true, tracking = false
|
||||||
|
)
|
||||||
`when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
|
`when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
|
||||||
notificationShadeDepthController.blursDisabledForAppLaunch = true
|
notificationShadeDepthController.blursDisabledForAppLaunch = true
|
||||||
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
||||||
@@ -300,7 +318,9 @@ class NotificationShadeDepthControllerTest : SysuiTestCase() {
|
|||||||
// Brightness mirror is fully visible
|
// Brightness mirror is fully visible
|
||||||
`when`(brightnessSpring.ratio).thenReturn(1f)
|
`when`(brightnessSpring.ratio).thenReturn(1f)
|
||||||
// And shade is blurred
|
// And shade is blurred
|
||||||
notificationShadeDepthController.onPanelExpansionChanged(1f, false)
|
notificationShadeDepthController.onPanelExpansionChanged(
|
||||||
|
rawFraction = 1f, expanded = true, tracking = false
|
||||||
|
)
|
||||||
`when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
|
`when`(shadeAnimation.radius).thenReturn(maxBlur.toFloat())
|
||||||
|
|
||||||
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
notificationShadeDepthController.updateBlurCallback.doFrame(0)
|
||||||
|
|||||||
@@ -184,8 +184,10 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
|||||||
public void onPanelExpansionChanged_neverHidesFullscreenBouncer() {
|
public void onPanelExpansionChanged_neverHidesFullscreenBouncer() {
|
||||||
// TODO: StatusBar should not be here, mBouncer.isFullscreenBouncer() should do the same.
|
// TODO: StatusBar should not be here, mBouncer.isFullscreenBouncer() should do the same.
|
||||||
when(mStatusBar.isFullScreenUserSwitcherState()).thenReturn(true);
|
when(mStatusBar.isFullScreenUserSwitcherState()).thenReturn(true);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
true /* tracking */);
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_VISIBLE));
|
verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_VISIBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,51 +195,67 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
|||||||
public void onPanelExpansionChanged_neverHidesScrimmedBouncer() {
|
public void onPanelExpansionChanged_neverHidesScrimmedBouncer() {
|
||||||
when(mBouncer.isShowing()).thenReturn(true);
|
when(mBouncer.isShowing()).thenReturn(true);
|
||||||
when(mBouncer.isScrimmed()).thenReturn(true);
|
when(mBouncer.isScrimmed()).thenReturn(true);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
true /* tracking */);
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_VISIBLE));
|
verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_VISIBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPanelExpansionChanged_neverShowsDuringHintAnimation() {
|
public void onPanelExpansionChanged_neverShowsDuringHintAnimation() {
|
||||||
when(mNotificationPanelView.isUnlockHintRunning()).thenReturn(true);
|
when(mNotificationPanelView.isUnlockHintRunning()).thenReturn(true);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
true /* tracking */);
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN));
|
verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPanelExpansionChanged_propagatesToBouncer() {
|
public void onPanelExpansionChanged_propagatesToBouncer() {
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
true /* tracking */);
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer).setExpansion(eq(0.5f));
|
verify(mBouncer).setExpansion(eq(0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPanelExpansionChanged_showsBouncerWhenSwiping() {
|
public void onPanelExpansionChanged_showsBouncerWhenSwiping() {
|
||||||
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
|
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
true /* tracking */);
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer).show(eq(false), eq(false));
|
verify(mBouncer).show(eq(false), eq(false));
|
||||||
|
|
||||||
// But not when it's already visible
|
// But not when it's already visible
|
||||||
reset(mBouncer);
|
reset(mBouncer);
|
||||||
when(mBouncer.isShowing()).thenReturn(true);
|
when(mBouncer.isShowing()).thenReturn(true);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */, true /* tracking */);
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer, never()).show(eq(false), eq(false));
|
verify(mBouncer, never()).show(eq(false), eq(false));
|
||||||
|
|
||||||
// Or animating away
|
// Or animating away
|
||||||
reset(mBouncer);
|
reset(mBouncer);
|
||||||
when(mBouncer.isAnimatingAway()).thenReturn(true);
|
when(mBouncer.isAnimatingAway()).thenReturn(true);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */, true /* tracking */);
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer, never()).show(eq(false), eq(false));
|
verify(mBouncer, never()).show(eq(false), eq(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPanelExpansionChanged_neverTranslatesBouncerWhenOccluded() {
|
public void onPanelExpansionChanged_neverTranslatesBouncerWhenOccluded() {
|
||||||
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animate */);
|
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animate */);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(0.5f /* expansion */,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
true /* tracking */);
|
/* fraction= */ 0.5f,
|
||||||
|
/* expanded= */ false,
|
||||||
|
/* tracking= */ true);
|
||||||
verify(mBouncer, never()).setExpansion(eq(0.5f));
|
verify(mBouncer, never()).setExpansion(eq(0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,16 +263,20 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
|||||||
public void onPanelExpansionChanged_neverTranslatesBouncerWhenWakeAndUnlock() {
|
public void onPanelExpansionChanged_neverTranslatesBouncerWhenWakeAndUnlock() {
|
||||||
when(mBiometrucUnlockController.getMode())
|
when(mBiometrucUnlockController.getMode())
|
||||||
.thenReturn(BiometricUnlockController.MODE_WAKE_AND_UNLOCK);
|
.thenReturn(BiometricUnlockController.MODE_WAKE_AND_UNLOCK);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(KeyguardBouncer.EXPANSION_VISIBLE,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
false /* tracking */);
|
/* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE,
|
||||||
|
/* expanded= */ true,
|
||||||
|
/* tracking= */ false);
|
||||||
verify(mBouncer, never()).setExpansion(anyFloat());
|
verify(mBouncer, never()).setExpansion(anyFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onPanelExpansionChanged_neverTranslatesBouncerWhenLaunchingApp() {
|
public void onPanelExpansionChanged_neverTranslatesBouncerWhenLaunchingApp() {
|
||||||
when(mStatusBar.isInLaunchTransition()).thenReturn(true);
|
when(mStatusBar.isInLaunchTransition()).thenReturn(true);
|
||||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(KeyguardBouncer.EXPANSION_VISIBLE,
|
mStatusBarKeyguardViewManager.onPanelExpansionChanged(
|
||||||
false /* tracking */);
|
/* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE,
|
||||||
|
/* expanded= */ true,
|
||||||
|
/* tracking= */ false);
|
||||||
verify(mBouncer, never()).setExpansion(anyFloat());
|
verify(mBouncer, never()).setExpansion(anyFloat());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,36 +37,43 @@ class PanelExpansionStateManagerTest : SysuiTestCase() {
|
|||||||
val listener = TestPanelExpansionListener()
|
val listener = TestPanelExpansionListener()
|
||||||
panelExpansionStateManager.addListener(listener)
|
panelExpansionStateManager.addListener(listener)
|
||||||
val fraction = 0.6f
|
val fraction = 0.6f
|
||||||
|
val expanded = true
|
||||||
val tracking = true
|
val tracking = true
|
||||||
|
|
||||||
panelExpansionStateManager.onPanelExpansionChanged(fraction, tracking)
|
panelExpansionStateManager.onPanelExpansionChanged(fraction, expanded, tracking)
|
||||||
|
|
||||||
assertThat(listener.fraction).isEqualTo(fraction)
|
assertThat(listener.fraction).isEqualTo(fraction)
|
||||||
|
assertThat(listener.expanded).isEqualTo(expanded)
|
||||||
assertThat(listener.tracking).isEqualTo(tracking)
|
assertThat(listener.tracking).isEqualTo(tracking)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun addPanelExpansionListener_listenerNotifiedOfCurrentValues() {
|
fun addPanelExpansionListener_listenerNotifiedOfCurrentValues() {
|
||||||
val fraction = 0.6f
|
val fraction = 0.6f
|
||||||
|
val expanded = true
|
||||||
val tracking = true
|
val tracking = true
|
||||||
panelExpansionStateManager.onPanelExpansionChanged(fraction, tracking)
|
panelExpansionStateManager.onPanelExpansionChanged(fraction, expanded, tracking)
|
||||||
val listener = TestPanelExpansionListener()
|
val listener = TestPanelExpansionListener()
|
||||||
|
|
||||||
panelExpansionStateManager.addListener(listener)
|
panelExpansionStateManager.addListener(listener)
|
||||||
|
|
||||||
assertThat(listener.fraction).isEqualTo(fraction)
|
assertThat(listener.fraction).isEqualTo(fraction)
|
||||||
|
assertThat(listener.expanded).isEqualTo(expanded)
|
||||||
assertThat(listener.tracking).isEqualTo(tracking)
|
assertThat(listener.tracking).isEqualTo(tracking)
|
||||||
}
|
}
|
||||||
|
|
||||||
class TestPanelExpansionListener : PanelExpansionListener {
|
class TestPanelExpansionListener : PanelExpansionListener {
|
||||||
var fraction: Float = 0f
|
var fraction: Float = 0f
|
||||||
|
var expanded: Boolean = false
|
||||||
var tracking: Boolean = false
|
var tracking: Boolean = false
|
||||||
|
|
||||||
override fun onPanelExpansionChanged(
|
override fun onPanelExpansionChanged(
|
||||||
fraction: Float,
|
fraction: Float,
|
||||||
|
expanded: Boolean,
|
||||||
tracking: Boolean
|
tracking: Boolean
|
||||||
) {
|
) {
|
||||||
this.fraction = fraction
|
this.fraction = fraction
|
||||||
|
this.expanded = expanded
|
||||||
this.tracking = tracking
|
this.tracking = tracking
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user