Fade in status bar icons during launch animations.

See b/184726377#comment17 for before/after videos.

Bug: 184726377
Test: Manual
Change-Id: If4cc67c622fec6a4f10f74f7432d6d4db20e6ed2
This commit is contained in:
Jordan Demeulenaere
2021-04-16 14:53:28 +02:00
parent 60f71b5b01
commit b5f0bcb0e5
5 changed files with 28 additions and 25 deletions

View File

@@ -6,7 +6,6 @@ import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.statusbar.NotificationShadeDepthController
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationListContainer
import com.android.systemui.statusbar.phone.NotificationPanelViewController
import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController
import kotlin.math.ceil
import kotlin.math.max
@@ -14,7 +13,6 @@ import kotlin.math.max
/** A provider of [NotificationLaunchAnimatorController]. */
class NotificationLaunchAnimatorControllerProvider(
private val notificationShadeWindowViewController: NotificationShadeWindowViewController,
private val notificationPanelViewController: NotificationPanelViewController,
private val notificationListContainer: NotificationListContainer,
private val depthController: NotificationShadeDepthController
) {
@@ -23,7 +21,6 @@ class NotificationLaunchAnimatorControllerProvider(
): NotificationLaunchAnimatorController {
return NotificationLaunchAnimatorController(
notificationShadeWindowViewController,
notificationPanelViewController,
notificationListContainer,
depthController,
notification
@@ -38,7 +35,6 @@ class NotificationLaunchAnimatorControllerProvider(
*/
class NotificationLaunchAnimatorController(
private val notificationShadeWindowViewController: NotificationShadeWindowViewController,
private val notificationPanelViewController: NotificationPanelViewController,
private val notificationListContainer: NotificationListContainer,
private val depthController: NotificationShadeDepthController,
private val notification: ExpandableNotificationRow
@@ -97,7 +93,6 @@ class NotificationLaunchAnimatorController(
}
override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
notificationPanelViewController.setLaunchingNotification(true)
notification.isExpandAnimationRunning = true
notificationListContainer.setExpandingNotification(notification)
@@ -108,7 +103,6 @@ class NotificationLaunchAnimatorController(
override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
InteractionJankMonitor.getInstance().end(InteractionJankMonitor.CUJ_NOTIFICATION_APP_START)
notificationPanelViewController.setLaunchingNotification(false)
notification.isExpandAnimationRunning = false
notificationShadeWindowViewController.setExpandAnimationRunning(false)
notificationListContainer.setExpandingNotification(null)
@@ -118,7 +112,6 @@ class NotificationLaunchAnimatorController(
private fun applyParams(params: ExpandAnimationParameters?) {
notification.applyExpandAnimationParams(params)
notificationListContainer.applyExpandAnimationParams(params)
notificationPanelViewController.applyExpandAnimationParams(params)
depthController.notificationLaunchAnimationParams = params
}

View File

@@ -122,7 +122,6 @@ import com.android.systemui.statusbar.VibratorHelper;
import com.android.systemui.statusbar.notification.AnimatableProperty;
import com.android.systemui.statusbar.notification.ConversationNotificationManager;
import com.android.systemui.statusbar.notification.DynamicPrivacyController;
import com.android.systemui.statusbar.notification.ExpandAnimationParameters;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.PropertyAnimator;
@@ -183,7 +182,7 @@ public class NotificationPanelViewController extends PanelViewController {
private static final int FLING_HIDE = 2;
private static final long ANIMATION_DELAY_ICON_FADE_IN =
ActivityLaunchAnimator.ANIMATION_DURATION - CollapsedStatusBarFragment.FADE_IN_DURATION
- CollapsedStatusBarFragment.FADE_IN_DELAY - 16;
- CollapsedStatusBarFragment.FADE_IN_DELAY - 48;
private final DozeParameters mDozeParameters;
private final OnHeightChangedListener mOnHeightChangedListener = new OnHeightChangedListener();
@@ -444,7 +443,7 @@ public class NotificationPanelViewController extends PanelViewController {
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mUserSetupComplete;
private int mQsNotificationTopPadding;
private boolean mHideIconsDuringNotificationLaunch = true;
private boolean mHideIconsDuringLaunchAnimation = true;
private int mStackScrollerMeasuringPass;
private ArrayList<Consumer<ExpandableNotificationRow>>
mTrackingHeadsUpListeners =
@@ -3089,8 +3088,8 @@ public class NotificationPanelViewController extends PanelViewController {
}
public boolean hideStatusBarIconsWhenExpanded() {
if (mLaunchingNotification) {
return mHideIconsDuringNotificationLaunch;
if (mIsLaunchAnimationRunning) {
return mHideIconsDuringLaunchAnimation;
}
if (mHeadsUpAppearanceController != null
&& mHeadsUpAppearanceController.shouldBeVisible()) {
@@ -3219,14 +3218,11 @@ public class NotificationPanelViewController extends PanelViewController {
mKeyguardBottomArea.setUserSetupComplete(userSetupComplete);
}
public void applyExpandAnimationParams(ExpandAnimationParameters params) {
if (params == null) {
return;
}
boolean hideIcons = params.getProgress(ANIMATION_DELAY_ICON_FADE_IN, 100) == 0.0f;
if (hideIcons != mHideIconsDuringNotificationLaunch) {
mHideIconsDuringNotificationLaunch = hideIcons;
public void applyLaunchAnimationProgress(float linearProgress) {
boolean hideIcons = ActivityLaunchAnimator.getProgress(linearProgress,
ANIMATION_DELAY_ICON_FADE_IN, 100) == 0.0f;
if (hideIcons != mHideIconsDuringLaunchAnimation) {
mHideIconsDuringLaunchAnimation = hideIcons;
if (!hideIcons) {
mCommandQueue.recomputeDisableFlags(mDisplayId, true /* animate */);
}

View File

@@ -83,7 +83,7 @@ public abstract class PanelViewController {
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
private boolean mPanelUpdateWhenAnimatorEnds;
private boolean mVibrateOnOpening;
protected boolean mLaunchingNotification;
protected boolean mIsLaunchAnimationRunning;
private int mFixedDuration = NO_FIXED_DURATION;
protected ArrayList<PanelExpansionListener> mExpansionListeners = new ArrayList<>();
@@ -830,7 +830,7 @@ public abstract class PanelViewController {
}
public boolean isCollapsing() {
return mClosing || mLaunchingNotification;
return mClosing || mIsLaunchAnimationRunning;
}
public boolean isTracking() {
@@ -1130,8 +1130,8 @@ public abstract class PanelViewController {
mHeadsUpManager = headsUpManager;
}
public void setLaunchingNotification(boolean launchingNotification) {
mLaunchingNotification = launchingNotification;
public void setIsLaunchAnimationRunning(boolean running) {
mIsLaunchAnimationRunning = running;
}
public void collapseWithDuration(int animationDuration) {

View File

@@ -1375,7 +1375,6 @@ public class StatusBar extends SystemUI implements DemoMode,
mActivityLaunchAnimator = new ActivityLaunchAnimator(mContext);
mNotificationAnimationProvider = new NotificationLaunchAnimatorControllerProvider(
mNotificationShadeWindowViewController,
mNotificationPanelViewController,
mStackScrollerController.getNotificationListContainer(),
mNotificationShadeDepthControllerLazy.get()
);
@@ -1589,6 +1588,10 @@ public class StatusBar extends SystemUI implements DemoMode,
return mNotificationShadeWindowViewController;
}
public NotificationPanelViewController getNotificationPanelViewController() {
return mNotificationPanelViewController;
}
protected ViewGroup getBouncerContainer() {
return mNotificationShadeWindowView;
}

View File

@@ -20,6 +20,7 @@ class StatusBarLaunchAnimatorController(
override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
delegate.onLaunchAnimationStart(isExpandingFullyAbove)
statusBar.notificationPanelViewController.setIsLaunchAnimationRunning(true)
if (!isExpandingFullyAbove) {
statusBar.collapsePanelWithDuration(ActivityLaunchAnimator.ANIMATION_DURATION.toInt())
}
@@ -28,6 +29,16 @@ class StatusBarLaunchAnimatorController(
override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
delegate.onLaunchAnimationEnd(isExpandingFullyAbove)
statusBar.onLaunchAnimationEnd(isExpandingFullyAbove)
statusBar.notificationPanelViewController.setIsLaunchAnimationRunning(false)
}
override fun onLaunchAnimationProgress(
state: ActivityLaunchAnimator.State,
progress: Float,
linearProgress: Float
) {
delegate.onLaunchAnimationProgress(state, progress, linearProgress)
statusBar.notificationPanelViewController.applyLaunchAnimationProgress(linearProgress)
}
override fun onLaunchAnimationCancelled() {