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

Commit 95180ce9 authored by wilsonshih's avatar wilsonshih Committed by Wei Sheng Shih
Browse files

Add WRITE_TO_PARCEL reference before creash snapshot starting window.

If the snapshot object represents Home task, the snapshot could be
removed before create snapshot starting window, add a reference to keep
it alive before passing to Shell.

Flag: com.android.window.flags.release_snapshot_aggressively
Bug: 398521360
Test: 1. set credential.
2. open MinusOneActivity, then screen off
3. Unlock device with NO_ANIMATION(ref issue description)

Change-Id: Iaab5a3c3f68791aed769dfa3daa0e1cfc4023e25
parent 36d58260
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -2328,13 +2328,16 @@ final class ActivityRecord extends WindowToken {
            if (isActivityTypeHome()) {
                // The snapshot of home is only used once because it won't be updated while screen
                // is on (see {@link TaskSnapshotController#screenTurningOff}).
                mWmService.mTaskSnapshotController.removeSnapshotCache(task.mTaskId);
                final Transition transition = mTransitionController.getCollectingTransition();
                if (transition != null && (transition.getFlags()
                        & WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0) {
                    mWmService.mTaskSnapshotController.removeSnapshotCache(task.mTaskId);
                    // Only use snapshot of home as starting window when unlocking directly.
                    return false;
                }
                // Add a reference before removing snapshot from cache.
                snapshot.addReference(TaskSnapshot.REFERENCE_WRITE_TO_PARCEL);
                mWmService.mTaskSnapshotController.removeSnapshotCache(task.mTaskId);
            }
            return createSnapshot(snapshot, typeParameter);
        }