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

Commit 9cc6ab62 authored by Joanne Chung's avatar Joanne Chung Committed by Android (Google) Code Review
Browse files

Merge "Revert "[DO NOT MERGE] Remove selection toolbar code from build time"" into tm-qpr-dev

parents fe195e6f 888e79f7
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -15,14 +15,6 @@ filegroup {
        "**/*.java",
        "**/*.aidl",
    ],
    exclude_srcs: [
        // Remove election toolbar code from build time
        "android/service/selectiontoolbar/*.aidl",
        "android/service/selectiontoolbar/*.java",
        "android/view/selectiontoolbar/*.aidl",
        "android/view/selectiontoolbar/*.java",
        "com/android/internal/widget/floatingtoolbar/RemoteFloatingToolbarPopup.java",
    ],
    visibility: ["//frameworks/base"],
}

+11 −0
Original line number Diff line number Diff line
@@ -230,6 +230,8 @@ import android.view.contentcapture.ContentCaptureManager;
import android.view.contentcapture.IContentCaptureManager;
import android.view.displayhash.DisplayHashManager;
import android.view.inputmethod.InputMethodManager;
import android.view.selectiontoolbar.ISelectionToolbarManager;
import android.view.selectiontoolbar.SelectionToolbarManager;
import android.view.textclassifier.TextClassificationManager;
import android.view.textservice.TextServicesManager;
import android.view.translation.ITranslationManager;
@@ -363,6 +365,15 @@ public final class SystemServiceRegistry {
                return new TextClassificationManager(ctx);
            }});

        registerService(Context.SELECTION_TOOLBAR_SERVICE, SelectionToolbarManager.class,
                new CachedServiceFetcher<SelectionToolbarManager>() {
                    @Override
                    public SelectionToolbarManager createService(ContextImpl ctx) {
                        IBinder b = ServiceManager.getService(Context.SELECTION_TOOLBAR_SERVICE);
                        return new SelectionToolbarManager(ctx.getOuterContext(),
                                ISelectionToolbarManager.Stub.asInterface(b));
                    }});

        registerService(Context.FONT_SERVICE, FontManager.class,
                new CachedServiceFetcher<FontManager>() {
            @Override
+5 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.graphics.Rect;
import android.view.MenuItem;
import android.view.View;
import android.view.selectiontoolbar.SelectionToolbarManager;
import android.widget.PopupWindow;

import java.util.List;
@@ -92,7 +93,10 @@ public interface FloatingToolbarPopup {
     * enabled, otherwise returns {@link LocalFloatingToolbarPopup} implementation.
     */
    static FloatingToolbarPopup createInstance(Context context, View parent) {
        return new LocalFloatingToolbarPopup(context, parent);
        boolean enabled = SelectionToolbarManager.isRemoteSelectionToolbarEnabled(context);
        return enabled
                ? new RemoteFloatingToolbarPopup(context, parent)
                : new LocalFloatingToolbarPopup(context, parent);
    }

}
+2 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ filegroup {
        ":services.profcollect-sources",
        ":services.restrictions-sources",
        ":services.searchui-sources",
        ":services.selectiontoolbar-sources",
        ":services.smartspace-sources",
        ":services.speech-sources",
        ":services.systemcaptions-sources",
@@ -157,6 +158,7 @@ java_library {
        "services.profcollect",
        "services.restrictions",
        "services.searchui",
        "services.selectiontoolbar",
        "services.smartspace",
        "services.speech",
        "services.systemcaptions",
+7 −0
Original line number Diff line number Diff line
@@ -338,6 +338,8 @@ public final class SystemServer implements Dumpable {
            "com.android.server.contentcapture.ContentCaptureManagerService";
    private static final String TRANSLATION_MANAGER_SERVICE_CLASS =
            "com.android.server.translation.TranslationManagerService";
    private static final String SELECTION_TOOLBAR_MANAGER_SERVICE_CLASS =
            "com.android.server.selectiontoolbar.SelectionToolbarManagerService";
    private static final String MUSIC_RECOGNITION_MANAGER_SERVICE_CLASS =
            "com.android.server.musicrecognition.MusicRecognitionManagerService";
    private static final String SYSTEM_CAPTIONS_MANAGER_SERVICE_CLASS =
@@ -2634,6 +2636,11 @@ public final class SystemServer implements Dumpable {
            Slog.d(TAG, "TranslationService not defined by OEM");
        }

        // Selection toolbar service
        t.traceBegin("StartSelectionToolbarManagerService");
        mSystemServiceManager.startService(SELECTION_TOOLBAR_MANAGER_SERVICE_CLASS);
        t.traceEnd();

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