Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 708da446 authored by Elliott Hughes's avatar Elliott Hughes Committed by Gerrit Code Review
Browse files

Merge "Use gettid directly in frameworks JNI."

parents 8a28e16c 06451fe0
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -1036,16 +1036,9 @@ static void conditionally_log_binder_call(int64_t start_millis,
}

// We only measure binder call durations to potentially log them if
// we're on the main thread.  Unfortunately sim-eng doesn't seem to
// have gettid, so we just ignore this and don't log if we can't
// get the thread id.
// we're on the main thread.
static bool should_time_binder_calls() {
#ifdef HAVE_GETTID
  return (getpid() == androidGetTid());
#else
#warning no gettid(), so not logging Binder calls...
  return false;
#endif
  return (getpid() == gettid());
}

static jboolean android_os_BinderProxy_transact(JNIEnv* env, jobject obj,
+3 −3
Original line number Diff line number Diff line
@@ -268,7 +268,7 @@ static void android_os_Process_setCanSelfBackground(JNIEnv* env, jobject clazz,
    // Establishes the calling thread as illegal to put into the background.
    // Typically used only for the system process's main looper.
#if GUARD_THREAD_PRIORITY
    ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, androidGetTid());
    ALOGV("Process.setCanSelfBackground(%d) : tid=%d", bgOk, gettid());
    {
        Mutex::Autolock _l(gKeyCreateMutex);
        if (gBgKey == -1) {
@@ -303,7 +303,7 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
    // if we're putting the current thread into the background, check the TLS
    // to make sure this thread isn't guarded.  If it is, raise an exception.
    if (pri >= ANDROID_PRIORITY_BACKGROUND) {
        if (pid == androidGetTid()) {
        if (pid == gettid()) {
            void* bgOk = pthread_getspecific(gBgKey);
            if (bgOk == ((void*)0xbaad)) {
                ALOGE("Thread marked fg-only put self in background!");
@@ -330,7 +330,7 @@ void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz,
void android_os_Process_setCallingThreadPriority(JNIEnv* env, jobject clazz,
                                                        jint pri)
{
    android_os_Process_setThreadPriority(env, clazz, androidGetTid(), pri);
    android_os_Process_setThreadPriority(env, clazz, gettid(), pri);
}

jint android_os_Process_getThreadPriority(JNIEnv* env, jobject clazz,