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

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

Merge "Animate the "Manage" notification app launch (1/2)" into sc-dev

parents a325ab12 fd8ab227
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -31,14 +31,16 @@ class ActivityLaunchAnimator(context: Context) {
    companion object {
        const val ANIMATION_DURATION = 500L
        const val ANIMATION_DURATION_FADE_OUT_CONTENT = 183L
        const val ANIMATION_DURATION_FADE_IN_WINDOW = 216L
        const val ANIMATION_DELAY_FADE_IN_WINDOW = 166L
        const val ANIMATION_DURATION_FADE_IN_WINDOW = 217L
        const val ANIMATION_DELAY_FADE_IN_WINDOW = 167L
        private const val ANIMATION_DURATION_NAV_FADE_IN = 266L
        private const val ANIMATION_DURATION_NAV_FADE_OUT = 133L
        private const val ANIMATION_DELAY_NAV_FADE_IN =
                ANIMATION_DURATION - ANIMATION_DURATION_NAV_FADE_IN
        private const val LAUNCH_TIMEOUT = 1000L

        private val CONTENT_FADE_OUT_INTERPOLATOR = PathInterpolator(0f, 0f, 0.2f, 1f)
        private val WINDOW_FADE_IN_INTERPOLATOR = PathInterpolator(0f, 0f, 0.6f, 1f)
        private val NAV_FADE_IN_INTERPOLATOR = PathInterpolator(0f, 0f, 0f, 1f)
        private val NAV_FADE_OUT_INTERPOLATOR = PathInterpolator(0.2f, 0f, 1f, 1f)

@@ -418,12 +420,12 @@ class ActivityLaunchAnimator(context: Context) {
                val contentAlphaProgress = getProgress(linearProgress, 0,
                        ANIMATION_DURATION_FADE_OUT_CONTENT)
                state.contentAlpha =
                        1 - Interpolators.ALPHA_OUT.getInterpolation(contentAlphaProgress)
                        1 - CONTENT_FADE_OUT_INTERPOLATOR.getInterpolation(contentAlphaProgress)

                val backgroundAlphaProgress = getProgress(linearProgress,
                        ANIMATION_DELAY_FADE_IN_WINDOW, ANIMATION_DURATION_FADE_IN_WINDOW)
                state.backgroundAlpha =
                        1 - Interpolators.ALPHA_IN.getInterpolation(backgroundAlphaProgress)
                        1 - WINDOW_FADE_IN_INTERPOLATOR.getInterpolation(backgroundAlphaProgress)

                applyStateToWindow(window, state)
                navigationBar?.let { applyStateToNavigationBar(it, state, linearProgress) }
+3 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.statusbar.notification;

import android.content.Intent;
import android.service.notification.StatusBarNotification;
import android.view.View;

import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;

@@ -33,7 +34,8 @@ public interface NotificationActivityStarter {
    void startNotificationGutsIntent(Intent intent, int appUid,
            ExpandableNotificationRow row);

    void startHistoryIntent(boolean showHistory);
    /** Called when the user clicks "Manage" or "History" in the Shade. */
    void startHistoryIntent(View view, boolean showHistory);

    default boolean isCollapsingToShowActivityOverLockscreen() {
        return false;
+0 −4
Original line number Diff line number Diff line
@@ -106,10 +106,6 @@ public class FooterView extends StackScrollerDecorView {
        showHistory(mShowHistory);
    }

    public boolean isButtonVisible() {
        return mManageButton.getAlpha() != 0.0f;
    }

    @Override
    public ExpandableViewState createExpandableViewState() {
        return new FooterViewState();
+1 −1
Original line number Diff line number Diff line
@@ -4877,7 +4877,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            clearNotifications(ROWS_ALL, true /* closeShade */);
        });
        footerView.setManageButtonClickListener(v -> {
            mNotificationActivityStarter.startHistoryIntent(mFooterView.isHistoryShown());
            mNotificationActivityStarter.startHistoryIntent(v, mFooterView.isHistoryShown());
        });
        setFooterView(footerView);
    }
+23 −6
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import android.service.dreams.IDreamManager;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.util.EventLog;
import android.view.View;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.statusbar.NotificationVisibility;
@@ -462,7 +463,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
        mActivityStarter.dismissKeyguardThenExecute(() -> {
            AsyncTask.execute(() -> {
                ActivityLaunchAnimator.Controller animationController = null;
                if (!mStatusBar.isOccluded() && mStatusBar.areLaunchAnimationsEnabled()) {
                if (mStatusBar.areLaunchAnimationsEnabled()) {
                    animationController = new StatusBarLaunchAnimatorController(
                            mNotificationAnimationProvider.getAnimatorController(row), mStatusBar,
                            true /* isActivityIntent */);
@@ -495,7 +496,7 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
    }

    @Override
    public void startHistoryIntent(boolean showHistory) {
    public void startHistoryIntent(View view, boolean showHistory) {
        mActivityStarter.dismissKeyguardThenExecute(() -> {
            AsyncTask.execute(() -> {
                Intent intent = showHistory ? new Intent(
@@ -506,11 +507,27 @@ public class StatusBarNotificationActivityStarter implements NotificationActivit
                if (showHistory) {
                    tsb.addNextIntent(intent);
                }
                tsb.startActivities(null, UserHandle.CURRENT);

                ActivityLaunchAnimator.Controller animationController = null;
                if (mStatusBar.areLaunchAnimationsEnabled()) {
                    animationController = new StatusBarLaunchAnimatorController(
                            ActivityLaunchAnimator.Controller.fromView(view), mStatusBar,
                            true /* isActivityIntent */);
                }

                mActivityLaunchAnimator.startIntentWithAnimation(animationController,
                        (adapter) -> tsb.startActivities(
                                getActivityOptions(mStatusBar.getDisplayId(), adapter),
                                UserHandle.CURRENT));

                // Note that other cases when we should still collapse (like activity already on
                // top) is handled by the StatusBarLaunchAnimatorController.
                boolean shouldCollapse = animationController == null;
                if (shouldCollapse) {
                    // Putting it back on the main thread, since we're touching views
                    mMainThreadHandler.post(() -> mCommandQueue.animateCollapsePanels(
                            CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */));
                }
            });
            return true;
        }, null, false /* afterKeyguardGone */);