Merge "Handling cases with a null bitmap." into oc-dev

This commit is contained in:
TreeHugger Robot
2017-06-03 01:37:49 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 6 deletions

View File

@@ -932,7 +932,7 @@ public class ActivityOptions {
* @hide
*/
public GraphicBuffer getThumbnail() {
return mThumbnail.createGraphicBufferHandle();
return mThumbnail != null ? mThumbnail.createGraphicBufferHandle() : null;
}
/** @hide */
@@ -1243,11 +1243,13 @@ public class ActivityOptions {
case ANIM_THUMBNAIL_ASPECT_SCALE_DOWN:
// Once we parcel the thumbnail for transfering over to the system, create a copy of
// the bitmap to a hardware bitmap and pass through the GraphicBuffer
if (mThumbnail == null) {
b.putParcelable(KEY_ANIM_THUMBNAIL, null);
} else {
if (mThumbnail != null) {
final Bitmap hwBitmap = mThumbnail.copy(Config.HARDWARE, true /* immutable */);
b.putParcelable(KEY_ANIM_THUMBNAIL, hwBitmap.createGraphicBufferHandle());
if (hwBitmap != null) {
b.putParcelable(KEY_ANIM_THUMBNAIL, hwBitmap.createGraphicBufferHandle());
} else {
Slog.w(TAG, "Failed to copy thumbnail");
}
}
b.putInt(KEY_ANIM_START_X, mStartX);
b.putInt(KEY_ANIM_START_Y, mStartY);

View File

@@ -1426,7 +1426,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
pendingOptions.getStartX(), pendingOptions.getStartY(),
pendingOptions.getOnAnimationStartListener(),
scaleUp);
if (intent.getSourceBounds() == null) {
if (intent.getSourceBounds() == null && buffer != null) {
intent.setSourceBounds(new Rect(pendingOptions.getStartX(),
pendingOptions.getStartY(),
pendingOptions.getStartX() + buffer.getWidth(),