Have app global connection as to other managers
Regular ...Manager-s connect to the system server hence there is no problem establishing a permanent connection via ServiceManager.getServiceOrThrow. (1) PermissionControllerManager connects to an app, hence the binding has to be dynamic. This is done my using the local RemoteService class. (2) ...Manager-s are per context. Hence when the context goes away all service connection started for this service are supposed to also be cleaned up. There is no callback when the context goes away. (1) and (2) lead to RemoteService connection to still be bound while the context goes away which causes a service connection leak. This change emulates the behavior of regular managers by creating a permanent RemoteService tied to the application context. Of course interanlly RemoteService itself binds and unbinds dynamically. Still, now the RemoteService is not bound to a context that goes away and no connection is leaked. Test: atest CtsAppSecurityHostTestCases:android.appsecurity.cts.PermissionsHostTest (this test failed before as settings was crashing due to leaked remote service connections) Change-Id: I5b8a4c62070fcce6e390897d046c4b28998e3952
Loading
Please register or sign in to comment