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

Commit 3507a65f authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Rename Stack to Task related terms (4/n)"

parents 74e51dd2 bfd7e2ce
Loading
Loading
Loading
Loading
+31 −31
Original line number Original line Diff line number Diff line
@@ -172,7 +172,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final ActivityRecord r;
        final ActivityRecord r;
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityStopped");
            Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "activityStopped");
            r = ActivityRecord.isInStackLocked(token);
            r = ActivityRecord.isInRootTaskLocked(token);
            if (r != null) {
            if (r != null) {
                if (r.attachedToProcess() && r.isState(Task.ActivityState.RESTARTING_PROCESS)) {
                if (r.attachedToProcess() && r.isState(Task.ActivityState.RESTARTING_PROCESS)) {
                    // The activity was requested to restart from
                    // The activity was requested to restart from
@@ -234,7 +234,7 @@ class ActivityClientController extends IActivityClientController.Stub {
                token, Arrays.toString(horizontalSizeConfiguration),
                token, Arrays.toString(horizontalSizeConfiguration),
                Arrays.toString(verticalSizeConfigurations));
                Arrays.toString(verticalSizeConfigurations));
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            if (r != null) {
            if (r != null) {
                r.setSizeConfigurations(horizontalSizeConfiguration, verticalSizeConfigurations,
                r.setSizeConfigurations(horizontalSizeConfiguration, verticalSizeConfigurations,
                        smallestSizeConfigurations);
                        smallestSizeConfigurations);
@@ -270,7 +270,7 @@ class ActivityClientController extends IActivityClientController.Stub {
                final int taskId = ActivityRecord.getTaskForActivityLocked(token, !nonRoot);
                final int taskId = ActivityRecord.getTaskForActivityLocked(token, !nonRoot);
                final Task task = mService.mRootWindowContainer.anyTaskForId(taskId);
                final Task task = mService.mRootWindowContainer.anyTaskForId(taskId);
                if (task != null) {
                if (task != null) {
                    return ActivityRecord.getStackLocked(token).moveTaskToBack(task);
                    return ActivityRecord.getRootTask(token).moveTaskToBack(task);
                }
                }
            }
            }
        } finally {
        } finally {
@@ -295,7 +295,7 @@ class ActivityClientController extends IActivityClientController.Stub {
            Intent resultData) {
            Intent resultData) {
        final ActivityRecord r;
        final ActivityRecord r;
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            r = ActivityRecord.isInStackLocked(token);
            r = ActivityRecord.isInRootTaskLocked(token);
            if (r == null) {
            if (r == null) {
                return false;
                return false;
            }
            }
@@ -316,7 +316,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null || !r.isDestroyable()) {
                if (r == null || !r.isDestroyable()) {
                    return false;
                    return false;
                }
                }
@@ -347,7 +347,7 @@ class ActivityClientController extends IActivityClientController.Stub {


        final ActivityRecord r;
        final ActivityRecord r;
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            r = ActivityRecord.isInStackLocked(token);
            r = ActivityRecord.isInRootTaskLocked(token);
            if (r == null) {
            if (r == null) {
                return true;
                return true;
            }
            }
@@ -442,7 +442,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null) {
                if (r == null) {
                    return false;
                    return false;
                }
                }
@@ -468,7 +468,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null) return;
                if (r == null) return;


                // TODO: This should probably only loop over the task since you need to be in the
                // TODO: This should probably only loop over the task since you need to be in the
@@ -487,7 +487,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public boolean isTopOfTask(IBinder token) {
    public boolean isTopOfTask(IBinder token) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            return r != null && r.getTask().getTopNonFinishingActivity() == r;
            return r != null && r.getTask().getTopNonFinishingActivity() == r;
        }
        }
    }
    }
@@ -495,7 +495,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public boolean willActivityBeVisible(IBinder token) {
    public boolean willActivityBeVisible(IBinder token) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final Task rootTask = ActivityRecord.getStackLocked(token);
            final Task rootTask = ActivityRecord.getRootTask(token);
            return rootTask != null && rootTask.willActivityBeVisible(token);
            return rootTask != null && rootTask.willActivityBeVisible(token);
        }
        }
    }
    }
