Merge "Prevent non-fullscreen activities from triggering auto-enter PiP" into oc-dr1-dev am: d24ed58bc2

am: 092d675192

Change-Id: I51c5a575c0700879af80a0ecd688f4f0de0eae72
This commit is contained in:
Winson Chung
2017-07-12 22:16:47 +00:00
committed by android-build-merger
2 changed files with 21 additions and 4 deletions

View File

@@ -2853,10 +2853,13 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
transit = TRANSIT_TASK_OPEN_BEHIND;
} else {
// If a new task is being launched, then mark the existing top activity as
// supporting picture-in-picture while pausing
// supporting picture-in-picture while pausing only if the starting activity
// would not be considered an overlay on top of the current activity
// (eg. not fullscreen, or the assistant)
if (focusedTopActivity != null
&& focusedTopActivity.getStackId() != PINNED_STACK_ID
&& r.getStackId() != ASSISTANT_STACK_ID) {
&& r.getStackId() != ASSISTANT_STACK_ID
&& r.fullscreen) {
focusedTopActivity.supportsPictureInPictureWhilePausing = true;
}
transit = TRANSIT_TASK_OPEN;
@@ -4467,9 +4470,10 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
updateTransitLocked(TRANSIT_TASK_TO_FRONT, options);
}
// If a new task is moved to the front, then mark the existing top activity as supporting
// picture-in-picture while paused
// picture-in-picture while paused only if the task would not be considered an oerlay on top
// of the current activity (eg. not fullscreen, or the assistant)
if (topActivity != null && topActivity.getStackId() != PINNED_STACK_ID
&& tr.getStackId() != ASSISTANT_STACK_ID) {
&& tr.getStackId() != ASSISTANT_STACK_ID && tr.containsOnlyFullscreenActivities()) {
topActivity.supportsPictureInPictureWhilePausing = true;
}

View File

@@ -1112,6 +1112,19 @@ final class TaskRecord extends ConfigurationContainer implements TaskWindowConta
return intent != null ? intent : affinityIntent;
}
/**
* @return Whether there are only fullscreen activities in this task.
*/
boolean containsOnlyFullscreenActivities() {
for (int i = 0; i < mActivities.size(); i++) {
final ActivityRecord r = mActivities.get(i);
if (!r.finishing && !r.fullscreen) {
return false;
}
}
return true;
}
/** Returns the first non-finishing activity from the root. */
ActivityRecord getRootActivity() {
for (int i = 0; i < mActivities.size(); i++) {