Loading core/java/android/os/HwBinder.java +7 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,13 @@ public abstract class HwBinder implements IHwBinder { public static native final void joinRpcThreadpool(); /** * Call configureRpcThreadpool, then actually spawn * (maxThreads - (callerWillJoin ? 0 : 1)) threads. */ public static final native void startRpcThreadPool( long maxThreads, boolean callerWillJoin); // Returns address of the "freeFunction". private static native final long native_init(); Loading core/jni/android_os_HwBinder.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -344,6 +344,17 @@ void JHwBinder_native_joinRpcThreadpool() { IPCThreadState::self()->joinThreadPool(); } void JHwBinder_native_startRpcThreadPool(JNIEnv *, jclass, jlong maxThreads, jboolean callerWillJoin) { CHECK(maxThreads > 0); ProcessState::self()->setThreadPoolConfiguration(maxThreads, callerWillJoin /* callerJoinsPool */); ssize_t threadsNeeded = maxThreads - (callerWillJoin ? 0 : 1); for (ssize_t i = 0; i < threadsNeeded; ++i) { ProcessState::self()->spawnPooledThread(false /* isMain */); } } static void JHwBinder_report_sysprop_change(JNIEnv * /*env*/, jclass /*clazz*/) { report_sysprop_change(); Loading @@ -369,6 +380,9 @@ static JNINativeMethod gMethods[] = { { "joinRpcThreadpool", "()V", (void *)JHwBinder_native_joinRpcThreadpool }, { "startRpcThreadPool", "(JZ)V", (void *)JHwBinder_native_startRpcThreadPool }, { "native_report_sysprop_change", "()V", (void *)JHwBinder_report_sysprop_change }, }; Loading services/core/jni/com_android_server_SystemServer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,6 @@ static void android_server_SystemServer_startHidlServices(JNIEnv* env, jobject / status_t err; configureRpcThreadpool(5, false /* callerWillJoin */); JavaVM *vm; LOG_ALWAYS_FATAL_IF(env->GetJavaVM(&vm) != JNI_OK, "Cannot get Java VM"); Loading services/java/com/android/server/SystemServer.java +3 −0 Original line number Diff line number Diff line Loading @@ -660,6 +660,9 @@ public final class SystemServer { mSystemServiceManager.startService(DropBoxManagerService.class); traceEnd(); // First hwbinder call is in BatteryService. android.os.HwBinder.startRpcThreadPool(5, false /* callerWillJoin */); traceBeginAndSlog("StartBatteryService"); // Tracks the battery level. Requires LightService. mSystemServiceManager.startService(BatteryService.class); Loading Loading
core/java/android/os/HwBinder.java +7 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,13 @@ public abstract class HwBinder implements IHwBinder { public static native final void joinRpcThreadpool(); /** * Call configureRpcThreadpool, then actually spawn * (maxThreads - (callerWillJoin ? 0 : 1)) threads. */ public static final native void startRpcThreadPool( long maxThreads, boolean callerWillJoin); // Returns address of the "freeFunction". private static native final long native_init(); Loading
core/jni/android_os_HwBinder.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -344,6 +344,17 @@ void JHwBinder_native_joinRpcThreadpool() { IPCThreadState::self()->joinThreadPool(); } void JHwBinder_native_startRpcThreadPool(JNIEnv *, jclass, jlong maxThreads, jboolean callerWillJoin) { CHECK(maxThreads > 0); ProcessState::self()->setThreadPoolConfiguration(maxThreads, callerWillJoin /* callerJoinsPool */); ssize_t threadsNeeded = maxThreads - (callerWillJoin ? 0 : 1); for (ssize_t i = 0; i < threadsNeeded; ++i) { ProcessState::self()->spawnPooledThread(false /* isMain */); } } static void JHwBinder_report_sysprop_change(JNIEnv * /*env*/, jclass /*clazz*/) { report_sysprop_change(); Loading @@ -369,6 +380,9 @@ static JNINativeMethod gMethods[] = { { "joinRpcThreadpool", "()V", (void *)JHwBinder_native_joinRpcThreadpool }, { "startRpcThreadPool", "(JZ)V", (void *)JHwBinder_native_startRpcThreadPool }, { "native_report_sysprop_change", "()V", (void *)JHwBinder_report_sysprop_change }, }; Loading
services/core/jni/com_android_server_SystemServer.cpp +0 −2 Original line number Diff line number Diff line Loading @@ -48,8 +48,6 @@ static void android_server_SystemServer_startHidlServices(JNIEnv* env, jobject / status_t err; configureRpcThreadpool(5, false /* callerWillJoin */); JavaVM *vm; LOG_ALWAYS_FATAL_IF(env->GetJavaVM(&vm) != JNI_OK, "Cannot get Java VM"); Loading
services/java/com/android/server/SystemServer.java +3 −0 Original line number Diff line number Diff line Loading @@ -660,6 +660,9 @@ public final class SystemServer { mSystemServiceManager.startService(DropBoxManagerService.class); traceEnd(); // First hwbinder call is in BatteryService. android.os.HwBinder.startRpcThreadPool(5, false /* callerWillJoin */); traceBeginAndSlog("StartBatteryService"); // Tracks the battery level. Requires LightService. mSystemServiceManager.startService(BatteryService.class); Loading