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

Commit a61edd0d authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Remove AppTransitionController" into main

parents 4c2d1bb9 781b2149
Loading
Loading
Loading
Loading
+1 −105
Original line number Original line Diff line number Diff line
@@ -113,7 +113,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
import static android.view.WindowManager.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED;
import static android.view.WindowManager.PROPERTY_ACTIVITY_EMBEDDING_SPLITS_ENABLED;
import static android.view.WindowManager.PROPERTY_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING_STATE_SHARING;
import static android.view.WindowManager.PROPERTY_ALLOW_UNTRUSTED_ACTIVITY_EMBEDDING_STATE_SHARING;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_FLAG_OPEN_BEHIND;
import static android.view.WindowManager.TRANSIT_OLD_UNSET;
import static android.view.WindowManager.TRANSIT_OLD_UNSET;
import static android.view.WindowManager.TRANSIT_RELAUNCH;
import static android.view.WindowManager.TRANSIT_RELAUNCH;
import static android.view.WindowManager.hasWindowExtensionsEnabled;
import static android.view.WindowManager.hasWindowExtensionsEnabled;
@@ -856,12 +855,6 @@ final class ActivityRecord extends WindowToken {
    })
    })
    @interface SplashScreenBehavior { }
    @interface SplashScreenBehavior { }


    // Force an app transition to be ran in the case the visibility of the app did not change.
    // We use this for the case of moving a Root Task to the back with multiple activities, and the
    // top activity enters PIP; the bottom activity's visibility stays the same, but we need to
    // run the transition.
    boolean mRequestForceTransition;

    boolean mEnteringAnimation;
    boolean mEnteringAnimation;
    boolean mOverrideTaskTransition;
    boolean mOverrideTaskTransition;
    boolean mDismissKeyguardIfInsecure;
    boolean mDismissKeyguardIfInsecure;
@@ -1788,7 +1781,6 @@ final class ActivityRecord extends WindowToken {
        if (prevDc.mOpeningApps.remove(this)) {
        if (prevDc.mOpeningApps.remove(this)) {
            // Transfer opening transition to new display.
            // Transfer opening transition to new display.
            mDisplayContent.mOpeningApps.add(this);
            mDisplayContent.mOpeningApps.add(this);
            mDisplayContent.transferAppTransitionFrom(prevDc);
            mDisplayContent.executeAppTransition();
            mDisplayContent.executeAppTransition();
        }
        }


@@ -4631,12 +4623,6 @@ final class ActivityRecord extends WindowToken {
                }
                }
            }
            }


            // In this case, the starting icon has already been displayed, so start
            // letting windows get shown immediately without any more transitions.
            if (fromActivity.mVisible) {
                mDisplayContent.mSkipAppTransitionAnimation = true;
            }

            ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Moving existing starting %s"
            ProtoLog.v(WM_DEBUG_STARTING_WINDOW, "Moving existing starting %s"
                    + " from %s to %s", tStartingWindow, fromActivity, this);
                    + " from %s to %s", tStartingWindow, fromActivity, this);


@@ -5667,76 +5653,17 @@ final class ActivityRecord extends WindowToken {
            mTransitionController.mValidateCommitVis.add(this);
            mTransitionController.mValidateCommitVis.add(this);
            return;
            return;
        }
        }
        // If we are preparing an app transition, then delay changing
        // the visibility of this token until we execute that transition.
        if (deferCommitVisibilityChange(visible)) {
            return;
        }


        commitVisibility(visible, true /* performLayout */);
        commitVisibility(visible, true /* performLayout */);
        updateReportedVisibilityLocked();
        updateReportedVisibilityLocked();
    }
    }


    /**
     * Returns {@code true} if this activity is either added to opening-apps or closing-apps.
     * Then its visibility will be committed until the transition is ready.
     */
    private boolean deferCommitVisibilityChange(boolean visible) {
        if (mTransitionController.isShellTransitionsEnabled()) {
            // Shell transition doesn't use opening/closing sets.
            return false;
        }
        if (!mDisplayContent.mAppTransition.isTransitionSet()) {
            return false;
        }
        if (mWaitForEnteringPinnedMode && mVisible == visible) {
            // If the visibility is not changed during enter PIP, we don't want to include it in
            // app transition to affect the animation theme, because the Pip organizer will
            // animate the entering PIP instead.
            return false;
        }

        // The animation will be visible soon so do not skip by screen off.
        final boolean ignoreScreenOn = canTurnScreenOn() || mTaskSupervisor.getKeyguardController()
                .isKeyguardGoingAway(mDisplayContent.mDisplayId);
        // Ignore display frozen so the opening / closing transition type can be updated correctly
        // even if the display is frozen. And it's safe since in applyAnimation will still check
        // DC#okToAnimate again if the transition animation is fine to apply.
        if (!okToAnimate(true /* ignoreFrozen */, ignoreScreenOn)) {
            return false;
        }
        if (visible) {
            mDisplayContent.mOpeningApps.add(this);
            mEnteringAnimation = true;
        } else if (mVisible) {
            mDisplayContent.mClosingApps.add(this);
            mEnteringAnimation = false;
        }
        if ((mDisplayContent.mAppTransition.getTransitFlags() & TRANSIT_FLAG_OPEN_BEHIND) != 0) {
            // Add the launching-behind activity to mOpeningApps.
            final WindowState win = mDisplayContent.findFocusedWindow();
            if (win != null) {
                final ActivityRecord focusedActivity = win.mActivityRecord;
                if (focusedActivity != null) {
                    ProtoLog.d(WM_DEBUG_APP_TRANSITIONS,
                            "TRANSIT_FLAG_OPEN_BEHIND,  adding %s to mOpeningApps",
                            focusedActivity);
                    // Force animation to be loaded.
                    mDisplayContent.mOpeningApps.add(focusedActivity);
                }
            }
        }
        return true;
    }

    @Override
    @Override
    boolean applyAnimation(LayoutParams lp, @TransitionOldType int transit, boolean enter,
    boolean applyAnimation(LayoutParams lp, @TransitionOldType int transit, boolean enter,
            boolean isVoiceInteraction, @Nullable ArrayList<WindowContainer> sources) {
            boolean isVoiceInteraction, @Nullable ArrayList<WindowContainer> sources) {
        if ((mTransitionChangeFlags & FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT) != 0) {
        if ((mTransitionChangeFlags & FLAG_STARTING_WINDOW_TRANSFER_RECIPIENT) != 0) {
            return false;
            return false;
        }
        }
        // If it was set to true, reset the last request to force the transition.
        mRequestForceTransition = false;
        return super.applyAnimation(lp, transit, enter, isVoiceInteraction, sources);
        return super.applyAnimation(lp, transit, enter, isVoiceInteraction, sources);
    }
    }


