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

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

Merge "Avoid crashes for no WearableSensingManager in Wear" into main

parents e18b5751 074c1433
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -1667,11 +1667,20 @@ public final class SystemServiceRegistry {
                    @Override
                    public WearableSensingManager createService(ContextImpl ctx)
                            throws ServiceNotFoundException {
                        IBinder iBinder = ServiceManager.getServiceOrThrow(
                        IBinder iBinder = ServiceManager.getService(
                                Context.WEARABLE_SENSING_SERVICE);
                        if (iBinder != null) {
                            IWearableSensingManager manager =
                                    IWearableSensingManager.Stub.asInterface(iBinder);
                            return new WearableSensingManager(ctx.getOuterContext(), manager);
                        }
                        // Wear intentionally removes the service, so do not throw a
                        // ServiceNotFoundException when the service is not absent.
                        if (ctx.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
                                && android.server.Flags.removeWearableSensingServiceFromWear()) {
                            return null;
                        }
                        throw new ServiceNotFoundException(Context.WEARABLE_SENSING_SERVICE);
                    }});

        registerService(Context.ON_DEVICE_INTELLIGENCE_SERVICE, OnDeviceIntelligenceManager.class,