Android blocking intent

2.9k Views Asked by At

Can my application block intents from other applications ? I would like to block requests from specific applications,

How can it be done ? I have access to the AOSP so I would like to understand where in the code I can add the blocking mechanism?

For example I would like to refuse to share something which arrives from the browser (for example a copy of the URL) with a specified application.

I see that intents goes to the activity manager, and the activity manager deliver it to the relevant application, How can I know in the lower layer what is the origin of the request ?

For example: am start -a android.intent.action.SEND -d "some message" -t text/plain I see in the shell: Starting: Intent { act=android.intent.action.SEND dat=some message typ=text/plain } I/ActivityManager( 309): START u0 {act=android.intent.action.SEND dat=some message typ=text/plain flg=0x10000000 cmp=android/com.android.internal.app.ResolverActivity} from pid 1149

How can I know in the lower layers that the origin process is 1149? I see in the binder that the request comes from 309 which is the activity manager, I would like to block process 1149 I can change the AOSP but I don't know where I can do it.

1

There are 1 best solutions below

0
On

You can do it using permissions. See this and this.