@@ -503,7 +503,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public int getDisplayId(IBinder activityToken) {
    public int getDisplayId(IBinder activityToken) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final Task rootTask = ActivityRecord.getStackLocked(activityToken);
            final Task rootTask = ActivityRecord.getRootTask(activityToken);
            if (rootTask != null) {
            if (rootTask != null) {
                final int displayId = rootTask.getDisplayId();
                final int displayId = rootTask.getDisplayId();
                return displayId != INVALID_DISPLAY ? displayId : DEFAULT_DISPLAY;
                return displayId != INVALID_DISPLAY ? displayId : DEFAULT_DISPLAY;
@@ -536,7 +536,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    }
    }


    private static ActivityRecord getCallingRecord(IBinder token) {
    private static ActivityRecord getCallingRecord(IBinder token) {
        final ActivityRecord r = ActivityRecord.isInStackLocked(token);
        final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
        return r != null ? r.resultTo : null;
        return r != null ? r.resultTo : null;
    }
    }


@@ -561,7 +561,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null) {
                if (r == null) {
                    return null;
                    return null;
                }
                }
@@ -578,7 +578,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.setRequestedOrientation(requestedOrientation);
                    r.setRequestedOrientation(requestedOrientation);
                }
                }
@@ -591,7 +591,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public int getRequestedOrientation(IBinder token) {
    public int getRequestedOrientation(IBinder token) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            return r != null
            return r != null
                    ? r.getRequestedOrientation() : ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
                    ? r.getRequestedOrientation() : ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
        }
        }
@@ -602,7 +602,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                return r != null && r.setOccludesParent(true);
                return r != null && r.setOccludesParent(true);
            }
            }
        } finally {
        } finally {
@@ -616,7 +616,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null) {
                if (r == null) {
                    return false;
                    return false;
                }
                }
@@ -634,7 +634,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public boolean isImmersive(IBinder token) {
    public boolean isImmersive(IBinder token) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            if (r == null) {
            if (r == null) {
                throw new IllegalArgumentException();
                throw new IllegalArgumentException();
            }
            }
@@ -645,7 +645,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public void setImmersive(IBinder token, boolean immersive) {
    public void setImmersive(IBinder token, boolean immersive) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            if (r == null) {
            if (r == null) {
                throw new IllegalArgumentException();
                throw new IllegalArgumentException();
            }
            }
@@ -841,7 +841,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public void setTaskDescription(IBinder token, ActivityManager.TaskDescription td) {
    public void setTaskDescription(IBinder token, ActivityManager.TaskDescription td) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            if (r != null) {
            if (r != null) {
                r.setTaskDescription(td);
                r.setTaskDescription(td);
            }
            }
@@ -878,7 +878,7 @@ class ActivityClientController extends IActivityClientController.Stub {
    @Override
    @Override
    public boolean isRootVoiceInteraction(IBinder token) {
    public boolean isRootVoiceInteraction(IBinder token) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            return r != null && r.rootVoiceInteraction;
            return r != null && r.rootVoiceInteraction;
        }
        }
    }
    }
@@ -919,7 +919,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.setShowWhenLocked(showWhenLocked);
                    r.setShowWhenLocked(showWhenLocked);
                }
                }
@@ -934,7 +934,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.setInheritShowWhenLocked(inheritShowWhenLocked);
                    r.setInheritShowWhenLocked(inheritShowWhenLocked);
                }
                }
@@ -949,7 +949,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.setTurnScreenOn(turnScreenOn);
                    r.setTurnScreenOn(turnScreenOn);
                }
                }
@@ -964,7 +964,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.reportFullyDrawnLocked(restoredFromBundle);
                    r.reportFullyDrawnLocked(restoredFromBundle);
                }
                }
