Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.server.wm; |
| 18 | |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 19 | import static com.android.server.am.ActivityStackSupervisor.HOME_STACK_ID; |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 20 | import static com.android.server.wm.WindowManagerService.DEBUG_STACK; |
| 21 | import static com.android.server.wm.WindowManagerService.TAG; |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 22 | |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 23 | import android.graphics.Rect; |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 24 | import android.util.Slog; |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 25 | import android.view.Display; |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 26 | import android.view.DisplayInfo; |
| 27 | |
| 28 | import java.io.PrintWriter; |
| 29 | import java.util.ArrayList; |
| 30 | |
| 31 | class DisplayContentList extends ArrayList<DisplayContent> { |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Utility class for keeping track of the WindowStates and other pertinent contents of a |
| 36 | * particular Display. |
| 37 | * |
| 38 | * IMPORTANT: No method from this class should ever be used without holding |
| 39 | * WindowManagerService.mWindowMap. |
| 40 | */ |
| 41 | class DisplayContent { |
| 42 | |
| 43 | /** Unique identifier of this stack. */ |
| 44 | private final int mDisplayId; |
| 45 | |
| 46 | /** Z-ordered (bottom-most first) list of all Window objects. Assigned to an element |
| 47 | * from mDisplayWindows; */ |
| 48 | private WindowList mWindows = new WindowList(); |
| 49 | |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 50 | // This protects the following display size properties, so that |
| 51 | // getDisplaySize() doesn't need to acquire the global lock. This is |
| 52 | // needed because the window manager sometimes needs to use ActivityThread |
| 53 | // while it has its global state locked (for example to load animation |
| 54 | // resources), but the ActivityThread also needs get the current display |
| 55 | // size sometimes when it has its package lock held. |
| 56 | // |
| 57 | // These will only be modified with both mWindowMap and mDisplaySizeLock |
| 58 | // held (in that order) so the window manager doesn't need to acquire this |
| 59 | // lock when needing these values in its normal operation. |
| 60 | final Object mDisplaySizeLock = new Object(); |
| 61 | int mInitialDisplayWidth = 0; |
| 62 | int mInitialDisplayHeight = 0; |
Dianne Hackborn | dde331c | 2012-08-03 14:01:57 -0700 | [diff] [blame] | 63 | int mInitialDisplayDensity = 0; |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 64 | int mBaseDisplayWidth = 0; |
| 65 | int mBaseDisplayHeight = 0; |
Dianne Hackborn | dde331c | 2012-08-03 14:01:57 -0700 | [diff] [blame] | 66 | int mBaseDisplayDensity = 0; |
Craig Mautner | 2d5618c | 2012-10-18 13:55:47 -0700 | [diff] [blame] | 67 | private final DisplayInfo mDisplayInfo = new DisplayInfo(); |
| 68 | private final Display mDisplay; |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 69 | |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 70 | // Accessed directly by all users. |
| 71 | boolean layoutNeeded; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 72 | int pendingLayoutChanges; |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 73 | final boolean isDefaultDisplay; |
Craig Mautner | 3983419 | 2012-09-02 07:47:24 -0700 | [diff] [blame] | 74 | |
Craig Mautner | 2d5618c | 2012-10-18 13:55:47 -0700 | [diff] [blame] | 75 | /** |
Craig Mautner | b1fd65c0 | 2013-02-05 13:34:57 -0800 | [diff] [blame] | 76 | * Window tokens that are in the process of exiting, but still |
| 77 | * on screen for animations. |
| 78 | */ |
| 79 | final ArrayList<WindowToken> mExitingTokens = new ArrayList<WindowToken>(); |
| 80 | |
| 81 | /** |
| 82 | * Application tokens that are in the process of exiting, but still |
| 83 | * on screen for animations. |
| 84 | */ |
| 85 | final AppTokenList mExitingAppTokens = new AppTokenList(); |
| 86 | |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 87 | /** Array containing the home StackBox and possibly one more which would contain apps */ |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 88 | private ArrayList<StackBox> mStackBoxes = new ArrayList<StackBox>(); |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 89 | |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 90 | /** True when the home StackBox is at the top of mStackBoxes, false otherwise */ |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 91 | private TaskStack mHomeStack = null; |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 92 | |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 93 | /** Save allocating when retrieving tasks */ |
Craig Mautner | d9a2288 | 2013-03-16 15:00:36 -0700 | [diff] [blame] | 94 | ArrayList<Task> mTmpTasks = new ArrayList<Task>(); |
Craig Mautner | b1fd65c0 | 2013-02-05 13:34:57 -0800 | [diff] [blame] | 95 | |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 96 | /** Sorted most recent at top, oldest at [0]. */ |
| 97 | ArrayList<TaskStack> mStackHistory = new ArrayList<TaskStack>(); |
| 98 | |
Craig Mautner | b1fd65c0 | 2013-02-05 13:34:57 -0800 | [diff] [blame] | 99 | /** |
Craig Mautner | 2d5618c | 2012-10-18 13:55:47 -0700 | [diff] [blame] | 100 | * @param display May not be null. |
| 101 | */ |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 102 | DisplayContent(Display display) { |
| 103 | mDisplay = display; |
| 104 | mDisplayId = display.getDisplayId(); |
| 105 | display.getDisplayInfo(mDisplayInfo); |
Craig Mautner | 69b0818 | 2012-09-05 13:07:13 -0700 | [diff] [blame] | 106 | isDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY; |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | int getDisplayId() { |
| 110 | return mDisplayId; |
| 111 | } |
| 112 | |
| 113 | WindowList getWindowList() { |
| 114 | return mWindows; |
| 115 | } |
| 116 | |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 117 | Display getDisplay() { |
| 118 | return mDisplay; |
| 119 | } |
| 120 | |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 121 | DisplayInfo getDisplayInfo() { |
| 122 | return mDisplayInfo; |
| 123 | } |
| 124 | |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 125 | boolean homeOnTop() { |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 126 | return mStackBoxes.get(0).mStack != mHomeStack; |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 127 | } |
| 128 | |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 129 | void moveStack(TaskStack stack, boolean toTop) { |
| 130 | mStackHistory.remove(stack); |
| 131 | mStackHistory.add(toTop ? mStackHistory.size() : 0, stack); |
| 132 | } |
| 133 | |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 134 | /** |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 135 | * Retrieve the tasks on this display in stack order from the bottommost TaskStack up. |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 136 | * @return All the Tasks, in order, on this display. |
| 137 | */ |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 138 | ArrayList<Task> getTasks() { |
Craig Mautner | d9a2288 | 2013-03-16 15:00:36 -0700 | [diff] [blame] | 139 | mTmpTasks.clear(); |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 140 | final int numStacks = mStackHistory.size(); |
| 141 | for (int stackNdx = 0; stackNdx < numStacks; ++stackNdx) { |
| 142 | mTmpTasks.addAll(mStackHistory.get(stackNdx).getTasks()); |
Craig Mautner | d9a2288 | 2013-03-16 15:00:36 -0700 | [diff] [blame] | 143 | } |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 144 | if (WindowManagerService.DEBUG_LAYERS) Slog.i(TAG, "getTasks: mStackHistory=" + |
| 145 | mStackHistory); |
Craig Mautner | d9a2288 | 2013-03-16 15:00:36 -0700 | [diff] [blame] | 146 | return mTmpTasks; |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 147 | } |
| 148 | |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 149 | TaskStack getHomeStack() { |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 150 | return mHomeStack; |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 151 | } |
| 152 | |
Craig Mautner | 722285e | 2012-09-07 13:55:58 -0700 | [diff] [blame] | 153 | public void updateDisplayInfo() { |
| 154 | mDisplay.getDisplayInfo(mDisplayInfo); |
| 155 | } |
| 156 | |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 157 | /** @return The number of tokens in all of the Tasks on this display. */ |
Craig Mautner | f81b9087 | 2013-02-26 13:02:43 -0800 | [diff] [blame] | 158 | int numTokens() { |
Craig Mautner | d9a2288 | 2013-03-16 15:00:36 -0700 | [diff] [blame] | 159 | getTasks(); |
Craig Mautner | f81b9087 | 2013-02-26 13:02:43 -0800 | [diff] [blame] | 160 | int count = 0; |
Craig Mautner | d9a2288 | 2013-03-16 15:00:36 -0700 | [diff] [blame] | 161 | for (int taskNdx = mTmpTasks.size() - 1; taskNdx >= 0; --taskNdx) { |
| 162 | count += mTmpTasks.get(taskNdx).mAppTokens.size(); |
Craig Mautner | 05d6272ba | 2013-02-11 09:39:27 -0800 | [diff] [blame] | 163 | } |
Craig Mautner | f81b9087 | 2013-02-26 13:02:43 -0800 | [diff] [blame] | 164 | return count; |
Craig Mautner | 05d6272ba | 2013-02-11 09:39:27 -0800 | [diff] [blame] | 165 | } |
| 166 | |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 167 | /** Refer to {@link WindowManagerService#createStack(int, int, int, float)} */ |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 168 | TaskStack createStack(int stackId, int relativeStackId, int position, float weight) { |
| 169 | TaskStack newStack = null; |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 170 | if (DEBUG_STACK) Slog.d(TAG, "createStack: stackId=" + stackId + " relativeStackId=" |
| 171 | + relativeStackId + " position=" + position + " weight=" + weight); |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 172 | if (mStackBoxes.isEmpty()) { |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 173 | if (stackId != HOME_STACK_ID) { |
| 174 | throw new IllegalArgumentException("createStack: First stackId not " |
| 175 | + HOME_STACK_ID); |
| 176 | } |
Craig Mautner | 967212c | 2013-04-13 21:10:58 -0700 | [diff] [blame] | 177 | StackBox newBox = new StackBox(this, null); |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 178 | mStackBoxes.add(newBox); |
Craig Mautner | 967212c | 2013-04-13 21:10:58 -0700 | [diff] [blame] | 179 | newStack = new TaskStack(stackId, this); |
| 180 | newStack.mStackBox = newBox; |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 181 | newBox.mStack = newStack; |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 182 | mHomeStack = newStack; |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 183 | } else { |
| 184 | int stackBoxNdx; |
| 185 | for (stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { |
| 186 | final StackBox box = mStackBoxes.get(stackBoxNdx); |
| 187 | if (position == StackBox.TASK_STACK_GOES_OVER |
| 188 | || position == StackBox.TASK_STACK_GOES_UNDER) { |
| 189 | // Position indicates a new box is added at top level only. |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 190 | if (box.contains(relativeStackId)) { |
Craig Mautner | 967212c | 2013-04-13 21:10:58 -0700 | [diff] [blame] | 191 | StackBox newBox = new StackBox(this, null); |
| 192 | newStack = new TaskStack(stackId, this); |
| 193 | newStack.mStackBox = newBox; |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 194 | newBox.mStack = newStack; |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 195 | final int offset = position == StackBox.TASK_STACK_GOES_OVER ? 1 : 0; |
| 196 | if (DEBUG_STACK) Slog.d(TAG, "createStack: inserting stack at " + |
| 197 | (stackBoxNdx + offset)); |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 198 | mStackBoxes.add(stackBoxNdx + offset, newBox); |
| 199 | break; |
| 200 | } |
| 201 | } else { |
| 202 | // Remaining position values indicate a box must be split. |
| 203 | newStack = box.split(stackId, relativeStackId, position, weight); |
| 204 | if (newStack != null) { |
| 205 | break; |
| 206 | } |
| 207 | } |
| 208 | } |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 209 | if (stackBoxNdx < 0) { |
| 210 | throw new IllegalArgumentException("createStack: stackId " + relativeStackId |
| 211 | + " not found."); |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 212 | } |
| 213 | } |
Craig Mautner | 967212c | 2013-04-13 21:10:58 -0700 | [diff] [blame] | 214 | if (newStack != null) { |
| 215 | layoutNeeded = true; |
| 216 | } |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 217 | return newStack; |
| 218 | } |
| 219 | |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 220 | /** Refer to {@link WindowManagerService#resizeStack(int, float)} */ |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 221 | boolean resizeStack(int stackId, float weight) { |
Craig Mautner | 967212c | 2013-04-13 21:10:58 -0700 | [diff] [blame] | 222 | for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { |
Craig Mautner | c00204b | 2013-03-05 15:02:14 -0800 | [diff] [blame] | 223 | final StackBox box = mStackBoxes.get(stackBoxNdx); |
| 224 | if (box.resize(stackId, weight)) { |
| 225 | return true; |
| 226 | } |
| 227 | } |
| 228 | return false; |
| 229 | } |
| 230 | |
Craig Mautner | 4cd0c13f | 2013-04-16 15:55:52 -0700 | [diff] [blame] | 231 | void addStackBox(StackBox box, boolean toTop) { |
| 232 | if (mStackBoxes.size() >= 2) { |
| 233 | throw new RuntimeException("addStackBox: Too many toplevel StackBoxes!"); |
| 234 | } |
| 235 | mStackBoxes.add(toTop ? mStackBoxes.size() : 0, box); |
| 236 | } |
| 237 | |
Craig Mautner | 9e4f28c | 2013-04-03 10:53:23 -0700 | [diff] [blame] | 238 | void removeStackBox(StackBox box) { |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 239 | if (DEBUG_STACK) Slog.d(TAG, "removeStackBox: box=" + box); |
Craig Mautner | 9e4f28c | 2013-04-03 10:53:23 -0700 | [diff] [blame] | 240 | final TaskStack stack = box.mStack; |
| 241 | if (stack != null && stack.mStackId == HOME_STACK_ID) { |
| 242 | // Never delete the home stack, even if it is empty. |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 243 | if (DEBUG_STACK) Slog.d(TAG, "removeStackBox: Not deleting home stack."); |
Craig Mautner | 9e4f28c | 2013-04-03 10:53:23 -0700 | [diff] [blame] | 244 | return; |
| 245 | } |
| 246 | mStackBoxes.remove(box); |
| 247 | } |
| 248 | |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 249 | /** |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 250 | * Move the home StackBox to the top or bottom of mStackBoxes. That is the only place |
| 251 | * it is allowed to be. This is a nop if the home StackBox is already in the correct position. |
| 252 | * @param toTop Move home to the top of mStackBoxes if true, to the bottom if false. |
| 253 | * @return true if a change was made, false otherwise. |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 254 | */ |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 255 | boolean moveHomeStackBox(boolean toTop) { |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 256 | if (DEBUG_STACK) Slog.d(TAG, "moveHomeStackBox: toTop=" + toTop); |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 257 | switch (mStackBoxes.size()) { |
| 258 | case 0: throw new RuntimeException("moveHomeStackBox: No home StackBox!"); |
| 259 | case 1: return false; // Only the home StackBox exists. |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 260 | case 2: |
| 261 | if (homeOnTop() ^ toTop) { |
| 262 | mStackBoxes.add(mStackBoxes.remove(0)); |
Craig Mautner | d5d5d0f | 2013-04-03 15:08:21 -0700 | [diff] [blame] | 263 | return true; |
| 264 | } |
| 265 | return false; |
| 266 | default: throw new RuntimeException("moveHomeStackBox: Too many toplevel StackBoxes!"); |
Craig Mautner | 00af9fe | 2013-03-25 09:13:41 -0700 | [diff] [blame] | 267 | } |
| 268 | } |
| 269 | |
Craig Mautner | 967212c | 2013-04-13 21:10:58 -0700 | [diff] [blame] | 270 | /** |
| 271 | * Propagate the new bounds to all child stack boxes, applying weights as we move down. |
| 272 | * @param contentRect The bounds to apply at the top level. |
| 273 | */ |
| 274 | void setStackBoxSize(Rect contentRect) { |
| 275 | for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { |
| 276 | mStackBoxes.get(stackBoxNdx).setStackBoxSizes(contentRect); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | Rect getStackBounds(int stackId) { |
| 281 | for (int stackBoxNdx = mStackBoxes.size() - 1; stackBoxNdx >= 0; --stackBoxNdx) { |
| 282 | Rect bounds = mStackBoxes.get(stackBoxNdx).getStackBounds(stackId); |
| 283 | if (bounds != null) { |
| 284 | return bounds; |
| 285 | } |
| 286 | } |
| 287 | return null; |
| 288 | } |
| 289 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 290 | public void dump(String prefix, PrintWriter pw) { |
| 291 | pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); |
| 292 | final String subPrefix = " " + prefix; |
| 293 | pw.print(subPrefix); pw.print("init="); pw.print(mInitialDisplayWidth); pw.print("x"); |
| 294 | pw.print(mInitialDisplayHeight); pw.print(" "); pw.print(mInitialDisplayDensity); |
| 295 | pw.print("dpi"); |
| 296 | if (mInitialDisplayWidth != mBaseDisplayWidth |
| 297 | || mInitialDisplayHeight != mBaseDisplayHeight |
| 298 | || mInitialDisplayDensity != mBaseDisplayDensity) { |
| 299 | pw.print(" base="); |
| 300 | pw.print(mBaseDisplayWidth); pw.print("x"); pw.print(mBaseDisplayHeight); |
| 301 | pw.print(" "); pw.print(mBaseDisplayDensity); pw.print("dpi"); |
| 302 | } |
| 303 | pw.print(" cur="); |
| 304 | pw.print(mDisplayInfo.logicalWidth); |
| 305 | pw.print("x"); pw.print(mDisplayInfo.logicalHeight); |
| 306 | pw.print(" app="); |
| 307 | pw.print(mDisplayInfo.appWidth); |
| 308 | pw.print("x"); pw.print(mDisplayInfo.appHeight); |
| 309 | pw.print(" rng="); pw.print(mDisplayInfo.smallestNominalAppWidth); |
| 310 | pw.print("x"); pw.print(mDisplayInfo.smallestNominalAppHeight); |
| 311 | pw.print("-"); pw.print(mDisplayInfo.largestNominalAppWidth); |
| 312 | pw.print("x"); pw.println(mDisplayInfo.largestNominalAppHeight); |
Dianne Hackborn | c652de8 | 2013-02-15 16:32:56 -0800 | [diff] [blame] | 313 | pw.print(subPrefix); pw.print("layoutNeeded="); pw.println(layoutNeeded); |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 314 | for (int boxNdx = 0; boxNdx < mStackBoxes.size(); ++boxNdx) { |
| 315 | pw.print(prefix); pw.print("StackBox #"); pw.println(boxNdx); |
| 316 | mStackBoxes.get(boxNdx).dump(prefix + " ", pw); |
| 317 | } |
| 318 | int ndx = numTokens(); |
| 319 | if (ndx > 0) { |
| 320 | pw.println(); |
| 321 | pw.println(" Application tokens in Z order:"); |
| 322 | getTasks(); |
| 323 | for (int taskNdx = mTmpTasks.size() - 1; taskNdx >= 0; --taskNdx) { |
| 324 | AppTokenList tokens = mTmpTasks.get(taskNdx).mAppTokens; |
| 325 | for (int tokenNdx = tokens.size() - 1; tokenNdx >= 0; --tokenNdx) { |
| 326 | final AppWindowToken wtoken = tokens.get(tokenNdx); |
| 327 | pw.print(" App #"); pw.print(ndx--); |
| 328 | pw.print(' '); pw.print(wtoken); pw.println(":"); |
| 329 | wtoken.dump(pw, " "); |
Craig Mautner | b1fd65c0 | 2013-02-05 13:34:57 -0800 | [diff] [blame] | 330 | } |
| 331 | } |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 332 | } |
| 333 | if (mExitingTokens.size() > 0) { |
| 334 | pw.println(); |
| 335 | pw.println(" Exiting tokens:"); |
| 336 | for (int i=mExitingTokens.size()-1; i>=0; i--) { |
| 337 | WindowToken token = mExitingTokens.get(i); |
| 338 | pw.print(" Exiting #"); pw.print(i); |
| 339 | pw.print(' '); pw.print(token); |
| 340 | pw.println(':'); |
| 341 | token.dump(pw, " "); |
Craig Mautner | b1fd65c0 | 2013-02-05 13:34:57 -0800 | [diff] [blame] | 342 | } |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 343 | } |
| 344 | if (mExitingAppTokens.size() > 0) { |
| 345 | pw.println(); |
| 346 | pw.println(" Exiting application tokens:"); |
| 347 | for (int i=mExitingAppTokens.size()-1; i>=0; i--) { |
| 348 | WindowToken token = mExitingAppTokens.get(i); |
| 349 | pw.print(" Exiting App #"); pw.print(i); |
| 350 | pw.print(' '); pw.print(token); |
| 351 | pw.println(':'); |
| 352 | token.dump(pw, " "); |
Craig Mautner | b1fd65c0 | 2013-02-05 13:34:57 -0800 | [diff] [blame] | 353 | } |
Craig Mautner | de4ef02 | 2013-04-07 19:01:33 -0700 | [diff] [blame] | 354 | } |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 355 | pw.println(); |
| 356 | } |
| 357 | } |