android 8.0 Permission Denial: not allowed to send broadcast

adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
Broadcasting: Intent { act=android.intent.action.BOOT_COMPLETED flg=0x400000 }
Security exception: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=13327, uid=2000

java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.BOOT_COMPLETED from pid=13327, uid=2000
	at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:19405)
	at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:20069)
	at com.android.server.am.ActivityManagerShellCommand.runSendBroadcast(ActivityManagerShellCommand.java:621)
	at com.android.server.am.ActivityManagerShellCommand.onCommand(ActivityManagerShellCommand.java:154)
	at android.os.ShellCommand.exec(ShellCommand.java:96)
	at com.android.server.am.ActivityManagerService.onShellCommand(ActivityManagerService.java:15222)
	at android.os.Binder.shellCommand(Binder.java:594)
	at android.os.Binder.onTransact(Binder.java:492)
	at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:4252)
	at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2971)
	at android.os.Binder.execTransact(Binder.java:697)

谷歌从4.4版本后保护了一些广播,不允许系统之外的应用发送这些广播,可以AndroidManifest.xml 中看到这条权限被保护了,只有系统能发送

你可能感兴趣的:(android基础架构)