Search code examples
javaandroidjvmandroid-sourcedalvik

How to enable IPC in Android Source Tree


I am working in a project where different components in Android source tree need to communicate. For example, the accessibility service need to sends a request to ImageView class to notify when ever a new image view is instantiated.

I want to know some ways to handle theses scenarios, my broadcast receiver did not work. And it does not work without a context. Can you guys suggest some other approaches? If I implement memory file how I can handle notifications that some requests have been made?


Solution

  • Most Android internal components that run under the dalvik (or ART) communicate with each other through AIDL's. This mechanism will provide a very raw mechanism to pass data between apps with different processes.
    AIDL also support creation of a callback - you will need to create another parcelable object as your callback interface and set it as a return value (Guide).

    Here you can find a good example of the accessibility service implemanting the AIDL IPC mechanism.