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

Commit ca6e2b72 authored by Issei Suzuki's avatar Issei Suzuki Committed by Automerger Merge Worker
Browse files

Merge "Ensure to trigger Activity#onEnterAnimationComplete" into rvc-dev am: b749be45

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11838100

Change-Id: Id86cf8c2b0dd45d1205dd1d851636612401a5e47
parents 617a72f3 b749be45
Loading
Loading
Loading
Loading
+3 −6
Original line number Original line Diff line number Diff line
@@ -311,7 +311,6 @@ import com.android.server.uri.UriPermissionOwner;
import com.android.server.wm.ActivityMetricsLogger.TransitionInfoSnapshot;
import com.android.server.wm.ActivityMetricsLogger.TransitionInfoSnapshot;
import com.android.server.wm.ActivityStack.ActivityState;
import com.android.server.wm.ActivityStack.ActivityState;
import com.android.server.wm.SurfaceAnimator.AnimationType;
import com.android.server.wm.SurfaceAnimator.AnimationType;
import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;
import com.android.server.wm.WindowManagerService.H;
import com.android.server.wm.WindowManagerService.H;
import com.android.server.wm.utils.InsetUtils;
import com.android.server.wm.utils.InsetUtils;


@@ -4166,14 +4165,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }
    }


    @Override
    @Override
    boolean applyAnimation(WindowManager.LayoutParams lp, int transit, boolean enter,
    boolean applyAnimation(LayoutParams lp, int transit, boolean enter,
            boolean isVoiceInteraction,
            boolean isVoiceInteraction, @Nullable ArrayList<WindowContainer> sources) {
            @Nullable OnAnimationFinishedCallback animationFinishedCallback) {
        if (mUseTransferredAnimation) {
        if (mUseTransferredAnimation) {
            return false;
            return false;
        }
        }
        return super.applyAnimation(lp, transit, enter, isVoiceInteraction,
        return super.applyAnimation(lp, transit, enter, isVoiceInteraction, sources);
                animationFinishedCallback);
    }
    }


    /**
    /**
+13 −12
Original line number Original line Diff line number Diff line
@@ -49,7 +49,7 @@ import static com.android.server.wm.ActivityTaskManagerInternal.APP_TRANSITION_W
import static com.android.server.wm.AppTransition.isKeyguardGoingAwayTransit;
import static com.android.server.wm.AppTransition.isKeyguardGoingAwayTransit;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS_ANIM;
import static com.android.server.wm.ProtoLogGroup.WM_DEBUG_APP_TRANSITIONS_ANIM;
import static com.android.server.wm.WindowContainer.AnimationFlags.CHILDREN;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -75,7 +75,6 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.LinkedList;
import java.util.function.Predicate;
import java.util.function.Predicate;



/**
/**
 * Checks for app transition readiness, resolves animation attributes and performs visibility
 * Checks for app transition readiness, resolves animation attributes and performs visibility
 * change for apps that animate as part of an app transition.
 * change for apps that animate as part of an app transition.
@@ -375,18 +374,14 @@ public class AppTransitionController {
            // triggers WC#onAnimationFinished only on the promoted target. So we need to take care
            // triggers WC#onAnimationFinished only on the promoted target. So we need to take care
            // of triggering AR#onAnimationFinished on each ActivityRecord which is a part of the
            // of triggering AR#onAnimationFinished on each ActivityRecord which is a part of the
            // app transition.
            // app transition.
            final ArrayList<ActivityRecord> transitioningDecendants = new ArrayList<>();
            final ArrayList<ActivityRecord> transitioningDescendants = new ArrayList<>();
            for (int j = 0; j < apps.size(); ++j) {
            for (int j = 0; j < apps.size(); ++j) {
                final ActivityRecord app = apps.valueAt(j);
                final ActivityRecord app = apps.valueAt(j);
                if (app.isDescendantOf(wc)) {
                if (app.isDescendantOf(wc)) {
                    transitioningDecendants.add(app);
                    transitioningDescendants.add(app);
                }
                }
                }
            wc.applyAnimation(animLp, transit, visible, voiceInteraction, (type, anim) -> {
                for (int j = 0; j < transitioningDecendants.size(); ++j) {
                    transitioningDecendants.get(j).onAnimationFinished(type, anim);
            }
            }
            });
            wc.applyAnimation(animLp, transit, visible, voiceInteraction, transitioningDescendants);
        }
        }
    }
    }


@@ -540,7 +535,14 @@ public class AppTransitionController {
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Now opening app %s", app);
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Now opening app %s", app);


            app.commitVisibility(true /* visible */, false /* performLayout */);
            app.commitVisibility(true /* visible */, false /* performLayout */);
            if (!app.isAnimating(PARENTS | CHILDREN)) {

            // In case a trampoline activity is used, it can happen that a new ActivityRecord is
            // added and a new app transition starts before the previous app transition animation
            // ends. So we cannot simply use app.isAnimating(PARENTS) to determine if the app must
            // to be added to the list of tokens to be notified of app transition complete.
            final WindowContainer wc = app.getAnimatingContainer(PARENTS,
                    ANIMATION_TYPE_APP_TRANSITION);
            if (wc == null || !wc.getAnimationSources().contains(app)) {
                // This token isn't going to be animating. Add it to the list of tokens to
                // This token isn't going to be animating. Add it to the list of tokens to
                // be notified of app transition complete since the notification will not be
                // be notified of app transition complete since the notification will not be
                // sent be the app window animator.
                // sent be the app window animator.
@@ -599,8 +601,7 @@ public class AppTransitionController {
        for (int i = 0; i < appsCount; i++) {
        for (int i = 0; i < appsCount; i++) {
            WindowContainer wc = apps.valueAt(i);
            WindowContainer wc = apps.valueAt(i);
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Now changing app %s", wc);
            ProtoLog.v(WM_DEBUG_APP_TRANSITIONS, "Now changing app %s", wc);
            wc.applyAnimation(null, transit, true, false,
            wc.applyAnimation(null, transit, true, false, null /* sources */);
                    null /* animationFinishedCallback */);
        }
        }
    }
    }


+2 −5
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ import static com.android.server.wm.AlphaAnimationSpecProto.TO;
import static com.android.server.wm.AnimationSpecProto.ALPHA;
import static com.android.server.wm.AnimationSpecProto.ALPHA;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_DIMMER;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_DIMMER;


import android.annotation.Nullable;
import android.graphics.Rect;
import android.graphics.Rect;
import android.util.Log;
import android.util.Log;
import android.util.proto.ProtoOutputStream;
import android.util.proto.ProtoOutputStream;
@@ -31,7 +30,6 @@ import android.view.SurfaceControl;


import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting;
import com.android.server.wm.SurfaceAnimator.AnimationType;
import com.android.server.wm.SurfaceAnimator.AnimationType;
import com.android.server.wm.SurfaceAnimator.OnAnimationFinishedCallback;


import java.io.PrintWriter;
import java.io.PrintWriter;


@@ -160,8 +158,7 @@ class Dimmer {
    @VisibleForTesting
    @VisibleForTesting
    interface SurfaceAnimatorStarter {
    interface SurfaceAnimatorStarter {
        void startAnimation(SurfaceAnimator surfaceAnimator, SurfaceControl.Transaction t,
        void startAnimation(SurfaceAnimator surfaceAnimator, SurfaceControl.Transaction t,
                AnimationAdapter anim, boolean hidden, @AnimationType int type,
                AnimationAdapter anim, boolean hidden, @AnimationType int type);
                @Nullable OnAnimationFinishedCallback animationFinishedCallback);
    }
    }


    Dimmer(WindowContainer host) {
    Dimmer(WindowContainer host) {
@@ -348,7 +345,7 @@ class Dimmer {
        mSurfaceAnimatorStarter.startAnimation(animator, t, new LocalAnimationAdapter(
        mSurfaceAnimatorStarter.startAnimation(animator, t, new LocalAnimationAdapter(
                new AlphaAnimationSpec(startAlpha, endAlpha, getDimDuration(container)),
                new AlphaAnimationSpec(startAlpha, endAlpha, getDimDuration(container)),
                mHost.mWmService.mSurfaceAnimationRunner), false /* hidden */,
                mHost.mWmService.mSurfaceAnimationRunner), false /* hidden */,
                ANIMATION_TYPE_DIMMER, null /* animationFinishedCallback */);
                ANIMATION_TYPE_DIMMER);
    }
    }


    private long getDimDuration(WindowContainer container) {
    private long getDimDuration(WindowContainer container) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -280,7 +280,7 @@ class InsetsSourceProvider {
        }
        }
        final Transaction t = mDisplayContent.getPendingTransaction();
        final Transaction t = mDisplayContent.getPendingTransaction();
        mWin.startAnimation(t, mAdapter, !mClientVisible /* hidden */,
        mWin.startAnimation(t, mAdapter, !mClientVisible /* hidden */,
                ANIMATION_TYPE_INSETS_CONTROL, null /* animationFinishedCallback */);
                ANIMATION_TYPE_INSETS_CONTROL);


        // The leash was just created. We cannot dispatch it until its surface transaction is
        // The leash was just created. We cannot dispatch it until its surface transaction is
        // applied. Otherwise, the client's operation to the leash might be overwritten by us.
        // applied. Otherwise, the client's operation to the leash might be overwritten by us.
+1 −1
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ public class ShellRoot {
                        0 /* windowCornerRadius */),
                        0 /* windowCornerRadius */),
                mDisplayContent.mWmService.mSurfaceAnimationRunner);
                mDisplayContent.mWmService.mSurfaceAnimationRunner);
        mToken.startAnimation(mToken.getPendingTransaction(), adapter, false /* hidden */,
        mToken.startAnimation(mToken.getPendingTransaction(), adapter, false /* hidden */,
                ANIMATION_TYPE_WINDOW_ANIMATION, null /* animationFinishedCallback */);
                ANIMATION_TYPE_WINDOW_ANIMATION);
    }
    }


    WindowInfo getWindowInfo() {
    WindowInfo getWindowInfo() {
Loading