Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7132932 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove IActivityTaskManager#setTaskWindowingModeSplitScreenPrimary

It is the same as setTaskWindowingMode(SPLIT_SCREEN_PRIMARY).

Still keep ActivityTaskManager#setTaskWindowingModeSplitScreenPrimary
that redirects to setTaskWindowingMode for simple usages.

Remove SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT and
SPLIT_SCREEN_CREATE_MODE_BOTTOM_OR_RIGHT because they are no longer
used since commits bed2d1b5, 4067a2d and 51beb146. Now if there needs
the similar functionality, it should be done by organizer in shell.

Remove the usage getNavBarPosition from StatusBar because it was
used to determine the split side.

The history about the removed fields: 59a73ca3, f59a4132.

Bug: 174040691
Test: SplitScreenTests
Change-Id: Ie5770d72cc5fb2f6ba1beceec418f1ea39f9c604
parent 0883dadd
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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 {
+1 −20
Original line number Diff line number Diff line
@@ -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;
@@ -255,13 +254,6 @@ public class ActivityOptions {
    private static final String KEY_FREEZE_RECENT_TASKS_REORDERING =
            "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.
@@ -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(
@@ -1468,15 +1457,10 @@ public class ActivityOptions {
        return mFreezeRecentTasksReordering;
    }

    /** @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);
+4 −32
Original line number Diff line number Diff line
@@ -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;
@@ -57,20 +59,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
@@ -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);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -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
+21 −21
Original line number Diff line number Diff line
@@ -503,6 +503,9 @@ public class LegacySplitScreenController implements LegacySplitScreen,
                    || isSplitActive()) {
                return false;
            }
        } catch (RemoteException e) {
            return false;
        }

        // Try fetching the top running task.
        final List<RunningTaskInfo> runningTasks =
@@ -523,11 +526,8 @@ public class LegacySplitScreenController implements LegacySplitScreen,
            return false;
        }

            return ActivityTaskManager.getService().setTaskWindowingModeSplitScreenPrimary(
        return ActivityTaskManager.getInstance().setTaskWindowingModeSplitScreenPrimary(
                topRunningTask.taskId, true /* onTop */);
        } catch (RemoteException e) {
            return false;
        }
    }

    @Override
Loading