Loading services/core/java/com/android/server/wm/ActivityClientController.java +31 −31 Original line number Original line Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -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 { Loading @@ -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; } } Loading @@ -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; } } Loading Loading @@ -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; } } Loading Loading @@ -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; } } Loading @@ -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 Loading @@ -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; } } } } Loading @@ -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); } } } } Loading @@ -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; Loading Loading @@ -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; } } Loading @@ -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; } } Loading @@ -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); } } Loading @@ -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; } } Loading @@ -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 { Loading @@ -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; } } Loading @@ -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(); } } Loading @@ -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(); } } Loading Loading @@ -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); } } Loading Loading @@ -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; } } } } Loading Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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); Loading @@ -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(); Loading Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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(); } } Loading @@ -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; } } Loading services/core/java/com/android/server/wm/ActivityRecord.java +28 −32 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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); } } } } } } Loading Loading @@ -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() { Loading Loading @@ -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 Loading Loading @@ -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 Loading Loading @@ -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 Loading Loading @@ -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); } } Loading Loading @@ -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(); } } Loading Loading @@ -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(); } } Loading Loading @@ -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(); } } Loading Loading @@ -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); Loading Loading @@ -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. Loading services/core/java/com/android/server/wm/ActivityStarter.java +69 −67 File changed.Preview size limit exceeded, changes collapsed. Show changes services/core/java/com/android/server/wm/ActivityTaskManagerService.java +9 −9 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } } Loading Loading @@ -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); Loading Loading @@ -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; } } Loading Loading @@ -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; Loading Loading @@ -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; } } Loading @@ -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); } } Loading @@ -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; } } } } Loading Loading @@ -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; } } Loading services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -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, Loading Loading @@ -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 Loading
services/core/java/com/android/server/wm/ActivityClientController.java +31 −31 Original line number Original line Diff line number Diff line Loading @@ -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 Loading Loading @@ -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); Loading Loading @@ -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 { Loading @@ -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; } } Loading @@ -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; } } Loading Loading @@ -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; } } Loading Loading @@ -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; } } Loading @@ -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 Loading @@ -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; } } } } Loading @@ -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); } } } } Loading @@ -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; Loading Loading @@ -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; } } Loading @@ -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; } } Loading @@ -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); } } Loading @@ -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; } } Loading @@ -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 { Loading @@ -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; } } Loading @@ -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(); } } Loading @@ -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(); } } Loading Loading @@ -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); } } Loading Loading @@ -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; } } } } Loading Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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); Loading @@ -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(); Loading Loading @@ -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); } } Loading @@ -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); } } Loading @@ -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(); } } Loading @@ -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; } } Loading
services/core/java/com/android/server/wm/ActivityRecord.java +28 −32 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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); } } } } } } Loading Loading @@ -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() { Loading Loading @@ -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 Loading Loading @@ -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 Loading Loading @@ -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 Loading Loading @@ -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); } } Loading Loading @@ -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(); } } Loading Loading @@ -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(); } } Loading Loading @@ -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(); } } Loading Loading @@ -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); Loading Loading @@ -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. Loading
services/core/java/com/android/server/wm/ActivityStarter.java +69 −67 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +9 −9 Original line number Original line Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; } } Loading Loading @@ -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); Loading Loading @@ -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; } } Loading Loading @@ -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; Loading Loading @@ -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; } } Loading @@ -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); } } Loading @@ -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; } } } } Loading Loading @@ -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; } } Loading
services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -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, Loading Loading @@ -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