// Avoid deadlock by avoiding calling back into the system process.
if (Binder.getCallingUid() == Process.SYSTEM_UID) return;
// Otherwise,explicitly check for caller permission ...
if (getBaseContext().checkCallingOrSelfPermission(PERMISSION) != PERMISSION_GRANTED) {
Log.w(TAG, "Caller needs permission '" + PERMISSION + "' to call " + Debug.getCaller());
throw new SecurityException("Access denied to process: " + Binder.getCallingPid()
+ ", must have permission " + PERMISSION);
}