Remove redundant method Binder.getNativeTid()

Bug: 177257934
Test: atest BinderCallsStatsTest
Change-Id: I797a580e7bf6bc3c7174d061c1cf86bccc5b1f3a
This commit is contained in:
Dmitri Plotnikov
2021-01-21 17:03:02 -08:00
parent 8b1a4d8c25
commit bf06ab10de
3 changed files with 1 additions and 16 deletions

View File

@@ -122,14 +122,6 @@ public class Binder implements IBinder {
private static native long getNativeFinalizer();
/**
* Returns the TID (task ID) for the current thread. Same as {@link Thread#getNativeTid()}
*
* @hide
*/
@CriticalNative
public static native int getNativeTid();
// Use a Holder to allow static initialization of Binder in the boot image, and
// possibly to avoid some initialization ordering issues.
private static class NoImagePreloadHolder {

View File

@@ -633,7 +633,7 @@ public class BinderCallsStats implements BinderInternal.Observer {
}
protected int getNativeTid() {
return Binder.getNativeTid();
return Process.myTid();
}
/**

View File

@@ -30,7 +30,6 @@
#include <unistd.h>
#include <android-base/stringprintf.h>
#include <android-base/threads.h>
#include <binder/BpBinder.h>
#include <binder/IInterface.h>
#include <binder/IPCThreadState.h>
@@ -1043,10 +1042,6 @@ static void android_os_Binder_setExtension(JNIEnv* env, jobject obj, jobject ext
jbh->setExtension(extension);
}
static jint android_os_Binder_getNativeTid() {
return (jint)android::base::GetThreadId();
}
// ----------------------------------------------------------------------------
static const JNINativeMethod gBinderMethods[] = {
@@ -1079,8 +1074,6 @@ 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 },
};
const char* const kBinderPathName = "android/os/Binder";