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

Commit 6f7a9e13 authored by Yifan Hong's avatar Yifan Hong
Browse files

Revert "SystemServer: spawn hwbinder threads before BatteryService"

This reverts commit 889902c9.

Reason for revert: b41e87ae680beefd0d39a127d1ea0b2614caa5f9 fixes 
the root issue. Revert the workaround.

Change-Id: I2f5dfaee8bda17b1d6aeb8418b4a64084b6a6b56
Test: multiple boots
Bug: 68785531
Bug: 68765551
parent 889902c9
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -63,13 +63,6 @@ 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();

+0 −14
Original line number Diff line number Diff line
@@ -344,17 +344,6 @@ 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();
@@ -380,9 +369,6 @@ 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 },
};
+2 −0
Original line number Diff line number Diff line
@@ -48,6 +48,8 @@ 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");

+0 −3
Original line number Diff line number Diff line
@@ -660,9 +660,6 @@ 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);