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

Commit 859331aa authored by David Su's avatar David Su
Browse files

Register RttManager correctly

RttManager is an exception in that the
service name (Context.WIFI_RTT_SERVICE)
it is published under is different from its
binder name (Context.WIFI_RTT_RANGING_SERVICE).

When
`SystemServiceRegistry.registerContextAwareService()`
tries to get the binder of Context.WIFI_RTT_SERVICE,
it won't find anything since there is no binder
published under that name. Thus, the registration
will fail.

Instead, delegate RttManager construction to
WifiRttManager construction.

Bug: 148817663
Test: atest android.net.wifi.rtt.cts.WifiRttTest
Change-Id: I94e505583689f3fd3836dba2f7feb0e7f0ab1378
parent eb765283
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -101,15 +101,6 @@ public class WifiFrameworkInitializer {
                    return new WifiScanner(context, service, getInstanceLooper());
                }
        );
        SystemServiceRegistry.registerContextAwareService(
                Context.WIFI_RTT_SERVICE,
                RttManager.class,
                (context, serviceBinder) -> {
                    IWifiRttManager service = IWifiRttManager.Stub.asInterface(serviceBinder);
                    WifiRttManager wifiRttManager = new WifiRttManager(context, service);
                    return new RttManager(context, wifiRttManager);
                }
        );
        SystemServiceRegistry.registerContextAwareService(
                Context.WIFI_RTT_RANGING_SERVICE,
                WifiRttManager.class,
@@ -118,5 +109,13 @@ public class WifiFrameworkInitializer {
                    return new WifiRttManager(context, service);
                }
        );
        SystemServiceRegistry.registerContextAwareService(
                Context.WIFI_RTT_SERVICE,
                RttManager.class,
                context -> {
                    WifiRttManager wifiRttManager = context.getSystemService(WifiRttManager.class);
                    return new RttManager(context, wifiRttManager);
                }
        );
    }
}