@@ -979,7 +979,7 @@ class ActivityClientController extends IActivityClientController.Stub {
            int enterAnim, int exitAnim) {
            int enterAnim, int exitAnim) {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            if (r != null && r.isState(Task.ActivityState.RESUMED, Task.ActivityState.PAUSING)) {
            if (r != null && r.isState(Task.ActivityState.RESUMED, Task.ActivityState.PAUSING)) {
                r.mDisplayContent.mAppTransition.overridePendingAppTransition(
                r.mDisplayContent.mAppTransition.overridePendingAppTransition(
                        packageName, enterAnim, exitAnim, null, null);
                        packageName, enterAnim, exitAnim, null, null);
@@ -995,7 +995,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
        final VrManagerInternal vrService = LocalServices.getService(VrManagerInternal.class);
        final ActivityRecord r;
        final ActivityRecord r;
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            r = ActivityRecord.isInStackLocked(token);
            r = ActivityRecord.isInRootTaskLocked(token);
        }
        }
        if (r == null) {
        if (r == null) {
            throw new IllegalArgumentException();
            throw new IllegalArgumentException();
@@ -1028,7 +1028,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.setDisablePreviewScreenshots(disable);
                    r.setDisablePreviewScreenshots(disable);
                }
                }
@@ -1046,7 +1046,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.registerRemoteAnimations(definition);
                    r.registerRemoteAnimations(definition);
                }
                }
@@ -1063,7 +1063,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r != null) {
                if (r != null) {
                    r.unregisterRemoteAnimations();
                    r.unregisterRemoteAnimations();
                }
                }
@@ -1078,7 +1078,7 @@ class ActivityClientController extends IActivityClientController.Stub {
        final long origId = Binder.clearCallingIdentity();
        final long origId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null) {
                if (r == null) {
                    return;
                    return;
                }
                }
+28 −32
Original line number Original line Diff line number Diff line
@@ -1217,10 +1217,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return task;
        return task;
    }
    }


    Task getStack() {
        return task != null ? task.getRootTask() : null;
    }

    @Override
    @Override
    void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
    void onParentChanged(ConfigurationContainer newParent, ConfigurationContainer oldParent) {
        final Task oldTask = oldParent != null ? (Task) oldParent : null;
        final Task oldTask = oldParent != null ? (Task) oldParent : null;
@@ -1268,14 +1264,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        } else if (mLastParent != null && mLastParent.getRootTask() != null) {
        } else if (mLastParent != null && mLastParent.getRootTask() != null) {
            task.getRootTask().mExitingActivities.remove(this);
            task.getRootTask().mExitingActivities.remove(this);
        }
        }
        final Task stack = getStack();
        final Task rootTask = getRootTask();


        // If we reparent, make sure to remove ourselves from the old animation registry.
        // If we reparent, make sure to remove ourselves from the old animation registry.
        if (mAnimatingActivityRegistry != null) {
        if (mAnimatingActivityRegistry != null) {
            mAnimatingActivityRegistry.notifyFinished(this);
            mAnimatingActivityRegistry.notifyFinished(this);
        }
        }
        mAnimatingActivityRegistry = stack != null
        mAnimatingActivityRegistry = rootTask != null
                ? stack.getAnimatingActivityRegistry()
                ? rootTask.getAnimatingActivityRegistry()
                : null;
                : null;


        mLastParent = task;
        mLastParent = task;
@@ -1289,10 +1285,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            newTask.setResumedActivity(this, "onParentChanged");
            newTask.setResumedActivity(this, "onParentChanged");
        }
        }


        if (stack != null && stack.topRunningActivity() == this) {
        if (rootTask != null && rootTask.topRunningActivity() == this) {
            // make ensure the TaskOrganizer still works after re-parenting
            // make ensure the TaskOrganizer still works after re-parenting
            if (firstWindowDrawn) {
            if (firstWindowDrawn) {
                stack.setHasBeenVisible(true);
                rootTask.setHasBeenVisible(true);
            }
            }
        }
        }
    }
    }
@@ -2218,9 +2214,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return inHistory;
        return inHistory;
    }
    }


    boolean isInStackLocked() {
    boolean isInRootTaskLocked() {
        final Task stack = getRootTask();
        final Task rootTask = getRootTask();
        return stack != null && stack.isInTask(this) != null;
        return rootTask != null && rootTask.isInTask(this) != null;
    }
    }


    boolean isPersistable() {
    boolean isPersistable() {
@@ -2552,14 +2548,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return FINISH_RESULT_CANCELLED;
            return FINISH_RESULT_CANCELLED;
        }
        }


        if (!isInStackLocked()) {
        if (!isInRootTaskLocked()) {
            Slog.w(TAG, "Finish request when not in stack for r=" + this);
            Slog.w(TAG, "Finish request when not in stack for r=" + this);
            return FINISH_RESULT_CANCELLED;
            return FINISH_RESULT_CANCELLED;
        }
        }


        final Task rootTask = getRootTask();
        final Task rootTask = getRootTask();
        final boolean mayAdjustTop = (isState(RESUMED) || rootTask.getResumedActivity() == null)
        final boolean mayAdjustTop = (isState(RESUMED) || rootTask.getResumedActivity() == null)
                && rootTask.isFocusedStackOnDisplay()
                && rootTask.isFocusedRootTaskOnDisplay()
                // Do not adjust focus task because the task will be reused to launch new activity.
                // Do not adjust focus task because the task will be reused to launch new activity.
                && !task.isClearingToReuseTask();
                && !task.isClearingToReuseTask();
        final boolean shouldAdjustGlobalFocus = mayAdjustTop
        final boolean shouldAdjustGlobalFocus = mayAdjustTop
