Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ee07a73 authored by Amos Bianchi's avatar Amos Bianchi
Browse files

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
parent 8c430943
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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;