Add @CriticalNative to getNativeTid to improve performance
Bug: 158232997 Test: atest FrameworksCoreTests:com.android.internal.os.BinderCallsStatsTestBug Change-Id: I5a5022921ba54354db59083f015d193d929ae0d5
This commit is contained in:
@@ -127,6 +127,7 @@ public class Binder implements IBinder {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@CriticalNative
|
||||
public static native int getNativeTid();
|
||||
|
||||
// Use a Holder to allow static initialization of Binder in the boot image, and
|
||||
|
||||
@@ -1048,7 +1048,7 @@ static void android_os_Binder_setExtension(JNIEnv* env, jobject obj, jobject ext
|
||||
jbh->setExtension(extension);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL android_os_Binder_getNativeTid(JNIEnv* env, jobject clazz) {
|
||||
static jint android_os_Binder_getNativeTid() {
|
||||
return (jint)android::base::GetThreadId();
|
||||
}
|
||||
|
||||
@@ -1083,6 +1083,7 @@ static const JNINativeMethod gBinderMethods[] = {
|
||||
{ "blockUntilThreadAvailable", "()V", (void*)android_os_Binder_blockUntilThreadAvailable },
|
||||
{ "getExtension", "()Landroid/os/IBinder;", (void*)android_os_Binder_getExtension },
|
||||
{ "setExtension", "(Landroid/os/IBinder;)V", (void*)android_os_Binder_setExtension },
|
||||
// @CriticalNative
|
||||
{ "getNativeTid", "()I", (void*)android_os_Binder_getNativeTid },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user