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

Commit f81ed8bf authored by Evan Rosky's avatar Evan Rosky Committed by Automerger Merge Worker
Browse files

Merge "Port IME tasksnapshot over to shell transitions" into sc-v2-dev am: 4097e44f

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

Change-Id: I1ee4e3f23de9ee715f3171caa634863ccfe3eb08
parents 97613d7c 4097e44f
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -4890,8 +4890,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     * @param visible {@code true} if this {@link ActivityRecord} should become visible, otherwise
     *                this should become invisible.
     * @param performLayout if {@code true}, perform surface placement after committing visibility.
     * @param fromTransition {@code true} if this is part of finishing a transition.
     */
    void commitVisibility(boolean visible, boolean performLayout) {
    void commitVisibility(boolean visible, boolean performLayout, boolean fromTransition) {
        // Reset the state of mVisibleSetFromTransferredStartingWindow since visibility is actually
        // been set by the app now.
        mVisibleSetFromTransferredStartingWindow = false;
@@ -4941,7 +4942,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        displayContent.getInputMonitor().updateInputWindowsLw(false /*force*/);
        mUseTransferredAnimation = false;

        postApplyAnimation(visible);
        postApplyAnimation(visible, fromTransition);
    }

    void commitVisibility(boolean visible, boolean performLayout) {
        commitVisibility(visible, performLayout, false /* fromTransition */);
    }

    /**
@@ -4952,8 +4957,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *
     * @param visible {@code true} if this {@link ActivityRecord} has become visible, otherwise
     *                this has become invisible.
     * @param fromTransition {@code true} if this call is part of finishing a transition. This is
     *                       needed because the shell transition is no-longer active by the time
     *                       commitVisibility is called.
     */
    private void postApplyAnimation(boolean visible) {
    private void postApplyAnimation(boolean visible, boolean fromTransition) {
        final boolean usingShellTransitions = mTransitionController.isShellTransitionsEnabled();
        final boolean delayed = isAnimating(TRANSITION | PARENTS | CHILDREN,
                ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION
@@ -4994,7 +5002,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        final DisplayContent displayContent = getDisplayContent();
        if (!displayContent.mClosingApps.contains(this)
                && !displayContent.mOpeningApps.contains(this)) {
                && !displayContent.mOpeningApps.contains(this)
                && !fromTransition) {
            // Take the screenshot before possibly hiding the WSA, otherwise the screenshot
            // will not be taken.
            mWmService.mTaskSnapshotController.notifyAppVisibilityChanged(this, visible);
+1 −0
Original line number Diff line number Diff line
@@ -991,6 +991,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        synchronized (mGlobalLock) {
            mWindowManager = wm;
            mRootWindowContainer = wm.mRoot;
            mWindowOrganizerController.setWindowManager(wm);
            mTempConfig.setToDefaults();
            mTempConfig.setLocales(LocaleList.getDefault());
            mConfigurationSeq = mTempConfig.seq = 1;
+37 −34
Original line number Diff line number Diff line
@@ -178,9 +178,7 @@ class TaskSnapshotController {
        snapshotTasks(tasks, false /* allowSnapshotHome */);
    }

    private void snapshotTasks(ArraySet<Task> tasks, boolean allowSnapshotHome) {
        for (int i = tasks.size() - 1; i >= 0; i--) {
            final Task task = tasks.valueAt(i);
    void recordTaskSnapshot(Task task, boolean allowSnapshotHome) {
        final TaskSnapshot snapshot;
        final boolean snapshotHome = allowSnapshotHome && task.isActivityTypeHome();
        if (snapshotHome) {
@@ -188,7 +186,7 @@ class TaskSnapshotController {
        } else {
            switch (getSnapshotMode(task)) {
                case SNAPSHOT_MODE_NONE:
                        continue;
                    return;
                case SNAPSHOT_MODE_APP_THEME:
                    snapshot = drawAppThemeSnapshot(task);
                    break;
@@ -216,6 +214,11 @@ class TaskSnapshotController {
            }
        }
    }

    private void snapshotTasks(ArraySet<Task> tasks, boolean allowSnapshotHome) {
        for (int i = tasks.size() - 1; i >= 0; i--) {
            recordTaskSnapshot(tasks.valueAt(i), allowSnapshotHome);
        }
    }

    /**
+23 −1
Original line number Diff line number Diff line
@@ -415,7 +415,16 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
                    if (commitVisibility) {
                        ProtoLog.v(ProtoLogGroup.WM_DEBUG_WINDOW_TRANSITIONS,
                                "  Commit activity becoming invisible: %s", ar);
                        ar.commitVisibility(false /* visible */, false /* performLayout */);
                        final Task task = ar.getTask();
                        if (task != null && !task.isVisibleRequested()
                                && mTransientLaunches != null) {
                            // If transition is transient, then snapshots are taken at end of
                            // transition.
                            mController.mTaskSnapshotController.recordTaskSnapshot(
                                    task, false /* allowSnapshotHome */);
                        }
                        ar.commitVisibility(false /* visible */, false /* performLayout */,
                                true /* fromTransition */);
                        activitiesWentInvisible = true;
                    }
                }
@@ -558,6 +567,19 @@ class Transition extends Binder implements BLASTSyncEngine.TransactionReadyListe
            mVisibleAtTransitionEndTokens.add(wc.asWindowToken());
        }

        // Take task snapshots before the animation so that we can capture IME before it gets
        // transferred. If transition is transient, IME won't be moved during the transition and
        // the tasks are still live, so we take the snapshot at the end of the transition instead.
        if (mTransientLaunches == null) {
            for (int i = mParticipants.size() - 1; i >= 0; --i) {
                final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord();
                if (ar == null || ar.isVisibleRequested() || ar.getTask() == null
                        || ar.getTask().isVisibleRequested()) continue;
                mController.mTaskSnapshotController.recordTaskSnapshot(
                        ar.getTask(), false /* allowSnapshotHome */);
            }
        }

        mStartTransaction = transaction;
        mFinishTransaction = mController.mAtm.mWindowManager.mTransactionFactory.get();
        buildFinishTransaction(mFinishTransaction, info.getRootLeash());
+4 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ class TransitionController {

    private ITransitionPlayer mTransitionPlayer;
    final ActivityTaskManagerService mAtm;
    final TaskSnapshotController mTaskSnapshotController;

    private final ArrayList<WindowManagerInternal.AppTransitionListener> mLegacyListeners =
            new ArrayList<>();
@@ -79,9 +80,11 @@ class TransitionController {
    // TODO(b/188595497): remove when not needed.
    final StatusBarManagerInternal mStatusBar;

    TransitionController(ActivityTaskManagerService atm) {
    TransitionController(ActivityTaskManagerService atm,
            TaskSnapshotController taskSnapshotController) {
        mAtm = atm;
        mStatusBar = LocalServices.getService(StatusBarManagerInternal.class);
        mTaskSnapshotController = taskSnapshotController;
        mTransitionPlayerDeath = () -> {
            synchronized (mAtm.mGlobalLock) {
                // Clean-up/finish any playing transitions.
Loading