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

Commit 18d13986 authored by Wei Wang's avatar Wei Wang Committed by android-build-merger
Browse files

Start sensor service in a seperate thread

am: 6ba0ef31

Change-Id: I325b0d5c02326355c7b04962537e695e7839be09
parents 52f065af 6ba0ef31
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -22,15 +22,22 @@
#include <cutils/properties.h>
#include <utils/Log.h>
#include <utils/misc.h>
#include <utils/AndroidThreads.h>

namespace android {

static int start_sensor_service(void* /*unused*/) {
    SensorService::instantiate();
    return 0;
}

static void android_server_SystemServer_startSensorService(JNIEnv* /* env */, jobject /* clazz */) {
    char propBuf[PROPERTY_VALUE_MAX];
    property_get("system_init.startsensorservice", propBuf, "1");
    if (strcmp(propBuf, "1") == 0) {
        // Start the sensor service
        SensorService::instantiate();
        // Start the sensor service in a new thread
        createThreadEtc(start_sensor_service, nullptr,
                        "StartSensorThread", PRIORITY_FOREGROUND);
    }
}