FileDocCategorySizeDatePackage
Task.javaAPI DocAndroid 5.1 API7378Thu Mar 12 22:22:42 GMT 2015com.android.systemui.recents.model

Task

public class Task extends Object
A task represents the top most task in the system's task stack.

Fields Summary
public TaskKey
key
public TaskGrouping
group
public int
taskAffiliation
public int
taskAffiliationColor
public boolean
isLaunchTarget
public android.graphics.drawable.Drawable
applicationIcon
public android.graphics.drawable.Drawable
activityIcon
public String
activityLabel
public int
colorPrimary
public boolean
useLightOnPrimaryColor
public android.graphics.Bitmap
thumbnail
public boolean
isActive
public boolean
lockToThisTask
public boolean
lockToTaskEnabled
public android.graphics.Bitmap
icon
public String
iconFilename
TaskCallbacks
mCb
Constructors Summary
public Task()

        // Do nothing
    
public Task(TaskKey key, boolean isActive, int taskAffiliation, int taskAffiliationColor, String activityTitle, android.graphics.drawable.Drawable activityIcon, int colorPrimary, boolean lockToThisTask, boolean lockToTaskEnabled, android.graphics.Bitmap icon, String iconFilename)

        boolean isInAffiliationGroup = (taskAffiliation != key.id);
        boolean hasAffiliationGroupColor = isInAffiliationGroup && (taskAffiliationColor != 0);
        this.key = key;
        this.taskAffiliation = taskAffiliation;
        this.taskAffiliationColor = taskAffiliationColor;
        this.activityLabel = activityTitle;
        this.activityIcon = activityIcon;
        this.colorPrimary = hasAffiliationGroupColor ? taskAffiliationColor : colorPrimary;
        this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(this.colorPrimary,
                Color.WHITE) > 3f;
        this.isActive = isActive;
        this.lockToThisTask = lockToTaskEnabled && lockToThisTask;
        this.lockToTaskEnabled = lockToTaskEnabled;
        this.icon = icon;
        this.iconFilename = iconFilename;
    
Methods Summary
public voidcopyFrom(com.android.systemui.recents.model.Task o)
Copies the other task.

        this.key = o.key;
        this.taskAffiliation = o.taskAffiliation;
        this.taskAffiliationColor = o.taskAffiliationColor;
        this.activityLabel = o.activityLabel;
        this.activityIcon = o.activityIcon;
        this.colorPrimary = o.colorPrimary;
        this.useLightOnPrimaryColor = o.useLightOnPrimaryColor;
        this.isActive = o.isActive;
        this.lockToThisTask = o.lockToThisTask;
        this.lockToTaskEnabled = o.lockToTaskEnabled;
    
public booleanequals(java.lang.Object o)

        // Check that the id matches
        Task t = (Task) o;
        return key.equals(t.key);
    
public voidnotifyTaskDataLoaded(android.graphics.Bitmap thumbnail, android.graphics.drawable.Drawable applicationIcon)
Notifies the callback listeners that this task has been loaded

        this.applicationIcon = applicationIcon;
        this.thumbnail = thumbnail;
        if (mCb != null) {
            mCb.onTaskDataLoaded();
        }
    
public voidnotifyTaskDataUnloaded(android.graphics.Bitmap defaultThumbnail, android.graphics.drawable.Drawable defaultApplicationIcon)
Notifies the callback listeners that this task has been unloaded

        applicationIcon = defaultApplicationIcon;
        thumbnail = defaultThumbnail;
        if (mCb != null) {
            mCb.onTaskDataUnloaded();
        }
    
public voidsetCallbacks(com.android.systemui.recents.model.Task$TaskCallbacks cb)
Set the callbacks

        mCb = cb;
    
public voidsetGroup(TaskGrouping group)
Set the grouping

        if (group != null && this.group != null) {
            throw new RuntimeException("This task is already assigned to a group.");
        }
        this.group = group;
    
public java.lang.StringtoString()

        String groupAffiliation = "no group";
        if (group != null) {
            groupAffiliation = Integer.toString(group.affiliation);
        }
        return "Task (" + groupAffiliation + "): " + key.baseIntent.getComponent().getPackageName() +
                " [" + super.toString() + "]";