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

Commit 2bedc1d9 authored by An An Yu's avatar An An Yu
Browse files

Allow custom animations to run on ActivityEmbeddings and propagate custom backdrop color.

Test: atest RemoteAnimationsControllerTest
Bug: 221048002

Change-Id: I801cc4700cf944da5acf9b92734153b56d46b655
parent 7c2c2000
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -314,6 +314,10 @@ public class AppTransition implements Dump {
        setAppTransitionState(APP_STATE_TIMEOUT);
    }

    @ColorInt int getNextAppTransitionBackgroundColor() {
        return mNextAppTransitionBackgroundColor;
    }

    HardwareBuffer getAppTransitionThumbnailHeader(WindowContainer container) {
        AppTransitionAnimationSpec spec = mNextAppTransitionAnimationsSpecs.get(
                container.hashCode());
+12 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static com.android.server.wm.RemoteAnimationAdapterWrapperProto.TARGET;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;

import android.annotation.ColorInt;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.Point;
@@ -431,6 +432,7 @@ class RemoteAnimationController implements DeathRecipient {
        final WindowContainer mWindowContainer;
        final Rect mStartBounds;
        final boolean mShowBackdrop;
        @ColorInt int mBackdropColor = 0;
        private @RemoteAnimationTarget.Mode int mMode = RemoteAnimationTarget.MODE_CHANGING;

        RemoteAnimationRecord(WindowContainer windowContainer, Point endPos, Rect localBounds,
@@ -456,6 +458,10 @@ class RemoteAnimationController implements DeathRecipient {
            }
        }

        void setBackDropColor(@ColorInt int backdropColor) {
            mBackdropColor = backdropColor;
        }

        RemoteAnimationTarget createRemoteAnimationTarget() {
            if (mAdapter == null
                    || mAdapter.mCapturedFinishCallback == null
@@ -509,6 +515,12 @@ class RemoteAnimationController implements DeathRecipient {
            mShowBackdrop = showBackdrop;
        }

        @Override
        @ColorInt
        public int getBackgroundColor() {
            return mRecord.mBackdropColor;
        }

        @Override
        public boolean getShowBackground() {
            return mShowBackdrop;
+7 −0
Original line number Diff line number Diff line
@@ -2949,11 +2949,15 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
        if (controller != null && !mSurfaceAnimator.isAnimationStartDelayed()) {
            // Here we load App XML in order to read com.android.R.styleable#Animation_showBackdrop.
            boolean showBackdrop = false;
            // Optionally set backdrop color if App explicitly provides it through
            // {@link Activity#overridePendingTransition(int, int, int)}.
            @ColorInt int backdropColor = 0;
            if (controller.isFromActivityEmbedding()) {
                final int animAttr = AppTransition.mapOpenCloseTransitTypes(transit, enter);
                final Animation a = animAttr != 0
                        ? appTransition.loadAnimationAttr(lp, animAttr, transit) : null;
                showBackdrop = a != null && a.getShowBackdrop();
                backdropColor = appTransition.getNextAppTransitionBackgroundColor();
            }
            final Rect localBounds = new Rect(mTmpRect);
            localBounds.offsetTo(mTmpPoint.x, mTmpPoint.y);
@@ -2961,6 +2965,9 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
                    controller.createRemoteAnimationRecord(
                            this, mTmpPoint, localBounds, screenBounds,
                            (isChanging ? mSurfaceFreezer.mFreezeBounds : null), showBackdrop);
            if (backdropColor != 0) {
                adapters.setBackDropColor(backdropColor);
            }
            if (!isChanging) {
                adapters.setMode(enter
                        ? RemoteAnimationTarget.MODE_OPENING