Incremental repairs to side by side stacks.
- Add taskId parameter to createStack() so stacks are pre-populated
with a task.
- Keep track of stack access order in DisplayContent so getTasks
returns in MRU order.
- Set touchableRegion in InputMonitor so modal touching does not
extend beyond stack boundary.
- Fix stack merging so that deleting a stack results in a new
stack the size of the two children.
Change-Id: I62a6ba0a34f34dd7ec866b440bf04595379e19e8
diff --git a/services/java/com/android/server/wm/DisplayContent.java b/services/java/com/android/server/wm/DisplayContent.java
index edf3d3b..915c696c 100644
--- a/services/java/com/android/server/wm/DisplayContent.java
+++ b/services/java/com/android/server/wm/DisplayContent.java
@@ -90,11 +90,12 @@
/** True when the home StackBox is at the top of mStackBoxes, false otherwise */
private TaskStack mHomeStack = null;
- /**
- * Sorted most recent at top, oldest at [0].
- */
+ /** Save allocating when retrieving tasks */
ArrayList<Task> mTmpTasks = new ArrayList<Task>();
+ /** Sorted most recent at top, oldest at [0]. */
+ ArrayList<TaskStack> mStackHistory = new ArrayList<TaskStack>();
+
/**
* @param display May not be null.
*/
@@ -125,17 +126,23 @@
return mStackBoxes.get(0).mStack != mHomeStack;
}
+ void moveStack(TaskStack stack, boolean toTop) {
+ mStackHistory.remove(stack);
+ mStackHistory.add(toTop ? mStackHistory.size() : 0, stack);
+ }
+
/**
- * Retrieve the tasks on this display in stack order from the topmost TaskStack down.
- * Note that the order of TaskStacks in the same StackBox is defined within StackBox.
+ * Retrieve the tasks on this display in stack order from the bottommost TaskStack up.
* @return All the Tasks, in order, on this display.
*/
ArrayList<Task> getTasks() {
mTmpTasks.clear();
- int numBoxes = mStackBoxes.size();
- for (int boxNdx = 0; boxNdx < numBoxes; ++boxNdx) {
- mTmpTasks.addAll(mStackBoxes.get(boxNdx).getTasks());
+ final int numStacks = mStackHistory.size();
+ for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) {
+ mTmpTasks.addAll(mStackHistory.get(stackNdx).getTasks());
}
+ if (WindowManagerService.DEBUG_LAYERS) Slog.i(TAG, "getTasks: mStackHistory=" +
+ mStackHistory);
return mTmpTasks;
}
@@ -221,6 +228,13 @@
return false;
}
+ void addStackBox(StackBox box, boolean toTop) {
+ if (mStackBoxes.size() >= 2) {
+ throw new RuntimeException("addStackBox: Too many toplevel StackBoxes!");
+ }
+ mStackBoxes.add(toTop ? mStackBoxes.size() : 0, box);
+ }
+
void removeStackBox(StackBox box) {
if (DEBUG_STACK) Slog.d(TAG, "removeStackBox: box=" + box);
final TaskStack stack = box.mStack;