@@ -2722,8 +2718,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A


        final boolean isCurrentVisible = mVisibleRequested || isState(PAUSED);
        final boolean isCurrentVisible = mVisibleRequested || isState(PAUSED);
        if (isCurrentVisible) {
        if (isCurrentVisible) {
            final Task stack = getStack();
            final Task rootTask = getRootTask();
            final ActivityRecord activity = stack.getResumedActivity();
            final ActivityRecord activity = rootTask.getResumedActivity();
            boolean ensureVisibility = false;
            boolean ensureVisibility = false;
            if (activity != null && !activity.occludesParent()) {
            if (activity != null && !activity.occludesParent()) {
                // If the resume activity is not opaque, we need to make sure the visibilities of
                // If the resume activity is not opaque, we need to make sure the visibilities of
@@ -2813,7 +2809,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // DisplayContent#topRunningActivity().
        // DisplayContent#topRunningActivity().
        final ActivityRecord next = taskDisplayArea.topRunningActivity();
        final ActivityRecord next = taskDisplayArea.topRunningActivity();
        final boolean isLastStackOverEmptyHome =
        final boolean isLastStackOverEmptyHome =
                next == null && stack.isFocusedStackOnDisplay()
                next == null && stack.isFocusedRootTaskOnDisplay()
                        && taskDisplayArea.getOrCreateRootHomeTask() != null;
                        && taskDisplayArea.getOrCreateRootHomeTask() != null;
        if (isLastStackOverEmptyHome) {
        if (isLastStackOverEmptyHome) {
            // Don't destroy activity immediately if this is the last activity on the display and
            // Don't destroy activity immediately if this is the last activity on the display and
@@ -3016,7 +3012,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    "Reported destroyed for activity that is not destroying: r=" + this);
                    "Reported destroyed for activity that is not destroying: r=" + this);
        }
        }


        if (isInStackLocked()) {
        if (isInRootTaskLocked()) {
            cleanUp(true /* cleanServices */, false /* setState */);
            cleanUp(true /* cleanServices */, false /* setState */);
            removeFromHistory(reason);
            removeFromHistory(reason);
        }
        }
@@ -3312,21 +3308,21 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            getDisplayContent().mNoAnimationNotifyOnTransitionFinished.add(token);
            getDisplayContent().mNoAnimationNotifyOnTransitionFinished.add(token);
        }
        }


        final Task stack = getStack();
        final Task rootTask = getRootTask();
        if (delayed && !isEmpty()) {
        if (delayed && !isEmpty()) {
            // set the token aside because it has an active animation to be finished
            // set the token aside because it has an active animation to be finished
            ProtoLog.v(WM_DEBUG_ADD_REMOVE,
            ProtoLog.v(WM_DEBUG_ADD_REMOVE,
                    "removeAppToken make exiting: %s", this);
                    "removeAppToken make exiting: %s", this);
            if (stack != null) {
            if (rootTask != null) {
                stack.mExitingActivities.add(this);
                rootTask.mExitingActivities.add(this);
            }
            }
            mIsExiting = true;
            mIsExiting = true;
        } else {
        } else {
            // Make sure there is no animation running on this token, so any windows associated
            // Make sure there is no animation running on this token, so any windows associated
            // with it will be removed as soon as their animations are complete
            // with it will be removed as soon as their animations are complete
            cancelAnimation();
            cancelAnimation();
            if (stack != null) {
            if (rootTask != null) {
                stack.mExitingActivities.remove(this);
                rootTask.mExitingActivities.remove(this);
            }
            }
            removeIfPossible();
            removeIfPossible();
        }
        }
