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

Commit 8a9716a8 authored by wilsonshih's avatar wilsonshih
Browse files

Removes the task snapshot's reference earlier from the persist queue.

If the previous write request is duplicated from the latest request.

Flag: com.android.window.flags.release_snapshot_aggressively
Bug: 238206323
Test: use swipe-up gesture to close an app, which will has two take
task snapshot request. Verify only one screenshot reference in dmabuf
since previous request can be released as soon as possible.

Change-Id: Ia5b9764ff20423e854706dcfc081c339eb661dcc
parent 4f783b4e
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -319,7 +319,13 @@ class SnapshotPersistQueue {
        @Override
        void onQueuedLocked() {
            // Remove duplicate request.
            mStoreQueueItems.remove(this);
            mStoreQueueItems.removeIf(item -> {
                if (item.equals(this) && item.mSnapshot != mSnapshot) {
                    item.mSnapshot.removeReference(TaskSnapshot.REFERENCE_PERSIST);
                    return true;
                }
                return false;
            });
            mStoreQueueItems.offer(this);
        }