diff options
author | Leon Scroggins III <scroggo@google.com> | 2017-10-03 14:00:20 -0400 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2017-11-28 03:30:29 +0000 |
commit | 42b2e419b48a26d2ba599d87e3a2a02c4aa625f4 (patch) | |
tree | 730e28aa47c7d5f122f1d0645d18d08c8ada25b6 | |
parent | d64e9594d3d73c613010ca9fafc7af9782e9225d (diff) | |
download | base-42b2e419b48a26d2ba599d87e3a2a02c4aa625f4.tar.gz |
Throw OOME if Bitmap.nativeCreate fails
Bug:33846679
Test: I6ab6cb7a3b3151641a9f9b02b0bfc484e0a4524b
This matches the old behavior, prior to switching from Java allocated
pixel memory to native allocations (b/27762775). It also better matches
what has happened - we ran out of memory. (Better than the current
behavior - NullPointerException in the Java code, or an alternative
solution of returning null, which would likely result in NPEs in the
calling code.)
Merged-In: I3958ed1106ac94fb1d3f30e044b620d984875211
Change-Id: I3958ed1106ac94fb1d3f30e044b620d984875211
(cherry picked from commit 5906a4869cdf5c39eba1d9a3125aff894c5e804d)
-rwxr-xr-x | core/jni/android/graphics/Bitmap.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp index ad05a5113dff..108fdbce386f 100755 --- a/core/jni/android/graphics/Bitmap.cpp +++ b/core/jni/android/graphics/Bitmap.cpp @@ -682,6 +682,8 @@ static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors, sk_sp<Bitmap> nativeBitmap = Bitmap::allocateHeapBitmap(&bitmap); if (!nativeBitmap) { + ALOGE("OOM allocating Bitmap with dimensions %i x %i", width, height); + doThrowOOME(env); return NULL; } |