blob: bb99787b5e47caedaefae9dd39e634a872b8630b [file] [log] [blame]
Craig Mautnerb1fd65c02013-02-05 13:34:57 -08001/*
2 * Copyright (C) 2013 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
17package com.android.server.wm;
18
Wale Ogunwale3797c222015-10-27 14:21:58 -070019import static android.app.ActivityManager.StackId.DOCKED_STACK_ID;
20import static android.app.ActivityManager.StackId.FREEFORM_WORKSPACE_STACK_ID;
21import static android.app.ActivityManager.StackId.HOME_STACK_ID;
22import static android.app.ActivityManager.StackId.PINNED_STACK_ID;
Wale Ogunwale1ed0d892015-09-28 13:27:44 -070023import static android.app.ActivityManager.RESIZE_MODE_SYSTEM_SCREEN_ROTATION;
Craig Mautner42bf39e2014-02-21 16:46:22 -080024import static com.android.server.wm.WindowManagerService.TAG;
Wale Ogunwalee4a0c572015-06-30 08:40:31 -070025import static com.android.server.wm.WindowManagerService.DEBUG_RESIZE;
Craig Mautnere3119b72015-01-20 15:02:36 -080026import static com.android.server.wm.WindowManagerService.DEBUG_STACK;
Wale Ogunwale1ed0d892015-09-28 13:27:44 -070027import static com.android.server.wm.WindowManagerService.H.RESIZE_TASK;
Wale Ogunwale99db1862015-10-23 20:08:22 -070028
Wale Ogunwale3797c222015-10-27 14:21:58 -070029import android.app.ActivityManager.StackId;
Wale Ogunwalee4a0c572015-06-30 08:40:31 -070030import android.content.res.Configuration;
31import android.graphics.Rect;
Craig Mautner2c2549c2013-11-12 08:31:15 -080032import android.util.EventLog;
Craig Mautner42bf39e2014-02-21 16:46:22 -080033import android.util.Slog;
Wale Ogunwalee4a0c572015-06-30 08:40:31 -070034import android.view.DisplayInfo;
35import android.view.Surface;
36
Craig Mautnere3119b72015-01-20 15:02:36 -080037import com.android.server.EventLogTags;
Craig Mautner2c2549c2013-11-12 08:31:15 -080038
Wale Ogunwalee4a0c572015-06-30 08:40:31 -070039import java.io.PrintWriter;
40import java.util.ArrayList;
41
42class Task implements DimLayer.DimLayerUser {
Wale Ogunwale2cc92f52015-09-09 13:12:10 -070043 // Return value from {@link setBounds} indicating no change was made to the Task bounds.
44 static final int BOUNDS_CHANGE_NONE = 0;
45 // Return value from {@link setBounds} indicating the position of the Task bounds changed.
46 static final int BOUNDS_CHANGE_POSITION = 1;
47 // Return value from {@link setBounds} indicating the size of the Task bounds changed.
48 static final int BOUNDS_CHANGE_SIZE = 1 << 1;
49
Craig Mautnerc00204b2013-03-05 15:02:14 -080050 TaskStack mStack;
Craig Mautner05d6272ba2013-02-11 09:39:27 -080051 final AppTokenList mAppTokens = new AppTokenList();
Craig Mautner83162a92015-01-26 14:43:30 -080052 final int mTaskId;
Craig Mautnerac6f8432013-07-17 13:24:59 -070053 final int mUserId;
Craig Mautner9ef471f2014-02-07 13:11:47 -080054 boolean mDeferRemoval = false;
Craig Mautnere3119b72015-01-20 15:02:36 -080055 final WindowManagerService mService;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080056
Wale Ogunwalee4a0c572015-06-30 08:40:31 -070057 // Content limits relative to the DisplayContent this sits in.
58 private Rect mBounds = new Rect();
59
60 // Device rotation as of the last time {@link #mBounds} was set.
61 int mRotation;
62
63 // Whether mBounds is fullscreen
64 private boolean mFullscreen = true;
65
66 // Contains configurations settings that are different from the global configuration due to
67 // stack specific operations. E.g. {@link #setBounds}.
68 Configuration mOverrideConfig;
69
70 // For comparison with DisplayContent bounds.
71 private Rect mTmpRect = new Rect();
72 // For handling display rotations.
73 private Rect mTmpRect2 = new Rect();
74
Chong Zhang3005e752015-09-18 18:46:28 -070075 // Whether the task is currently being drag-resized
76 private boolean mDragResizing;
77
Filip Gruszczynskiebcc8752015-08-25 16:51:05 -070078 Task(int taskId, TaskStack stack, int userId, WindowManagerService service, Rect bounds,
79 Configuration config) {
Craig Mautner83162a92015-01-26 14:43:30 -080080 mTaskId = taskId;
Craig Mautnerc00204b2013-03-05 15:02:14 -080081 mStack = stack;
Craig Mautnerac6f8432013-07-17 13:24:59 -070082 mUserId = userId;
Craig Mautnere3119b72015-01-20 15:02:36 -080083 mService = service;
Filip Gruszczynskiebcc8752015-08-25 16:51:05 -070084 setBounds(bounds, config);
Craig Mautnerc00204b2013-03-05 15:02:14 -080085 }
86
87 DisplayContent getDisplayContent() {
88 return mStack.getDisplayContent();
89 }
90
91 void addAppToken(int addPos, AppWindowToken wtoken) {
Craig Mautner42bf39e2014-02-21 16:46:22 -080092 final int lastPos = mAppTokens.size();
Craig Mautner83162a92015-01-26 14:43:30 -080093 if (addPos >= lastPos) {
94 addPos = lastPos;
95 } else {
96 for (int pos = 0; pos < lastPos && pos < addPos; ++pos) {
97 if (mAppTokens.get(pos).removed) {
98 // addPos assumes removed tokens are actually gone.
99 ++addPos;
100 }
Craig Mautner01f79cf2014-08-27 09:56:02 -0700101 }
Craig Mautner42bf39e2014-02-21 16:46:22 -0800102 }
Craig Mautnerc00204b2013-03-05 15:02:14 -0800103 mAppTokens.add(addPos, wtoken);
Craig Mautner83162a92015-01-26 14:43:30 -0800104 wtoken.mTask = this;
Craig Mautner42bf39e2014-02-21 16:46:22 -0800105 mDeferRemoval = false;
Craig Mautnerc00204b2013-03-05 15:02:14 -0800106 }
107
Craig Mautnere3119b72015-01-20 15:02:36 -0800108 void removeLocked() {
109 if (!mAppTokens.isEmpty() && mStack.isAnimating()) {
Craig Mautner83162a92015-01-26 14:43:30 -0800110 if (DEBUG_STACK) Slog.i(TAG, "removeTask: deferring removing taskId=" + mTaskId);
Craig Mautnere3119b72015-01-20 15:02:36 -0800111 mDeferRemoval = true;
112 return;
113 }
Craig Mautner83162a92015-01-26 14:43:30 -0800114 if (DEBUG_STACK) Slog.i(TAG, "removeTask: removing taskId=" + mTaskId);
115 EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId, "removeTask");
Craig Mautnere3119b72015-01-20 15:02:36 -0800116 mDeferRemoval = false;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700117 DisplayContent content = getDisplayContent();
118 if (content != null) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800119 content.mDimLayerController.removeDimLayerUser(this);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700120 }
Craig Mautnere3119b72015-01-20 15:02:36 -0800121 mStack.removeTask(this);
Craig Mautner83162a92015-01-26 14:43:30 -0800122 mService.mTaskIdToTask.delete(mTaskId);
Craig Mautnere3119b72015-01-20 15:02:36 -0800123 }
124
Wale Ogunwale53a29a92015-02-23 15:42:52 -0800125 void moveTaskToStack(TaskStack stack, boolean toTop) {
126 if (stack == mStack) {
127 return;
128 }
129 if (DEBUG_STACK) Slog.i(TAG, "moveTaskToStack: removing taskId=" + mTaskId
130 + " from stack=" + mStack);
Wale Ogunwale000957c2015-04-03 08:19:12 -0700131 EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId, "moveTask");
Wale Ogunwale53a29a92015-02-23 15:42:52 -0800132 if (mStack != null) {
133 mStack.removeTask(this);
134 }
135 stack.addTask(this, toTop);
136 }
137
Wale Ogunwaleddc1cb22015-07-25 19:23:04 -0700138 void positionTaskInStack(TaskStack stack, int position) {
139 if (mStack != null && stack != mStack) {
140 if (DEBUG_STACK) Slog.i(TAG, "positionTaskInStack: removing taskId=" + mTaskId
141 + " from stack=" + mStack);
142 EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId, "moveTask");
143 mStack.removeTask(this);
144 }
145 stack.positionTask(this, position, showForAllUsers());
146 }
147
Craig Mautnerc00204b2013-03-05 15:02:14 -0800148 boolean removeAppToken(AppWindowToken wtoken) {
Craig Mautner42bf39e2014-02-21 16:46:22 -0800149 boolean removed = mAppTokens.remove(wtoken);
Craig Mautnerc00204b2013-03-05 15:02:14 -0800150 if (mAppTokens.size() == 0) {
Wale Ogunwale000957c2015-04-03 08:19:12 -0700151 EventLog.writeEvent(EventLogTags.WM_TASK_REMOVED, mTaskId,
Craig Mautner2c2549c2013-11-12 08:31:15 -0800152 "removeAppToken: last token");
Craig Mautnere3119b72015-01-20 15:02:36 -0800153 if (mDeferRemoval) {
154 removeLocked();
155 }
Craig Mautnerc00204b2013-03-05 15:02:14 -0800156 }
Craig Mautner83162a92015-01-26 14:43:30 -0800157 wtoken.mTask = null;
158 /* Leave mTaskId for now, it might be useful for debug
159 wtoken.mTaskId = -1;
160 */
Craig Mautner42bf39e2014-02-21 16:46:22 -0800161 return removed;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -0800162 }
Craig Mautner5d9c7be2013-02-15 14:02:56 -0800163
Craig Mautnercbd84af2014-10-22 13:21:22 -0700164 void setSendingToBottom(boolean toBottom) {
165 for (int appTokenNdx = 0; appTokenNdx < mAppTokens.size(); appTokenNdx++) {
166 mAppTokens.get(appTokenNdx).sendingToBottom = toBottom;
167 }
168 }
169
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700170 /** Set the task bounds. Passing in null sets the bounds to fullscreen. */
Wale Ogunwale2cc92f52015-09-09 13:12:10 -0700171 int setBounds(Rect bounds, Configuration config) {
Filip Gruszczynskiebcc8752015-08-25 16:51:05 -0700172 if (config == null) {
173 config = Configuration.EMPTY;
174 }
175 if (bounds == null && !Configuration.EMPTY.equals(config)) {
176 throw new IllegalArgumentException("null bounds but non empty configuration: "
177 + config);
178 }
179 if (bounds != null && Configuration.EMPTY.equals(config)) {
180 throw new IllegalArgumentException("non null bounds, but empty configuration");
181 }
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700182 boolean oldFullscreen = mFullscreen;
183 int rotation = Surface.ROTATION_0;
184 final DisplayContent displayContent = mStack.getDisplayContent();
185 if (displayContent != null) {
186 displayContent.getLogicalDisplayRect(mTmpRect);
187 rotation = displayContent.getDisplayInfo().rotation;
188 if (bounds == null) {
189 bounds = mTmpRect;
190 mFullscreen = true;
191 } else {
Wale Ogunwale99db1862015-10-23 20:08:22 -0700192 if ((mStack.mStackId != FREEFORM_WORKSPACE_STACK_ID
193 && mStack.mStackId != PINNED_STACK_ID) || bounds.isEmpty()) {
Stefan Kuhne234dbf82015-08-13 09:44:28 -0700194 // ensure bounds are entirely within the display rect
195 if (!bounds.intersect(mTmpRect)) {
196 // Can't set bounds outside the containing display...Sorry!
Wale Ogunwale2cc92f52015-09-09 13:12:10 -0700197 return BOUNDS_CHANGE_NONE;
Stefan Kuhne234dbf82015-08-13 09:44:28 -0700198 }
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700199 }
200 mFullscreen = mTmpRect.equals(bounds);
201 }
202 }
203
204 if (bounds == null) {
205 // Can't set to fullscreen if we don't have a display to get bounds from...
Wale Ogunwale2cc92f52015-09-09 13:12:10 -0700206 return BOUNDS_CHANGE_NONE;
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700207 }
208 if (mBounds.equals(bounds) && oldFullscreen == mFullscreen && mRotation == rotation) {
Wale Ogunwale2cc92f52015-09-09 13:12:10 -0700209 return BOUNDS_CHANGE_NONE;
210 }
211
212 int boundsChange = BOUNDS_CHANGE_NONE;
213 if (mBounds.left != bounds.left || mBounds.right != bounds.right) {
214 boundsChange |= BOUNDS_CHANGE_POSITION;
215 }
216 if (mBounds.width() != bounds.width() || mBounds.height() != bounds.height()) {
217 boundsChange |= BOUNDS_CHANGE_SIZE;
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700218 }
219
220 mBounds.set(bounds);
221 mRotation = rotation;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700222 if (displayContent != null) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800223 displayContent.mDimLayerController.updateDimLayer(this);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700224 }
Filip Gruszczynskiebcc8752015-08-25 16:51:05 -0700225 mOverrideConfig = mFullscreen ? Configuration.EMPTY : config;
Wale Ogunwale2cc92f52015-09-09 13:12:10 -0700226 return boundsChange;
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700227 }
228
Chong Zhang87b21722015-09-21 15:39:51 -0700229 boolean resizeLocked(Rect bounds, Configuration configuration, boolean forced) {
Chong Zhang3005e752015-09-18 18:46:28 -0700230 int boundsChanged = setBounds(bounds, configuration);
Chong Zhang87b21722015-09-21 15:39:51 -0700231 if (forced) {
Chong Zhang3005e752015-09-18 18:46:28 -0700232 boundsChanged |= BOUNDS_CHANGE_SIZE;
Chong Zhang3005e752015-09-18 18:46:28 -0700233 }
234 if (boundsChanged == BOUNDS_CHANGE_NONE) {
235 return false;
236 }
237 if ((boundsChanged & BOUNDS_CHANGE_SIZE) == BOUNDS_CHANGE_SIZE) {
238 resizeWindows();
239 }
240 return true;
241 }
242
Wale Ogunwalef175e8a2015-09-29 11:07:06 -0700243 /** Return true if the current bound can get outputted to the rest of the system as-is. */
244 private boolean useCurrentBounds() {
245 final DisplayContent displayContent = mStack.getDisplayContent();
246 if (mFullscreen
Wale Ogunwale3797c222015-10-27 14:21:58 -0700247 || !StackId.isTaskResizeableByDockedStack(mStack.mStackId)
Wale Ogunwalef175e8a2015-09-29 11:07:06 -0700248 || displayContent == null
249 || displayContent.getDockedStackLocked() != null) {
250 return true;
251 }
252 return false;
253 }
254
Chong Zhang4c9ba52a2015-11-10 18:36:33 -0800255 /** Original bounds of the task if applicable, otherwise fullscreen rect. */
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700256 public void getBounds(Rect out) {
Wale Ogunwalef175e8a2015-09-29 11:07:06 -0700257 if (useCurrentBounds()) {
258 // No need to adjust the output bounds if fullscreen or the docked stack is visible
259 // since it is already what we want to represent to the rest of the system.
260 out.set(mBounds);
261 return;
262 }
263
264 // The bounds has been adjusted to accommodate for a docked stack, but the docked stack
265 // is not currently visible. Go ahead a represent it as fullscreen to the rest of the
266 // system.
267 mStack.getDisplayContent().getLogicalDisplayRect(out);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700268 }
269
Chong Zhang4c9ba52a2015-11-10 18:36:33 -0800270
271 /**
272 * Calculate the maximum visible area of this task. If the task has only one app,
273 * the result will be visible frame of that app. If the task has more than one apps,
274 * we search from top down if the next app got different visible area.
275 *
276 * This effort is to handle the case where some task (eg. GMail composer) might pop up
277 * a dialog that's different in size from the activity below, in which case we should
278 * be dimming the entire task area behind the dialog.
279 *
280 * @param out Rect containing the max visible bounds.
281 * @return true if the task has some visible app windows; false otherwise.
282 */
283 boolean getMaxVisibleBounds(Rect out) {
284 boolean foundTop = false;
285 for (int i = mAppTokens.size() - 1; i >= 0; i--) {
286 final WindowState win = mAppTokens.get(i).findMainWindow();
287 if (win == null) {
288 continue;
289 }
290 if (!foundTop) {
291 out.set(win.mVisibleFrame);
292 foundTop = true;
293 continue;
294 }
295 if (win.mVisibleFrame.left < out.left) {
296 out.left = win.mVisibleFrame.left;
297 }
298 if (win.mVisibleFrame.top < out.top) {
299 out.top = win.mVisibleFrame.top;
300 }
301 if (win.mVisibleFrame.right > out.right) {
302 out.right = win.mVisibleFrame.right;
303 }
304 if (win.mVisibleFrame.bottom > out.bottom) {
305 out.bottom = win.mVisibleFrame.bottom;
306 }
307 }
308 return foundTop;
309 }
310
311 /** Bounds of the task to be used for dimming, as well as touch related tests. */
312 @Override
313 public void getDimBounds(Rect out) {
314 if (useCurrentBounds()) {
315 if (inFreeformWorkspace() && getMaxVisibleBounds(out)) {
316 return;
317 }
318
319 out.set(mBounds);
320 return;
321 }
322
323 // The bounds has been adjusted to accommodate for a docked stack, but the docked stack
324 // is not currently visible. Go ahead a represent it as fullscreen to the rest of the
325 // system.
326 mStack.getDisplayContent().getLogicalDisplayRect(out);
327 }
328
Chong Zhang3005e752015-09-18 18:46:28 -0700329 void setDragResizing(boolean dragResizing) {
Chong Zhang3005e752015-09-18 18:46:28 -0700330 mDragResizing = dragResizing;
331 }
332
333 boolean isDragResizing() {
334 return mDragResizing;
335 }
336
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700337 void updateDisplayInfo(final DisplayContent displayContent) {
338 if (displayContent == null) {
339 return;
340 }
341 if (mFullscreen) {
Filip Gruszczynskiebcc8752015-08-25 16:51:05 -0700342 setBounds(null, Configuration.EMPTY);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700343 return;
344 }
345 final int newRotation = displayContent.getDisplayInfo().rotation;
346 if (mRotation == newRotation) {
347 return;
348 }
349
350 // Device rotation changed. We don't want the task to move around on the screen when
351 // this happens, so update the task bounds so it stays in the same place.
Wale Ogunwale94744212015-09-21 19:01:47 -0700352 mTmpRect2.set(mBounds);
353 displayContent.rotateBounds(mRotation, newRotation, mTmpRect2);
Wale Ogunwale1ed0d892015-09-28 13:27:44 -0700354 if (setBounds(mTmpRect2, mOverrideConfig) != BOUNDS_CHANGE_NONE) {
355 // Post message to inform activity manager of the bounds change simulating
356 // a one-way call. We do this to prevent a deadlock between window manager
Filip Gruszczynski44bc4da2015-10-03 13:59:49 -0700357 // lock and activity manager lock been held. Only tasks within the freeform stack
358 // are resizeable independently of their stack resizing.
359 if (mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID) {
360 mService.mH.sendMessage(mService.mH.obtainMessage(
361 RESIZE_TASK, mTaskId, RESIZE_MODE_SYSTEM_SCREEN_ROTATION, mBounds));
362 }
Wale Ogunwale1ed0d892015-09-28 13:27:44 -0700363 }
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700364 }
365
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700366 void resizeWindows() {
367 final ArrayList<WindowState> resizingWindows = mService.mResizingWindows;
368 for (int activityNdx = mAppTokens.size() - 1; activityNdx >= 0; --activityNdx) {
369 final ArrayList<WindowState> windows = mAppTokens.get(activityNdx).allAppWindows;
370 for (int winNdx = windows.size() - 1; winNdx >= 0; --winNdx) {
371 final WindowState win = windows.get(winNdx);
372 if (!resizingWindows.contains(win)) {
373 if (DEBUG_RESIZE) Slog.d(TAG, "setBounds: Resizing " + win);
374 resizingWindows.add(win);
375 }
376 }
377 }
378 }
379
Winsonc28098f2015-10-30 14:50:19 -0700380 /**
381 * Cancels any running app transitions associated with the task.
382 */
383 void cancelTaskWindowTransition() {
384 for (int activityNdx = mAppTokens.size() - 1; activityNdx >= 0; --activityNdx) {
385 mAppTokens.get(activityNdx).mAppAnimator.clearAnimation();
386 }
387 }
388
Winson13d30662015-11-06 15:30:29 -0800389 /**
390 * Cancels any running thumbnail transitions associated with the task.
391 */
392 void cancelTaskThumbnailTransition() {
393 for (int activityNdx = mAppTokens.size() - 1; activityNdx >= 0; --activityNdx) {
394 mAppTokens.get(activityNdx).mAppAnimator.clearThumbnail();
395 }
396 }
397
Wale Ogunwale6dfdfd62015-04-15 12:01:38 -0700398 boolean showForAllUsers() {
Wale Ogunwale3fcb4a82015-04-06 14:00:13 -0700399 final int tokensCount = mAppTokens.size();
Wale Ogunwale6dfdfd62015-04-15 12:01:38 -0700400 return (tokensCount != 0) && mAppTokens.get(tokensCount - 1).showForAllUsers;
Wale Ogunwale3fcb4a82015-04-06 14:00:13 -0700401 }
402
Chong Zhangdb20b5f2015-10-23 14:01:43 -0700403 boolean inHomeStack() {
404 return mStack != null && mStack.mStackId == HOME_STACK_ID;
405 }
406
Chong Zhang09b21ef2015-09-14 10:20:21 -0700407 boolean inFreeformWorkspace() {
408 return mStack != null && mStack.mStackId == FREEFORM_WORKSPACE_STACK_ID;
409 }
410
Filip Gruszczynski955b2fc2015-10-15 14:46:07 -0700411 boolean inDockedWorkspace() {
412 return mStack != null && mStack.mStackId == DOCKED_STACK_ID;
413 }
414
Chong Zhang9184ec62015-09-24 12:32:21 -0700415 WindowState getTopAppMainWindow() {
416 final int tokensCount = mAppTokens.size();
417 return tokensCount > 0 ? mAppTokens.get(tokensCount - 1).findMainWindow() : null;
418 }
419
Chong Zhangbef461f2015-10-27 11:38:24 -0700420 AppWindowToken getTopAppWindowToken() {
421 final int tokensCount = mAppTokens.size();
422 return tokensCount > 0 ? mAppTokens.get(tokensCount - 1) : null;
423 }
424
Craig Mautner5d9c7be2013-02-15 14:02:56 -0800425 @Override
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700426 public boolean isFullscreen() {
Wale Ogunwalef175e8a2015-09-29 11:07:06 -0700427 if (useCurrentBounds()) {
428 return mFullscreen;
429 }
430 // The bounds has been adjusted to accommodate for a docked stack, but the docked stack
431 // is not currently visible. Go ahead a represent it as fullscreen to the rest of the
432 // system.
433 return true;
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700434 }
435
436 @Override
437 public DisplayInfo getDisplayInfo() {
438 return mStack.getDisplayContent().getDisplayInfo();
439 }
440
441 @Override
Craig Mautner5d9c7be2013-02-15 14:02:56 -0800442 public String toString() {
Craig Mautner83162a92015-01-26 14:43:30 -0800443 return "{taskId=" + mTaskId + " appTokens=" + mAppTokens + " mdr=" + mDeferRemoval + "}";
Craig Mautner5d9c7be2013-02-15 14:02:56 -0800444 }
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700445
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700446 @Override
447 public String toShortString() {
448 return "Task=" + mTaskId;
449 }
450
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700451 public void printTo(String prefix, PrintWriter pw) {
452 pw.print(prefix); pw.print("taskId="); pw.print(mTaskId);
453 pw.print(prefix); pw.print("appTokens="); pw.print(mAppTokens);
454 pw.print(prefix); pw.print("mdr="); pw.println(mDeferRemoval);
Wale Ogunwalee4a0c572015-06-30 08:40:31 -0700455 }
Craig Mautnerb1fd65c02013-02-05 13:34:57 -0800456}