summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wale Ogunwale <ogunwale@google.com> 2015-09-22 23:24:04 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2015-09-22 23:24:04 +0000
commit58a32f3155bf581aa9667f5b08bc01afe4192a43 (patch)
tree8b6ec40d96df991f1a0046f91bc32d55b7350287
parent3be3aedb9599823eccb48c604922b9e93a515aff (diff)
parenta6e902ec61ab1cd8f7d5df84deab6f26471c22fd (diff)
Merge "Properly size tasks based on stack size."
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java2
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java25
-rw-r--r--services/core/java/com/android/server/am/TaskRecord.java2
-rw-r--r--services/core/java/com/android/server/wm/TaskStack.java12
-rw-r--r--services/core/java/com/android/server/wm/WindowManagerService.java5
5 files changed, 18 insertions, 28 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 3fcffd78d049..ee4dbd4ca451 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -4564,6 +4564,8 @@ final class ActivityStack {
addTask(task, toTop, false);
if (mTaskPositioner != null) {
mTaskPositioner.updateDefaultBounds(task, mTaskHistory, info.initialLayout);
+ } else if (mBounds != null && task.mResizeable) {
+ task.updateOverrideConfiguration(mBounds);
}
return task;
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 3c181e1086d4..f546c1dc94f0 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2971,31 +2971,29 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
ActivityRecord r = stack.topRunningActivityLocked(null);
- final boolean resizeTasks = r != null && r.task.mResizeable;
mTmpBounds.clear();
mTmpConfigs.clear();
- if (resizeTasks) {
- ArrayList<TaskRecord> tasks = stack.getAllTasks();
- for (int i = tasks.size() - 1; i >= 0; i--) {
- TaskRecord task = tasks.get(i);
+ ArrayList<TaskRecord> tasks = stack.getAllTasks();
+ for (int i = tasks.size() - 1; i >= 0; i--) {
+ TaskRecord task = tasks.get(i);
+ if (task.mResizeable) {
if (stack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
- // For freeform stack we don't adjust the size of the tasks to match that of
- // the stack, but we do try to make sure the tasks are still contained with the
- // bounds of the stack.
+ // For freeform stack we don't adjust the size of the tasks to match that
+ // of the stack, but we do try to make sure the tasks are still contained
+ // with the bounds of the stack.
tempRect2.set(task.mBounds);
fitWithinBounds(tempRect2, bounds);
task.updateOverrideConfiguration(tempRect2);
} else {
task.updateOverrideConfiguration(bounds);
}
-
- mTmpConfigs.put(task.taskId, task.mOverrideConfig);
- mTmpBounds.put(task.taskId, task.mBounds);
}
+
+ mTmpConfigs.put(task.taskId, task.mOverrideConfig);
+ mTmpBounds.put(task.taskId, task.mBounds);
}
- stack.mFullscreen = mWindowManager.resizeStack(stackId, bounds, resizeTasks, mTmpConfigs,
- mTmpBounds);
+ stack.mFullscreen = mWindowManager.resizeStack(stackId, bounds, mTmpConfigs, mTmpBounds);
if (stack.mStackId == DOCKED_STACK_ID) {
// Dock stack funness...Yay!
if (stack.mFullscreen) {
@@ -3008,7 +3006,6 @@ public final class ActivityStackSupervisor implements DisplayListener {
}
}
- final ArrayList<TaskRecord> tasks = stack.getAllTasks();
final int count = tasks.size();
for (int i = 0; i < count; i++) {
moveTaskToStackLocked(tasks.get(i).taskId,
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index 8f10f083c0ff..43f5baab793f 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -1235,7 +1235,7 @@ final class TaskRecord {
if (stack == null
|| stack.mStackId == HOME_STACK_ID
|| stack.mStackId == FULLSCREEN_WORKSPACE_STACK_ID) {
- return null;
+ return (mResizeable && stack != null) ? stack.mBounds : null;
} else if (stack.mStackId == DOCKED_STACK_ID) {
return stack.mBounds;
}
diff --git a/services/core/java/com/android/server/wm/TaskStack.java b/services/core/java/com/android/server/wm/TaskStack.java
index 571540fade62..86597badb1c7 100644
--- a/services/core/java/com/android/server/wm/TaskStack.java
+++ b/services/core/java/com/android/server/wm/TaskStack.java
@@ -118,30 +118,22 @@ public class TaskStack implements DimLayer.DimLayerUser {
/**
* Set the bounds of the stack and its containing tasks.
* @param stackBounds New stack bounds. Passing in null sets the bounds to fullscreen.
- * @param resizeTasks If true, the tasks within the stack will also be resized.
* @param configs Configuration for individual tasks, keyed by task id.
* @param taskBounds Bounds for individual tasks, keyed by task id.
* @return True if the stack bounds was changed.
* */
- boolean setBounds(Rect stackBounds, boolean resizeTasks, SparseArray<Configuration> configs,
- SparseArray<Rect> taskBounds) {
+ boolean setBounds(
+ Rect stackBounds, SparseArray<Configuration> configs, SparseArray<Rect> taskBounds) {
if (!setBounds(stackBounds)) {
return false;
}
- if (!resizeTasks) {
- return true;
- }
-
// Update bounds of containing tasks.
for (int taskNdx = mTasks.size() - 1; taskNdx >= 0; --taskNdx) {
final Task task = mTasks.get(taskNdx);
Configuration config = configs.get(task.mTaskId);
if (config != null) {
Rect bounds = taskBounds.get(task.mTaskId);
- if (bounds == null) {
- bounds = stackBounds;
- }
task.setBounds(bounds, config);
} else {
Slog.wtf(TAG, "No config for task: " + task + ", is there a mismatch with AM?");
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java
index 1b38b433a779..29598ab19476 100644
--- a/services/core/java/com/android/server/wm/WindowManagerService.java
+++ b/services/core/java/com/android/server/wm/WindowManagerService.java
@@ -4632,12 +4632,11 @@ public class WindowManagerService extends IWindowManager.Stub
* Re-sizes a stack and its containing tasks.
* @param stackId Id of stack to resize.
* @param bounds New stack bounds. Passing in null sets the bounds to fullscreen.
- * @param resizeTasks If true, the tasks within the stack will also be resized.
* @param configs Configurations for tasks in the resized stack, keyed by task id.
* @param taskBounds Bounds for tasks in the resized stack, keyed by task id.
* @return True if the stack is now fullscreen.
* */
- public boolean resizeStack(int stackId, Rect bounds, boolean resizeTasks,
+ public boolean resizeStack(int stackId, Rect bounds,
SparseArray<Configuration> configs, SparseArray<Rect> taskBounds) {
synchronized (mWindowMap) {
final TaskStack stack = mStackIdToStack.get(stackId);
@@ -4645,7 +4644,7 @@ public class WindowManagerService extends IWindowManager.Stub
throw new IllegalArgumentException("resizeStack: stackId " + stackId
+ " not found.");
}
- if (stack.setBounds(bounds, resizeTasks, configs, taskBounds)) {
+ if (stack.setBounds(bounds, configs, taskBounds)) {
stack.resizeWindows();
stack.getDisplayContent().layoutNeeded = true;
mWindowPlacerLocked.performSurfacePlacement();