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

Commit 5af32735 authored by Yeabkal Wubshit's avatar Yeabkal Wubshit Committed by Android (Google) Code Review
Browse files

Merge "Do not start SelectionToolbarManagerService for Wear" into main

parents 20f74664 a86cce68
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -453,8 +453,24 @@ public final class SystemServiceRegistry {
                    @Override
                    public SelectionToolbarManager createService(ContextImpl ctx)
                            throws ServiceNotFoundException {
                        IBinder b = ServiceManager.getServiceOrThrow(
                                Context.SELECTION_TOOLBAR_SERVICE);
                        final PackageManager pm = ctx.getPackageManager();
                        final boolean serviceRequired =
                                !pm.hasSystemFeature(PackageManager.FEATURE_WATCH)
                                && !pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
                        // If the service is required on the device, use `getServiceOrThrow`, which
                        // will throw an Exception if the service is missing.
                        // If the service is not required on the device, use `getService`. This
                        // method simply returns `null` if the service is absent. Avoiding the
                        // Exception is critical for such devices, because the Exception may cause
                        // process crashes, and we do not want that given that the service is not
                        // mandatory.
                        IBinder b = serviceRequired
                                ? ServiceManager.getServiceOrThrow(
                                        Context.SELECTION_TOOLBAR_SERVICE)
                                : ServiceManager.getService(Context.SELECTION_TOOLBAR_SERVICE);
                        if (b == null) {
                            return null;
                        }
                        return new SelectionToolbarManager(
                                ISelectionToolbarManager.Stub.asInterface(b));
                    }});
+1 −1
Original line number Diff line number Diff line
@@ -3016,7 +3016,7 @@ public final class SystemServer implements Dumpable {
        mSystemServiceManager.startService(ClipboardService.class);
        t.traceEnd();

        if (!isTv) {
        if (!isTv && !isWatch) {
            // Selection toolbar service
            t.traceBegin("StartSelectionToolbarManagerService");
            mSystemServiceManager.startService(SelectionToolbarManagerService.class);