Merge "Add system config to specify Multi-Display support" into oc-dev

This commit is contained in:
Andrii Kulian
2017-04-07 00:22:37 +00:00
committed by Android (Google) Code Review
7 changed files with 35 additions and 1 deletions

View File

@@ -66,4 +66,8 @@
<!-- The small screens of watch devices makes multi-window support undesireable. -->
<bool name="config_supportsMultiWindow">false</bool>
<bool name="config_supportsSplitScreenMultiWindow">false</bool>
<!-- Disable Multi-Display because of small screen space and lack of external display connection
options. -->
<bool name="config_supportsMultiDisplay">false</bool>
</resources>

View File

@@ -2651,6 +2651,9 @@
<!-- True if the device supports split screen as a form of multi-window. -->
<bool name="config_supportsSplitScreenMultiWindow">true</bool>
<!-- True if the device supports running activities on secondary displays. -->
<bool name="config_supportsMultiDisplay">true</bool>
<!-- True if the device has no home screen. That is a launcher activity
where the user can launch other applications from. -->
<bool name="config_noHomeScreen">false</bool>

View File

@@ -313,6 +313,7 @@
<java-symbol type="bool" name="config_freeformWindowManagement" />
<java-symbol type="bool" name="config_supportsMultiWindow" />
<java-symbol type="bool" name="config_supportsSplitScreenMultiWindow" />
<java-symbol type="bool" name="config_supportsMultiDisplay" />
<java-symbol type="bool" name="config_noHomeScreen" />
<java-symbol type="bool" name="config_guestUserEphemeral" />
<java-symbol type="bool" name="config_localDisplaysMirrorContent" />

View File

@@ -1490,6 +1490,7 @@ public class ActivityManagerService extends IActivityManager.Stub
boolean mSupportsSplitScreenMultiWindow;
boolean mSupportsFreeformWindowManagement;
boolean mSupportsPictureInPicture;
boolean mSupportsMultiDisplay;
boolean mSupportsLeanbackOnly;
IActivityController mController = null;
boolean mControllerIsAMonkey = false;
@@ -13827,6 +13828,8 @@ public class ActivityManagerService extends IActivityManager.Stub
com.android.internal.R.fraction.thumbnail_fullscreen_scale, 1, 1);
}
mWaitForNetworkTimeoutMs = waitForNetworkTimeoutMs;
mSupportsMultiDisplay = res.getBoolean(
com.android.internal.R.bool.config_supportsMultiDisplay);
}
}

View File

@@ -247,6 +247,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
return runSupportsMultiwindow(pw);
case "supports-split-screen-multi-window":
return runSupportsSplitScreenMultiwindow(pw);
case "supports-multi-display":
return runSupportsMultiDisplay(pw);
case "update-appinfo":
return runUpdateApplicationInfo(pw);
case "no-home-screen":
@@ -2398,6 +2400,15 @@ final class ActivityManagerShellCommand extends ShellCommand {
return 0;
}
int runSupportsMultiDisplay(PrintWriter pw) throws RemoteException {
final Resources res = getResources(pw);
if (res == null) {
return -1;
}
pw.println(res.getBoolean(com.android.internal.R.bool.config_supportsMultiDisplay));
return 0;
}
int runUpdateApplicationInfo(PrintWriter pw) throws RemoteException {
int userid = UserHandle.parseUserArg(getNextArgRequired());
ArrayList<String> packages = new ArrayList<>();
@@ -2627,6 +2638,8 @@ final class ActivityManagerShellCommand extends ShellCommand {
pw.println(" Returns true if the device supports multiwindow.");
pw.println(" supports-split-screen-multi-window");
pw.println(" Returns true if the device supports split screen multiwindow.");
pw.println(" supports-multi-display");
pw.println(" Returns true if the device supports multi-display.");
pw.println(" suppress-resize-config-changes <true|false>");
pw.println(" Suppresses configuration changes due to user resizing an activity/task.");
pw.println(" set-inactive [--user <USER_ID>] <PACKAGE> true|false");

View File

@@ -2782,6 +2782,15 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
+ " reparent task=" + task + " to stackId=" + stackId);
}
// Ensure that we're not moving a task to a dynamic stack if device doesn't support
// multi-display.
// TODO(multi-display): Support non-dynamic stacks on secondary displays.
// TODO: Check ActivityView after fixing b/35349678.
if (StackId.isDynamicStack(stackId) && !mService.mSupportsMultiDisplay) {
throw new IllegalArgumentException("Device doesn't support multi-display, can not"
+ " reparent task=" + task + " to stackId=" + stackId);
}
// Ensure that we aren't trying to move into a freeform stack without freeform
// support
if (stackId == FREEFORM_WORKSPACE_STACK_ID && !mService.mSupportsFreeformWindowManagement) {

View File

@@ -2178,7 +2178,8 @@ class ActivityStarter {
case ASSISTANT_STACK_ID:
return r.isAssistantActivity();
default:
if (StackId.isDynamicStack(stackId)) {
// TODO: Check ActivityView after fixing b/35349678.
if (StackId.isDynamicStack(stackId) && mService.mSupportsMultiDisplay) {
return true;
}
Slog.e(TAG, "isValidLaunchStackId: Unexpected stackId=" + stackId);