From 3ee07a732cc353f776b8221e28a8af53c6c895c8 Mon Sep 17 00:00:00 2001 From: Amos Bianchi Date: Fri, 7 Jul 2023 10:11:29 -0700 Subject: [PATCH] Explicitly start device lock system service. We used to relay on the "apex-system-service" tag in the APEX AndroidManifest.xml, however startApexServices() will not start the service in case of flattened APEXes. Bug: 290795765 Test: Service is started Test: atest CtsDeviceLockTestCases Change-Id: Ib306a6248d8a0dbd30d822f8e82f4fb4f721aca2 --- services/java/com/android/server/SystemServer.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 991248aceb4be..6960da74dd1a3 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -434,6 +434,10 @@ public final class SystemServer implements Dumpable { + "OnDevicePersonalizationSystemService$Lifecycle"; private static final String UPDATABLE_DEVICE_CONFIG_SERVICE_CLASS = "com.android.server.deviceconfig.DeviceConfigInit$Lifecycle"; + private static final String DEVICE_LOCK_SERVICE_CLASS = + "com.android.server.devicelock.DeviceLockService"; + private static final String DEVICE_LOCK_APEX_PATH = + "/apex/com.android.devicelock/javalib/service-devicelock.jar"; private static final String TETHERING_CONNECTOR_CLASS = "android.net.ITetheringConnector"; @@ -2864,6 +2868,13 @@ public final class SystemServer implements Dumpable { mSystemServiceManager.startService(HEALTHCONNECT_MANAGER_SERVICE_CLASS); t.traceEnd(); + if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_DEVICE_LOCK)) { + t.traceBegin("DeviceLockService"); + mSystemServiceManager.startServiceFromJar(DEVICE_LOCK_SERVICE_CLASS, + DEVICE_LOCK_APEX_PATH); + t.traceEnd(); + } + // These are needed to propagate to the runnable below. final NetworkManagementService networkManagementF = networkManagement; final NetworkPolicyManagerService networkPolicyF = networkPolicy;