use of com.android.systemui.recents.model.ThumbnailData in project platform_frameworks_base by android.
the class RecentsTvImpl method getThumbnailTransitionActivityOptionsForTV.
/**
* Creates the activity options for an app->recents transition on TV.
*/
private ActivityOptions getThumbnailTransitionActivityOptionsForTV(ActivityManager.RunningTaskInfo runningTask, int numTasks) {
Rect rect = TaskCardView.getStartingCardThumbnailRect(mContext, !mPipManager.isPipShown(), numTasks);
SystemServicesProxy ssp = Recents.getSystemServices();
ThumbnailData thumbnailData = ssp.getTaskThumbnail(runningTask.id);
if (thumbnailData.thumbnail != null) {
Bitmap thumbnail = Bitmap.createScaledBitmap(thumbnailData.thumbnail, rect.width(), rect.height(), false);
return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) rect.left, (int) rect.top, (int) rect.width(), (int) rect.height(), mHandler, null);
}
// If both the screenshot and thumbnail fails, then just fall back to the default transition
return getUnknownTransitionActivityOptions();
}
use of com.android.systemui.recents.model.ThumbnailData in project platform_frameworks_base by android.
the class SystemServicesProxy method getTaskThumbnail.
/** Returns the top task thumbnail for the given task id */
public ThumbnailData getTaskThumbnail(int taskId) {
if (mAm == null)
return null;
ThumbnailData thumbnailData = new ThumbnailData();
// If we are mocking, then just return a dummy thumbnail
if (RecentsDebugFlags.Static.EnableMockTasks) {
thumbnailData.thumbnail = Bitmap.createBitmap(mDummyThumbnailWidth, mDummyThumbnailHeight, Bitmap.Config.ARGB_8888);
thumbnailData.thumbnail.eraseColor(0xff333333);
return thumbnailData;
}
getThumbnail(taskId, thumbnailData);
if (thumbnailData.thumbnail != null) {
thumbnailData.thumbnail.setHasAlpha(false);
// screenshots are always composed onto a bitmap that has no alpha.
if (Color.alpha(thumbnailData.thumbnail.getPixel(0, 0)) == 0) {
mBgProtectionCanvas.setBitmap(thumbnailData.thumbnail);
mBgProtectionCanvas.drawRect(0, 0, thumbnailData.thumbnail.getWidth(), thumbnailData.thumbnail.getHeight(), mBgProtectionPaint);
mBgProtectionCanvas.setBitmap(null);
Log.e(TAG, "Invalid screenshot detected from getTaskThumbnail()");
}
}
return thumbnailData;
}
use of com.android.systemui.recents.model.ThumbnailData in project android_frameworks_base by DirtyUnicorns.
the class SystemServicesProxy method getTaskThumbnail.
/** Returns the top task thumbnail for the given task id */
public ThumbnailData getTaskThumbnail(int taskId) {
if (mAm == null)
return null;
ThumbnailData thumbnailData = new ThumbnailData();
// If we are mocking, then just return a dummy thumbnail
if (RecentsDebugFlags.Static.EnableMockTasks) {
thumbnailData.thumbnail = Bitmap.createBitmap(mDummyThumbnailWidth, mDummyThumbnailHeight, Bitmap.Config.ARGB_8888);
thumbnailData.thumbnail.eraseColor(0xff333333);
return thumbnailData;
}
getThumbnail(taskId, thumbnailData);
if (thumbnailData.thumbnail != null) {
thumbnailData.thumbnail.setHasAlpha(false);
// screenshots are always composed onto a bitmap that has no alpha.
if (Color.alpha(thumbnailData.thumbnail.getPixel(0, 0)) == 0) {
mBgProtectionCanvas.setBitmap(thumbnailData.thumbnail);
mBgProtectionCanvas.drawRect(0, 0, thumbnailData.thumbnail.getWidth(), thumbnailData.thumbnail.getHeight(), mBgProtectionPaint);
mBgProtectionCanvas.setBitmap(null);
Log.e(TAG, "Invalid screenshot detected from getTaskThumbnail()");
}
}
return thumbnailData;
}
use of com.android.systemui.recents.model.ThumbnailData in project android_frameworks_base by AOSPA.
the class RecentsTvImpl method getThumbnailTransitionActivityOptionsForTV.
/**
* Creates the activity options for an app->recents transition on TV.
*/
private ActivityOptions getThumbnailTransitionActivityOptionsForTV(ActivityManager.RunningTaskInfo runningTask, int numTasks) {
Rect rect = TaskCardView.getStartingCardThumbnailRect(mContext, !mPipManager.isPipShown(), numTasks);
SystemServicesProxy ssp = Recents.getSystemServices();
ThumbnailData thumbnailData = ssp.getTaskThumbnail(runningTask.id);
if (thumbnailData.thumbnail != null) {
Bitmap thumbnail = Bitmap.createScaledBitmap(thumbnailData.thumbnail, rect.width(), rect.height(), false);
return ActivityOptions.makeThumbnailAspectScaleDownAnimation(mDummyStackView, thumbnail, (int) rect.left, (int) rect.top, (int) rect.width(), (int) rect.height(), mHandler, null);
}
// If both the screenshot and thumbnail fails, then just fall back to the default transition
return getUnknownTransitionActivityOptions();
}
use of com.android.systemui.recents.model.ThumbnailData in project android_frameworks_base by AOSPA.
the class SystemServicesProxy method getTaskThumbnail.
/** Returns the top task thumbnail for the given task id */
public ThumbnailData getTaskThumbnail(int taskId) {
if (mAm == null)
return null;
ThumbnailData thumbnailData = new ThumbnailData();
// If we are mocking, then just return a dummy thumbnail
if (RecentsDebugFlags.Static.EnableMockTasks) {
thumbnailData.thumbnail = Bitmap.createBitmap(mDummyThumbnailWidth, mDummyThumbnailHeight, Bitmap.Config.ARGB_8888);
thumbnailData.thumbnail.eraseColor(0xff333333);
return thumbnailData;
}
getThumbnail(taskId, thumbnailData);
if (thumbnailData.thumbnail != null) {
thumbnailData.thumbnail.setHasAlpha(false);
// screenshots are always composed onto a bitmap that has no alpha.
if (Color.alpha(thumbnailData.thumbnail.getPixel(0, 0)) == 0) {
mBgProtectionCanvas.setBitmap(thumbnailData.thumbnail);
mBgProtectionCanvas.drawRect(0, 0, thumbnailData.thumbnail.getWidth(), thumbnailData.thumbnail.getHeight(), mBgProtectionPaint);
mBgProtectionCanvas.setBitmap(null);
Log.e(TAG, "Invalid screenshot detected from getTaskThumbnail()");
}
}
return thumbnailData;
}
Aggregations