diff options
11 files changed, 28 insertions, 127 deletions
diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 5b86e8d93064..4fb283a4b7f0 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -144,15 +144,13 @@ package android.app { method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void resizePrimarySplitScreen(@NonNull android.graphics.Rect, @NonNull android.graphics.Rect); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void resizeTask(int, android.graphics.Rect); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean setTaskWindowingMode(int, int, boolean) throws java.lang.SecurityException; - method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean setTaskWindowingModeSplitScreenPrimary(int, int, boolean, boolean, android.graphics.Rect, boolean) throws java.lang.SecurityException; + method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean setTaskWindowingModeSplitScreenPrimary(int, boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void startSystemLockTaskMode(int); method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void stopSystemLockTaskMode(); method public static boolean supportsMultiWindow(android.content.Context); method public static boolean supportsSplitScreenMultiWindow(android.content.Context); field public static final int DEFAULT_MINIMAL_SPLIT_SCREEN_DISPLAY_SIZE_DP = 440; // 0x1b8 field public static final int INVALID_STACK_ID = -1; // 0xffffffff - field public static final int SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT = 1; // 0x1 - field public static final int SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT = 0; // 0x0 } public class ActivityView extends android.view.ViewGroup { diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java index a2b9157e5454..f541e1a7dab0 100644 --- a/core/java/android/app/ActivityOptions.java +++ b/core/java/android/app/ActivityOptions.java @@ -17,7 +17,6 @@ package android.app; import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS; -import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.view.Display.INVALID_DISPLAY; @@ -256,13 +255,6 @@ public class ActivityOptions { "android.activity.freezeRecentTasksReordering"; /** - * Where the split-screen-primary stack should be positioned. - * @hide - */ - private static final String KEY_SPLIT_SCREEN_CREATE_MODE = - "android:activity.splitScreenCreateMode"; - - /** * Determines whether to disallow the outgoing activity from entering picture-in-picture as the * result of a new activity being launched. * @hide @@ -373,7 +365,6 @@ public class ActivityOptions { private int mLaunchActivityType = ACTIVITY_TYPE_UNDEFINED; private int mLaunchTaskId = -1; private int mPendingIntentLaunchFlags; - private int mSplitScreenCreateMode = SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT; private boolean mLockTaskMode = false; private boolean mDisallowEnterPictureInPictureWhileLaunching; private boolean mApplyActivityFlagsForBubbles; @@ -1049,8 +1040,6 @@ public class ActivityOptions { mTaskOverlayCanResume = opts.getBoolean(KEY_TASK_OVERLAY_CAN_RESUME, false); mAvoidMoveToFront = opts.getBoolean(KEY_AVOID_MOVE_TO_FRONT, false); mFreezeRecentTasksReordering = opts.getBoolean(KEY_FREEZE_RECENT_TASKS_REORDERING, false); - mSplitScreenCreateMode = opts.getInt(KEY_SPLIT_SCREEN_CREATE_MODE, - SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT); mDisallowEnterPictureInPictureWhileLaunching = opts.getBoolean( KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING, false); mApplyActivityFlagsForBubbles = opts.getBoolean( @@ -1469,14 +1458,9 @@ public class ActivityOptions { } /** @hide */ - public int getSplitScreenCreateMode() { - return mSplitScreenCreateMode; - } - - /** @hide */ @UnsupportedAppUsage public void setSplitScreenCreateMode(int splitScreenCreateMode) { - mSplitScreenCreateMode = splitScreenCreateMode; + // Remove this method after @UnsupportedAppUsage can be removed. } /** @hide */ @@ -1709,9 +1693,6 @@ public class ActivityOptions { if (mFreezeRecentTasksReordering) { b.putBoolean(KEY_FREEZE_RECENT_TASKS_REORDERING, mFreezeRecentTasksReordering); } - if (mSplitScreenCreateMode != SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT) { - b.putInt(KEY_SPLIT_SCREEN_CREATE_MODE, mSplitScreenCreateMode); - } if (mDisallowEnterPictureInPictureWhileLaunching) { b.putBoolean(KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING, mDisallowEnterPictureInPictureWhileLaunching); diff --git a/core/java/android/app/ActivityTaskManager.java b/core/java/android/app/ActivityTaskManager.java index 206025250018..fbc3b0d1753e 100644 --- a/core/java/android/app/ActivityTaskManager.java +++ b/core/java/android/app/ActivityTaskManager.java @@ -16,6 +16,8 @@ package android.app; +import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; + import android.annotation.NonNull; import android.annotation.RequiresPermission; import android.annotation.SystemService; @@ -58,20 +60,6 @@ public class ActivityTaskManager { public static final int INVALID_TASK_ID = -1; /** - * Parameter to {@link IActivityTaskManager#setTaskWindowingModeSplitScreenPrimary} which - * specifies the position of the created docked stack at the top half of the screen if - * in portrait mode or at the left half of the screen if in landscape mode. - */ - public static final int SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT = 0; - - /** - * Parameter to {@link IActivityTaskManager#setTaskWindowingModeSplitScreenPrimary} which - * specifies the position of the created docked stack at the bottom half of the screen if - * in portrait mode or at the right half of the screen if in landscape mode. - */ - public static final int SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT = 1; - - /** * Input parameter to {@link IActivityTaskManager#resizeTask} which indicates * that the resize doesn't need to preserve the window, and can be skipped if bounds * is unchanged. This mode is used by window manager in most cases. @@ -199,28 +187,12 @@ public class ActivityTaskManager { /** * Moves the input task to the primary-split-screen stack. * @param taskId Id of task to move. - * @param createMode The mode the primary split screen stack should be created in if it doesn't - * exist already. See - * {@link ActivityTaskManager#SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT} - * and - * {@link android.app.ActivityManager - * #SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT} * @param toTop If the task and stack should be moved to the top. - * @param animate Whether we should play an animation for the moving the task - * @param initialBounds If the primary stack gets created, it will use these bounds for the - * docked stack. Pass {@code null} to use default bounds. - * @param showRecents If the recents activity should be shown on the other side of the task - * going into split-screen mode. * @return Whether the task was successfully put into splitscreen. */ @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) - public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode, boolean toTop, - boolean animate, Rect initialBounds, boolean showRecents) throws SecurityException { - try { - return getService().setTaskWindowingModeSplitScreenPrimary(taskId, toTop); - } catch (RemoteException e) { - throw e.rethrowFromSystemServer(); - } + public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, boolean toTop) { + return setTaskWindowingMode(taskId, WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, toTop); } /** diff --git a/core/java/android/app/IActivityTaskManager.aidl b/core/java/android/app/IActivityTaskManager.aidl index 523c1550e316..1d657114c6ff 100644 --- a/core/java/android/app/IActivityTaskManager.aidl +++ b/core/java/android/app/IActivityTaskManager.aidl @@ -218,7 +218,7 @@ interface IActivityTaskManager { */ boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop); void moveTaskToRootTask(int taskId, int rootTaskId, boolean toTop); - boolean setTaskWindowingModeSplitScreenPrimary(int taskId, boolean toTop); + /** * Removes root tasks in the input windowing modes from the system if they are of activity type * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/LegacySplitScreenController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/LegacySplitScreenController.java index d88696db7c1f..6b79a3661bc0 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/LegacySplitScreenController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/legacysplitscreen/LegacySplitScreenController.java @@ -503,31 +503,31 @@ public class LegacySplitScreenController implements LegacySplitScreen, || isSplitActive()) { return false; } + } catch (RemoteException e) { + return false; + } - // Try fetching the top running task. - final List<RunningTaskInfo> runningTasks = - ActivityTaskManager.getInstance().getTasks(1 /* maxNum */); - if (runningTasks == null || runningTasks.isEmpty()) { - return false; - } - // Note: The set of running tasks from the system is ordered by recency. - final RunningTaskInfo topRunningTask = runningTasks.get(0); - final int activityType = topRunningTask.getActivityType(); - if (activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS) { - return false; - } - - if (!topRunningTask.supportsSplitScreenMultiWindow) { - Toast.makeText(mContext, R.string.dock_non_resizeble_failed_to_dock_text, - Toast.LENGTH_SHORT).show(); - return false; - } + // Try fetching the top running task. + final List<RunningTaskInfo> runningTasks = + ActivityTaskManager.getInstance().getTasks(1 /* maxNum */); + if (runningTasks == null || runningTasks.isEmpty()) { + return false; + } + // Note: The set of running tasks from the system is ordered by recency. + final RunningTaskInfo topRunningTask = runningTasks.get(0); + final int activityType = topRunningTask.getActivityType(); + if (activityType == ACTIVITY_TYPE_HOME || activityType == ACTIVITY_TYPE_RECENTS) { + return false; + } - return ActivityTaskManager.getService().setTaskWindowingModeSplitScreenPrimary( - topRunningTask.taskId, true /* onTop */); - } catch (RemoteException e) { + if (!topRunningTask.supportsSplitScreenMultiWindow) { + Toast.makeText(mContext, R.string.dock_non_resizeble_failed_to_dock_text, + Toast.LENGTH_SHORT).show(); return false; } + + return ActivityTaskManager.getInstance().setTaskWindowingModeSplitScreenPrimary( + topRunningTask.taskId, true /* onTop */); } @Override diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java index 1a71f119419c..d672c2c1dc58 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/ActivityOptionsCompat.java @@ -16,8 +16,6 @@ package com.android.systemui.shared.system; -import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT; -import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT; import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY; @@ -48,9 +46,6 @@ public abstract class ActivityOptionsCompat { options.setLaunchWindowingMode(isPrimary ? WINDOWING_MODE_SPLIT_SCREEN_PRIMARY : WINDOWING_MODE_SPLIT_SCREEN_SECONDARY); - options.setSplitScreenCreateMode(dockTopLeft - ? SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT - : SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT); return options; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index a991d3615fbb..f9c7799b4900 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -34,7 +34,6 @@ import static com.android.systemui.charging.WirelessChargingLayout.UNKNOWN_BATTE import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE; import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_WAKING; -import static com.android.systemui.shared.system.WindowManagerWrapper.NAV_BAR_POS_INVALID; import static com.android.systemui.statusbar.LightRevealScrimKt.getEnableLightReveal; import static com.android.systemui.statusbar.NotificationLockscreenUserManager.PERMISSION_SELF; import static com.android.systemui.statusbar.phone.BarTransitions.MODE_LIGHTS_OUT; @@ -176,7 +175,6 @@ import com.android.systemui.qs.QSPanelController; import com.android.systemui.recents.ScreenPinningRequest; import com.android.systemui.settings.brightness.BrightnessSlider; import com.android.systemui.shared.plugins.PluginManager; -import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.statusbar.AutoHideUiElement; import com.android.systemui.statusbar.BackDropView; import com.android.systemui.statusbar.CommandQueue; @@ -1582,11 +1580,6 @@ public class StatusBar extends SystemUI implements DemoMode, return true; } - final int navbarPos = WindowManagerWrapper.getInstance().getNavBarPosition(mDisplayId); - if (navbarPos == NAV_BAR_POS_INVALID) { - return false; - } - if (legacySplitScreen.splitPrimaryTask()) { if (metricsDockAction != -1) { mMetricsLogger.action(metricsDockAction); diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index ea04c64930a8..cd5ea46afb8d 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -34,7 +34,6 @@ import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.ActivityTaskManager.RESIZE_MODE_PRESERVE_WINDOW; import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; -import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY; import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED; import static android.content.Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS; import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; @@ -1902,9 +1901,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { @Override public boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop) { - if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) { - return setTaskWindowingModeSplitScreenPrimary(taskId, toTop); - } enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_TASKS, "setTaskWindowingMode()"); synchronized (mGlobalLock) { final long ident = Binder.clearCallingIdentity(); @@ -2235,28 +2231,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } /** - * Moves the specified task to the primary-split-screen stack. - * - * @param taskId Id of task to move. - * @param toTop If the task and stack should be moved to the top. - * @return Whether the task was successfully put into splitscreen. - */ - @Override - public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, boolean toTop) { - enforceCallerIsRecentsOrHasPermission(MANAGE_ACTIVITY_TASKS, - "setTaskWindowingModeSplitScreenPrimary()"); - synchronized (mGlobalLock) { - final long ident = Binder.clearCallingIdentity(); - try { - return setTaskWindowingModeSplitScreen(taskId, WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, - toTop); - } finally { - Binder.restoreCallingIdentity(ident); - } - } - } - - /** * Moves the specified task into a split-screen tile. */ private boolean setTaskWindowingModeSplitScreen(int taskId, int windowingMode, boolean toTop) { diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 447e66e4fe1f..292d7eae1a40 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -27,7 +27,6 @@ import static android.Manifest.permission.STATUS_BAR_SERVICE; import static android.Manifest.permission.WRITE_SECURE_SETTINGS; import static android.app.ActivityManagerInternal.ALLOW_FULL_ONLY; import static android.app.ActivityManagerInternal.ALLOW_NON_FULL; -import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT; import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW; import static android.app.StatusBarManager.DISABLE_MASK; import static android.app.WindowConfiguration.ROTATION_UNDEFINED; @@ -689,9 +688,6 @@ public class WindowManagerService extends IWindowManager.Stub final BLASTSyncEngine mSyncEngine; - int mDockedStackCreateMode = SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT; - Rect mDockedStackCreateBounds; - boolean mIsPc; /** * Flag that indicates that desktop mode is forced for public secondary screens. diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityOptionsTest.java b/services/tests/wmtests/src/com/android/server/wm/ActivityOptionsTest.java index 2acb6476453c..8983b4e28619 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityOptionsTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityOptionsTest.java @@ -16,7 +16,6 @@ package com.android.server.wm; -import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT; import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_ROTATE; @@ -53,7 +52,6 @@ public class ActivityOptionsTest { opts.setRotationAnimationHint(ROTATION_ANIMATION_ROTATE); opts.setTaskAlwaysOnTop(true); opts.setTaskOverlay(true, true); - opts.setSplitScreenCreateMode(SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT); Bundle optsBundle = opts.toBundle(); // Try and merge the constructed options with a new set of options @@ -71,7 +69,5 @@ public class ActivityOptionsTest { assertTrue(restoredOpts.getTaskAlwaysOnTop()); assertTrue(restoredOpts.getTaskOverlay()); assertTrue(restoredOpts.canTaskOverlayResume()); - assertEquals(SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT, - restoredOpts.getSplitScreenCreateMode()); } } diff --git a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java index 4892ef3b6322..93ef126b895a 100644 --- a/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java +++ b/services/tests/wmtests/src/com/android/server/wm/RecentTasksTest.java @@ -1006,8 +1006,6 @@ public class RecentTasksTest extends WindowTestsBase { assertNotRestoreTask( () -> mAtm.setTaskWindowingMode(taskId, WINDOWING_MODE_FULLSCREEN, false/* toTop */)); - assertNotRestoreTask( - () -> mAtm.setTaskWindowingModeSplitScreenPrimary(taskId, false /* toTop */)); } @Test @@ -1144,8 +1142,6 @@ public class RecentTasksTest extends WindowTestsBase { assertSecurityException(expectCallable, () -> mAtm.moveTaskToRootTask(0, INVALID_STACK_ID, true)); assertSecurityException(expectCallable, - () -> mAtm.setTaskWindowingModeSplitScreenPrimary(0, true)); - assertSecurityException(expectCallable, () -> mAtm.moveTopActivityToPinnedRootTask(INVALID_STACK_ID, new Rect())); assertSecurityException(expectCallable, () -> mAtm.getAllRootTaskInfos()); assertSecurityException(expectCallable, |