Blocking/Synchronous function call in AIDL
<p>I am working on a android service, this service provided a AIDL interface for applications, Now application calls function GetData() using AIDL interface, this function is implemented in Service , it does some network operation, connect to server and fetch some data, this network transaction happen in background thread, Problem is that I want function GetData() should NOT return until network operation is complete, result comes from server and I want to return it into GetData(), GetData function returns immediately and network operation in background thread keep on running in parallel, how to avoid this, cannot call network operation also in main thread. I read about countDownlatch, is it only possible solution?</p>

<pre><code>                        Service Main Thread

                            GetData
                                 GetDataFromServer-----------&gt; in Background thread
      /*this is problem */  GetData returns;                         |
                                                                     |
                                                                     |
                                                              communication in progress
                                                                     |
                                                                     |
                                                                     |
      /*I want GetData should return here &lt;-------------------transaction complete
</code></pre>
