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