Loading core/jni/AndroidRuntime.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <android_runtime/AndroidRuntime.h> #include <binder/IBinder.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <utils/Log.h> #include <utils/misc.h> Loading Loading @@ -431,6 +432,20 @@ static void runtime_vfprintf(FILE* fp, const char* format, va_list ap) LOG_PRI_VA(ANDROID_LOG_INFO, "vm-printf", format, ap); } /** * The VM calls this when mutex contention debugging is enabled to * determine whether or not the blocked thread was a "sensitive thread" * for user responsiveness/smoothess. * * Our policy for this is whether or not we're tracing any StrictMode * events on this thread (which we might've inherited via Binder calls * into us) */ static bool runtime_isSensitiveThread() { IPCThreadState* state = IPCThreadState::selfOrNull(); return state && state->getStrictModePolicy() != 0; } /** * Add VM arguments to the to-be-executed VM Loading Loading @@ -618,6 +633,11 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) opt.optionString = "vfprintf"; mOptions.add(opt); /* register the framework-specific "is sensitive thread" hook */ opt.extraInfo = (void*) runtime_isSensitiveThread; opt.optionString = "sensitiveThread"; mOptions.add(opt); opt.extraInfo = NULL; /* enable verbose; standard options are { jni, gc, class } */ Loading include/binder/IPCThreadState.h +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ class IPCThreadState { public: static IPCThreadState* self(); static IPCThreadState* selfOrNull(); // self(), but won't instantiate sp<ProcessState> process(); Loading libs/binder/IPCThreadState.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,16 @@ restart: goto restart; } IPCThreadState* IPCThreadState::selfOrNull() { if (gHaveTLS) { const pthread_key_t k = gTLS; IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k); return st; } return NULL; } void IPCThreadState::shutdown() { gShutdown = true; Loading Loading
core/jni/AndroidRuntime.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <android_runtime/AndroidRuntime.h> #include <binder/IBinder.h> #include <binder/IPCThreadState.h> #include <binder/IServiceManager.h> #include <utils/Log.h> #include <utils/misc.h> Loading Loading @@ -431,6 +432,20 @@ static void runtime_vfprintf(FILE* fp, const char* format, va_list ap) LOG_PRI_VA(ANDROID_LOG_INFO, "vm-printf", format, ap); } /** * The VM calls this when mutex contention debugging is enabled to * determine whether or not the blocked thread was a "sensitive thread" * for user responsiveness/smoothess. * * Our policy for this is whether or not we're tracing any StrictMode * events on this thread (which we might've inherited via Binder calls * into us) */ static bool runtime_isSensitiveThread() { IPCThreadState* state = IPCThreadState::selfOrNull(); return state && state->getStrictModePolicy() != 0; } /** * Add VM arguments to the to-be-executed VM Loading Loading @@ -618,6 +633,11 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) opt.optionString = "vfprintf"; mOptions.add(opt); /* register the framework-specific "is sensitive thread" hook */ opt.extraInfo = (void*) runtime_isSensitiveThread; opt.optionString = "sensitiveThread"; mOptions.add(opt); opt.extraInfo = NULL; /* enable verbose; standard options are { jni, gc, class } */ Loading
include/binder/IPCThreadState.h +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ class IPCThreadState { public: static IPCThreadState* self(); static IPCThreadState* selfOrNull(); // self(), but won't instantiate sp<ProcessState> process(); Loading
libs/binder/IPCThreadState.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -318,6 +318,16 @@ restart: goto restart; } IPCThreadState* IPCThreadState::selfOrNull() { if (gHaveTLS) { const pthread_key_t k = gTLS; IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k); return st; } return NULL; } void IPCThreadState::shutdown() { gShutdown = true; Loading