blob: d9acbb95f72fab8ba551438c0df6e76e5cfebb3e [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 Mautnerac6f8432013-07-17 13:24:59 -070024 final int mUserId;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080025
Craig Mautnerac6f8432013-07-17 13:24:59 -070026 Task(AppWindowToken wtoken, TaskStack stack, int userId) {
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080027 taskId = wtoken.groupId;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080028 mAppTokens.add(wtoken);
Craig Mautnerc00204b2013-03-05 15:02:14 -080029 mStack = stack;
Craig Mautnerac6f8432013-07-17 13:24:59 -070030 mUserId = userId;
Craig Mautnerc00204b2013-03-05 15:02:14 -080031 }
32
33 DisplayContent getDisplayContent() {
34 return mStack.getDisplayContent();
35 }
36
37 void addAppToken(int addPos, AppWindowToken wtoken) {
38 mAppTokens.add(addPos, wtoken);
39 }
40
41 boolean removeAppToken(AppWindowToken wtoken) {
42 mAppTokens.remove(wtoken);
43 if (mAppTokens.size() == 0) {
44 mStack.removeTask(this);
45 return true;
46 }
47 return false;
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080048 }
Craig Mautner5d9c7be2013-02-15 14:02:56 -080049
50 @Override
51 public String toString() {
Craig Mautner4cd0c13f2013-04-16 15:55:52 -070052 return "{taskId=" + taskId + " appTokens=" + mAppTokens + "}";
Craig Mautner5d9c7be2013-02-15 14:02:56 -080053 }
Craig Mautnerb1fd65c02013-02-05 13:34:57 -080054}