Reputation: 477
I know that AudioManager provides API for AudioService. However, that I want is to get instance of AudioService class.
Studying the source showed that AudioManager makes a call to class in remote service.
I know that AudioManager have a field "sService", but is not an instance of AudioService, instead it is an instance of BinderInternal, IIRC. Can I somehow gain access to instance of AudioService? Or it is totally impossible because of security issues?
Upvotes: 0
Views: 1952
Reputation: 20936
I suppose that you can easily get the reference to AudioService. I think you've just missed the appropriate part of the code:
private static IAudioService getService()
{
if (sService != null) {
return sService;
}
IBinder b = ServiceManager.getService(Context.AUDIO_SERVICE);
sService = IAudioService.Stub.asInterface(b);
return sService;
}
You can see that sService
will be a reference to IAudioService. Similarly, in your application you can get direct reference to IAudioService. However, I do not understand why you may need to do this.
Upvotes: 1