summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/res/res/values/config.xml3
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java9
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java4
4 files changed, 14 insertions, 3 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index bff8b1aa6d96..313987a9ff36 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2407,4 +2407,7 @@
that have not requested doing so (via the WindowManager.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
flag). -->
<bool name="config_forceWindowDrawsStatusBarBackground">true</bool>
+
+ <!-- Default bounds [left top right bottom] on screen for picture-in-picture windows. -->
+ <string translatable="false" name="config_defaultPictureInPictureBounds">"0 0 100 100"</string>
</resources>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index f6326f723298..517bb75c08a0 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -303,6 +303,7 @@
<java-symbol type="bool" name="config_supportMicNearUltrasound" />
<java-symbol type="bool" name="config_supportSpeakerNearUltrasound" />
<java-symbol type="bool" name="config_freeformWindowManagement" />
+ <java-symbol type="string" name="config_defaultPictureInPictureBounds" />
<java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_threshold" />
<java-symbol type="integer" name="config_wifi_framework_5GHz_preference_boost_factor" />
<java-symbol type="integer" name="config_wifi_framework_5GHz_preference_penalty_threshold" />
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index bcd8efdd61cf..b805c103f011 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -1281,6 +1281,7 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean mForceResizableActivities;
boolean mSupportsFreeformWindowManagement;
boolean mSupportsPictureInPicture;
+ Rect mDefaultPinnedStackBounds;
IActivityController mController = null;
String mProfileApp = null;
ProcessRecord mProfileProc = null;
@@ -7224,8 +7225,12 @@ public final class ActivityManagerService extends ActivityManagerNative
+ "Picture-In-Picture not supported for r=" + r);
}
+ // Use the default launch bounds for pinned stack if it doesn't exist yet.
+ final Rect bounds = (mStackSupervisor.getStack(PINNED_STACK_ID) == null)
+ ? mDefaultPinnedStackBounds : null;
+
mStackSupervisor.moveActivityToStackLocked(
- r, PINNED_STACK_ID, "enterPictureInPictureMode", null);
+ r, PINNED_STACK_ID, "enterPictureInPictureMode", bounds);
}
} finally {
Binder.restoreCallingIdentity(origId);
@@ -12102,6 +12107,8 @@ public final class ActivityManagerService extends ActivityManagerNative
com.android.internal.R.dimen.thumbnail_width);
mThumbnailHeight = res.getDimensionPixelSize(
com.android.internal.R.dimen.thumbnail_height);
+ mDefaultPinnedStackBounds = Rect.unflattenFromString(res.getString(
+ com.android.internal.R.string.config_defaultPictureInPictureBounds));
}
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index f7d66afd148f..5c2f73d46aa9 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -3635,8 +3635,8 @@ public final class ActivityStackSupervisor implements DisplayListener {
moveTaskToStackLocked(
task.taskId, stackId, ON_TOP, FORCE_FOCUS, reason, true /* animate */);
} else {
- final ActivityStack pinnedStack = getStack(PINNED_STACK_ID, CREATE_IF_NEEDED, ON_TOP);
- pinnedStack.moveActivityToStack(r);
+ final ActivityStack stack = getStack(stackId, CREATE_IF_NEEDED, ON_TOP);
+ stack.moveActivityToStack(r);
}
if (bounds != null) {