Merge "config_supportsMultiWindow for device to specify multi-window support" into nyc-dev

am: 3716e52be5

* commit '3716e52be592482534943d32ba0f72309305a224':
  config_supportsMultiWindow for device to specify multi-window support
This commit is contained in:
Wale Ogunwale
2016-03-02 22:55:55 +00:00
committed by android-build-merger
6 changed files with 48 additions and 8 deletions

View File

@@ -647,6 +647,16 @@ public class ActivityManager {
return stackId != PINNED_STACK_ID && stackId != FREEFORM_WORKSPACE_STACK_ID
&& stackId != DOCKED_STACK_ID;
}
/**
* Returns true if the input stack id should only be present on a device that supports
* multi-window mode.
* @see android.app.ActivityManager#supportsMultiWindow
*/
public static boolean isMultiWindowStack(int stackId) {
return isStaticStack(stackId) || stackId == PINNED_STACK_ID
|| stackId == FREEFORM_WORKSPACE_STACK_ID || stackId == DOCKED_STACK_ID;
}
}
/**
@@ -867,6 +877,17 @@ public class ActivityManager {
return getMaxRecentTasksStatic() / 2;
}
/**
* Returns true if the system supports at least one form of multi-window.
* E.g. freeform, split-screen, picture-in-picture.
* @hide
*/
static public boolean supportsMultiWindow() {
return !isLowRamDeviceStatic()
&& Resources.getSystem().getBoolean(
com.android.internal.R.bool.config_supportsMultiWindow);
}
/**
* Information you can set and retrieve about the current activity within the recent task list.
*/

View File

@@ -2479,4 +2479,8 @@
handle wallpaper cropping.
-->
<string name="config_wallpaperCropperPackage" translatable="false">com.android.wallpapercropper</string>
<!-- True if the device supports at least one form of multi-window.
E.g. freeform, split-screen, picture-in-picture. -->
<bool name="config_supportsMultiWindow">true</bool>
</resources>

View File

@@ -303,6 +303,7 @@
<java-symbol type="bool" name="config_supportSpeakerNearUltrasound" />
<java-symbol type="bool" name="config_supportAudioSourceUnprocessed" />
<java-symbol type="bool" name="config_freeformWindowManagement" />
<java-symbol type="bool" name="config_supportsMultiWindow" />
<java-symbol type="bool" name="config_guestUserEphemeral" />
<java-symbol type="string" name="config_defaultPictureInPictureBounds" />
<java-symbol type="string" name="config_centeredPictureInPictureBounds" />

View File

@@ -1294,6 +1294,7 @@ public final class ActivityManagerService extends ActivityManagerNative
boolean mAlwaysFinishActivities = false;
boolean mLenientBackgroundCheck = false;
boolean mForceResizableActivities;
boolean mSupportsMultiWindow;
boolean mSupportsFreeformWindowManagement;
boolean mSupportsPictureInPicture;
Rect mDefaultPinnedStackBounds;
@@ -12371,6 +12372,7 @@ public final class ActivityManagerService extends ActivityManagerNative
final boolean supportsPictureInPicture =
mContext.getPackageManager().hasSystemFeature(FEATURE_PICTURE_IN_PICTURE);
final boolean supportsMultiWindow = ActivityManager.supportsMultiWindow();
final String debugApp = Settings.Global.getString(resolver, DEBUG_APP);
final boolean waitForDebugger = Settings.Global.getInt(resolver, WAIT_FOR_DEBUGGER, 0) != 0;
final boolean alwaysFinishActivities =
@@ -12397,8 +12399,15 @@ public final class ActivityManagerService extends ActivityManagerNative
mLenientBackgroundCheck = lenientBackgroundCheck;
mForceResizableActivities = forceResizable;
mWindowManager.setForceResizableTasks(mForceResizableActivities);
mSupportsFreeformWindowManagement = freeformWindowManagement || forceResizable;
mSupportsPictureInPicture = supportsPictureInPicture || forceResizable;
if (supportsMultiWindow || forceResizable) {
mSupportsMultiWindow = true;
mSupportsFreeformWindowManagement = freeformWindowManagement || forceResizable;
mSupportsPictureInPicture = supportsPictureInPicture || forceResizable;
} else {
mSupportsMultiWindow = false;
mSupportsFreeformWindowManagement = false;
mSupportsPictureInPicture = false;
}
// This happens before any activities are started, so we can
// change mConfiguration in-place.
updateConfigurationLocked(configuration, null, true);

View File

@@ -2174,6 +2174,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
*/
ActivityStack moveTaskToStackUncheckedLocked(
TaskRecord task, int stackId, boolean toTop, boolean forceFocus, String reason) {
if (StackId.isMultiWindowStack(stackId) && !mService.mSupportsMultiWindow) {
throw new IllegalStateException("moveTaskToStackUncheckedLocked: Device doesn't "
+ "support multi-window task=" + task + " to stackId=" + stackId);
}
final ActivityRecord r = task.getTopActivity();
final ActivityStack prevStack = task.stack;
final boolean wasFocused = isFocusedStack(prevStack) && (topRunningActivityLocked() == r);
@@ -2184,8 +2190,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
final boolean wasFront = isFrontStack(prevStack)
&& (prevStack.topRunningActivityLocked() == r);
final int resizeMode = task.mResizeMode;
if (stackId == DOCKED_STACK_ID && !task.isResizeable()) {
// We don't allow moving a unresizeable task to the docked stack since the docked
// stack is used for split-screen mode and will cause things like the docked divider to

View File

@@ -1772,12 +1772,13 @@ class ActivityStarter {
return false;
}
if (stackId == DOCKED_STACK_ID && r.canGoInDockedStack()) {
return true;
if (stackId != FULLSCREEN_WORKSPACE_STACK_ID
&& (!mService.mSupportsMultiWindow || !r.isResizeableOrForced())) {
return false;
}
if (stackId != FULLSCREEN_WORKSPACE_STACK_ID && !r.isResizeableOrForced()) {
return false;
if (stackId == DOCKED_STACK_ID && r.canGoInDockedStack()) {
return true;
}
if (stackId == FREEFORM_WORKSPACE_STACK_ID && !mService.mSupportsFreeformWindowManagement) {