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

Commit 9497e10f authored by Wale Ogunwale's avatar Wale Ogunwale Committed by Android (Google) Code Review
Browse files

Merge changes Ibc47b63f,Ie625bf87,Ic9c6ea02

* changes:
  Renamed some getXXXStack methods to getRootXXXTask (87/n)
  Removed mStackId (86/n)
  Rename TaskStackContainers to TaskContainers (85/n)
parents 2eb5cc7b 734b896c
Loading
Loading
Loading
Loading
+38 −41
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ import static android.app.ActivityOptions.ANIM_THUMBNAIL_ASPECT_SCALE_UP;
import static android.app.ActivityOptions.ANIM_THUMBNAIL_SCALE_DOWN;
import static android.app.ActivityOptions.ANIM_THUMBNAIL_SCALE_UP;
import static android.app.ActivityOptions.ANIM_UNDEFINED;
import static android.app.ActivityTaskManager.INVALID_STACK_ID;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.OP_PICTURE_IN_PICTURE;
@@ -1426,7 +1425,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                return null;
            }
            ActivityRecord r = token.weakActivity.get();
            if (r == null || r.getActivityStack() == null) {
            if (r == null || r.getRootTask() == null) {
                return null;
            }
            return r;
@@ -2055,19 +2054,17 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
    }

    /**
     * @return Stack value from current task, null if there is no task.
     */
    ActivityStack getActivityStack() {
        return task != null ? task.getStack() : null;
    /** @return Root task of this activity, null if there is no task. */
    ActivityStack getRootTask() {
        return task != null ? (ActivityStack) task.getRootTask() : null;
    }

    int getStackId() {
        return getActivityStack() != null ? getActivityStack().mStackId : INVALID_STACK_ID;
    int getRootTaskId() {
        return task != null ? task.getRootTaskId() : INVALID_TASK_ID;
    }

    DisplayContent getDisplay() {
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        return stack != null ? stack.getDisplay() : null;
    }

@@ -2088,7 +2085,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mWmService.mWindowPlacerLocked.requestTraversal();

        if (changed && task != null && !occludesParent) {
            getActivityStack().convertActivityToTranslucent(this);
            getRootTask().convertActivityToTranslucent(this);
        }
        // Always ensure visibility if this activity doesn't occlude parent, so the
        // {@link #returningOptions} of the activity under this one can be applied in
@@ -2123,7 +2120,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    boolean isInStackLocked() {
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        return stack != null && stack.isInStackLocked(this) != null;
    }

@@ -2226,7 +2223,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        boolean isCurrentAppLocked =
                mAtmService.getLockTaskModeState() != LOCK_TASK_MODE_NONE;
        final DisplayContent display = getDisplay();
        boolean hasPinnedStack = display != null && display.hasPinnedStack();
        boolean hasPinnedStack = display != null && display.hasPinnedTask();
        // Don't return early if !isNotLocked, since we want to throw an exception if the activity
        // is in an incorrect state
        boolean isNotLockedOrOnKeyguard = !isKeyguardLocked && !isCurrentAppLocked;
@@ -2325,7 +2322,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return false;
        }

        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (stack == null) {
            Slog.w(TAG, "moveActivityStackToFront: invalid task or stack: activity="
                    + this + " task=" + task);
@@ -2456,7 +2453,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return FINISH_RESULT_CANCELLED;
        }

        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        final boolean mayAdjustTop = (isState(RESUMED) || stack.mResumedActivity == null)
                && stack.isFocusedStackOnDisplay();
        final boolean shouldAdjustGlobalFocus = mayAdjustTop
@@ -2497,7 +2494,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    final DisplayContent display = stack.getDisplay();
                    next = display.topRunningActivity();
                    if (next != null) {
                        display.positionStackAtTop(next.getActivityStack(),
                        display.positionStackAtTop(next.getRootTask(),
                                false /* includingParents */, "finish-display-top");
                    }
                }
@@ -2666,13 +2663,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mStackSupervisor.mStoppingActivities.remove(this);
        mStackSupervisor.mGoingToSleepActivities.remove(this);

        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        final DisplayContent display = getDisplay();
        // TODO(b/137329632): Exclude current activity when looking for the next one with
        // DisplayContent#topRunningActivity().
        final ActivityRecord next = display.topRunningActivity();
        final boolean isLastStackOverEmptyHome =
                next == null && stack.isFocusedStackOnDisplay() && display.getHomeStack() != null;
                next == null && stack.isFocusedStackOnDisplay() && display.getRootHomeTask() != null;
        if (isLastStackOverEmptyHome) {
            // Don't destroy activity immediately if this is the last activity on the display and
            // the display contains home stack. Although there is no next activity at the moment,
@@ -2824,7 +2821,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    boolean safelyDestroy(String reason) {
        if (isDestroyable()) {
            if (DEBUG_SWITCH) {
                final ActivityStack stack = getActivityStack();
                final ActivityStack stack = getRootTask();
                Slog.v(TAG_SWITCH, "Safely destroying " + this + " in state " + getState()
                        + " resumed=" + stack.mResumedActivity
                        + " pausing=" + stack.mPausingActivity
@@ -3612,7 +3609,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    final boolean isSleeping() {
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        return stack != null ? stack.shouldSleepActivities() : mAtmService.isSleepingLocked();
    }

@@ -3827,7 +3824,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

                // Notify the pinned stack upon all windows drawn. If there was an animation in
                // progress then this signal will resume that animation.
                final ActivityStack pinnedStack = mDisplayContent.getPinnedStack();
                final ActivityStack pinnedStack = mDisplayContent.getRootPinnedTask();
                if (pinnedStack != null) {
                    pinnedStack.onAllWindowsDrawn();
                }
@@ -4449,7 +4446,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return visibleIgnoringKeyguard;
        }

        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (stack == null) {
            return false;
        }
@@ -4471,7 +4468,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }

    boolean shouldBeVisible() {
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (stack == null) {
            return false;
        }
@@ -4492,7 +4489,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // If this activity is paused, tell it to now show its window.
        if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY,
                "Making visible and scheduling visibility: " + this);
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        try {
            if (stack.mTranslucentActivityWaiting != null) {
                updateOptionsLocked(returningOptions);
@@ -4578,7 +4575,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            if (DEBUG_VISIBILITY) {
                Slog.v(TAG_VISIBILITY, "Resume visible activity, " + this);
            }
            return getActivityStack().resumeTopActivityUncheckedLocked(activeActivity /* prev */,
            return getRootTask().resumeTopActivityUncheckedLocked(activeActivity /* prev */,
                    null /* options */);
        } else if (shouldPauseActivity(activeActivity)) {
            if (DEBUG_VISIBILITY) {
@@ -4643,7 +4640,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     */
    private boolean shouldBeResumed(ActivityRecord activeActivity) {
        return shouldMakeActive(activeActivity) && isFocusable()
                && getActivityStack().getVisibility(activeActivity) == STACK_VISIBILITY_VISIBLE
                && getRootTask().getVisibility(activeActivity) == STACK_VISIBILITY_VISIBLE
                && canResumeByCompat();
    }

@@ -4672,7 +4669,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // ActivityStack#ensureActivitiesVisible will bring the activity to a proper
        // active state.
        if (!isState(STARTED, RESUMED, PAUSED, STOPPED, STOPPING)
                || getActivityStack().mTranslucentActivityWaiting != null) {
                || getRootTask().mTranslucentActivityWaiting != null) {
            return false;
        }

@@ -4769,7 +4766,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mStackSupervisor.reportResumedActivityLocked(this);

        resumeKeyDispatchingLocked();
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        mStackSupervisor.mNoAnimActivities.clear();

        // Mark the point when the activity is resuming
@@ -4862,7 +4859,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    void stopIfPossible() {
        if (DEBUG_SWITCH) Slog.d(TAG_SWITCH, "Stopping: " + this);
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (isNoHistory()) {
            if (!finishing) {
                if (!stack.shouldSleepActivities()) {
@@ -4919,7 +4916,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    void activityStopped(Bundle newIcicle, PersistableBundle newPersistentState,
            CharSequence description) {
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        final boolean isStopping = mState == STOPPING;
        if (!isStopping && mState != RESTARTING_PROCESS) {
            Slog.i(TAG, "Activity reported stop, but no longer stopping: " + this);
@@ -4969,7 +4966,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            mStackSupervisor.mStoppingActivities.add(this);
        }

        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        // If we already have a few activities waiting to stop, then give up on things going idle
        // and start clearing them out. Or if r is the last of activity of the last task the stack
        // will be empty and must be cleared immediately.
@@ -5005,7 +5002,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return false;
        }

        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (stack == null) {
            return false;
        }
@@ -5021,7 +5018,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    void finishLaunchTickingLocked() {
        launchTickTime = 0;
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (stack == null) {
            return;
        }
@@ -5491,13 +5488,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

    static ActivityRecord isInStackLocked(IBinder token) {
        final ActivityRecord r = ActivityRecord.forTokenLocked(token);
        return (r != null) ? r.getActivityStack().isInStackLocked(r) : null;
        return (r != null) ? r.getRootTask().isInStackLocked(r) : null;
    }

    static ActivityStack getStackLocked(IBinder token) {
        final ActivityRecord r = ActivityRecord.isInStackLocked(token);
        if (r != null) {
            return r.getActivityStack();
            return r.getRootTask();
        }
        return null;
    }
@@ -5507,7 +5504,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *         {@link android.view.Display#INVALID_DISPLAY} if not attached.
     */
    int getDisplayId() {
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (stack == null) {
            return INVALID_DISPLAY;
        }
@@ -5519,7 +5516,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            // This would be redundant.
            return false;
        }
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (isState(RESUMED) || stack == null || this == stack.mPausingActivity || !mHaveState
                || !stopped) {
            // We're not ready for this kind of thing.
@@ -6715,7 +6712,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    void savePinnedStackBounds() {
        // Leaving PiP to fullscreen, save the snap fraction based on the pre-animation bounds
        // for the next re-entry into PiP (assuming the activity is not hidden or destroyed)
        final ActivityStack pinnedStack = mDisplayContent.getPinnedStack();
        final ActivityStack pinnedStack = mDisplayContent.getRootPinnedTask();
        if (pinnedStack == null) return;
        final Rect stackBounds;
        if (pinnedStack.lastAnimatingBoundsWasToFullscreen()) {
@@ -6755,7 +6752,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    private void applyAspectRatio(Rect outBounds, Rect containingAppBounds,
            Rect containingBounds) {
        final float maxAspectRatio = info.maxAspectRatio;
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        final float minAspectRatio = info.minAspectRatio;

        if (task == null || stack == null || (inMultiWindowMode() && !shouldUseSizeCompatMode())
@@ -6861,7 +6858,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     */
    boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow,
            boolean ignoreVisibility) {
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        if (stack.mConfigWillChange) {
            if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
                    "Skipping config check (will change): " + this);
@@ -7406,7 +7403,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (!getTurnScreenOnFlag()) {
            return false;
        }
        final ActivityStack stack = getActivityStack();
        final ActivityStack stack = getRootTask();
        return stack != null &&
                stack.checkKeyguardVisibility(this, true /* shouldBeVisible */, true /* isTop */);
    }
+18 −30
Original line number Diff line number Diff line
@@ -277,9 +277,6 @@ class ActivityStack extends Task implements BoundsAnimationTarget {

    int mCurrentUser;

    /** Unique identifier */
    final int mStackId;

    /** For comparison with DisplayContent bounds. */
    private Rect mTmpRect = new Rect();
    private Rect mTmpRect2 = new Rect();
@@ -633,7 +630,6 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
                _realActivitySuspended, userSetupComplete, minWidth, minHeight, info, _voiceSession,
                _voiceInteractor, stack);

        mStackId = mTaskId;
        mDockedStackMinimizeThickness = mWmService.mContext.getResources().getDimensionPixelSize(
                com.android.internal.R.dimen.docked_stack_minimize_thickness);
        EventLogTags.writeWmStackCreated(id);
@@ -732,11 +728,11 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
                setBounds(newBounds);
                newBounds.set(newBounds);
            } else if (overrideWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
                Rect dockedBounds = display.getSplitScreenPrimaryStack().getBounds();
                Rect dockedBounds = display.getRootSplitScreenPrimaryTask().getBounds();
                final boolean isMinimizedDock =
                        display.mDisplayContent.getDockedDividerController().isMinimizedDock();
                if (isMinimizedDock) {
                    Task topTask = display.getSplitScreenPrimaryStack().getTopMostTask();
                    Task topTask = display.getRootSplitScreenPrimaryTask().getTopMostTask();
                    if (topTask != null) {
                        dockedBounds = topTask.getBounds();
                    }
@@ -830,7 +826,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
        final int currentOverrideMode = getRequestedOverrideWindowingMode();
        final DisplayContent display = getDisplay();
        final Task topTask = getTopMostTask();
        final ActivityStack splitScreenStack = display.getSplitScreenPrimaryStack();
        final ActivityStack splitScreenStack = display.getRootSplitScreenPrimaryTask();
        int windowingMode = preferredWindowingMode;
        if (preferredWindowingMode == WINDOWING_MODE_UNDEFINED
                && isTransientWindowingMode(currentMode)) {
@@ -851,7 +847,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
            windowingMode = mRestoreOverrideWindowingMode;
        }

        final boolean alreadyInSplitScreenMode = display.hasSplitScreenPrimaryStack();
        final boolean alreadyInSplitScreenMode = display.hasSplitScreenPrimaryTask();

        // Don't send non-resizeable notifications if the windowing mode changed was a side effect
        // of us entering split-screen mode.
@@ -868,7 +864,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
                // warning toast about it.
                mAtmService.getTaskChangeNotificationController()
                        .notifyActivityDismissingDockedStack();
                final ActivityStack primarySplitStack = display.getSplitScreenPrimaryStack();
                final ActivityStack primarySplitStack = display.getRootSplitScreenPrimaryTask();
                primarySplitStack.setWindowingModeInSurfaceTransaction(WINDOWING_MODE_UNDEFINED,
                        false /* animate */, false /* showRecents */,
                        false /* enteringSplitScreenMode */, true /* deferEnsuringVisibility */,
@@ -1118,7 +1114,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
            return null;
        }
        final Task task = r.getTask();
        final ActivityStack stack = r.getActivityStack();
        final ActivityStack stack = r.getRootTask();
        if (stack != null && task.mChildren.contains(r) && mChildren.contains(task)) {
            if (stack != this) Slog.w(TAG,
                    "Illegal state! task does not point to stack it is in.");
@@ -1165,7 +1161,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
            final ActivityStack topFullScreenStack =
                    display.getTopStackInWindowingMode(WINDOWING_MODE_FULLSCREEN);
            if (topFullScreenStack != null) {
                final ActivityStack primarySplitScreenStack = display.getSplitScreenPrimaryStack();
                final ActivityStack primarySplitScreenStack = display.getRootSplitScreenPrimaryTask();
                if (display.getIndexOf(topFullScreenStack)
                        > display.getIndexOf(primarySplitScreenStack)) {
                    primarySplitScreenStack.moveToFront(reason + " splitScreenToTop");
@@ -1347,7 +1343,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {

    private boolean containsActivityFromStack(List<ActivityRecord> rs) {
        for (ActivityRecord r : rs) {
            if (r.getActivityStack() == this) {
            if (r.getRootTask() == this) {
                return true;
            }
        }
@@ -1563,7 +1559,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
        // focus). Also if there is an active pinned stack - we always want to notify it about
        // task stack changes, because its positioning may depend on it.
        if (mStackSupervisor.mAppVisibilitiesChangedSinceLastPause
                || (getDisplay() != null && getDisplay().hasPinnedStack())) {
                || (getDisplay() != null && getDisplay().hasPinnedTask())) {
            mAtmService.getTaskChangeNotificationController().notifyTaskStackChanged();
            mStackSupervisor.mAppVisibilitiesChangedSinceLastPause = false;
        }
@@ -1873,7 +1869,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
        final DisplayContent displayContent = getDisplay();
        if (displayContent == null) {
            throw new IllegalStateException("Stack is not attached to any display, stackId="
                    + mStackId);
                    + getRootTaskId());
        }

        final int flags = displayContent.mDisplay.getFlags();
@@ -2592,7 +2588,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
            return false;
        }
        final ActivityStack targetStack = toFrontTask != null
                ? toFrontTask.getStack() : toFrontActivity.getActivityStack();
                ? toFrontTask.getStack() : toFrontActivity.getRootTask();
        if (targetStack != null && targetStack.isActivityTypeAssistant()) {
            // Ensure the task/activity being brought forward is not the assistant
            return false;
@@ -3073,7 +3069,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
        }

        ActivityRecord topActivity = getDisplay().topRunningActivity();
        ActivityStack topStack = topActivity.getActivityStack();
        ActivityStack topStack = topActivity.getRootTask();
        if (topStack != null && topStack != this && topActivity.isState(RESUMED)) {
            // The new top activity is already resumed, so there's a good chance that nothing will
            // get resumed below. So, update visibility now in case the transition is closed
@@ -3102,7 +3098,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
            return;
        }

        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "stack.resize_" + mStackId);
        Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "stack.resize_" + getRootTaskId());
        mAtmService.deferWindowLayout();
        try {
            // Update override configurations of all tasks in the stack.
@@ -3219,7 +3215,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {

    boolean dump(FileDescriptor fd, PrintWriter pw, boolean dumpAll, boolean dumpClient,
            String dumpPackage, boolean needSep) {
        pw.println("  Stack #" + mStackId
        pw.println("  Stack #" + getRootTaskId()
                + ": type=" + activityTypeToString(getActivityType())
                + " mode=" + windowingModeToString(getWindowingMode()));
        pw.println("  isSleeping=" + shouldSleepActivities());
@@ -4484,7 +4480,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {

    @Override
    void dump(PrintWriter pw, String prefix, boolean dumpAll) {
        pw.println(prefix + "mStackId=" + mStackId);
        pw.println(prefix + "mStackId=" + getRootTaskId());
        pw.println(prefix + "mDeferRemoval=" + mDeferRemoval);
        pw.println(prefix + "mBounds=" + getRawBounds().toShortString());
        if (mMinimizeAmount != 0f) {
@@ -4515,14 +4511,6 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
        mAnimatingActivityRegistry.dump(pw, "AnimatingApps:", prefix);
    }

    String getName() {
        return toShortString();
    }

    public String toShortString() {
        return "Stack=" + mStackId;
    }

    /**
     * For docked workspace (or workspace that's side-by-side to the docked), provides
     * information which side of the screen was the dock anchored.
@@ -4731,7 +4719,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
            // activity early for the recents animation prior to the PiP animation starting, there
            // is no subsequent all-drawn signal. In this case, we can skip the pause when the home
            // stack is already visible and drawn.
            final ActivityStack homeStack = mDisplayContent.getHomeStack();
            final ActivityStack homeStack = mDisplayContent.getRootHomeTask();
            if (homeStack == null) {
                return true;
            }
@@ -4863,7 +4851,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {
            @WindowTraceLogLevel int logLevel) {
        final long token = proto.start(fieldId);
        dumpDebugInnerStackOnly(proto, STACK, logLevel);
        proto.write(com.android.server.am.ActivityStackProto.ID, mStackId);
        proto.write(com.android.server.am.ActivityStackProto.ID, getRootTaskId());

        forAllTasks((t) -> {
            t.dumpDebugInner(proto, com.android.server.am.ActivityStackProto.TASKS, logLevel);
@@ -4891,7 +4879,7 @@ class ActivityStack extends Task implements BoundsAnimationTarget {

        final long token = proto.start(fieldId);
        super.dumpDebug(proto, WINDOW_CONTAINER, logLevel);
        proto.write(StackProto.ID, mStackId);
        proto.write(StackProto.ID, getRootTaskId());
        forAllTasks((t) -> {
            t.dumpDebugInnerTaskOnly(proto, StackProto.TASKS, logLevel);
        }, true /* traverseTopToBottom */, this);
+13 −13

File changed.

Preview size limit exceeded, changes collapsed.

+11 −10
Original line number Diff line number Diff line
@@ -937,7 +937,7 @@ class ActivityStarter {
        }

        final ActivityStack resultStack = resultRecord == null
                ? null : resultRecord.getActivityStack();
                ? null : resultRecord.getRootTask();

        if (err != START_SUCCESS) {
            if (resultRecord != null) {
@@ -1365,7 +1365,7 @@ class ActivityStarter {
                    break;
                case WINDOWING_MODE_SPLIT_SCREEN_PRIMARY:
                    final ActivityStack homeStack =
                            startedActivityStack.getDisplay().getHomeStack();
                            startedActivityStack.getDisplay().getRootHomeTask();
                    if (homeStack != null && homeStack.shouldBeVisible(null /* starting */)) {
                        mService.mWindowManager.showRecentApps();
                    }
@@ -1425,7 +1425,7 @@ class ActivityStarter {
     * @return the stack where the successful started activity resides.
     */
    private @Nullable ActivityStack handleStartResult(@NonNull ActivityRecord started, int result) {
        final ActivityStack currentStack = started.getActivityStack();
        final ActivityStack currentStack = started.getRootTask();
        ActivityStack startedActivityStack = currentStack != null ? currentStack : mTargetStack;

        if (ActivityManager.isStartResultSuccessful(result)) {
@@ -1446,7 +1446,7 @@ class ActivityStarter {
        // If we are not able to proceed, disassociate the activity from the task. Leaving an
        // activity in an incomplete state can lead to issues, such as performing operations
        // without a window container.
        final ActivityStack stack = mStartActivity.getActivityStack();
        final ActivityStack stack = mStartActivity.getRootTask();
        if (stack != null) {
            mStartActivity.finishIfPossible("startActivity", true /* oomAdj */);
        }
@@ -2231,7 +2231,7 @@ class ActivityStarter {
            return;
        }
        if (!mSourceRecord.finishing) {
            mSourceStack = mSourceRecord.getActivityStack();
            mSourceStack = mSourceRecord.getRootTask();
            return;
        }

@@ -2314,7 +2314,7 @@ class ActivityStarter {
     * @return {@link ActivityRecord} brought to front.
     */
    private void setTargetStackIfNeeded(ActivityRecord intentActivity) {
        mTargetStack = intentActivity.getActivityStack();
        mTargetStack = intentActivity.getRootTask();
        mTargetStack.mLastPausedActivity = null;
        // If the target task is not in the front, then we need to bring it to the front...
        // except...  well, with SINGLE_TASK_LAUNCH it's not entirely clear. We'd like to have
@@ -2371,7 +2371,7 @@ class ActivityStarter {
        }
        // Need to update mTargetStack because if task was moved out of it, the original stack may
        // be destroyed.
        mTargetStack = intentActivity.getActivityStack();
        mTargetStack = intentActivity.getRootTask();
        mSupervisor.handleNonResizableTaskIfNeeded(intentActivity.getTask(),
                WINDOWING_MODE_UNDEFINED, DEFAULT_DISPLAY, mTargetStack);
    }
@@ -2422,10 +2422,11 @@ class ActivityStarter {
            return;
        }

        final ActivityStack stack = task.getStack();
        if (stack != null && stack.inPinnedWindowingMode()) {
            mService.animateResizePinnedStack(stack.mStackId, bounds, -1);
        final Task rootTask = task.getRootTask();
        if (rootTask != null && rootTask.inPinnedWindowingMode()) {
            mService.animateResizePinnedStack(rootTask.mTaskId, bounds, -1);
        } else {
            // TODO: I don't believe it is possible to reach this else condition anymore...
            task.setBounds(bounds);
        }
    }
+18 −18

File changed.

Preview size limit exceeded, changes collapsed.

Loading