Cache reference to stack objects we use a lot in AM.
This helps with fast access since we are no longer using stack ids
to look-up stack objects.
Also,
- Made ActivityDisplay.mStacks private so no one out the ActivityDisplay
class changing the stack list order.
- Changed some methods to pass stack objects vs. ids.
Test: Existing tests pass.
Test: go/wm-smoke
Change-Id: I04490cd505c4251e115043fa2ba5134d9a641846
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index e4a5980..0bc30cf 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -83,7 +83,6 @@
import android.annotation.Nullable;
import android.app.Activity;
import android.app.ActivityManager;
-import android.app.ActivityManager.StackId;
import android.app.ActivityManager.TaskDescription;
import android.app.ActivityManager.TaskSnapshot;
import android.app.ActivityOptions;
@@ -650,7 +649,7 @@
// In some cases the focused stack isn't the front stack. E.g. pinned stack.
// Whenever we are moving the top activity from the front stack we want to make sure to
// move the stack to the front.
- final boolean wasFront = r != null && supervisor.isFrontStackOnDisplay(sourceStack)
+ final boolean wasFront = r != null && sourceStack.isTopStackOnDisplay()
&& (sourceStack.topRunningActivityLocked() == r);
// Adjust the position for the new parent stack as needed.
@@ -739,9 +738,9 @@
}
// TODO: Handle incorrect request to move before the actual move, not after.
- final boolean inSplitScreenMode = supervisor.getDefaultDisplay().hasSplitScreenStack();
+ final boolean inSplitScreenMode = supervisor.getDefaultDisplay().hasSplitScreenPrimaryStack();
supervisor.handleNonResizableTaskIfNeeded(this, preferredStack.getWindowingMode(),
- DEFAULT_DISPLAY, toStack.mStackId);
+ DEFAULT_DISPLAY, toStack);
boolean successful = (preferredStack == toStack);
if (successful && toStack.getWindowingMode() == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {