summaryrefslogtreecommitdiff
path: root/core/java/android/app/ActivityOptions.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2017-06-02 14:34:52 -0700
committerWinson Chung <winsonc@google.com>2017-06-02 14:34:52 -0700
commitf229ae55230427e8466790e99008bad1c2956ba6 (patch)
treeae3c280521fa2a44635c38724eb50d0c829a1f0a /core/java/android/app/ActivityOptions.java
parent2b2221e94bd4b299ccbcbc76d636ba0b231794db (diff)
Handling cases with a null bitmap.
- This can happen either if an app creates an ActivityOptions without a thumbnail, or if the call to create a hardware bitmap fails for any reason. Just ignore the thumbnail for the transition in this case. Bug: 62296016 Test: Have not been able to reproduce, but this is just a logical change Change-Id: I30776b651df1f42118fe1d317fa4817261a6e977
Diffstat (limited to 'core/java/android/app/ActivityOptions.java')
-rw-r--r--core/java/android/app/ActivityOptions.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/java/android/app/ActivityOptions.java b/core/java/android/app/ActivityOptions.java
index c4d51168d20c..cbb93a059613 100644
--- a/core/java/android/app/ActivityOptions.java
+++ b/core/java/android/app/ActivityOptions.java
@@ -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);