summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/SystemServer.java
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2021-04-23 22:02:50 +0100
committerMichael Wright <michaelwr@google.com>2021-05-04 18:33:30 +0100
commite3912446ecf49e9d20591d203a10bde23bda7ac2 (patch)
treeae2a65cd2f07e7ef212cd89cfa8fd52b4102439b /services/java/com/android/server/SystemServer.java
parent16529a261391ac48968e86e54a69b7134ee71f7e (diff)
Create Java interface to SensorService.
This is in preparation for adding some system_server-only, non-binder APIs, which mean we need to keep a handle to the actual class and not just the binder interface. Bug: 175793106 Test: boots, sensors work Change-Id: I83dcaee53ac52e95aa238a8fa9b875caeeddc725
Diffstat (limited to 'services/java/com/android/server/SystemServer.java')
-rw-r--r--services/java/com/android/server/SystemServer.java25
1 files changed, 7 insertions, 18 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 8dc501119af1..1e4b2485cd94 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -179,6 +179,7 @@ import com.android.server.rotationresolver.RotationResolverManagerService;
import com.android.server.security.FileIntegrityService;
import com.android.server.security.KeyAttestationApplicationIdProviderService;
import com.android.server.security.KeyChainSystemService;
+import com.android.server.sensors.SensorService;
import com.android.server.signedconfig.SignedConfigService;
import com.android.server.soundtrigger.SoundTriggerService;
import com.android.server.soundtrigger_middleware.SoundTriggerMiddlewareService;
@@ -427,7 +428,6 @@ public final class SystemServer implements Dumpable {
private final long mRuntimeStartElapsedTime;
private final long mRuntimeStartUptime;
- private static final String START_SENSOR_SERVICE = "StartSensorService";
private static final String START_HIDL_SERVICES = "StartHidlServices";
private static final String START_BLOB_STORE_SERVICE = "startBlobStoreManagerService";
@@ -435,7 +435,6 @@ public final class SystemServer implements Dumpable {
private static final String SYSPROP_START_ELAPSED = "sys.system_server.start_elapsed";
private static final String SYSPROP_START_UPTIME = "sys.system_server.start_uptime";
- private Future<?> mSensorServiceStart;
private Future<?> mZygotePreload;
private Future<?> mBlobStoreServiceStart;
@@ -449,9 +448,6 @@ public final class SystemServer implements Dumpable {
/** Start the IStats services. This is a blocking call and can take time. */
private static native void startIStatsService();
- /** Start the sensor service. This is a blocking call and can take time. */
- private static native void startSensorService();
-
/**
* Start the memtrack proxy service.
*/
@@ -1229,15 +1225,9 @@ public final class SystemServer implements Dumpable {
// The sensor service needs access to package manager service, app ops
// service, and permissions service, therefore we start it after them.
- // Start sensor service in a separate thread. Completion should be checked
- // before using it.
- mSensorServiceStart = SystemServerInitThreadPool.submit(() -> {
- TimingsTraceAndSlog traceLog = TimingsTraceAndSlog.newAsyncLog();
- traceLog.traceBegin(START_SENSOR_SERVICE);
- startSensorService();
- traceLog.traceEnd();
- }, START_SENSOR_SERVICE);
-
+ t.traceBegin("StartSensorService");
+ mSystemServiceManager.startService(SensorService.class);
+ t.traceEnd();
t.traceEnd(); // startBootstrapServices
}
@@ -1474,8 +1464,7 @@ public final class SystemServer implements Dumpable {
t.traceBegin("StartWindowManagerService");
// WMS needs sensor service ready
- ConcurrentUtils.waitForFutureNoInterrupt(mSensorServiceStart, START_SENSOR_SERVICE);
- mSensorServiceStart = null;
+ mSystemServiceManager.startBootPhase(t, SystemService.PHASE_WAIT_FOR_SENSOR_SERVICE);
wm = WindowManagerService.main(context, inputManager, !mFirstBoot, mOnlyCore,
new PhoneWindowManager(), mActivityManagerService.mActivityTaskManager);
ServiceManager.addService(Context.WINDOW_SERVICE, wm, /* allowIsolated= */ false,
@@ -1493,8 +1482,8 @@ public final class SystemServer implements Dumpable {
t.traceEnd();
// Start receiving calls from HIDL services. Start in in a separate thread
- // because it need to connect to SensorManager. This have to start
- // after START_SENSOR_SERVICE is done.
+ // because it need to connect to SensorManager. This has to start
+ // after PHASE_WAIT_FOR_SENSOR_SERVICE is done.
SystemServerInitThreadPool.submit(() -> {
TimingsTraceAndSlog traceLog = TimingsTraceAndSlog.newAsyncLog();
traceLog.traceBegin(START_HIDL_SERVICES);