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

Commit aaeac91a authored by Adam He's avatar Adam He Committed by Android (Google) Code Review
Browse files

Merge "Register translation service."

parents 9b2cce77 aa194963
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);