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

Commit 58906532 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Merge cherrypicks of [14346182] into sc-release

Change-Id: I852530bd422c6a00d99ccb27e136c8880c8edace
parents eb64f5fb a38ef5ea
Loading
Loading
Loading
Loading
+0 −39
Original line number Diff line number Diff line
@@ -338,33 +338,6 @@ public final class WindowContainerTransaction implements Parcelable {
        return this;
    }

    /**
     * Sets the container as launch adjacent flag root. Task starting with
     * {@link FLAG_ACTIVITY_LAUNCH_ADJACENT} will be launching to.
     *
     * @hide
     */
    @NonNull
    public WindowContainerTransaction setLaunchAdjacentFlagRoot(
            @NonNull WindowContainerToken container) {
        mHierarchyOps.add(HierarchyOp.createForSetLaunchAdjacentFlagRoot(container.asBinder(),
                false /* clearRoot */));
        return this;
    }

    /**
     * Clears launch adjacent flag root for the display area of passing container.
     *
     * @hide
     */
    @NonNull
    public WindowContainerTransaction clearLaunchAdjacentFlagRoot(
            @NonNull WindowContainerToken container) {
        mHierarchyOps.add(HierarchyOp.createForSetLaunchAdjacentFlagRoot(container.asBinder(),
                true /* clearRoot */));
        return this;
    }

    /**
     * Starts a task by id. The task is expected to already exist (eg. as a recent task).
     * @param taskId Id of task to start.
@@ -704,7 +677,6 @@ public final class WindowContainerTransaction implements Parcelable {
        public static final int HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT = 3;
        public static final int HIERARCHY_OP_TYPE_SET_ADJACENT_ROOTS = 4;
        public static final int HIERARCHY_OP_TYPE_LAUNCH_TASK = 5;
        public static final int HIERARCHY_OP_TYPE_SET_LAUNCH_ADJACENT_FLAG_ROOT = 6;

        // The following key(s) are for use with mLaunchOptions:
        // When launching a task (eg. from recents), this is the taskId to be launched.
@@ -762,14 +734,6 @@ public final class WindowContainerTransaction implements Parcelable {
                    fullOptions);
        }

        /** Create a hierarchy op for setting launch adjacent flag root. */
        public static HierarchyOp createForSetLaunchAdjacentFlagRoot(IBinder container,
                boolean clearRoot) {
            return new HierarchyOp(HIERARCHY_OP_TYPE_SET_LAUNCH_ADJACENT_FLAG_ROOT, container, null,
                    null, null, clearRoot, null);
        }


        private HierarchyOp(int type, @Nullable IBinder container, @Nullable IBinder reparent,
                int[] windowingModes, int[] activityTypes, boolean toTop,
                @Nullable Bundle launchOptions) {
@@ -865,9 +829,6 @@ public final class WindowContainerTransaction implements Parcelable {
                            + " adjacentRoot=" + mReparent + "}";
                case HIERARCHY_OP_TYPE_LAUNCH_TASK:
                    return "{LaunchTask: " + mLaunchOptions + "}";
                case HIERARCHY_OP_TYPE_SET_LAUNCH_ADJACENT_FLAG_ROOT:
                    return "{SetAdjacentFlagRoot: container=" + mContainer + " clearRoot=" + mToTop
                            + "}";
                default:
                    return "{mType=" + mType + " container=" + mContainer + " reparent=" + mReparent
                            + " mToTop=" + mToTop + " mWindowingMode=" + mWindowingModes
+0 −3
Original line number Diff line number Diff line
@@ -337,7 +337,6 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
            final WindowContainerTransaction wct = new WindowContainerTransaction();
            // Make the stages adjacent to each other so they occlude what's behind them.
            wct.setAdjacentRoots(mMainStage.mRootTaskInfo.token, mSideStage.mRootTaskInfo.token);
            wct.setLaunchAdjacentFlagRoot(mSideStage.mRootTaskInfo.token);
            mTaskOrganizer.applyTransaction(wct);
        }
    }
@@ -347,7 +346,6 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
            final WindowContainerTransaction wct = new WindowContainerTransaction();
            // Deactivate the main stage if it no longer has a root task.
            mMainStage.deactivate(wct);
            wct.clearLaunchAdjacentFlagRoot(mSideStage.mRootTaskInfo.token);
            mTaskOrganizer.applyTransaction(wct);
        }
    }
