summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-07-31 17:38:11 -0700
committerElliott Hughes <enh@google.com>2013-07-31 17:38:11 -0700
commit6d4b1e24aef5b74b40de4d8f6e63c21874ce8e3a (patch)
tree550cc7ef92d52ab54c29ba82f275194ca3703471
parent406ec15647b7664cadadde41dbaaa10e298c582b (diff)
downloadbase-6d4b1e24aef5b74b40de4d8f6e63c21874ce8e3a.tar.gz
Switch Process.myTid over to the libcore JNI too.
Change-Id: I80eaecff014fabf809f4be3c9ee8b26aa64bf0cf
-rw-r--r--core/java/android/os/Process.java4
-rw-r--r--core/jni/android_util_Process.cpp9
2 files changed, 4 insertions, 9 deletions
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 0e38ebc1e390..ebeb9f83182a 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -657,7 +657,9 @@ public class Process {
* Returns the identifier of the calling thread, which be used with
* {@link #setThreadPriority(int, int)}.
*/
- public static final native int myTid();
+ public static final int myTid() {
+ return Libcore.os.gettid();
+ }
/**
* Returns the identifier of this process's uid. This is the kernel uid
diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp
index 7506e5aa4b2e..607c42978672 100644
--- a/core/jni/android_util_Process.cpp
+++ b/core/jni/android_util_Process.cpp
@@ -94,11 +94,6 @@ static void signalExceptionForGroupError(JNIEnv* env, int err)
}
}
-jint android_os_Process_myTid(JNIEnv* env, jobject clazz)
-{
- return androidGetTid();
-}
-
jint android_os_Process_getUidForName(JNIEnv* env, jobject clazz, jstring name)
{
if (name == NULL) {
@@ -333,8 +328,7 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
void android_os_Process_setCallingThreadPriority(JNIEnv* env, jobject clazz,
jint pri)
{
- jint tid = android_os_Process_myTid(env, clazz);
- android_os_Process_setThreadPriority(env, clazz, tid, pri);
+ android_os_Process_setThreadPriority(env, clazz, androidGetTid(), pri);
}
jint android_os_Process_getThreadPriority(JNIEnv* env, jobject clazz,
@@ -979,7 +973,6 @@ jintArray android_os_Process_getPidsForCommands(JNIEnv* env, jobject clazz,
}
static const JNINativeMethod methods[] = {
- {"myTid", "()I", (void*)android_os_Process_myTid},
{"getUidForName", "(Ljava/lang/String;)I", (void*)android_os_Process_getUidForName},
{"getGidForName", "(Ljava/lang/String;)I", (void*)android_os_Process_getGidForName},
{"setThreadPriority", "(II)V", (void*)android_os_Process_setThreadPriority},