Start NearbyService when system server starts.

Bug: 189355156
Bug: 214495869
Test: manual
Change-Id: I41ecaf814efce374e8448f9cab3fce45c18862f0
This commit is contained in:
Wei Wang
2021-09-12 21:15:48 -07:00
committed by Eric Lin
parent 768e23133a
commit 0fc06be8ca

View File

@@ -258,6 +258,8 @@ public final class SystemServer implements Dumpable {
"com.android.server.scheduling.RebootReadinessManagerService$Lifecycle";
private static final String CONNECTIVITY_SERVICE_APEX_PATH =
"/apex/com.android.tethering/javalib/service-connectivity.jar";
private static final String NEARBY_SERVICE_APEX_PATH =
"/apex/com.android.nearby/javalib/service-nearby.jar";
private static final String STATS_COMPANION_LIFECYCLE_CLASS =
"com.android.server.stats.StatsCompanion$Lifecycle";
private static final String STATS_PULL_ATOM_SERVICE_CLASS =
@@ -266,6 +268,8 @@ public final class SystemServer implements Dumpable {
"com.android.server.usb.UsbService$Lifecycle";
private static final String MIDI_SERVICE_CLASS =
"com.android.server.midi.MidiService$Lifecycle";
private static final String NEARBY_SERVICE_CLASS =
"com.android.server.nearby.NearbyService";
private static final String WIFI_APEX_SERVICE_JAR_PATH =
"/apex/com.android.wifi/javalib/service-wifi.jar";
private static final String WIFI_SERVICE_CLASS =
@@ -1927,6 +1931,16 @@ public final class SystemServer implements Dumpable {
}
t.traceEnd();
// Start Nearby Service.
t.traceBegin("StartNearbyService");
try {
mSystemServiceManager.startServiceFromJar(NEARBY_SERVICE_CLASS,
NEARBY_SERVICE_APEX_PATH);
} catch (Throwable e) {
reportWtf("starting NearbyService", e);
}
t.traceEnd();
t.traceBegin("StartConnectivityService");
// This has to be called after NetworkManagementService, NetworkStatsService
// and NetworkPolicyManager because ConnectivityService needs to take these