getCallingPid() returning my PID in onBind()
<p>I am just getting started with Android programming, and I have implemented a <strong>very</strong> simple remote service.  I am able to bind to my service from other processes and send simple "ping" and "pong" messages back and forth.  (I am not using AIDL, stubs, etc.  I am just passing <code>Messages</code> and using the <code>what</code> field.)</p>

<p>I am now investigating permissions, and I've run into a problem.  In my <code>onBind()</code> method, <code>checkCallingPermission()</code> is always returning <code>PERMISSION_DENIED</code>, even though the calling process does have the permission in question (verified by calling <code>checkCallingOrSelfPermission()</code> in that process).  I suspect that this is happening because <code>Binder.getCallingUid()</code> is returning the PID of the server process, rather than the caller.</p>

<p>Any idea what I might be doing wrong?  <code>checkCallingPermission()</code> is supposed to work this way in a service's <code>onBind()</code> method, right?</p>

<p>Thanks!</p>
