Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85592956 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Android (Google) Code Review
Browse files

Merge "Fix HUN launch animation" into sc-dev

parents ea022555 65a6a0e1
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -204,6 +204,12 @@ public abstract class AlertingNotificationManager implements NotificationLifetim
            return;
        }
        NotificationEntry entry = alertEntry.mEntry;

        // If the notification is animating, we will remove it at the end of the animation.
        if (entry != null && entry.isExpandAnimationRunning()) {
            return;
        }

        mAlertEntries.remove(key);
        onAlertEntryRemoved(alertEntry);
        entry.sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
+11 −5
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.notification.stack.NotificationListContainer
import com.android.systemui.statusbar.phone.HeadsUpManagerPhone
import com.android.systemui.statusbar.phone.NotificationShadeWindowViewController
import com.android.systemui.statusbar.policy.HeadsUpUtil
import kotlin.math.ceil
import kotlin.math.max

@@ -22,8 +23,8 @@ class NotificationLaunchAnimatorControllerProvider(
        return NotificationLaunchAnimatorController(
            notificationShadeWindowViewController,
            notificationListContainer,
            notification,
            headsUpManager
            headsUpManager,
            notification
        )
    }
}
@@ -36,10 +37,11 @@ class NotificationLaunchAnimatorControllerProvider(
class NotificationLaunchAnimatorController(
    private val notificationShadeWindowViewController: NotificationShadeWindowViewController,
    private val notificationListContainer: NotificationListContainer,
    private val notification: ExpandableNotificationRow,
    private val headsUpManager: HeadsUpManagerPhone
    private val headsUpManager: HeadsUpManagerPhone,
    private val notification: ExpandableNotificationRow
) : ActivityLaunchAnimator.Controller {
    private val notificationKey = notification.entry.sbn.key
    private val notificationEntry = notification.entry
    private val notificationKey = notificationEntry.sbn.key

    override var launchContainer: ViewGroup
        get() = notification.rootView as ViewGroup
@@ -82,6 +84,7 @@ class NotificationLaunchAnimatorController(

    override fun onIntentStarted(willAnimate: Boolean) {
        notificationShadeWindowViewController.setExpandAnimationRunning(willAnimate)
        notificationEntry.isExpandAnimationRunning = willAnimate

        if (!willAnimate) {
            removeHun(animate = true)
@@ -93,6 +96,7 @@ class NotificationLaunchAnimatorController(
            return
        }

        HeadsUpUtil.setNeedsHeadsUpDisappearAnimationAfterClick(notification, animate)
        headsUpManager.removeNotification(notificationKey, true /* releaseImmediately */, animate)
    }

@@ -100,6 +104,7 @@ class NotificationLaunchAnimatorController(
        // TODO(b/184121838): Should we call InteractionJankMonitor.cancel if the animation started
        // here?
        notificationShadeWindowViewController.setExpandAnimationRunning(false)
        notificationEntry.isExpandAnimationRunning = false
        removeHun(animate = true)
    }

@@ -116,6 +121,7 @@ class NotificationLaunchAnimatorController(

        notification.isExpandAnimationRunning = false
        notificationShadeWindowViewController.setExpandAnimationRunning(false)
        notificationEntry.isExpandAnimationRunning = false
        notificationListContainer.setExpandingNotification(null)
        applyParams(null)
        removeHun(animate = false)
+11 −0
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ public final class NotificationEntry extends ListEntry {
    private boolean mIsAlerting;

    public boolean mRemoteEditImeVisible;
    private boolean mExpandAnimationRunning;

    /**
     * @param sbn the StatusBarNotification from system server
@@ -952,6 +953,16 @@ public final class NotificationEntry extends ListEntry {
        return mIsAlerting;
    }

    /** Set whether this notification is currently used to animate a launch. */
    public void setExpandAnimationRunning(boolean expandAnimationRunning) {
        mExpandAnimationRunning = expandAnimationRunning;
    }

    /** Whether this notification is currently used to animate a launch. */
    public boolean isExpandAnimationRunning() {
        return mExpandAnimationRunning;
    }

    /** Information about a suggestion that is being edited. */
    public static class EditedSuggestionInfo {

+1 −1
Original line number Diff line number Diff line
@@ -591,7 +591,7 @@ public class ViewState implements Dumpable {
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                HeadsUpUtil.setIsClickedHeadsUpNotification(child, false);
                HeadsUpUtil.setNeedsHeadsUpDisappearAnimationAfterClick(child, false);
                child.setTag(TAG_ANIMATOR_TRANSLATION_Y, null);
                child.setTag(TAG_START_TRANSLATION_Y, null);
                child.setTag(TAG_END_TRANSLATION_Y, null);
+1 −1
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ class StatusBarLaunchAnimatorController(

    override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
        delegate.onLaunchAnimationEnd(isExpandingFullyAbove)
        statusBar.onLaunchAnimationEnd(isExpandingFullyAbove)
        statusBar.notificationPanelViewController.setIsLaunchAnimationRunning(false)
        statusBar.onLaunchAnimationEnd(isExpandingFullyAbove)
    }

    override fun onLaunchAnimationProgress(
Loading