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

Commit 7274d2d1 authored by Evan Rosky's avatar Evan Rosky
Browse files

Track changes during transitions and report to player

Current tracked changes include bounds, visibility, and
"existence".

bounds and visibility are fairly straightforward, call
collect() before doing operations and it will record the
state. Once the transition is finished, it will compare
that recorded state with the finished state.

"existence" is more complicated. It's the difference
between show/hide vs open/close. Because Task instances
are basically always around, their existence depends on
the circumstances around when/how activities are started.
For that we have to explicitly indicate when a container
is going to change its existence via
collectExistenceChange().

Bug: 169035306
Test: atest TransitionTests
Change-Id: I78d4cda6b726202507b757f93c742d49e51e2d7b
parent 738ba560
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -316,8 +316,8 @@ public class ActivityManager {
    public static final int START_RETURN_INTENT_TO_CALLER = FIRST_START_SUCCESS_CODE + 1;

    /**
     * Result for IActivityManaqer.startActivity: activity wasn't really started, but
     * a task was simply brought to the foreground.
     * Result for IActivityManaqer.startActivity: activity was started or brought forward in an
     * existing task which was brought to the foreground.
     * @hide
     */
    public static final int START_TASK_TO_FRONT = FIRST_START_SUCCESS_CODE + 2;
+6 −0
Original line number Diff line number Diff line
@@ -1507,6 +1507,12 @@
      "group": "WM_DEBUG_APP_TRANSITIONS",
      "at": "com\/android\/server\/wm\/AppTransitionController.java"
    },
    "-354571697": {
      "message": "Existence Changed in transition %d: %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_WINDOW_TRANSITIONS",
      "at": "com\/android\/server\/wm\/Transition.java"
    },
    "-344488673": {
      "message": "Finishing drawing window %s: mDrawState=%s",
      "level": "VERBOSE",
+4 −2
Original line number Diff line number Diff line
@@ -4167,6 +4167,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                appToken, visible, appTransition, isVisible(), mVisibleRequested,
                Debug.getCallers(6));

        // Before setting mVisibleRequested so we can track changes.
        mAtmService.getTransitionController().collect(this);

        onChildVisibilityRequested(visible);

        final DisplayContent displayContent = getDisplayContent();
@@ -4236,8 +4239,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            transferStartingWindowFromHiddenAboveTokenIfNeeded();
        }

        // TODO(b/169035022): move to a more-appropriate place.
        mAtmService.getTransitionController().collect(this);
        // If in a transition, defer commits for activities that are going invisible
        if (!visible && mAtmService.getTransitionController().inTransition()) {
            return;
        }
+12 −5
Original line number Diff line number Diff line
@@ -1591,13 +1591,20 @@ class ActivityStarter {
                if (newTransition != null) {
                    newTransition.abort();
                }
            } else if (newTransition != null) {
            } else {
                if (result == START_SUCCESS || result == START_TASK_TO_FRONT) {
                    // The activity is started new rather than just brought forward, so record
                    // it as an existence change.
                    mService.getTransitionController().collectExistenceChange(r);
                }
                if (newTransition != null) {
                    mService.getTransitionController().requestStartTransition(newTransition);
                } else {
                    // Make the collecting transition wait until this request is ready.
                    mService.getTransitionController().setReady(false);
                }
            }
        }

        postStartActivityProcessing(r, result, startedActivityStack);

@@ -2629,7 +2636,7 @@ class ActivityStarter {
                mNewTaskInfo != null ? mNewTaskInfo : mStartActivity.info,
                mNewTaskIntent != null ? mNewTaskIntent : mIntent, mVoiceSession,
                mVoiceInteractor, toTop, mStartActivity, mSourceRecord, mOptions);
        mService.getTransitionController().collect(task);
        mService.getTransitionController().collectExistenceChange(task);
        addOrReparentStartingActivity(task, "setTaskFromReuseOrCreateNewTask - mReuseTask");

        ProtoLog.v(WM_DEBUG_TASKS, "Starting new activity %s in new task %s",
+0 −1
Original line number Diff line number Diff line
@@ -2358,7 +2358,6 @@ class Task extends WindowContainer<WindowContainer> {
        mDisplayContent.prepareAppTransitionOld(TRANSIT_OLD_TASK_CHANGE_WINDOWING_MODE,
                false /* alwaysKeepCurrent */, 0, false /* forceOverride */);
        mDisplayContent.prepareAppTransition(TRANSIT_CHANGE_WINDOWING_MODE);
        mAtmService.getTransitionController().collect(this);
        mDisplayContent.mChangingContainers.add(this);

        mSurfaceFreezer.freeze(getPendingTransaction(), startBounds);
Loading