Removed mStackId (86/n)
mStackId is the same as mTaskId since all stacks are now tasks
Also, switch some of the users to use getRootTask()/getRootTaskId()
where it makes sense.
Bug: 80414790
Test: Existing tests pass.
Change-Id: Ie625bf8734ca01646f6f45705edf0eb240819c24
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 8491bc2..9f4c581 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -1612,7 +1612,7 @@
if (mController != null) {
// Find the first activity that is not finishing.
final ActivityRecord next =
- r.getActivityStack().topRunningActivity(token, INVALID_TASK_ID);
+ r.getRootTask().topRunningActivity(token, INVALID_TASK_ID);
if (next != null) {
// ask watcher if this is allowed
boolean resumeOK = true;
@@ -2037,7 +2037,7 @@
synchronized (mGlobalLock) {
ActivityRecord r = mRootWindowContainer.isInAnyStack(token);
if (r != null) {
- r.getActivityStack().notifyActivityDrawnLocked(r);
+ r.getRootTask().notifyActivityDrawnLocked(r);
}
}
}
@@ -2073,7 +2073,7 @@
synchronized (mGlobalLock) {
ActivityStack focusedStack = getTopDisplayFocusedStack();
if (focusedStack != null) {
- return mRootWindowContainer.getStackInfo(focusedStack.mStackId);
+ return mRootWindowContainer.getStackInfo(focusedStack.mTaskId);
}
return null;
}
@@ -2175,7 +2175,7 @@
synchronized (mGlobalLock) {
final ActivityRecord srec = ActivityRecord.forTokenLocked(token);
if (srec != null) {
- return srec.getActivityStack().shouldUpRecreateTaskLocked(srec, destAffinity);
+ return srec.getRootTask().shouldUpRecreateTaskLocked(srec, destAffinity);
}
}
return false;
@@ -2188,7 +2188,7 @@
synchronized (mGlobalLock) {
final ActivityRecord r = ActivityRecord.forTokenLocked(token);
if (r != null) {
- return r.getActivityStack().navigateUpTo(
+ return r.getRootTask().navigateUpTo(
r, destIntent, resultCode, resultData);
}
return false;
@@ -2354,7 +2354,7 @@
if (r == null) {
return;
}
- ActivityStack stack = r.getActivityStack();
+ ActivityStack stack = r.getRootTask();
if (stack != null && stack.isSingleTaskInstance()) {
// Single-task stacks are used for activities which are presented in floating
// windows above full screen activities. Instead of directly finishing the
@@ -2582,7 +2582,7 @@
r, resultWho, requestCode);
// TODO: This should probably only loop over the task since you need to be in the
// same task to return results.
- r.getActivityStack().forAllActivities(c);
+ r.getRootTask().forAllActivities(c);
c.recycle();
updateOomAdj();
@@ -3215,7 +3215,7 @@
+ ainfo.applicationInfo.uid + ", calling uid=" + callingUid);
}
- final ActivityStack stack = r.getActivityStack();
+ final ActivityStack stack = r.getRootTask();
final Task task = stack.createTask(
mStackSupervisor.getNextTaskIdForUser(r.mUserId), ainfo, intent, !ON_TOP);
if (!mRecentTasks.addToBottom(task)) {
@@ -3551,7 +3551,7 @@
+ token);
}
- final ActivityStack stack = r.getActivityStack();
+ final ActivityStack stack = r.getRootTask();
if (stack == null) {
throw new IllegalStateException("toggleFreeformWindowingMode: the activity "
+ "doesn't have a stack");
@@ -4235,14 +4235,14 @@
}
private boolean isInPictureInPictureMode(ActivityRecord r) {
- if (r == null || r.getActivityStack() == null || !r.inPinnedWindowingMode()
- || r.getActivityStack().isInStackLocked(r) == null) {
+ if (r == null || r.getRootTask() == null || !r.inPinnedWindowingMode()
+ || r.getRootTask().isInStackLocked(r) == null) {
return false;
}
// If we are animating to fullscreen then we have already dispatched the PIP mode
// changed, so we should reflect that check here as well.
- final ActivityStack taskStack = r.getActivityStack();
+ final ActivityStack taskStack = r.getRootTask();
return !taskStack.isAnimatingBoundsToFullscreen();
}
@@ -4281,7 +4281,7 @@
r.pictureInPictureArgs.getSourceRectHint());
mRootWindowContainer.moveActivityToPinnedStack(
r, sourceBounds, aspectRatio, "enterPictureInPictureMode");
- final ActivityStack stack = r.getActivityStack();
+ final ActivityStack stack = r.getRootTask();
stack.setPictureInPictureAspectRatio(aspectRatio);
stack.setPictureInPictureActions(actions);
MetricsLoggerWrapper.logPictureInPictureEnter(mContext,
@@ -4326,7 +4326,7 @@
// If the activity is already in picture-in-picture, update the pinned stack now
// if it is not already expanding to fullscreen. Otherwise, the arguments will
// be used the next time the activity enters PiP
- final ActivityStack stack = r.getActivityStack();
+ final ActivityStack stack = r.getRootTask();
if (!stack.isAnimatingBoundsToFullscreen()) {
stack.setPictureInPictureAspectRatio(
r.pictureInPictureArgs.getAspectRatio());
@@ -4923,7 +4923,7 @@
Slog.i(TAG, "Moving " + r.shortComponentName + " from display " + r.getDisplayId()
+ " to main display for VR");
mRootWindowContainer.moveStackToDisplay(
- r.getStackId(), DEFAULT_DISPLAY, true /* toTop */);
+ r.getRootTaskId(), DEFAULT_DISPLAY, true /* toTop */);
}
mH.post(() -> {
if (!mVrController.onVrModeChanged(r)) {
@@ -6752,7 +6752,7 @@
int requestCode, int resultCode, Intent data) {
synchronized (mGlobalLock) {
final ActivityRecord r = ActivityRecord.isInStackLocked(activityToken);
- if (r != null && r.getActivityStack() != null) {
+ if (r != null && r.getRootTask() != null) {
r.sendResult(callingUid, resultWho, requestCode, resultCode, data);
}
}