1. Are you ready for the Galaxy S20? Here is everything we know so far!

Query about AIDL

Discussion in 'Android Development' started by Estgobi, Apr 18, 2012.

  1. Estgobi

    Estgobi Lurker
    Thread Starter

    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
     



    1. Download the Forums for Android™ app!


      Download

       
  2. alostpacket

    alostpacket Over Macho Grande?

    My guess would be it's almost certainly async. Just seems logical but I don't know for sure.
     
  3. wubbzy

    wubbzy Well-Known Member

    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.
     
    alostpacket likes this.
Loading...

Share This Page

Loading...