@@ -5898,27 +5825,6 @@ final class ActivityRecord extends WindowToken {
        }
        }
    }
    }


    /**
     * Check if visibility of this {@link ActivityRecord} should be updated as part of an app
     * transition.
     *
     * <p class="note><strong>Note:</strong> If the visibility of this {@link ActivityRecord} is
     * already set to {@link #mVisible}, we don't need to update the visibility. So {@code false} is
     * returned.</p>
     *
     * @param visible {@code true} if this {@link ActivityRecord} should become visible,
     *                {@code false} if this should become invisible.
     * @return {@code true} if visibility of this {@link ActivityRecord} should be updated, and
     *         an app transition animation should be run.
     */
    boolean shouldApplyAnimation(boolean visible) {
        // Allow for state update and animation to be applied if:
        // * activity is transitioning visibility state
        // * or the activity was marked as hidden and is exiting before we had a chance to play the
        // transition animation
        return isVisible() != visible || mRequestForceTransition || (!isVisible() && mIsExiting);
    }

    /**
    /**
     * See {@link Activity#setRecentsScreenshotEnabled}.
     * See {@link Activity#setRecentsScreenshotEnabled}.
     */
     */
@@ -7670,17 +7576,7 @@ final class ActivityRecord extends WindowToken {
        // new layer.
        // new layer.
        if (mNeedsAnimationBoundsLayer) {
        if (mNeedsAnimationBoundsLayer) {
            mTmpRect.setEmpty();
            mTmpRect.setEmpty();
            if (getDisplayContent().mAppTransitionController.isTransitWithinTask(
                    getTransit(), task)) {
            task.getBounds(mTmpRect);
            task.getBounds(mTmpRect);
            } else {
                final Task rootTask = getRootTask();
                if (rootTask == null) {
                    return;
                }
                // Set clip rect to root task bounds.
                rootTask.getBounds(mTmpRect);
            }
            mAnimationBoundsLayer = createAnimationBoundsLayer(t);
            mAnimationBoundsLayer = createAnimationBoundsLayer(t);


            // Crop to root task bounds.
            // Crop to root task bounds.
+1 −16
Original line number Original line Diff line number Diff line
@@ -4128,22 +4128,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    @Override
    @Override
    public void registerRemoteAnimationsForDisplay(int displayId,
    public void registerRemoteAnimationsForDisplay(int displayId,
            RemoteAnimationDefinition definition) {
            RemoteAnimationDefinition definition) {
        mAmInternal.enforceCallingPermission(CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS,
        // TODO(b/365884835): Remove callers.
                "registerRemoteAnimations");
        definition.setCallingPidUid(Binder.getCallingPid(), Binder.getCallingUid());
        synchronized (mGlobalLock) {
            final DisplayContent display = mRootWindowContainer.getDisplayContent(displayId);
            if (display == null) {
                Slog.e(TAG, "Couldn't find display with id: " + displayId);
                return;
            }
            final long origId = Binder.clearCallingIdentity();
            try {
                display.registerRemoteAnimations(definition);
            } finally {
                Binder.restoreCallingIdentity(origId);
            }
        }
    }
    }


    /** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
    /** @see android.app.ActivityManager#alwaysShowUnsupportedCompileSdkWarning */
+1 −1
Original line number Original line Diff line number Diff line
@@ -1462,7 +1462,7 @@ public class AppTransition implements Dump {
    }
    }


    boolean prepareAppTransition(@TransitionType int transit, @TransitionFlags int flags) {
    boolean prepareAppTransition(@TransitionType int transit, @TransitionFlags int flags) {
        if (mDisplayContent.mTransitionController.isShellTransitionsEnabled()) {
        if (WindowManagerService.sEnableShellTransitions) {
            return false;
            return false;
        }
        }
        mNextAppTransitionRequests.add(transit);
        mNextAppTransitionRequests.add(transit);
+0 −1352

File deleted.

Preview size limit exceeded, changes collapsed.

+1 −26
Original line number Original line Diff line number Diff line
@@ -226,7 +226,6 @@ import android.view.InsetsSource;
import android.view.InsetsState;
import android.view.InsetsState;
import android.view.MagnificationSpec;
import android.view.MagnificationSpec;
import android.view.PrivacyIndicatorBounds;
import android.view.PrivacyIndicatorBounds;
import android.view.RemoteAnimationDefinition;
import android.view.RoundedCorners;
import android.view.RoundedCorners;
import android.view.Surface;
import android.view.Surface;
import android.view.Surface.Rotation;
import android.view.Surface.Rotation;
@@ -367,8 +366,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    private int mMaxUiWidth = 0;
    private int mMaxUiWidth = 0;


    final AppTransition mAppTransition;
    final AppTransition mAppTransition;
    final AppTransitionController mAppTransitionController;
    boolean mSkipAppTransitionAnimation = false;


    final ArraySet<ActivityRecord> mOpeningApps = new ArraySet<>();
    final ArraySet<ActivityRecord> mOpeningApps = new ArraySet<>();
    final ArraySet<ActivityRecord> mClosingApps = new ArraySet<>();
    final ArraySet<ActivityRecord> mClosingApps = new ArraySet<>();
@@ -1161,7 +1158,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        mAppTransition = new AppTransition(mWmService.mContext, mWmService, this);
        mAppTransition = new AppTransition(mWmService.mContext, mWmService, this);
        mAppTransition.registerListenerLocked(mWmService.mActivityManagerAppTransitionNotifier);
        mAppTransition.registerListenerLocked(mWmService.mActivityManagerAppTransitionNotifier);
        mAppTransition.registerListenerLocked(mFixedRotationTransitionListener);
        mAppTransition.registerListenerLocked(mFixedRotationTransitionListener);
        mAppTransitionController = new AppTransitionController(mWmService, this);
        mTransitionController.registerLegacyListener(mFixedRotationTransitionListener);
        mTransitionController.registerLegacyListener(mFixedRotationTransitionListener);
        mUnknownAppVisibilityController = new UnknownAppVisibilityController(mWmService, this);
        mUnknownAppVisibilityController = new UnknownAppVisibilityController(mWmService, this);
        mRemoteDisplayChangeController = new RemoteDisplayChangeController(this);
        mRemoteDisplayChangeController = new RemoteDisplayChangeController(this);
@@ -1553,10 +1549,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        return mInputMethodSurfaceParentWindow;
        return mInputMethodSurfaceParentWindow;
    }
    }


    void registerRemoteAnimations(RemoteAnimationDefinition definition) {
        mAppTransitionController.registerRemoteAnimations(definition);
    }

    void reconfigureDisplayLocked() {
    void reconfigureDisplayLocked() {
        if (!isReady()) {
        if (!isReady()) {
            return;
            return;
@@ -5603,20 +5595,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        mPointerEventDispatcher.unregisterInputEventListener(listener);
        mPointerEventDispatcher.unregisterInputEventListener(listener);
    }
    }


    /**
     * Transfer app transition from other display to this display.
     *
     * @param from Display from where the app transition is transferred.
     *
     * TODO(new-app-transition): Remove this once the shell handles app transition.
     */
    void transferAppTransitionFrom(DisplayContent from) {
        final boolean prepared = mAppTransition.transferFrom(from.mAppTransition);
        if (prepared && okToAnimate()) {
            mSkipAppTransitionAnimation = false;
        }
    }

    /**
    /**
     * @deprecated new transition should use {@link #requestTransitionAndLegacyPrepare(int, int)}
     * @deprecated new transition should use {@link #requestTransitionAndLegacyPrepare(int, int)}
     */
     */
@@ -5631,10 +5609,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    @Deprecated
    @Deprecated
    void prepareAppTransition(@WindowManager.TransitionType int transit,
    void prepareAppTransition(@WindowManager.TransitionType int transit,
            @WindowManager.TransitionFlags int flags) {
            @WindowManager.TransitionFlags int flags) {
        final boolean prepared = mAppTransition.prepareAppTransition(transit, flags);
        mAppTransition.prepareAppTransition(transit, flags);
        if (prepared && okToAnimate() && transit != TRANSIT_NONE) {
            mSkipAppTransitionAnimation = false;
        }
    }
    }


    /**
    /**
Loading