Task.java revision 9ef471f7f2f59de032d7cb9c3c7241486109979e
1/* 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 19import android.util.EventLog; 20import com.android.server.EventLogTags; 21 22class Task { 23// private final String TAG = "TaskGroup"; 24 TaskStack mStack; 25 final AppTokenList mAppTokens = new AppTokenList(); 26 final int taskId; 27 final int mUserId; 28 boolean mDeferRemoval = false; 29 30 Task(AppWindowToken wtoken, TaskStack stack, int userId) { 31 taskId = wtoken.groupId; 32 mAppTokens.add(wtoken); 33 mStack = stack; 34 mUserId = userId; 35 } 36 37 DisplayContent getDisplayContent() { 38 return mStack.getDisplayContent(); 39 } 40 41 void addAppToken(int addPos, AppWindowToken wtoken) { 42 mAppTokens.add(addPos, wtoken); 43 } 44 45 boolean removeAppToken(AppWindowToken wtoken) { 46 mAppTokens.remove(wtoken); 47 if (mAppTokens.size() == 0) { 48 EventLog.writeEvent(com.android.server.EventLogTags.WM_TASK_REMOVED, taskId, 49 "removeAppToken: last token"); 50 return true; 51 } 52 return false; 53 } 54 55 @Override 56 public String toString() { 57 return "{taskId=" + taskId + " appTokens=" + mAppTokens + "}"; 58 } 59} 60