atsushieno / aap-core

an Audio Plugin Format/Framework for Android
MIT License
88 stars 3 forks source link

AudioPluginInterfaceCallback object is not transmitted to service if client and service are different apps #188

Closed atsushieno closed 7 months ago

atsushieno commented 9 months ago

In AudioPluginInterface.aidl there is setCallback() method that passes a callback object to the AudioPluginInterface service.

Its corresponding service setCallback() implementation receives in_callback correctly if the client and service are the same app (e.g. aapinstrumentsample on its own PluginManagerActivity), but if they are different apps then in_callback is nullptr.

atsushieno commented 9 months ago

It is blocking notify_parameters_changed() dogfooding implementation in aap-juce (https://github.com/atsushieno/aap-core/issues/130).

atsushieno commented 7 months ago

I wondered if cross-process callbacks are not supported, but it seems to work at least on Java level. Locally confirmed that this example works (it mentions an example git repo): https://stackoverflow.com/questions/13948671/how-can-i-use-aidl-remote-service-to-deal-with-defferent-clients-concurrent-req/34217138#34217138

atsushieno commented 7 months ago

Other possibilities:

atsushieno commented 7 months ago

After more investigation, it turned out that NdkBinder lacks android.os.Binder equivalent, and it leads to missing Stub class in the generated code.

When we bind our interface e.g. MyService in .aidl, there will be IMyService.Stub class and IMyService.Stub.Proxy class if it were Java, along with IMyServiceDefault class. aidl(.exe) with -lang=ndk generates only IMyServiceDefault which only provides interface methods stubs.

android.os.Binder seems to do a lot of work and it is not easily ported to NdkBinder land (at least the full implementation equivalent would be hard task). We need to get around it.