summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wale Ogunwale <ogunwale@google.com> 2015-12-06 19:39:01 -0800
committer Wale Ogunwale <ogunwale@google.com> 2015-12-16 13:40:19 -0800
commitd88f651da8fc1beac6784696586c21c1b211e0ff (patch)
treed995e40518616a507396a503372ad08d30259c47
parentc51fd1d8cf534f0290bfcb3b3a66c95cbe7a41ec (diff)
Added config_defaultPictureInPictureBounds
Allows device to specify the default launch bounds for the pinned stack. Bug: 25580820 Change-Id: I477781aec910553d3b3645a0ac6106cf616949ed
-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) {