getCallingUid/getCallingPid return current uid and pid in Handler.handleMessage
<p>I have a class extending <code>android.os.Handler</code>. An instance of this handler is passed to the constructor of a <code>Messenger</code>. The <code>Messenger</code>'s <code>IBinder</code> from <code>getBinder</code> is passed as the result of <code>onBind</code> events in my service. Messages sent via the binder from remote applications do go to the handler's <code>handleMessage</code> method, however calls to <code>Binder.getCallingUid</code> and <code>Binder.getCallingPid</code> within <code>handleMessage</code> always return the uid and pid of the service's process (which is definitely not the same process as the remote application). <code>handleMessage</code> is definitely part of an IPC transaction, isn't it? So where have I gone wrong? I need this to work for authentication of connecting applications.</p>

<p>Thanks in advance.</p>

<p><strong>Edit</strong></p>

<p>OK. I have this horrible feeling that <code>handleMessage</code> is not part of the IPC transaction, because that happens in separate threads for AIDL which puts messages in a queue for the <code>Messenger</code>. Is there any other way of getting the User ID and Process ID of the caller?</p>
