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

Commit 8577a05d authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Removed Task.mStack (61/n)

Use getTaskStack() to get the information instead.
Makes it easier to switch TaskStack to have TaskRecord children type
vs Task.

Bug: 80414790
Test: Existing tests pass
Change-Id: I1e9feb04ad6b01d8de864619cd5da47868754bfa
parent f3946a63
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1167,7 +1167,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    TaskStack getStack() {
        final Task task = getTask();
        if (task != null) {
            return task.mStack;
            return task.getTaskStack();
        } else {
            return null;
        }
@@ -1210,8 +1210,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            if (getDisplayContent() != null) {
                getDisplayContent().mClosingApps.remove(this);
            }
        } else if (mLastParent != null && mLastParent.mStack != null) {
            task.mStack.mExitingActivities.remove(this);
        } else if (mLastParent != null && mLastParent.getTaskStack() != null) {
            task.getTaskStack().mExitingActivities.remove(this);
        }
        final TaskStack stack = getStack();

+4 −4
Original line number Diff line number Diff line
@@ -1628,7 +1628,7 @@ class RootActivityContainer extends ConfigurationContainer
        return false;
    }

    <T extends ActivityStack> T getLaunchStack(@Nullable ActivityRecord r,
    ActivityStack getLaunchStack(@Nullable ActivityRecord r,
            @Nullable ActivityOptions options, @Nullable TaskRecord candidateTask, boolean onTop) {
        return getLaunchStack(r, options, candidateTask, onTop, null /* launchParams */,
                -1 /* no realCallingPid */, -1 /* no realCallingUid */);
@@ -1646,7 +1646,7 @@ class RootActivityContainer extends ConfigurationContainer
     *
     * @return The stack to use for the launch or INVALID_STACK_ID.
     */
    <T extends ActivityStack> T getLaunchStack(@Nullable ActivityRecord r,
    ActivityStack getLaunchStack(@Nullable ActivityRecord r,
            @Nullable ActivityOptions options, @Nullable TaskRecord candidateTask, boolean onTop,
            @Nullable LaunchParamsController.LaunchParams launchParams, int realCallingPid,
            int realCallingUid) {
@@ -1674,7 +1674,7 @@ class RootActivityContainer extends ConfigurationContainer
        }

        final int activityType = resolveActivityType(r, options, candidateTask);
        T stack;
        ActivityStack stack;

        // Next preference for stack goes to the display Id set the candidate display.
        if (launchParams != null && launchParams.mPreferredDisplayId != INVALID_DISPLAY) {
@@ -1690,7 +1690,7 @@ class RootActivityContainer extends ConfigurationContainer
        if (displayId != INVALID_DISPLAY && (canLaunchOnDisplay(r, displayId)
                || canLaunchOnDisplayFromStartRequest)) {
            if (r != null) {
                stack = (T) getValidLaunchStackOnDisplay(displayId, r, candidateTask, options,
                stack = getValidLaunchStackOnDisplay(displayId, r, candidateTask, options,
                        launchParams);
                if (stack != null) {
                    return stack;
+18 −17
Original line number Diff line number Diff line
@@ -67,8 +67,6 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta

    final ActivityTaskManagerService mAtmService;

    // TODO: Track parent marks like this in WindowContainer.
    TaskStack mStack;
    /* Unique identifier for this task. */
    final int mTaskId;
    /* User for which this task was created. */
@@ -128,7 +126,6 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
        super(atm.mWindowManager);
        mAtmService = atm;
        mTaskId = taskId;
        mStack = stack;
        mUserId = userId;
        mResizeMode = resizeMode;
        mSupportsPictureInPicture = supportsPictureInPicture;
@@ -139,12 +136,16 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
        // Tasks have no set orientation value (including SCREEN_ORIENTATION_UNSPECIFIED).
        setOrientation(SCREEN_ORIENTATION_UNSET);
        // TODO(task-merge): Is this really needed?
        setBounds(getResolvedOverrideBounds());
        //setBounds(getResolvedOverrideBounds());
    }

    @Override
    DisplayContent getDisplayContent() {
        return mStack != null ? mStack.getDisplayContent() : null;
        return getTaskStack() != null ? getTaskStack().getDisplayContent() : null;
    }

    TaskStack getTaskStack() {
        return (TaskStack) getParent();
    }

    int getAdjustedAddPosition(ActivityRecord r, int suggestedPosition) {
@@ -199,7 +200,7 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
            // No reason to defer removal of a Task that doesn't have any child.
            return false;
        }
        return hasWindowsAlive() && mStack.isAnimating(TRANSITION | CHILDREN);
        return hasWindowsAlive() && getTaskStack().isAnimating(TRANSITION | CHILDREN);
    }

    @Override
@@ -221,10 +222,10 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
    // TODO: Consolidate this with TaskRecord.reparent()
    void reparent(TaskStack stack, int position, boolean moveParents, String reason) {
        if (DEBUG_STACK) Slog.i(TAG, "reParentTask: removing taskId=" + mTaskId
                + " from stack=" + mStack);
                + " from stack=" + getTaskStack());
        EventLog.writeEvent(WM_TASK_REMOVED, mTaskId, "reParentTask");

        final ActivityStack prevStack = mStack.mActivityStack;
        final ActivityStack prevStack = getTaskStack().mActivityStack;
        final boolean wasTopFocusedStack =
                mAtmService.mRootActivityContainer.isTopDisplayFocusedStack(prevStack);
        final ActivityDisplay prevStackDisplay = prevStack.getDisplay();
@@ -236,7 +237,6 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
            prevStack.moveHomeStackToFrontIfNeeded(wasTopFocusedStack, prevStackDisplay, reason);
        }

        mStack = stack;
        stack.positionChildAt(position, this, moveParents);

        // If we are moving from the fullscreen stack to the pinned stack then we want to preserve
@@ -247,7 +247,7 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta

    /** @see ActivityTaskManagerService#positionTaskInStack(int, int, int). */
    void positionAt(int position) {
        mStack.positionChildAt(position, this, false /* includingParents */);
        getTaskStack().positionChildAt(position, this, false /* includingParents */);
    }

    void setSendingToBottom(boolean toBottom) {
@@ -271,7 +271,8 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
    @Override
    public int setBounds(Rect bounds) {
        int rotation = Surface.ROTATION_0;
        final DisplayContent displayContent = mStack != null ? mStack.getDisplayContent() : null;
        final DisplayContent displayContent = getTaskStack() != null
                ? getTaskStack().getDisplayContent() : null;
        if (displayContent != null) {
            rotation = displayContent.getDisplayInfo().rotation;
        } else if (bounds == null) {
@@ -462,7 +463,7 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta

    /** Bounds of the task to be used for dimming, as well as touch related tests. */
    public void getDimBounds(Rect out) {
        final DisplayContent displayContent = mStack.getDisplayContent();
        final DisplayContent displayContent = getTaskStack().getDisplayContent();
        // It doesn't matter if we in particular are part of the resize, since we couldn't have
        // a DimLayer anyway if we weren't visible.
        final boolean dockedResizing = displayContent != null
@@ -479,9 +480,9 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
            // stack bounds and so we don't even want to use them. Even if the app should not be
            // resized the Dim should keep up with the divider.
            if (dockedResizing) {
                mStack.getBounds(out);
                getTaskStack().getBounds(out);
            } else {
                mStack.getBounds(mTmpRect);
                getTaskStack().getBounds(mTmpRect);
                mTmpRect.intersect(getBounds());
                out.set(mTmpRect);
            }
@@ -494,9 +495,9 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
    void setDragResizing(boolean dragResizing, int dragResizeMode) {
        if (mDragResizing != dragResizing) {
            // No need to check if the mode is allowed if it's leaving dragResize
            if (dragResizing && !DragResizeMode.isModeAllowedForStack(mStack, dragResizeMode)) {
            if (dragResizing && !DragResizeMode.isModeAllowedForStack(getTaskStack(), dragResizeMode)) {
                throw new IllegalArgumentException("Drag resize mode not allow for stack stackId="
                        + mStack.mStackId + " dragResizeMode=" + dragResizeMode);
                        + getTaskStack().mStackId + " dragResizeMode=" + dragResizeMode);
            }
            mDragResizing = dragResizing;
            mDragResizeMode = dragResizeMode;
@@ -586,7 +587,7 @@ class Task extends WindowContainer<ActivityRecord> implements ConfigurationConta
     */
    boolean isFloating() {
        return getWindowConfiguration().tasksAreFloating()
                && !mStack.isAnimatingBoundsToFullscreen() && !mPreserveNonFloatingState;
                && !getTaskStack().isAnimatingBoundsToFullscreen() && !mPreserveNonFloatingState;
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -441,7 +441,7 @@ class TaskPositioner implements IBinder.DeathRecipient {
        }

        // This is a moving or scrolling operation.
        mTask.mStack.getDimBounds(mTmpRect);
        mTask.getTaskStack().getDimBounds(mTmpRect);
        // If a target window is covered by system bar, there is no way to move it again by touch.
        // So we exclude them from stack bounds. and then it will be shown inside stable area.
        Rect stableBounds = new Rect();
+2 −2
Original line number Diff line number Diff line
@@ -835,8 +835,8 @@ class TaskRecord extends Task {
        mNextAffiliateTaskId = nextAffiliate == null ? INVALID_TASK_ID : nextAffiliate.mTaskId;
    }

    <T extends ActivityStack> T getStack() {
        return (T) mStack;
    ActivityStack getStack() {
        return mStack;
    }

    // TODO(stack-unify): Can be removed on stack unified.
Loading