Home | History | Annotate | Download | only in recent
      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 
     17 package com.android.systemui.recent;
     18 
     19 import android.os.UserHandle;
     20 import android.content.Intent;
     21 import android.content.pm.ResolveInfo;
     22 import android.graphics.drawable.Drawable;
     23 
     24 public 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     final int userId;
     32 
     33     private Drawable mThumbnail; // generated by Activity.onCreateThumbnail()
     34     private Drawable mIcon; // application package icon
     35     private CharSequence mLabel; // application package label
     36     private boolean mLoaded;
     37 
     38     public TaskDescription(int _taskId, int _persistentTaskId,
     39             ResolveInfo _resolveInfo, Intent _intent,
     40             String _packageName, CharSequence _description, int _userId) {
     41         resolveInfo = _resolveInfo;
     42         intent = _intent;
     43         taskId = _taskId;
     44         persistentTaskId = _persistentTaskId;
     45 
     46         description = _description;
     47         packageName = _packageName;
     48         userId = _userId;
     49     }
     50 
     51     public TaskDescription() {
     52         resolveInfo = null;
     53         intent = null;
     54         taskId = -1;
     55         persistentTaskId = -1;
     56 
     57         description = null;
     58         packageName = null;
     59         userId = UserHandle.USER_NULL;
     60     }
     61 
     62     public void setLoaded(boolean loaded) {
     63         mLoaded = loaded;
     64     }
     65 
     66     public boolean isLoaded() {
     67         return mLoaded;
     68     }
     69 
     70     public boolean isNull() {
     71         return resolveInfo == null;
     72     }
     73 
     74     // mark all these as locked?
     75     public CharSequence getLabel() {
     76         return mLabel;
     77     }
     78 
     79     public void setLabel(CharSequence label) {
     80         mLabel = label;
     81     }
     82 
     83     public Drawable getIcon() {
     84         return mIcon;
     85     }
     86 
     87     public void setIcon(Drawable icon) {
     88         mIcon = icon;
     89     }
     90 
     91     public void setThumbnail(Drawable thumbnail) {
     92         mThumbnail = thumbnail;
     93     }
     94 
     95     public Drawable getThumbnail() {
     96         return mThumbnail;
     97     }
     98 }
     99