Search in sources :

Example 1 with ThumbnailData

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();
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) Bitmap(android.graphics.Bitmap) ThumbnailData(com.android.systemui.recents.model.ThumbnailData)

Example 2 with ThumbnailData

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;
}
Also used : ThumbnailData(com.android.systemui.recents.model.ThumbnailData)

Example 3 with 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;
}
Also used : ThumbnailData(com.android.systemui.recents.model.ThumbnailData)

Example 4 with 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();
}
Also used : SystemServicesProxy(com.android.systemui.recents.misc.SystemServicesProxy) Rect(android.graphics.Rect) Bitmap(android.graphics.Bitmap) ThumbnailData(com.android.systemui.recents.model.ThumbnailData)

Example 5 with ThumbnailData

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;
}
Also used : ThumbnailData(com.android.systemui.recents.model.ThumbnailData)

Aggregations

ThumbnailData (com.android.systemui.recents.model.ThumbnailData)10 Bitmap (android.graphics.Bitmap)5 Rect (android.graphics.Rect)5 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)5