@@ -5765,13 +5761,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return task.mTaskId;
        return task.mTaskId;
    }
    }


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


    static Task getStackLocked(IBinder token) {
    static Task getRootTask(IBinder token) {
        final ActivityRecord r = ActivityRecord.isInStackLocked(token);
        final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
        if (r != null) {
        if (r != null) {
            return r.getRootTask();
            return r.getRootTask();
        }
        }
@@ -6034,7 +6030,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // a new hierarchical animation is enabled, we just let them occur as a child of the parent
        // a new hierarchical animation is enabled, we just let them occur as a child of the parent
        // stack, i.e. the hierarchy of the surfaces is unchanged.
        // stack, i.e. the hierarchy of the surfaces is unchanged.
        if (inPinnedWindowingMode()) {
        if (inPinnedWindowingMode()) {
            return getStack().getSurfaceControl();
            return getRootTask().getSurfaceControl();
        } else {
        } else {
            return super.getAnimationLeashParent();
            return super.getAnimationLeashParent();
        }
        }
@@ -6114,12 +6110,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                    getTransit(), task)) {
                    getTransit(), task)) {
                task.getBounds(mTmpRect);
                task.getBounds(mTmpRect);
            } else {
            } else {
                final Task stack = getStack();
                final Task rootTask = getRootTask();
                if (stack == null) {
                if (rootTask == null) {
                    return;
                    return;
                }
                }
                // Set clip rect to stack bounds.
                // Set clip rect to stack bounds.
                stack.getBounds(mTmpRect);
                rootTask.getBounds(mTmpRect);
            }
            }
            mAnimationBoundsLayer = createAnimationBoundsLayer(t);
            mAnimationBoundsLayer = createAnimationBoundsLayer(t);


