diff options
| -rw-r--r-- | core/java/android/os/Parcel.java | 9 | ||||
| -rw-r--r-- | core/jni/android_os_Parcel.cpp | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java index 9d8a1bafb93e..77c50877978b 100644 --- a/core/java/android/os/Parcel.java +++ b/core/java/android/os/Parcel.java @@ -283,6 +283,8 @@ public final class Parcel { private static native void nativeWriteInterfaceToken(long nativePtr, String interfaceName); private static native void nativeEnforceInterface(long nativePtr, String interfaceName); + private static native long nativeGetAshmemSize(long nativePtr); + public final static Parcelable.Creator<String> STRING_CREATOR = new Parcelable.Creator<String>() { public String createFromParcel(Parcel source) { @@ -2594,4 +2596,11 @@ public final class Parcel { N--; } } + + /** + * @hide For testing + */ + public long getBlobAshmemSize() { + return nativeGetBlobAshmemSize(mNativePtr); + } } diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp index 4f29c5027423..c2a9bbde5113 100644 --- a/core/jni/android_os_Parcel.cpp +++ b/core/jni/android_os_Parcel.cpp @@ -704,6 +704,15 @@ static jlong android_os_Parcel_getGlobalAllocCount(JNIEnv* env, jclass clazz) return Parcel::getGlobalAllocCount(); } +static jlong android_os_Parcel_getBlobAshmemSize(JNIEnv* env, jclass clazz, jlong nativePtr) +{ + Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr); + if (parcel != NULL) { + return parcel->getBlobAshmemSize(); + } + return 0; +} + // ---------------------------------------------------------------------------- static const JNINativeMethod gParcelMethods[] = { @@ -756,6 +765,8 @@ static const JNINativeMethod gParcelMethods[] = { {"getGlobalAllocSize", "()J", (void*)android_os_Parcel_getGlobalAllocSize}, {"getGlobalAllocCount", "()J", (void*)android_os_Parcel_getGlobalAllocCount}, + + {"nativeGetAshmemSize", "(J)J", (void*)android_os_Parcel_getAshmemSize}, }; const char* const kParcelPathName = "android/os/Parcel"; |