summaryrefslogtreecommitdiff
path: root/service/java/com/android/server/deviceconfig/DeviceConfigInit.java
blob: 0921d81375e8d0340bf1cb989dea6b4f181dccf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.android.server.deviceconfig;

import java.io.FileDescriptor;

import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.content.Context;
import android.os.Binder;
import android.provider.UpdatableDeviceConfigServiceReadiness;

import com.android.server.SystemService;

/** @hide */
@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
public class DeviceConfigInit {

    private DeviceConfigInit() {
        // do not instantiate
    }

    /** @hide */
    @SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
    public static class Lifecycle extends SystemService {
        private DeviceConfigShellService mShellService;

        /** @hide */
        @SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
        public Lifecycle(@NonNull Context context) {
            super(context);
            // this service is always instantiated but should only launch subsequent services
            // if the module is ready
            if (UpdatableDeviceConfigServiceReadiness.shouldStartUpdatableService()) {
                mShellService = new DeviceConfigShellService();
            }
        }

        /** @hide */
        @Override
        public void onStart() {
            if (UpdatableDeviceConfigServiceReadiness.shouldStartUpdatableService()) {
                publishBinderService("device_config_updatable", mShellService);
            }
        }
    }
}