@@ -6860,9 +6856,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @VisibleForTesting
    @VisibleForTesting
    @Override
    @Override
    Rect getAnimationBounds(int appStackClipMode) {
    Rect getAnimationBounds(int appStackClipMode) {
        if (appStackClipMode == STACK_CLIP_BEFORE_ANIM && getStack() != null) {
        if (appStackClipMode == STACK_CLIP_BEFORE_ANIM && getRootTask() != null) {
            // Using the stack bounds here effectively applies the clipping before animation.
            // Using the stack bounds here effectively applies the clipping before animation.
            return getStack().getBounds();
            return getRootTask().getBounds();
        }
        }
        // Use task-bounds if available so that activity-level letterbox (maxAspectRatio) is
        // Use task-bounds if available so that activity-level letterbox (maxAspectRatio) is
        // included in the animation.
        // included in the animation.
+69 −67

File changed.

Preview size limit exceeded, changes collapsed.

+9 −9
Original line number Original line Diff line number Diff line
@@ -1154,7 +1154,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        SafeActivityOptions options = SafeActivityOptions.fromBundle(bOptions);
        SafeActivityOptions options = SafeActivityOptions.fromBundle(bOptions);


        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(callingActivity);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(callingActivity);
            if (r == null) {
            if (r == null) {
                SafeActivityOptions.abort(options);
                SafeActivityOptions.abort(options);
                return false;
                return false;
@@ -1812,7 +1812,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        final long callingId = Binder.clearCallingIdentity();
        final long callingId = Binder.clearCallingIdentity();
        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(activityToken);
                if (r == null) {
                if (r == null) {
                    return;
                    return;
                }
                }
@@ -2653,7 +2653,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {


        try {
        try {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
                ActivityRecord r = ActivityRecord.isInRootTaskLocked(activityToken);
                if (r == null) {
                if (r == null) {
                    throw new IllegalArgumentException("Activity does not exist; token="
                    throw new IllegalArgumentException("Activity does not exist; token="
                            + activityToken);
                            + activityToken);
@@ -3483,7 +3483,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    @Override
    @Override
    public void invalidateHomeTaskSnapshot(IBinder token) {
    public void invalidateHomeTaskSnapshot(IBinder token) {
        synchronized (mGlobalLock) {
        synchronized (mGlobalLock) {
            final ActivityRecord r = ActivityRecord.isInStackLocked(token);
            final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
            if (r == null || !r.isActivityTypeHome()) {
            if (r == null || !r.isActivityTypeHome()) {
                return;
                return;
            }
            }
@@ -4634,7 +4634,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {


        ActivityRecord activity = null;
        ActivityRecord activity = null;
        if (type == ActivityManager.INTENT_SENDER_ACTIVITY_RESULT) {
        if (type == ActivityManager.INTENT_SENDER_ACTIVITY_RESULT) {
            activity = ActivityRecord.isInStackLocked(token);
            activity = ActivityRecord.isInRootTaskLocked(token);
            if (activity == null) {
            if (activity == null) {
                Slog.w(TAG, "Failed createPendingResult: activity " + token + " not in any stack");
                Slog.w(TAG, "Failed createPendingResult: activity " + token + " not in any stack");
                return null;
                return null;
@@ -5488,7 +5488,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                int requestCode, int resultCode, Intent data) {
                int requestCode, int resultCode, Intent data) {
            final ActivityRecord r;
            final ActivityRecord r;
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                r = ActivityRecord.isInStackLocked(activityToken);
                r = ActivityRecord.isInRootTaskLocked(activityToken);
                if (r == null || r.getRootTask() == null) {
                if (r == null || r.getRootTask() == null) {
                    return;
                    return;
                }
                }
@@ -5506,7 +5506,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        public void clearPendingResultForActivity(IBinder activityToken,
        public void clearPendingResultForActivity(IBinder activityToken,
                WeakReference<PendingIntentRecord> pir) {
                WeakReference<PendingIntentRecord> pir) {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(activityToken);
                if (r != null && r.pendingResults != null) {
                if (r != null && r.pendingResults != null) {
                    r.pendingResults.remove(pir);
                    r.pendingResults.remove(pir);
                }
                }
@@ -5516,7 +5516,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        @Override
        @Override
        public ComponentName getActivityName(IBinder activityToken) {
        public ComponentName getActivityName(IBinder activityToken) {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(activityToken);
                return r != null ? r.intent.getComponent() : null;
                return r != null ? r.intent.getComponent() : null;
            }
            }
        }
        }
@@ -5560,7 +5560,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        @Override
        @Override
        public ActivityServiceConnectionsHolder getServiceConnectionsHolder(IBinder token) {
        public ActivityServiceConnectionsHolder getServiceConnectionsHolder(IBinder token) {
            synchronized (mGlobalLock) {
            synchronized (mGlobalLock) {
                final ActivityRecord r = ActivityRecord.isInStackLocked(token);
                final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
                if (r == null) {
                if (r == null) {
                    return null;
                    return null;
                }
                }
+3 −3
Original line number Original line Diff line number Diff line
@@ -1394,7 +1394,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                // task.reparent() should already placed the task on top,
                // task.reparent() should already placed the task on top,
                // still need moveTaskToFrontLocked() below for any transition settings.
                // still need moveTaskToFrontLocked() below for any transition settings.
            }
            }
            if (stack.shouldResizeStackWithLaunchBounds()) {
            if (stack.shouldResizeRootTaskWithLaunchBounds()) {
                stack.resize(bounds, !PRESERVE_WINDOWS, !DEFER_RESUME);
                stack.resize(bounds, !PRESERVE_WINDOWS, !DEFER_RESUME);
            } else {
            } else {
                // WM resizeTask must be done after the task is moved to the correct stack,
                // WM resizeTask must be done after the task is moved to the correct stack,
@@ -2237,13 +2237,13 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
    }
    }


    void activityRelaunchedLocked(IBinder token) {
    void activityRelaunchedLocked(IBinder token) {
        final ActivityRecord r = ActivityRecord.isInStackLocked(token);
        final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
        if (r != null) {
        if (r != null) {
            r.finishRelaunching();
            r.finishRelaunching();
            if (r.getRootTask().shouldSleepOrShutDownActivities()) {
            if (r.getRootTask().shouldSleepOrShutDownActivities()) {
                // Activity is always relaunched to either resumed or paused state. If it was
                // Activity is always relaunched to either resumed or paused state. If it was
                // relaunched while hidden (by keyguard or smth else), it should be stopped.
                // relaunched while hidden (by keyguard or smth else), it should be stopped.
                r.getStack().ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
                r.getRootTask().ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
                        false /* preserveWindows */);
                        false /* preserveWindows */);
            }
            }
        }
        }
Loading