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

Commit 146dc70a authored by Chen Bai's avatar Chen Bai
Browse files

boot ac: make AmbientContextManagerService optional

- Based on the overlay config, device may not load AmbientContextManagerService

Test: atest CtsAmbientContextServiceTestCases
BUG: 284076411
Change-Id: Ia6775e54a0354ac3795d8dc94cad05daaafc112a
parent 6a548f64
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ import com.android.internal.util.FrameworkStatsLog;
import com.android.internal.widget.ILockSettings;
import com.android.internal.widget.LockSettingsInternal;
import com.android.server.am.ActivityManagerService;
import com.android.server.ambientcontext.AmbientContextManagerService;
import com.android.server.appbinding.AppBindingService;
import com.android.server.appop.AppOpMigrationHelper;
import com.android.server.appop.AppOpMigrationHelperImpl;
@@ -356,6 +355,8 @@ public final class SystemServer implements Dumpable {
            "com.android.server.selectiontoolbar.SelectionToolbarManagerService";
    private static final String MUSIC_RECOGNITION_MANAGER_SERVICE_CLASS =
            "com.android.server.musicrecognition.MusicRecognitionManagerService";
    private static final String AMBIENT_CONTEXT_MANAGER_SERVICE_CLASS =
            "com.android.server.ambientcontext.AmbientContextManagerService";
    private static final String SYSTEM_CAPTIONS_MANAGER_SERVICE_CLASS =
            "com.android.server.systemcaptions.SystemCaptionsManagerService";
    private static final String TEXT_TO_SPEECH_MANAGER_SERVICE_CLASS =
@@ -1908,9 +1909,17 @@ public final class SystemServer implements Dumpable {
            startRotationResolverService(context, t);
            startSystemCaptionsManagerService(context, t);
            startTextToSpeechManagerService(context, t);
            startAmbientContextService(t);
            startWearableSensingService(t);

            if (deviceHasConfigString(
                    context, R.string.config_defaultAmbientContextDetectionService)) {
                t.traceBegin("StartAmbientContextService");
                mSystemServiceManager.startService(AMBIENT_CONTEXT_MANAGER_SERVICE_CLASS);
                t.traceEnd();
            } else {
                Slog.d(TAG, "AmbientContextManagerService not defined by OEM or disabled by flag");
            }

            // System Speech Recognition Service
            t.traceBegin("StartSpeechRecognitionManagerService");
            mSystemServiceManager.startService(SPEECH_RECOGNITION_MANAGER_SERVICE_CLASS);
@@ -3311,12 +3320,6 @@ public final class SystemServer implements Dumpable {

    }

    private void startAmbientContextService(@NonNull TimingsTraceAndSlog t) {
        t.traceBegin("StartAmbientContextService");
        mSystemServiceManager.startService(AmbientContextManagerService.class);
        t.traceEnd();
    }

    private void startWearableSensingService(@NonNull TimingsTraceAndSlog t) {
        t.traceBegin("startWearableSensingService");
        mSystemServiceManager.startService(WearableSensingManagerService.class);