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

Skip to content
Commit c262b2c1 authored by wilsonshih's avatar wilsonshih
Browse files

Refactor snapshot access between from cache and disk.

1. Correct the scope of the lock in SnapshotCache.
The lock is now held from the snapshot cache to allow adding an extra
reference if the snapshot is used outside the Window Manager lock. This
ensures proper synchronization and prevents premature release of the
snapshot.
2. Allows adding a reference for restored snapshots.
Snapshots restored from disk can now also have an extra reference added.
This enables quicker release of the associated hardware buffer,
improving memory management.
3. Separates snapshot retrieval methods.
The `getSnapshot` method is split into `FromDisk` and `FromCache`
variants. This clarifies when the WM lock/Cache lock should be held,
improving code readability and maintainability.

Bug: 238206323
Bug: 379546318
Flag: com.android.window.flags.release_snapshot_aggressively
Test: atest TaskSnapshotLowResDisabledTest TaskSnapshotCacheTest
Test: Verify the snapshot load from disk can be released after parcel.
Change-Id: I1982f1eb3fdf65d942c6bfae9ecee977984a222e
parent 17408328
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment