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

Commit 6cf0f7cd authored by wilsonshih's avatar wilsonshih
Browse files

Fix getTaskSnapshot returning a stale snapshot when loading from disk.

In commit 3dfdc4c2, when a client asks for a low-resolution snapshot,
the system will convert a high-resolution snapshot from the cache if
one exists.
This can cause a race condition from a second calls getTaskSnapshot
requesting the high-resolution version. Since the cache now holds the
low-resolution snapshot, the system attempts to load the
high-resolution version from disk. However, because the persistence
task may not have completed yet, the version on disk can be stale,
causing the client to receive an old snapshot.
To fix this, the low-resolution snapshot is now only updated in the cache
after the persistence task is complete.
Additionally, if the corresponding StoreWriteQueueItem exists, the
pre-converted low-resolution snapshot will be put into it, which avoids
performing the conversion again after processing the item.

Flag: com.android.window.flags.respect_requested_task_snapshot_resolution
Bug: 238206323
Test: Verified that calling getTasksnapshot first for low-resolution and
then for high-resolution returns the same, up-to-date snapshot ID.

Change-Id: I045cd3c1934adf3e003a4c4014d48112eb76963d
parent dad7f3c8
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