Merge "Fix media being stretched during the wake-up/unlock animation" into udc-dev am: e8fa3364a6
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23875487 Change-Id: Idaf1f0f69801d3f071b7e1e659b5e8decd3e8cdc Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -128,6 +128,15 @@ constructor(
|
|||||||
|
|
||||||
var visibilityChangedListener: ((Boolean) -> Unit)? = null
|
var visibilityChangedListener: ((Boolean) -> Unit)? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the doze wake up animation is delayed and we are currently waiting for it to start.
|
||||||
|
*/
|
||||||
|
var isDozeWakeUpAnimationWaiting: Boolean = false
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
refreshMediaPosition()
|
||||||
|
}
|
||||||
|
|
||||||
/** single pane media container placed at the top of the notifications list */
|
/** single pane media container placed at the top of the notifications list */
|
||||||
var singlePaneContainer: MediaContainerView? = null
|
var singlePaneContainer: MediaContainerView? = null
|
||||||
private set
|
private set
|
||||||
@@ -221,7 +230,13 @@ constructor(
|
|||||||
// by the clock. This is not the case for single-line clock though.
|
// by the clock. This is not the case for single-line clock though.
|
||||||
// For single shade, we don't need to do it, because media is a child of NSSL, which already
|
// For single shade, we don't need to do it, because media is a child of NSSL, which already
|
||||||
// gets hidden on AOD.
|
// gets hidden on AOD.
|
||||||
return !statusBarStateController.isDozing
|
// Media also has to be hidden when waking up from dozing, and the doze wake up animation is
|
||||||
|
// delayed and waiting to be started.
|
||||||
|
// This is to stay in sync with the delaying of the horizontal alignment of the rest of the
|
||||||
|
// keyguard container, that is also delayed until the "wait" is over.
|
||||||
|
// If we show media during this waiting period, the shade will still be centered, and using
|
||||||
|
// the entire width of the screen, and making media show fully stretched.
|
||||||
|
return !statusBarStateController.isDozing && !isDozeWakeUpAnimationWaiting
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showMediaPlayer() {
|
private fun showMediaPlayer() {
|
||||||
|
|||||||
@@ -1621,6 +1621,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
|
|||||||
|
|
||||||
mWillPlayDelayedDozeAmountAnimation = willPlay;
|
mWillPlayDelayedDozeAmountAnimation = willPlay;
|
||||||
mWakeUpCoordinator.logDelayingClockWakeUpAnimation(willPlay);
|
mWakeUpCoordinator.logDelayingClockWakeUpAnimation(willPlay);
|
||||||
|
mKeyguardMediaController.setDozeWakeUpAnimationWaiting(willPlay);
|
||||||
|
|
||||||
// Once changing this value, see if we should move the clock.
|
// Once changing this value, see if we should move the clock.
|
||||||
positionClockAndNotifications();
|
positionClockAndNotifications();
|
||||||
|
|||||||
@@ -192,6 +192,17 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
|
|||||||
assertThat(splitShadeContainer.visibility).isEqualTo(GONE)
|
assertThat(splitShadeContainer.visibility).isEqualTo(GONE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun dozeWakeUpAnimationWaiting_inSplitShade_mediaIsHidden() {
|
||||||
|
val splitShadeContainer = FrameLayout(context)
|
||||||
|
keyguardMediaController.attachSplitShadeContainer(splitShadeContainer)
|
||||||
|
keyguardMediaController.useSplitShade = true
|
||||||
|
|
||||||
|
keyguardMediaController.isDozeWakeUpAnimationWaiting = true
|
||||||
|
|
||||||
|
assertThat(splitShadeContainer.visibility).isEqualTo(GONE)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun dozing_inSingleShade_mediaIsVisible() {
|
fun dozing_inSingleShade_mediaIsVisible() {
|
||||||
val splitShadeContainer = FrameLayout(context)
|
val splitShadeContainer = FrameLayout(context)
|
||||||
@@ -203,6 +214,17 @@ class KeyguardMediaControllerTest : SysuiTestCase() {
|
|||||||
assertThat(mediaContainerView.visibility).isEqualTo(VISIBLE)
|
assertThat(mediaContainerView.visibility).isEqualTo(VISIBLE)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun dozeWakeUpAnimationWaiting_inSingleShade_mediaIsVisible() {
|
||||||
|
val splitShadeContainer = FrameLayout(context)
|
||||||
|
keyguardMediaController.attachSplitShadeContainer(splitShadeContainer)
|
||||||
|
keyguardMediaController.useSplitShade = false
|
||||||
|
|
||||||
|
keyguardMediaController.isDozeWakeUpAnimationWaiting = true
|
||||||
|
|
||||||
|
assertThat(mediaContainerView.visibility).isEqualTo(VISIBLE)
|
||||||
|
}
|
||||||
|
|
||||||
private fun setDozing() {
|
private fun setDozing() {
|
||||||
whenever(statusBarStateController.isDozing).thenReturn(true)
|
whenever(statusBarStateController.isDozing).thenReturn(true)
|
||||||
statusBarStateListener.onDozingChanged(true)
|
statusBarStateListener.onDozingChanged(true)
|
||||||
|
|||||||
@@ -509,6 +509,17 @@ public class NotificationPanelViewControllerTest extends NotificationPanelViewCo
|
|||||||
assertKeyguardStatusViewNotCentered();
|
assertKeyguardStatusViewNotCentered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void keyguardStatusView_willPlayDelayedDoze_notifiesKeyguardMediaController() {
|
||||||
|
when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(2);
|
||||||
|
mStatusBarStateController.setState(KEYGUARD);
|
||||||
|
enableSplitShade(/* enabled= */ true);
|
||||||
|
|
||||||
|
mNotificationPanelViewController.setWillPlayDelayedDozeAmountAnimation(true);
|
||||||
|
|
||||||
|
verify(mKeyguardMediaController).setDozeWakeUpAnimationWaiting(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void keyguardStatusView_willPlayDelayedDoze_isCentered_thenStillCenteredIfNoNotifs() {
|
public void keyguardStatusView_willPlayDelayedDoze_isCentered_thenStillCenteredIfNoNotifs() {
|
||||||
when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0);
|
when(mNotificationStackScrollLayoutController.getVisibleNotificationCount()).thenReturn(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user