blob: 88eb96e226821b838529502eb63beaceb4f1880f [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
Craig Mautnerc00204b2013-03-05 15:02:14 -080019class Task {
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080020// private final String TAG = "TaskGroup";
Craig Mautnerc00204b2013-03-05 15:02:14 -080021 TaskStack mStack;
Craig Mautner05d6272ba2013-02-11 09:39:27 -080022 final AppTokenList mAppTokens = new AppTokenList();
23 final int taskId;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080024
Craig Mautnerc00204b2013-03-05 15:02:14 -080025 Task(AppWindowToken wtoken, TaskStack stack) {
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080026 taskId = wtoken.groupId;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080027 mAppTokens.add(wtoken);
Craig Mautnerc00204b2013-03-05 15:02:14 -080028 mStack = stack;
29 }
30
31 DisplayContent getDisplayContent() {
32 return mStack.getDisplayContent();
33 }
34
35 void addAppToken(int addPos, AppWindowToken wtoken) {
36 mAppTokens.add(addPos, wtoken);
37 }
38
39 boolean removeAppToken(AppWindowToken wtoken) {
40 mAppTokens.remove(wtoken);
41 if (mAppTokens.size() == 0) {
42 mStack.removeTask(this);
43 return true;
44 }
45 return false;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080046 }
Craig Mautner5d9c7be2013-02-15 14:02:56 -080047
48 @Override
49 public String toString() {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -070050 return "{taskId=" + taskId + " appTokens=" + mAppTokens + "}";
Craig Mautner5d9c7be2013-02-15 14:02:56 -080051 }
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080052}