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

Commit 47fcbd74 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Remove IActivityTaskManager#setTaskWindowingModeSplitScreenPrimary"

parents 974f4c31 b7132932
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line 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 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 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 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 startSystemLockTaskMode(int);
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void stopSystemLockTaskMode();
    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void stopSystemLockTaskMode();
    method public static boolean supportsMultiWindow(android.content.Context);
    method public static boolean supportsMultiWindow(android.content.Context);
    method public static boolean supportsSplitScreenMultiWindow(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 DEFAULT_MINIMAL_SPLIT_SCREEN_DISPLAY_SIZE_DP = 440; // 0x1b8
    field public static final int INVALID_STACK_ID = -1; // 0xffffffff
    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 {
  public class ActivityView extends android.view.ViewGroup {
+1 −20
Original line number Original line Diff line number Diff line
@@ -17,7 +17,6 @@
package android.app;
package android.app;


import static android.Manifest.permission.CONTROL_REMOTE_APP_TRANSITION_ANIMATIONS;
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.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.Display.INVALID_DISPLAY;
import static android.view.Display.INVALID_DISPLAY;
@@ -255,13 +254,6 @@ public class ActivityOptions {
    private static final String KEY_FREEZE_RECENT_TASKS_REORDERING =
    private static final String KEY_FREEZE_RECENT_TASKS_REORDERING =
            "android.activity.freezeRecentTasksReordering";
            "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
     * Determines whether to disallow the outgoing activity from entering picture-in-picture as the
     * result of a new activity being launched.
     * result of a new activity being launched.
@@ -373,7 +365,6 @@ public class ActivityOptions {
    private int mLaunchActivityType = ACTIVITY_TYPE_UNDEFINED;
    private int mLaunchActivityType = ACTIVITY_TYPE_UNDEFINED;
    private int mLaunchTaskId = -1;
    private int mLaunchTaskId = -1;
    private int mPendingIntentLaunchFlags;
    private int mPendingIntentLaunchFlags;
    private int mSplitScreenCreateMode = SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
    private boolean mLockTaskMode = false;
    private boolean mLockTaskMode = false;
    private boolean mDisallowEnterPictureInPictureWhileLaunching;
    private boolean mDisallowEnterPictureInPictureWhileLaunching;
    private boolean mApplyActivityFlagsForBubbles;
    private boolean mApplyActivityFlagsForBubbles;
@@ -1049,8 +1040,6 @@ public class ActivityOptions {
        mTaskOverlayCanResume = opts.getBoolean(KEY_TASK_OVERLAY_CAN_RESUME, false);
        mTaskOverlayCanResume = opts.getBoolean(KEY_TASK_OVERLAY_CAN_RESUME, false);
        mAvoidMoveToFront = opts.getBoolean(KEY_AVOID_MOVE_TO_FRONT, false);
        mAvoidMoveToFront = opts.getBoolean(KEY_AVOID_MOVE_TO_FRONT, false);
        mFreezeRecentTasksReordering = opts.getBoolean(KEY_FREEZE_RECENT_TASKS_REORDERING, 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(
        mDisallowEnterPictureInPictureWhileLaunching = opts.getBoolean(
                KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING, false);
                KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING, false);
        mApplyActivityFlagsForBubbles = opts.getBoolean(
        mApplyActivityFlagsForBubbles = opts.getBoolean(
@@ -1468,15 +1457,10 @@ public class ActivityOptions {
        return mFreezeRecentTasksReordering;
        return mFreezeRecentTasksReordering;
    }
    }


    /** @hide */
    public int getSplitScreenCreateMode() {
        return mSplitScreenCreateMode;
    }

    /** @hide */
    /** @hide */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    public void setSplitScreenCreateMode(int splitScreenCreateMode) {
    public void setSplitScreenCreateMode(int splitScreenCreateMode) {
        mSplitScreenCreateMode = splitScreenCreateMode;
        // Remove this method after @UnsupportedAppUsage can be removed.
    }
    }


    /** @hide */
    /** @hide */
@@ -1709,9 +1693,6 @@ public class ActivityOptions {
        if (mFreezeRecentTasksReordering) {
        if (mFreezeRecentTasksReordering) {
            b.putBoolean(KEY_FREEZE_RECENT_TASKS_REORDERING, 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) {
        if (mDisallowEnterPictureInPictureWhileLaunching) {
            b.putBoolean(KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING,
            b.putBoolean(KEY_DISALLOW_ENTER_PICTURE_IN_PICTURE_WHILE_LAUNCHING,
                    mDisallowEnterPictureInPictureWhileLaunching);
                    mDisallowEnterPictureInPictureWhileLaunching);
+4 −32
Original line number Original line Diff line number Diff line
@@ -16,6 +16,8 @@


package android.app;
package android.app;


import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;

import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.annotation.RequiresPermission;
import android.annotation.SystemService;
import android.annotation.SystemService;
@@ -57,20 +59,6 @@ public class ActivityTaskManager {
     */
     */
    public static final int INVALID_TASK_ID = -1;
    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
     * Input parameter to {@link IActivityTaskManager#resizeTask} which indicates
     * that the resize doesn't need to preserve the window, and can be skipped if bounds
     * 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.
     * Moves the input task to the primary-split-screen stack.
     * @param taskId Id of task to move.
     * @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 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.
     * @return Whether the task was successfully put into splitscreen.
     */
     */
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
    public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, int createMode, boolean toTop,
    public boolean setTaskWindowingModeSplitScreenPrimary(int taskId, boolean toTop) {
            boolean animate, Rect initialBounds, boolean showRecents) throws SecurityException {
        return setTaskWindowingMode(taskId, WINDOWING_MODE_SPLIT_SCREEN_PRIMARY, toTop);
        try {
            return getService().setTaskWindowingModeSplitScreenPrimary(taskId, toTop);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }
    }


    /**
    /**
+1 −1
Original line number Original line Diff line number Diff line
@@ -218,7 +218,7 @@ interface IActivityTaskManager {
     */
     */
    boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
    boolean setTaskWindowingMode(int taskId, int windowingMode, boolean toTop);
    void moveTaskToRootTask(int taskId, int rootTaskId, 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
     * Removes root tasks in the input windowing modes from the system if they are of activity type
     * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
     * ACTIVITY_TYPE_STANDARD or ACTIVITY_TYPE_UNDEFINED
+21 −21
Original line number Original line Diff line number Diff line
@@ -503,6 +503,9 @@ public class LegacySplitScreenController implements LegacySplitScreen,
                    || isSplitActive()) {
                    || isSplitActive()) {
                return false;
                return false;
            }
            }
        } catch (RemoteException e) {
            return false;
        }


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


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


    @Override
    @Override
Loading