use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by AOSPA.
the class RecentsTaskLoader method run.
@Override
public void run() {
while (true) {
if (mCancelled) {
// We have to unset the context here, since the background thread may be using it
// when we call stop()
mContext = null;
// If we are cancelled, then wait until we are started again
synchronized (mLoadThread) {
try {
mLoadThread.wait();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
} else {
RecentsConfiguration config = Recents.getConfiguration();
SystemServicesProxy ssp = Recents.getSystemServices();
// the load thread
if (ssp != null) {
// Load the next item from the queue
final Task t = mLoadQueue.nextTask();
if (t != null) {
Drawable cachedIcon = mIconCache.get(t.key);
ThumbnailData cachedThumbnailData = mThumbnailCache.get(t.key);
// Load the icon if it is stale or we haven't cached one yet
if (cachedIcon == null) {
cachedIcon = ssp.getBadgedTaskDescriptionIcon(t.taskDescription, t.key.userId, mContext.getResources());
if (cachedIcon == null) {
ActivityInfo info = ssp.getActivityInfo(t.key.getComponent(), t.key.userId);
if (info != null) {
if (DEBUG)
Log.d(TAG, "Loading icon: " + t.key);
cachedIcon = ssp.getBadgedActivityIcon(info, t.key.userId);
}
}
if (cachedIcon == null) {
cachedIcon = mDefaultIcon;
}
// At this point, even if we can't load the icon, we will set the
// default icon.
mIconCache.put(t.key, cachedIcon);
}
// Load the thumbnail if it is stale or we haven't cached one yet
if (cachedThumbnailData == null) {
if (config.svelteLevel < RecentsConfiguration.SVELTE_DISABLE_LOADING) {
if (DEBUG)
Log.d(TAG, "Loading thumbnail: " + t.key);
cachedThumbnailData = ssp.getTaskThumbnail(t.key.id);
}
if (cachedThumbnailData.thumbnail == null) {
cachedThumbnailData.thumbnail = mDefaultThumbnail;
} else {
// Kick off an early upload of the bitmap to GL so
// that this won't jank the first frame it's drawn in.
cachedThumbnailData.thumbnail.prepareToDraw();
}
// them from scratch each time)
if (config.svelteLevel < RecentsConfiguration.SVELTE_LIMIT_CACHE) {
mThumbnailCache.put(t.key, cachedThumbnailData);
}
}
if (!mCancelled) {
// Notify that the task data has changed
final Drawable newIcon = cachedIcon;
final ThumbnailData newThumbnailData = cachedThumbnailData;
mMainThreadHandler.post(new Runnable() {
@Override
public void run() {
t.notifyTaskDataLoaded(newThumbnailData.thumbnail, newIcon, newThumbnailData.thumbnailInfo);
}
});
}
}
}
// If there are no other items in the list, then just wait until something is added
if (!mCancelled && mLoadQueue.isEmpty()) {
synchronized (mLoadQueue) {
try {
mWaitingOnLoadQueue = true;
while (mLoadQueue.isEmpty()) {
mLoadQueue.wait();
}
mWaitingOnLoadQueue = false;
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
}
}
}
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by AOSPA.
the class RecentsTvImpl method startRecentsActivity.
protected void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask, ActivityOptions opts, boolean fromHome, boolean fromThumbnail) {
// Update the configuration based on the launch options
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
launchState.launchedFromHome = fromHome;
launchState.launchedFromApp = fromThumbnail;
launchState.launchedToTaskId = (runningTask != null) ? runningTask.id : -1;
launchState.launchedWithAltTab = mTriggeredFromAltTab;
Intent intent = new Intent();
intent.setClassName(RECENTS_PACKAGE, RECENTS_TV_ACTIVITY);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_TASK_ON_HOME);
if (opts != null) {
mContext.startActivityAsUser(intent, opts.toBundle(), UserHandle.CURRENT);
} else {
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
}
EventBus.getDefault().send(new RecentsActivityStartingEvent());
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.
the class RecentsTvView method init.
/**
* Initialize the view.
*/
public void init(TaskStack stack) {
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
mStack = stack;
mTaskStackHorizontalView.init(stack);
if (stack.getStackTaskCount() > 0) {
hideEmptyView();
} else {
showEmptyView();
}
// Layout with the new stack
requestLayout();
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.
the class RecentsTvImpl method startRecentsActivity.
protected void startRecentsActivity(ActivityManager.RunningTaskInfo runningTask, ActivityOptions opts, boolean fromHome, boolean fromThumbnail) {
// Update the configuration based on the launch options
RecentsConfiguration config = Recents.getConfiguration();
RecentsActivityLaunchState launchState = config.getLaunchState();
launchState.launchedFromHome = fromHome;
launchState.launchedFromApp = fromThumbnail;
launchState.launchedToTaskId = (runningTask != null) ? runningTask.id : -1;
launchState.launchedWithAltTab = mTriggeredFromAltTab;
Intent intent = new Intent();
intent.setClassName(RECENTS_PACKAGE, RECENTS_TV_ACTIVITY);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_TASK_ON_HOME);
if (opts != null) {
mContext.startActivityAsUser(intent, opts.toBundle(), UserHandle.CURRENT);
} else {
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
}
EventBus.getDefault().send(new RecentsActivityStartingEvent());
}
use of com.android.systemui.recents.RecentsConfiguration in project android_frameworks_base by crdroidandroid.
the class RecentsView method startFABanimation.
public void startFABanimation() {
RecentsConfiguration config = Recents.getConfiguration();
// Animate the action button in
mFloatingButton = ((View) getParent()).findViewById(R.id.floating_action_button);
mFloatingButton.animate().alpha(1f).setStartDelay(config.fabEnterAnimDelay).setDuration(config.fabEnterAnimDuration).setInterpolator(Interpolators.ALPHA_IN).withLayer().start();
}
Aggregations