Check for PIPable activities after moving task to back.
When we move a task to the back, there is a possibility that the previous stack won't be put into a paused state if it's in a multi-resume environment (e.g. freeform windows). If that's the case and the activity is eligible for PIP, we pause the task so that PIP mode can be triggered via onUserLeaveHint. We pause the task instead of using ATM#requestPictureInPictureMode because the latter is not able to handle the two scenarios we want to support on minimize: 1. If the app wants to enter PIP -> enter PIP 2. If the app doesn't want to -> put the app to stopped Using requestPIPMode works for 1. but won't put the app to stopped when the app decides not to enter PIP. Pausing the task explicitely does handle both cases correctly, as it triggers onUserLeaveHint and only puts the app to stopped if the app did not enter PIP mode. Also, don't call on resumeFocusedStacksTopActivities when in a multi-resume environment. There is nothing to resume, and the focused stack is already updated when moving the task back. Bug: 142680249 Bug: 141156846 Test: In an environment with freeform window, try: 1) Minimizing a PIPable activity - sees it enters PIP 2) With two windows in freeform, try switching focus and see they perform as expected 3) Minimizing an activity that supports PIP but doesn't want to enter PIP on onUserLeaveHint - it gets STOPPED Change-Id: I59811a56a954d32458d741b8f44ccd37f5729094
Loading
Please register or sign in to comment