Use the task windowing mode to determine inheritance
This matters in very unique scenario:
- activity A1 is launched in Task T1 with launchMode=singleInstance
- it then launches activity A2, activity A2 gets hosted in T2 due to
launchMode of A1
- then A2 enters PiP
- user expands PiP via the menu overlay icon
- A2 decides to startActivity(...) A1 in the onPictureInPictureParamsChanged
- A2 also calls finish() on itself
At that point T2 was in PINNED windowing mode, but A2 was already not.
The existing logic would have compared the A2 windowing mode and A1
windowing mode, and since both would be not PINNED, it would then decide
to inherit the task windowing mode, making T1 now in PINNED windowing
mode. This leads to wrong WM state, as T1 was not meant to be in that
windowing mode.
Bug: 296071915
Test: atest TaskLaunchParamsModifierTests
Change-Id: I005f92ef7dbb334c64466d83eb5bbe6b4c03d144
3 files changed