Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14050,6 +14050,7 @@ package android.gesture { package android.graphics { public final class Bitmap implements android.os.Parcelable { method @NonNull public android.graphics.Bitmap asShared(); method @WorkerThread public boolean compress(android.graphics.Bitmap.CompressFormat, int, java.io.OutputStream); method public android.graphics.Bitmap copy(android.graphics.Bitmap.Config, boolean); method public void copyPixelsFromBuffer(java.nio.Buffer); core/java/android/app/Notification.java +1 −1 Original line number Diff line number Diff line Loading @@ -6748,7 +6748,7 @@ public class Notification implements Parcelable if (mPicture != null && mPicture.isMutable() && mPicture.getAllocationByteCount() >= MIN_ASHMEM_BITMAP_SIZE) { mPicture = mPicture.createAshmemBitmap(); mPicture = mPicture.asShared(); } if (mBigLargeIcon != null) { mBigLargeIcon.convertToAshmem(); Loading graphics/java/android/graphics/Bitmap.java +27 −5 Original line number Diff line number Diff line Loading @@ -684,14 +684,16 @@ public final class Bitmap implements Parcelable { return b; } // FIXME: The maxTargetSdk should be R, once R is no longer set to // CUR_DEVELOPMENT. /** * Creates a new immutable bitmap backed by ashmem which can efficiently * be passed between processes. The bitmap is assumed to be in the sRGB * color space. * be passed between processes. * * @hide */ @UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link #asShared()} instead") public Bitmap createAshmemBitmap() { checkRecycled("Can't copy a recycled bitmap"); noteHardwareBitmapSlowCall(); Loading @@ -703,10 +705,27 @@ public final class Bitmap implements Parcelable { return b; } /** * Return an immutable bitmap backed by shared memory which can be * efficiently passed between processes via Parcelable. * * <p>If this bitmap already meets these criteria it will return itself. */ @NonNull public Bitmap asShared() { if (nativeIsBackedByAshmem(mNativePtr) && nativeIsImmutable(mNativePtr)) { return this; } Bitmap shared = createAshmemBitmap(); if (shared == null) { throw new RuntimeException("Failed to create shared Bitmap!"); } return shared; } /** * Creates a new immutable bitmap backed by ashmem which can efficiently * be passed between processes. The bitmap is assumed to be in the sRGB * color space. * be passed between processes. * * @hide */ Loading Loading @@ -2344,4 +2363,7 @@ public final class Bitmap implements Parcelable { @CriticalNative private static native boolean nativeIsImmutable(long nativePtr); @CriticalNative private static native boolean nativeIsBackedByAshmem(long nativePtr); } graphics/java/android/graphics/drawable/Icon.java +1 −1 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ public final class Icon implements Parcelable { if ((mType == TYPE_BITMAP || mType == TYPE_ADAPTIVE_BITMAP) && getBitmap().isMutable() && getBitmap().getAllocationByteCount() >= MIN_ASHMEM_ICON_SIZE) { setBitmap(getBitmap().createAshmemBitmap()); setBitmap(getBitmap().asShared()); } } Loading libs/hwui/jni/Bitmap.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -1216,6 +1216,14 @@ static jboolean Bitmap_isImmutable(CRITICAL_JNI_PARAMS_COMMA jlong bitmapHandle) return bitmapHolder->bitmap().isImmutable() ? JNI_TRUE : JNI_FALSE; } static jboolean Bitmap_isBackedByAshmem(CRITICAL_JNI_PARAMS_COMMA jlong bitmapHandle) { LocalScopedBitmap bitmapHolder(bitmapHandle); if (!bitmapHolder.valid()) return JNI_FALSE; return bitmapHolder->bitmap().pixelStorageType() == PixelStorageType::Ashmem ? JNI_TRUE : JNI_FALSE; } static void Bitmap_setImmutable(JNIEnv* env, jobject, jlong bitmapHandle) { LocalScopedBitmap bitmapHolder(bitmapHandle); if (!bitmapHolder.valid()) return; Loading Loading @@ -1282,7 +1290,8 @@ static const JNINativeMethod gBitmapMethods[] = { { "nativeSetImmutable", "(J)V", (void*)Bitmap_setImmutable}, // ------------ @CriticalNative ---------------- { "nativeIsImmutable", "(J)Z", (void*)Bitmap_isImmutable} { "nativeIsImmutable", "(J)Z", (void*)Bitmap_isImmutable}, { "nativeIsBackedByAshmem", "(J)Z", (void*)Bitmap_isBackedByAshmem} }; Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -14050,6 +14050,7 @@ package android.gesture { package android.graphics { public final class Bitmap implements android.os.Parcelable { method @NonNull public android.graphics.Bitmap asShared(); method @WorkerThread public boolean compress(android.graphics.Bitmap.CompressFormat, int, java.io.OutputStream); method public android.graphics.Bitmap copy(android.graphics.Bitmap.Config, boolean); method public void copyPixelsFromBuffer(java.nio.Buffer);
core/java/android/app/Notification.java +1 −1 Original line number Diff line number Diff line Loading @@ -6748,7 +6748,7 @@ public class Notification implements Parcelable if (mPicture != null && mPicture.isMutable() && mPicture.getAllocationByteCount() >= MIN_ASHMEM_BITMAP_SIZE) { mPicture = mPicture.createAshmemBitmap(); mPicture = mPicture.asShared(); } if (mBigLargeIcon != null) { mBigLargeIcon.convertToAshmem(); Loading
graphics/java/android/graphics/Bitmap.java +27 −5 Original line number Diff line number Diff line Loading @@ -684,14 +684,16 @@ public final class Bitmap implements Parcelable { return b; } // FIXME: The maxTargetSdk should be R, once R is no longer set to // CUR_DEVELOPMENT. /** * Creates a new immutable bitmap backed by ashmem which can efficiently * be passed between processes. The bitmap is assumed to be in the sRGB * color space. * be passed between processes. * * @hide */ @UnsupportedAppUsage @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q, publicAlternatives = "Use {@link #asShared()} instead") public Bitmap createAshmemBitmap() { checkRecycled("Can't copy a recycled bitmap"); noteHardwareBitmapSlowCall(); Loading @@ -703,10 +705,27 @@ public final class Bitmap implements Parcelable { return b; } /** * Return an immutable bitmap backed by shared memory which can be * efficiently passed between processes via Parcelable. * * <p>If this bitmap already meets these criteria it will return itself. */ @NonNull public Bitmap asShared() { if (nativeIsBackedByAshmem(mNativePtr) && nativeIsImmutable(mNativePtr)) { return this; } Bitmap shared = createAshmemBitmap(); if (shared == null) { throw new RuntimeException("Failed to create shared Bitmap!"); } return shared; } /** * Creates a new immutable bitmap backed by ashmem which can efficiently * be passed between processes. The bitmap is assumed to be in the sRGB * color space. * be passed between processes. * * @hide */ Loading Loading @@ -2344,4 +2363,7 @@ public final class Bitmap implements Parcelable { @CriticalNative private static native boolean nativeIsImmutable(long nativePtr); @CriticalNative private static native boolean nativeIsBackedByAshmem(long nativePtr); }
graphics/java/android/graphics/drawable/Icon.java +1 −1 Original line number Diff line number Diff line Loading @@ -467,7 +467,7 @@ public final class Icon implements Parcelable { if ((mType == TYPE_BITMAP || mType == TYPE_ADAPTIVE_BITMAP) && getBitmap().isMutable() && getBitmap().getAllocationByteCount() >= MIN_ASHMEM_ICON_SIZE) { setBitmap(getBitmap().createAshmemBitmap()); setBitmap(getBitmap().asShared()); } } Loading
libs/hwui/jni/Bitmap.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -1216,6 +1216,14 @@ static jboolean Bitmap_isImmutable(CRITICAL_JNI_PARAMS_COMMA jlong bitmapHandle) return bitmapHolder->bitmap().isImmutable() ? JNI_TRUE : JNI_FALSE; } static jboolean Bitmap_isBackedByAshmem(CRITICAL_JNI_PARAMS_COMMA jlong bitmapHandle) { LocalScopedBitmap bitmapHolder(bitmapHandle); if (!bitmapHolder.valid()) return JNI_FALSE; return bitmapHolder->bitmap().pixelStorageType() == PixelStorageType::Ashmem ? JNI_TRUE : JNI_FALSE; } static void Bitmap_setImmutable(JNIEnv* env, jobject, jlong bitmapHandle) { LocalScopedBitmap bitmapHolder(bitmapHandle); if (!bitmapHolder.valid()) return; Loading Loading @@ -1282,7 +1290,8 @@ static const JNINativeMethod gBitmapMethods[] = { { "nativeSetImmutable", "(J)V", (void*)Bitmap_setImmutable}, // ------------ @CriticalNative ---------------- { "nativeIsImmutable", "(J)Z", (void*)Bitmap_isImmutable} { "nativeIsImmutable", "(J)Z", (void*)Bitmap_isImmutable}, { "nativeIsBackedByAshmem", "(J)Z", (void*)Bitmap_isBackedByAshmem} }; Loading