Hello!

I hope you can help to answer my question: I am doing some AOSP system
development for a university project and I want to to "tag" Intents
created within a function of service component with the UID of the
remote caller app who bound/called to the service. My straightforward
solution was to extend the Intent class with a new private integer
which is set with Binder.getCallingUid in the constructors of the
Intent. However, I encountered strange behavior:

When calling Binder.getCallingUid in the function of the service, it
correctly returns the UID of the caller app. But when using
Binder.getCallingUid in the Intent constructor (called in this service
function), Binder.getCallingUid returns the UID of the service's app.

The stack dump looks like:
W/System.err(  668): java.lang.Throwable: stack dump
W/System.err(  668):    at java.lang.Thread.dumpStack(Thread.java:612)
W/System.err(  668):    at android.content.Intent.<init>(Intent.java:
2668)
W/System.err(  668):    at com.test.app.RemoteService
$1.sendData(RemoteService.java:46)
W/System.err(  668):    at com.test.app.IRemoteService
$Stub.onTransact(IRemoteService.java:54)
W/System.err(  668):    at android.os.Binder.execTransact(Binder.java:
288)
W/System.err(  668):    at dalvik.system.NativeStart.run(Native
Method)

So, it seems there is no IPC going on when calling the Intent
constructor, so I wonder why the return value of Binder.getCallingUid
changes between sendData(RemoteService.java:46) and (Intent.java:
2668)?!

Thanks and cheers,
- Sven

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to