• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Query about AIDL

Estgobi

Lurker
Nov 26, 2011
2
0
Hi All,

If I want to communicate between the process , then I need to use AIDL.
while using AIDL , It is creating Binder thread in my process.I want to know why this thread is needed as communication between the process in Synchronous ?

I am really want to know, why IPC call is Synchronous, why not Asynchronous?
as it is designed as Synchronous , it will affect the performance .

Check out the timestamp and pid in below logs


04-19 08:23:21.575: INFO/MainActivity(332): mRemoteService.StartTimer calling st
04-19 08:23:21.575: INFO/Timer Service(323): StartTimer-Binder Thread #2
04-19 08:23:21.685: INFO/MainActivity(332): mRemoteService.StartTimer called

please correct me if I am wrong
 
The answer actually lies in your own question - *IDL concept is borrowed from RPC or other remote method/function execution frameworks. The reason to choose IDL can vary, but they provide one important thing - they are and behave similar (including syntactically) to local function/method call. Just like a local method/function call does not return until it has completed neither does IDL or RPC.

That being said android tries to manage read/write ends to IDL sides (activity/service combo). So it can tell them when other disconnected or connected, so one end does not wait (recv) and other does not keep sending (return) - simple remote exception handling situation.

Consider if you really need remote service. If you just have one 'process' (maybe many activities tied to it), then you can simplify this a lot by using local service.
 
  • Like
Reactions: alostpacket
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones