Other Permission Enforcement
Arbitrarily fine-grained permissions can be enforced at any call into a
service. This is accomplished with the Context.checkCallingPermission()
method. Call with a desired
permission string and it will return an integer indicating whether that
permission has been granted to the current calling process. Note that this can
only be used when you are executing a call coming in from another process,
usually through an IDL interface published from a service or in some other way
given to another process.
There are a number of other useful ways to check permissions. If you have
the pid of another process, you can use the Context method Context.checkPermission(String, int, int)
to check a permission against that pid. If you have the package name of another
application, you can use the direct PackageManager method PackageManager.checkPermission(String, String)
to find out whether that particular package has been granted a specific permission.