summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/core/jni/com_android_server_SystemServer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/services/core/jni/com_android_server_SystemServer.cpp b/services/core/jni/com_android_server_SystemServer.cpp
index c7d6b95083d2..e46490bb3fac 100644
--- a/services/core/jni/com_android_server_SystemServer.cpp
+++ b/services/core/jni/com_android_server_SystemServer.cpp
@@ -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);
}
}