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

Commit cc497e34 authored by wilsonshih's avatar wilsonshih
Browse files

Temporary decouple snapshot controller from transition.

- Accediently capture task snapshot when activity converting
  translucent.
- Need to fine tune the performance. When transition ready, only do
capture snapshot so it won't block surface placement. The other
analysis tasks such as load/remove/delete activity snapshot can be
schedule after transition finish. Also this version should only focus
on shell transiton.

Bug: 274216498
Test: manual test there won't capture snapshot when
app is converting from/to translucent.

Change-Id: I1c106dfd128d8ae229fbcba3ed1bd793dac36b67
parent 25af92cd
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -191,6 +191,9 @@ class ActivitySnapshotController extends AbsAppSnapshotController<ActivityRecord
     * Prepare to handle on transition start. Clear all temporary fields.
     */
    void preTransitionStart() {
        if (shouldDisableSnapshots()) {
            return;
        }
        resetTmpFields();
    }

@@ -283,6 +286,9 @@ class ActivitySnapshotController extends AbsAppSnapshotController<ActivityRecord
     * Called when the visibility of an app changes outside the regular app transition flow.
     */
    void notifyAppVisibilityChanged(ActivityRecord appWindowToken, boolean visible) {
        if (shouldDisableSnapshots()) {
            return;
        }
        if (!visible) {
            resetTmpFields();
            addBelowTopActivityIfExist(appWindowToken.getTask(), mPendingRemoveActivity,
+5 −1
Original line number Diff line number Diff line
@@ -213,8 +213,12 @@ class SnapshotController {

    void notifyAppVisibilityChanged(ActivityRecord appWindowToken, boolean visible) {
        if (!visible && hasTransitionStateConsumer(TASK_CLOSE)) {
            final Task task = appWindowToken.getTask();
            if (task == null || task.isVisibleRequested()) {
                return;
            }
            // close task transition
            addTransitionRecord(TASK_CLOSE, false /*open*/, appWindowToken.getTask());
            addTransitionRecord(TASK_CLOSE, false /*open*/, task);
            mActivitySnapshotController.preTransitionStart();
            notifyTransition(TASK_CLOSE);
            mActivitySnapshotController.postTransitionStart();
+7 −1
Original line number Diff line number Diff line
@@ -1227,7 +1227,13 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        // 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) {
            mController.mSnapshotController.onTransitionReady(mType, mParticipants);
            for (int i = mParticipants.size() - 1; i >= 0; --i) {
                final ActivityRecord ar = mParticipants.valueAt(i).asActivityRecord();
                if (ar == null || ar.getTask() == null
                        || ar.getTask().isVisibleRequested()) continue;
                mController.mSnapshotController.mTaskSnapshotController.recordSnapshot(
                        ar.getTask(), false /* allowSnapshotHome */);
            }
        }

        // This is non-null only if display has changes. It handles the visible windows that don't