Start sensor service in a seperate thread
StartSensorService is taking ~141.8ms on marlin to start
With this CL, StartSensor will be done in a seperate
thread so the SystemServer can continue booting
Bug: 33199244
Bug: 33623300
Test: on marlin
Change-Id: I9e486d61e85072d5cbe69b1671c8fbfeca9c2200
(cherry picked from commit f94016d91b)
This commit is contained in:
@@ -22,15 +22,22 @@
|
|||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
#include <utils/misc.h>
|
#include <utils/misc.h>
|
||||||
|
#include <utils/AndroidThreads.h>
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
|
|
||||||
|
static int start_sensor_service(void* /*unused*/) {
|
||||||
|
SensorService::instantiate();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void android_server_SystemServer_startSensorService(JNIEnv* /* env */, jobject /* clazz */) {
|
static void android_server_SystemServer_startSensorService(JNIEnv* /* env */, jobject /* clazz */) {
|
||||||
char propBuf[PROPERTY_VALUE_MAX];
|
char propBuf[PROPERTY_VALUE_MAX];
|
||||||
property_get("system_init.startsensorservice", propBuf, "1");
|
property_get("system_init.startsensorservice", propBuf, "1");
|
||||||
if (strcmp(propBuf, "1") == 0) {
|
if (strcmp(propBuf, "1") == 0) {
|
||||||
// Start the sensor service
|
// Start the sensor service in a new thread
|
||||||
SensorService::instantiate();
|
createThreadEtc(start_sensor_service, nullptr,
|
||||||
|
"StartSensorThread", PRIORITY_FOREGROUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user