Merge "Register translation service."

This commit is contained in:
Adam He
2021-01-12 23:35:18 +00:00
committed by Android (Google) Code Review
2 changed files with 25 additions and 0 deletions

View File

@@ -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

View File

@@ -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);