2015年6月25日 星期四

[Android] Permission Denial when broadcasting Intent



When suffering the problem about Permission Denial, the LOG pattern might like this:
Permission Denial: broadcasting Intent { act=com.abc.intent.YOUR_INTENT flg=0x10 } from com.abc.myapp (pid=1191, uid=10119) requires com.abc.permission.APP_PERMISSION due to registered receiver BroadcastFilter{2463d6a8 u0 ReceiverList{d4f8ecb 695 com.android.systemui/10104/u0 remote:2fa2559a}}


It declaim the intent you broadcasting has no appropriate permission you used.

Now you can think about that any place has defined the permission before you used it?

You can check it by adb bugreport
adb bugreport > bugreport.txt


If you can find the following patterns in report you output, it means your device has granted the permission:
Permissions:
  Permission [com.abc.myapp.permission.WRITE_SETTINGS] (39f2d3cc):
    sourcePackage=com.abc.myapp
    uid=10124 gids=[] type=0 prot=signature|system
    packageSetting=PackageSetting{4b48615 com.abc.myapps/10124}
    perm=Permission{af5ad2a com.abc.permission.APP_PERMISSION}

If not, it means you don't have the permission cause you suffering Permission Denial.