From 4760ca91def2eb9f5445f4ecc154ff7f68abb466 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 13 Oct 2021 11:01:18 -0700 Subject: getBlobAshmemSize -> getOpenAshmemSize This API returns the total size of all ashmem memory that is in FDs that is owned by a Parcel object. It was renamed a while ago, but the name was never updated in Java. Bug: 202029388 Test: atest android.app.NotificationTest Change-Id: Icc428063083110952cf3951721d69cbb919429b1 --- core/java/android/os/Parcel.java | 6 +++--- core/jni/android_os_Parcel.cpp | 6 +++--- .../frameworks/tests/notification/NotificationTests.java | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index fa578be0c984..d83ccf7f91a5 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -401,7 +401,7 @@ public final class Parcel { private static final int WRITE_EXCEPTION_STACK_TRACE_THRESHOLD_MS = 1000; @CriticalNative - private static native long nativeGetBlobAshmemSize(long nativePtr); + private static native long nativeGetOpenAshmemSize(long nativePtr); public final static Parcelable.Creator STRING_CREATOR = new Parcelable.Creator() { @@ -4373,8 +4373,8 @@ public final class Parcel { /** * @hide For testing */ - public long getBlobAshmemSize() { - return nativeGetBlobAshmemSize(mNativePtr); + public long getOpenAshmemSize() { + return nativeGetOpenAshmemSize(mNativePtr); } private static String valueTypeToString(int type) { diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp index 8fee610180ca..0d338072fa00 100644 --- a/core/jni/android_os_Parcel.cpp +++ b/core/jni/android_os_Parcel.cpp @@ -740,11 +740,11 @@ static jlong android_os_Parcel_getGlobalAllocCount(JNIEnv* env, jclass clazz) return Parcel::getGlobalAllocCount(); } -static jlong android_os_Parcel_getBlobAshmemSize(jlong nativePtr) +static jlong android_os_Parcel_getOpenAshmemSize(jlong nativePtr) { Parcel* parcel = reinterpret_cast(nativePtr); if (parcel != NULL) { - return parcel->getBlobAshmemSize(); + return parcel->getOpenAshmemSize(); } return 0; } @@ -852,7 +852,7 @@ static const JNINativeMethod gParcelMethods[] = { {"getGlobalAllocCount", "()J", (void*)android_os_Parcel_getGlobalAllocCount}, // @CriticalNative - {"nativeGetBlobAshmemSize", "(J)J", (void*)android_os_Parcel_getBlobAshmemSize}, + {"nativeGetOpenAshmemSize", "(J)J", (void*)android_os_Parcel_getOpenAshmemSize}, // @CriticalNative {"nativeReadCallingWorkSourceUid", "(J)I", (void*)android_os_Parcel_readCallingWorkSourceUid}, diff --git a/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java b/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java index 7cda977d2115..5d639f6f6266 100644 --- a/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java +++ b/tests/notification/src/com/android/frameworks/tests/notification/NotificationTests.java @@ -409,10 +409,10 @@ public class NotificationTests extends AndroidTestCase { sleepIfYouCan(500); L("Parceling notifications..."); - // we want to be able to use this test on older OSes that do not have getBlobAshmemSize - Method getBlobAshmemSize = null; + // we want to be able to use this test on older OSes that do not have getOpenAshmemSize + Method getOpenAshmemSize = null; try { - getBlobAshmemSize = Parcel.class.getMethod("getBlobAshmemSize"); + getOpenAshmemSize = Parcel.class.getMethod("getOpenAshmemSize"); } catch (NoSuchMethodException ex) { } for (int i=0; i