diff options
| author | 2019-07-24 11:23:57 -0700 | |
|---|---|---|
| committer | 2019-07-26 10:01:16 -0700 | |
| commit | acad244c70ca74d25d4e0d2bc7b738e7b5fa6356 (patch) | |
| tree | f1e54b486a1a0b560d6617cc00279255137392ae | |
| parent | dc860bdfa8da9a2532aa12da2eb946751c1df558 (diff) | |
Allow resume of parent activity that launches PiP
For an application that
- Targets pre-Q
- Launches activity A which goes into PiP mode from activity B
We prevents launching activity B from recents since we only allow
top-most visible activities for pre-Q app.
The restriction is first introduced in ag/6077827
Bug: 137085496
Test: Launch parent activity of PiP from recents
Test: atest ActivityLifecyclePipTests
Test: atest ActivityLifecycleSplitScreenTests
Test: atest WindowProcessControllerTests
Change-Id: I3a4a2c874e401a6d278d1b1b8b3fb5ee8548b8c7
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowProcessController.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/wm/WindowProcessController.java b/services/core/java/com/android/server/wm/WindowProcessController.java index bc5e32823547..b6960f0d1fe6 100644 --- a/services/core/java/com/android/server/wm/WindowProcessController.java +++ b/services/core/java/com/android/server/wm/WindowProcessController.java @@ -565,7 +565,8 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio * activities are allowed to be resumed per process. * @return {@code true} if the activity is allowed to be resumed by compatibility * restrictions, which the activity was the topmost visible activity in process or the app is - * targeting after Q. + * targeting after Q. Note that non-focusable activity, in picture-in-picture mode for instance, + * does not count as a topmost activity. */ boolean updateTopResumingActivityInProcessIfNeeded(@NonNull ActivityRecord activity) { if (mInfo.targetSdkVersion >= Q || mPreQTopResumedActivity == activity) { @@ -581,9 +582,13 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio boolean canUpdate = false; final ActivityDisplay topDisplay = mPreQTopResumedActivity != null ? mPreQTopResumedActivity.getDisplay() : null; - // Update the topmost activity if current top activity was not on any display or no - // longer visible. - if (topDisplay == null || !mPreQTopResumedActivity.visible) { + // Update the topmost activity if current top activity is + // - not on any display OR + // - no longer visible OR + // - not focusable (in PiP mode for instance) + if (topDisplay == null + || !mPreQTopResumedActivity.visible + || !mPreQTopResumedActivity.isFocusable()) { canUpdate = true; } |