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

Commit 194f30e4 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

[PiP2] Do not allow multiple on-idle runnables

Earlier, it was actually possible to schedule multiple
onIdlePipTransitionStateRunnables if done in quick succession.
Effectively, the first runnable could get posted, the local cache would
be cleared, and if that posted runnable did not have enough time to
actually execute, we could remain in an idle state briefly.
This means any follow-up setOnIdlePipTransitionStateRunnable() call
would still go through and post the callback onto the message queue as
well. This can introduce race conditions in PipTransitionState.

Instead, we wanna enforce one on-idle runnable scheduled at a time,
by clearing out the previously scheduled on-idle runnables from the msg
queue as needed.

We should also allow setting the state to SCHEDULED_BOUNDS_CHANGE only
when in a valid idle PiP state.

Lastly, we are adding a sanity check wtf log to finishTransition()
in case we end up in an UNDEFINED PipTransitionState.

Bug: 405394597
Flag: com.android.wm.shell.enable_pip2
Test: atest PipTransitionStateTest
Change-Id: Ic3a1cb187e0b778ac755d449e02b15e894556bbc
parent ed71cd15
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