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

Commit aa194963 authored by Joanne Chung's avatar Joanne Chung Committed by Adam He
Browse files

Register translation service.

Bug: 173243538
Test: manual. Make sure device can boot to home and we can get
the TranslationManager successfully.

Change-Id: Ib0e733d6b8f3792431d71f9791b5b2e43a029a7b
parent 5664e559
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -209,6 +209,8 @@ import android.view.contentcapture.IContentCaptureManager;
import android.view.inputmethod.InputMethodManager;
import android.view.textclassifier.TextClassificationManager;
import android.view.textservice.TextServicesManager;
import android.view.translation.ITranslationManager;
import android.view.translation.TranslationManager;

import com.android.internal.app.IAppOpsService;
import com.android.internal.app.IBatteryStats;
@@ -1172,6 +1174,20 @@ public final class SystemServiceRegistry {
                return null;
            }});

        registerService(Context.TRANSLATION_MANAGER_SERVICE, TranslationManager.class,
                new CachedServiceFetcher<TranslationManager>() {
                    @Override
                    public TranslationManager createService(ContextImpl ctx)
                            throws ServiceNotFoundException {
                        IBinder b = ServiceManager.getService(Context.TRANSLATION_MANAGER_SERVICE);
                        ITranslationManager service = ITranslationManager.Stub.asInterface(b);
                        // Service is null when not provided by OEM.
                        if (service != null) {
                            return new TranslationManager(ctx.getOuterContext(), service);
                        }
                        return null;
                    }});

        registerService(Context.SEARCH_UI_SERVICE, SearchUiManager.class,
            new CachedServiceFetcher<SearchUiManager>() {
                @Override
+9 −0
Original line number Diff line number Diff line
@@ -299,6 +299,8 @@ public final class SystemServer implements Dumpable {
            "com.android.server.autofill.AutofillManagerService";
    private static final String CONTENT_CAPTURE_MANAGER_SERVICE_CLASS =
            "com.android.server.contentcapture.ContentCaptureManagerService";
    private static final String TRANSLATION_MANAGER_SERVICE_CLASS =
            "com.android.server.translation.TranslationManagerService";
    private static final String MUSIC_RECOGNITION_MANAGER_SERVICE_CLASS =
            "com.android.server.musicrecognition.MusicRecognitionManagerService";
    private static final String SYSTEM_CAPTIONS_MANAGER_SERVICE_CLASS =
@@ -2291,6 +2293,13 @@ public final class SystemServer implements Dumpable {
            t.traceEnd();
        }

        // Translation manager service
        if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_TRANSLATION)) {
            t.traceBegin("StartTranslationManagerService");
            mSystemServiceManager.startService(TRANSLATION_MANAGER_SERVICE_CLASS);
            t.traceEnd();
        }

        // NOTE: ClipboardService depends on ContentCapture and Autofill
        t.traceBegin("StartClipboardService");
        mSystemServiceManager.startService(ClipboardService.class);