Deprecate use of onActivityHidden() in PiP
We should not rely on onActivityHidden()
callback in PiP to reset the PiP state, such as
the re-entry state and the flags indicating whether
PiP has been moved or resized.
For instance, relying on it can lead to issues with SLEEP
and locking of the screen which causes the PiP activity to stop,
as expected, which then triggers onActivityHidden() resetting the state.
This means unlocking from the keyguard, can move PiP to its default
position, losing previous state.
Instead we should rely on transitions. We make sure to detect
if an incoming transition going through the PipTransition handler
contains a change of mode CLOSE with the same PiP component name.
This triggers the state reset.
The cases where we switch apps entering PiP are already handled
since stopSwipePipToHome and startEnterAnimation check for changes
in component names upon entry as well.
Bug: 299642417
Flag: EXEMPT bugfix
Test: enter multi-activity PiP, move PiP, expand, do a back-gesture
to remove PiP activity, reopen the activity, and re-enter PiP in
default bounds.
Test: enter PiP, move PiP, expand, quick-switch to a different PiP app,
enter PiP into default bounds.
Test: enter PiP, move PiP, lock and unlock the screen, observe same PiP
position
Change-Id: Id59023be234a8573bbe83d405a7ed5f4c8a4aece
7 files changed