From 15af97697b7475642d8d1f577f5512d7e0482f7f Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Tue, 19 Mar 2019 18:32:37 -0700 Subject: [PATCH] Fixed animation for legacy devices and when not always on We were always animating the pulsing before, even if the device didn't support this properly or if the device wasn't always on. This also fixed the wake-up animation for these devices. Fixes: 129015862 Fixes: 128636045 Test: atest SystemUITests Change-Id: Iadc562ed0195c69c69feff70e6a7ed9d0689cf4a --- .../notification/NotificationWakeUpCoordinator.kt | 7 ++++++- .../notification/row/ExpandableNotificationRow.java | 2 +- .../com/android/systemui/statusbar/phone/StatusBar.java | 5 ++++- .../statusbar/phone/NotificationPanelViewTest.java | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt index ccb8d9bf46c13..3433fa8ffff08 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationWakeUpCoordinator.kt @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification import android.animation.ObjectAnimator +import android.content.Context import android.util.FloatProperty import com.android.systemui.Interpolators import com.android.systemui.plugins.statusbar.StatusBarStateController @@ -25,12 +26,14 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.collection.NotificationEntry import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout import com.android.systemui.statusbar.notification.stack.StackStateAnimator +import com.android.systemui.statusbar.phone.DozeParameters import javax.inject.Inject import javax.inject.Singleton @Singleton class NotificationWakeUpCoordinator @Inject constructor( + private val mContext: Context, private val mAmbientPulseManager: AmbientPulseManager, private val mStatusBarStateController: StatusBarStateController) : AmbientPulseManager.OnAmbientChangedListener, StatusBarStateController.StateListener { @@ -59,10 +62,12 @@ class NotificationWakeUpCoordinator @Inject constructor( private var mLinearVisibilityAmount = 0.0f private var mWakingUp = false private val mEntrySetToClearWhenFinished = mutableSetOf() + private val mDozeParameters: DozeParameters; init { mAmbientPulseManager.addListener(this) mStatusBarStateController.addCallback(this) + mDozeParameters = DozeParameters.getInstance(mContext) } fun setStackScroller(stackScroller: NotificationStackScrollLayout) { @@ -194,7 +199,7 @@ class NotificationWakeUpCoordinator @Inject constructor( } override fun onAmbientStateChanged(entry: NotificationEntry, isPulsing: Boolean) { - var animate = true + var animate = mDozeParameters.getAlwaysOn() && !mDozeParameters.getDisplayNeedsBlanking() if (!isPulsing) { if (mLinearDozeAmount != 0.0f) { if (entry.isRowDismissed) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index c769daa735198..6e3fbd7fb2da9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -2429,7 +2429,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView protected void onLayout(boolean changed, int left, int top, int right, int bottom) { int intrinsicBefore = getIntrinsicHeight(); super.onLayout(changed, left, top, right, bottom); - if (intrinsicBefore != getIntrinsicHeight()) { + if (intrinsicBefore != getIntrinsicHeight() && intrinsicBefore != 0) { notifyHeightChanged(true /* needsAnimation */); } if (mMenuRow.getMenuView() != null) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index d18b4190400ac..c5d0b17e7845f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -3597,10 +3597,13 @@ public class StatusBar extends SystemUI implements DemoMode, mWakeUpCoordinator.setWakingUp(true); mAmbientPulseManager.releaseAllImmediately(); mVisualStabilityManager.setScreenOn(true); - updateNotificationPanelTouchState(); updateVisibleToUser(); updateIsKeyguard(); mDozeServiceHost.stopDozing(); + // This is intentionally below the stopDozing call above, since it avoids that we're + // unnecessarily animating the wakeUp transition. Animations should only be enabled + // once we fully woke up. + updateNotificationPanelTouchState(); mPulseExpansionHandler.onStartedWakingUp(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index db8357a5a9db4..6889c57d74df7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -71,7 +71,7 @@ public class NotificationPanelViewTest extends SysuiTestCase { mDependency.injectMockDependency(ConfigurationController.class); mDependency.injectMockDependency(ZenModeController.class); NotificationWakeUpCoordinator coordinator = - new NotificationWakeUpCoordinator( + new NotificationWakeUpCoordinator(mContext, new AmbientPulseManager(mContext), new StatusBarStateControllerImpl()); PulseExpansionHandler expansionHandler = new PulseExpansionHandler(mContext, coordinator);