Merge "Determine whether to support activities in multi window (1/n)" into sc-dev
This commit is contained in:
@@ -1947,8 +1947,9 @@ public class ActivityManager {
|
||||
pw.print(((baseIntent.getFlags() & FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) != 0));
|
||||
pw.print(" activityType="); pw.print(activityTypeToString(getActivityType()));
|
||||
pw.print(" windowingMode="); pw.print(windowingModeToString(getWindowingMode()));
|
||||
pw.print(" supportsSplitScreenMultiWindow=");
|
||||
pw.println(supportsSplitScreenMultiWindow);
|
||||
pw.print(" supportsSplitScreenMultiWindow="); pw.print(supportsSplitScreenMultiWindow);
|
||||
pw.print(" supportsMultiWindow=");
|
||||
pw.println(supportsMultiWindow);
|
||||
if (taskDescription != null) {
|
||||
pw.print(" ");
|
||||
final ActivityManager.TaskDescription td = taskDescription;
|
||||
|
||||
@@ -348,20 +348,6 @@ public class ActivityTaskManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to allow non-resizable apps to be shown in multi-window. The app will be letterboxed
|
||||
* if the request orientation is not met, and will be shown in size-compat mode if the container
|
||||
* size has changed.
|
||||
* @hide
|
||||
*/
|
||||
public static boolean supportsNonResizableMultiWindow() {
|
||||
try {
|
||||
return ActivityTaskManager.getService().supportsNonResizableMultiWindow();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return whether the UI mode of the given config supports error dialogs (ANR, crash, etc).
|
||||
* @hide
|
||||
|
||||
@@ -259,13 +259,6 @@ interface IActivityTaskManager {
|
||||
void setSplitScreenResizing(boolean resizing);
|
||||
boolean supportsLocalVoiceInteraction();
|
||||
|
||||
/**
|
||||
* Whether to allow non-resizable apps to be shown in multi-window. The app will be letterboxed
|
||||
* if the request orientation is not met, and will be shown in size-compat mode if the container
|
||||
* size has changed.
|
||||
*/
|
||||
boolean supportsNonResizableMultiWindow();
|
||||
|
||||
// Get device configuration
|
||||
ConfigurationInfo getDeviceConfigurationInfo();
|
||||
|
||||
|
||||
@@ -137,6 +137,13 @@ public class TaskInfo {
|
||||
@UnsupportedAppUsage
|
||||
public boolean supportsSplitScreenMultiWindow;
|
||||
|
||||
/**
|
||||
* Whether this task supports multi windowing modes based on the device settings and the
|
||||
* root activity resizability and configuration.
|
||||
* @hide
|
||||
*/
|
||||
public boolean supportsMultiWindow;
|
||||
|
||||
/**
|
||||
* The resize mode of the task. See {@link ActivityInfo#resizeMode}.
|
||||
* @hide
|
||||
@@ -329,6 +336,7 @@ public class TaskInfo {
|
||||
}
|
||||
return topActivityType == that.topActivityType
|
||||
&& isResizeable == that.isResizeable
|
||||
&& supportsMultiWindow == that.supportsMultiWindow
|
||||
&& Objects.equals(positionInParent, that.positionInParent)
|
||||
&& Objects.equals(pictureInPictureParams, that.pictureInPictureParams)
|
||||
&& getWindowingMode() == that.getWindowingMode()
|
||||
@@ -375,6 +383,7 @@ public class TaskInfo {
|
||||
|
||||
taskDescription = source.readTypedObject(ActivityManager.TaskDescription.CREATOR);
|
||||
supportsSplitScreenMultiWindow = source.readBoolean();
|
||||
supportsMultiWindow = source.readBoolean();
|
||||
resizeMode = source.readInt();
|
||||
configuration.readFromParcel(source);
|
||||
token = WindowContainerToken.CREATOR.createFromParcel(source);
|
||||
@@ -412,6 +421,7 @@ public class TaskInfo {
|
||||
|
||||
dest.writeTypedObject(taskDescription, flags);
|
||||
dest.writeBoolean(supportsSplitScreenMultiWindow);
|
||||
dest.writeBoolean(supportsMultiWindow);
|
||||
dest.writeInt(resizeMode);
|
||||
configuration.writeToParcel(dest, flags);
|
||||
token.writeToParcel(dest, flags);
|
||||
@@ -440,6 +450,7 @@ public class TaskInfo {
|
||||
+ " numActivities=" + numActivities
|
||||
+ " lastActiveTime=" + lastActiveTime
|
||||
+ " supportsSplitScreenMultiWindow=" + supportsSplitScreenMultiWindow
|
||||
+ " supportsMultiWindow=" + supportsMultiWindow
|
||||
+ " resizeMode=" + resizeMode
|
||||
+ " isResizeable=" + isResizeable
|
||||
+ " token=" + token
|
||||
|
||||
@@ -23,7 +23,6 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TASK_ORG;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.graphics.Rect;
|
||||
import android.view.SurfaceControl;
|
||||
import android.window.WindowContainerToken;
|
||||
@@ -89,11 +88,11 @@ class AppPair implements ShellTaskOrganizer.TaskListener, SplitLayout.LayoutChan
|
||||
ProtoLog.v(WM_SHELL_TASK_ORG, "pair task1=%d task2=%d in AppPair=%s",
|
||||
task1.taskId, task2.taskId, this);
|
||||
|
||||
if ((!task1.isResizeable || !task2.isResizeable)
|
||||
&& !ActivityTaskManager.supportsNonResizableMultiWindow()) {
|
||||
if (!task1.supportsMultiWindow || !task2.supportsMultiWindow) {
|
||||
ProtoLog.e(WM_SHELL_TASK_ORG,
|
||||
"Can't pair unresizeable tasks task1.isResizeable=%b task1.isResizeable=%b",
|
||||
task1.isResizeable, task2.isResizeable);
|
||||
"Can't pair tasks that doesn't support multi window, "
|
||||
+ "task1.supportsMultiWindow=%b, task2.supportsMultiWindow=%b",
|
||||
task1.supportsMultiWindow, task2.supportsMultiWindow);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.animation.ValueAnimator;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.app.WindowConfiguration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.IBinder;
|
||||
@@ -92,11 +91,10 @@ public class LegacySplitScreenTransitions implements Transitions.TransitionHandl
|
||||
// is nothing behind it.
|
||||
((type == TRANSIT_CLOSE || type == TRANSIT_TO_BACK)
|
||||
&& triggerTask.parentTaskId == mListener.mPrimary.taskId)
|
||||
// if a non-resizable is launched when it is not supported in multi window,
|
||||
// if an activity that is not supported in multi window mode is launched,
|
||||
// we also need to leave split-screen.
|
||||
|| ((type == TRANSIT_OPEN || type == TRANSIT_TO_FRONT)
|
||||
&& !triggerTask.isResizeable
|
||||
&& !ActivityTaskManager.supportsNonResizableMultiWindow());
|
||||
&& !triggerTask.supportsMultiWindow);
|
||||
// In both cases, dismiss the primary
|
||||
if (shouldDismiss) {
|
||||
WindowManagerProxy.buildDismissSplit(out, mListener,
|
||||
|
||||
@@ -46,7 +46,6 @@ import com.android.wm.shell.transition.Transitions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.BooleanSupplier;
|
||||
|
||||
/**
|
||||
* Proxy to simplify calls into window manager/activity manager
|
||||
@@ -209,17 +208,10 @@ class WindowManagerProxy {
|
||||
return false;
|
||||
}
|
||||
ActivityManager.RunningTaskInfo topHomeTask = null;
|
||||
// One-time lazy wrapper to avoid duplicated IPC in loop. Not store as class variable
|
||||
// because the value can be changed at runtime.
|
||||
final BooleanSupplier supportsNonResizableMultiWindow =
|
||||
createSupportsNonResizableMultiWindowSupplier();
|
||||
for (int i = rootTasks.size() - 1; i >= 0; --i) {
|
||||
final ActivityManager.RunningTaskInfo rootTask = rootTasks.get(i);
|
||||
// Check whether to move resizeable task to split secondary.
|
||||
// Also, we have an exception for non-resizable home because we will minimize to show
|
||||
// it.
|
||||
if (!rootTask.isResizeable && rootTask.topActivityType != ACTIVITY_TYPE_HOME
|
||||
&& !supportsNonResizableMultiWindow.getAsBoolean()) {
|
||||
// Check whether the task can be moved to split secondary.
|
||||
if (!rootTask.supportsMultiWindow && rootTask.topActivityType != ACTIVITY_TYPE_HOME) {
|
||||
continue;
|
||||
}
|
||||
// Only move fullscreen tasks to split secondary.
|
||||
@@ -364,21 +356,6 @@ class WindowManagerProxy {
|
||||
outWct.setFocusable(tiles.mPrimary.token, true /* focusable */);
|
||||
}
|
||||
|
||||
/** Creates a lazy wrapper to get whether it supports non-resizable in multi window. */
|
||||
private static BooleanSupplier createSupportsNonResizableMultiWindowSupplier() {
|
||||
return new BooleanSupplier() {
|
||||
private Boolean mSupportsNonResizableMultiWindow;
|
||||
@Override
|
||||
public boolean getAsBoolean() {
|
||||
if (mSupportsNonResizableMultiWindow == null) {
|
||||
mSupportsNonResizableMultiWindow =
|
||||
ActivityTaskManager.supportsNonResizableMultiWindow();
|
||||
}
|
||||
return mSupportsNonResizableMultiWindow;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to apply a sync transaction serially with other sync transactions.
|
||||
*
|
||||
|
||||
@@ -69,6 +69,7 @@ public final class TestRunningTaskInfoBuilder {
|
||||
info.configuration.windowConfiguration.setActivityType(mActivityType);
|
||||
info.token = mToken;
|
||||
info.isResizeable = true;
|
||||
info.supportsMultiWindow = true;
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3339,11 +3339,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
.supportsLocalVoiceInteraction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsNonResizableMultiWindow() {
|
||||
return mSupportsNonResizableMultiWindow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateConfiguration(Configuration values) {
|
||||
mAmInternal.enforceCallingPermission(CHANGE_CONFIGURATION, "updateConfiguration()");
|
||||
|
||||
@@ -4079,6 +4079,7 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
info.lastActiveTime = lastActiveTime;
|
||||
info.taskDescription = new ActivityManager.TaskDescription(getTaskDescription());
|
||||
info.supportsSplitScreenMultiWindow = supportsSplitScreenWindowingMode();
|
||||
info.supportsMultiWindow = supportsMultiWindow();
|
||||
info.configuration.setTo(getConfiguration());
|
||||
// Update to the task's current activity type and windowing mode which may differ from the
|
||||
// window configuration
|
||||
|
||||
Reference in New Issue
Block a user