From bcd771bd085063de6c9ccf57d1f886f450b19aae Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Mon, 24 Feb 2020 03:18:55 -0800 Subject: [PATCH] Avoid allocation on Java Binder fast path We recently added a new API to the native Parcel class that avoids a string allocation in enforceInterface. Have the Java JNI glue for Parcel use this new interface. Test: builds Change-Id: I50b29ef95e214812c5fa83514497e0a188a635aa --- core/jni/android_os_Parcel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/jni/android_os_Parcel.cpp b/core/jni/android_os_Parcel.cpp index d80c071c3e26c..d723ecc13dd09 100644 --- a/core/jni/android_os_Parcel.cpp +++ b/core/jni/android_os_Parcel.cpp @@ -625,8 +625,8 @@ static void android_os_Parcel_enforceInterface(JNIEnv* env, jclass clazz, jlong IPCThreadState* threadState = IPCThreadState::self(); const int32_t oldPolicy = threadState->getStrictModePolicy(); const bool isValid = parcel->enforceInterface( - String16(reinterpret_cast(str), - env->GetStringLength(name)), + reinterpret_cast(str), + env->GetStringLength(name), threadState); env->ReleaseStringCritical(name, str); if (isValid) {