TaskDescription.java revision 6090995951c6e2e4dcf38102f01793f8a94166e1
1/*
2 * Copyright (C) 2011 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.systemui.recent;
18
19import android.content.Intent;
20import android.content.pm.ResolveInfo;
21import android.graphics.drawable.Drawable;
22
23public final class TaskDescription {
24    final ResolveInfo resolveInfo;
25    final int taskId; // application task id for curating apps
26    final int persistentTaskId; // persistent id
27    final Intent intent; // launch intent for application
28    final String packageName; // used to override animations (see onClick())
29    final CharSequence description;
30
31    private Drawable mThumbnail; // generated by Activity.onCreateThumbnail()
32    private Drawable mIcon; // application package icon
33    private CharSequence mLabel; // application package label
34    private boolean mLoaded;
35
36    public TaskDescription(int _taskId, int _persistentTaskId,
37            ResolveInfo _resolveInfo, Intent _intent,
38            String _packageName, CharSequence _description) {
39        resolveInfo = _resolveInfo;
40        intent = _intent;
41        taskId = _taskId;
42        persistentTaskId = _persistentTaskId;
43
44        description = _description;
45        packageName = _packageName;
46    }
47
48    public TaskDescription() {
49        resolveInfo = null;
50        intent = null;
51        taskId = -1;
52        persistentTaskId = -1;
53
54        description = null;
55        packageName = null;
56    }
57
58    public void setLoaded(boolean loaded) {
59        mLoaded = loaded;
60    }
61
62    public boolean isLoaded() {
63        return mLoaded;
64    }
65
66    public boolean isNull() {
67        return resolveInfo == null;
68    }
69
70    // mark all these as locked?
71    public CharSequence getLabel() {
72        return mLabel;
73    }
74
75    public void setLabel(CharSequence label) {
76        mLabel = label;
77    }
78
79    public Drawable getIcon() {
80        return mIcon;
81    }
82
83    public void setIcon(Drawable icon) {
84        mIcon = icon;
85    }
86
87    public void setThumbnail(Drawable thumbnail) {
88        mThumbnail = thumbnail;
89    }
90
91    public Drawable getThumbnail() {
92        return mThumbnail;
93    }
94}
95