@@ -451,7 +449,6 @@ class StageCoordinator implements SplitLayout.LayoutChangeListener,
            final WindowContainerTransaction wct = new WindowContainerTransaction();
            // Make sure the main stage is active.
            mMainStage.activate(getMainStageBounds(), wct);
            mSideStage.setBounds(getSideStageBounds(), wct);
            mTaskOrganizer.applyTransaction(wct);
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -2761,8 +2761,8 @@ class ActivityStarter {

        final boolean onTop =
                (aOptions == null || !aOptions.getAvoidMoveToFront()) && !mLaunchTaskBehind;
        return mRootWindowContainer.getLaunchRootTask(r, aOptions, task, mSourceRootTask, onTop,
                mLaunchParams, launchFlags, mRequest.realCallingPid, mRequest.realCallingUid);
        return mRootWindowContainer.getLaunchRootTask(r, aOptions, task, onTop, mLaunchParams,
                mRequest.realCallingPid, mRequest.realCallingUid);
    }

    private boolean isLaunchModeOneOf(int mode1, int mode2) {
+10 −14
Original line number Diff line number Diff line
@@ -2810,11 +2810,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        return false;
    }

    Task getLaunchRootTask(@Nullable ActivityRecord r, @Nullable ActivityOptions options,
            @Nullable Task candidateTask, boolean onTop) {
        return getLaunchRootTask(r, options, candidateTask, null /* sourceTask */, onTop,
                null /* launchParams */, 0 /* launchFlags */, -1 /* no realCallingPid */,
                -1 /* no realCallingUid */);
    Task getLaunchRootTask(@Nullable ActivityRecord r,
            @Nullable ActivityOptions options, @Nullable Task candidateTask, boolean onTop) {
        return getLaunchRootTask(r, options, candidateTask, onTop, null /* launchParams */,
                -1 /* no realCallingPid */, -1 /* no realCallingUid */);
    }

    /**
@@ -2823,18 +2822,15 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
     * @param r              The activity we are trying to launch. Can be null.
     * @param options        The activity options used to the launch. Can be null.
     * @param candidateTask  The possible task the activity might be launched in. Can be null.
     * @param sourceTask     The task requesting to start activity. Can be null.
     * @param launchParams   The resolved launch params to use.
     * @param launchFlags    The launch flags for this launch.
     * @param realCallingPid The pid from {@link ActivityStarter#setRealCallingPid}
     * @param realCallingUid The uid from {@link ActivityStarter#setRealCallingUid}
     * @return The root task to use for the launch or INVALID_TASK_ID.
     */
    Task getLaunchRootTask(@Nullable ActivityRecord r,
            @Nullable ActivityOptions options, @Nullable Task candidateTask,
            @Nullable Task sourceTask, boolean onTop,
            @Nullable LaunchParamsController.LaunchParams launchParams, int launchFlags,
            int realCallingPid, int realCallingUid) {
            @Nullable ActivityOptions options, @Nullable Task candidateTask, boolean onTop,
            @Nullable LaunchParamsController.LaunchParams launchParams, int realCallingPid,
            int realCallingUid) {
        int taskId = INVALID_TASK_ID;
        int displayId = INVALID_DISPLAY;
        TaskDisplayArea taskDisplayArea = null;
@@ -2898,7 +2894,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
                // Falling back to default task container
                taskDisplayArea = taskDisplayArea.mDisplayContent.getDefaultTaskDisplayArea();
                rootTask = taskDisplayArea.getOrCreateRootTask(r, options, candidateTask,
                        sourceTask, launchParams, launchFlags, activityType, onTop);
                        launchParams, activityType, onTop);
                if (rootTask != null) {
                    return rootTask;
                }
@@ -2953,8 +2949,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            }
        }

        return container.getOrCreateRootTask(r, options, candidateTask, sourceTask, launchParams,
                launchFlags, activityType, onTop);
        return container.getOrCreateRootTask(
                r, options, candidateTask, launchParams, activityType, onTop);
    }

    /** @return true if activity record is null or can be launched on provided display. */
+1 −27
Original line number Diff line number Diff line
@@ -7952,17 +7952,6 @@ class Task extends WindowContainer<WindowContainer> {
        private boolean mHasBeenVisible;
        private boolean mRemoveWithTaskOrganizer;

        /**
         * Records the source task that requesting to build a new task, used to determine which of
         * the adjacent roots should be launch root of the new task.
         */
        private Task mSourceTask;

        /**
         * Records launch flags to apply when launching new task.
         */
        private int mLaunchFlags;

        Builder(ActivityTaskManagerService atm) {
            mAtmService = atm;
        }
@@ -7972,16 +7961,6 @@ class Task extends WindowContainer<WindowContainer> {
            return this;
        }

        Builder setSourceTask(Task sourceTask) {
            mSourceTask = sourceTask;
            return this;
        }

        Builder setLaunchFlags(int launchFlags) {
            mLaunchFlags = launchFlags;
            return this;
        }

        Builder setTaskId(int taskId) {
            mTaskId = taskId;
            return this;
@@ -8236,14 +8215,9 @@ class Task extends WindowContainer<WindowContainer> {
                tda.getRootPinnedTask().dismissPip();
            }

            if (mIntent != null) {
                mLaunchFlags |= mIntent.getFlags();
            }

            // Task created by organizer are added as root.
            final Task launchRootTask = mCreatedByOrganizer
                    ? null : tda.getLaunchRootTask(mWindowingMode, mActivityType, mActivityOptions,
                    mSourceTask, mLaunchFlags);
                    ? null : tda.getLaunchRootTask(mWindowingMode, mActivityType, mActivityOptions);
            if (launchRootTask != null) {
                // Since this task will be put into a root task, its windowingMode will be
                // inherited.
Loading