试图改变在android系统组件的状态安全异常 [英] Attempt to change component state security exception in android
本文介绍了试图改变在android系统组件的状态安全异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,我在一边框架我的工作实现一个测试程序,以禁止其他应用程序,但是当我运行我的测试程序是显示
hi i am working in framework side implementing one test app to disable another app but when i run my test app it is showing
Java.lang.SecurityException: Permission Denial: attempt to change component state from pid=xxx,uid=xxxx,package uid=xxx
at xxxxxxxx
我的Java code
my java code
PackageManager pm = getApplicationContext().getPackagemanager();
pm.setComponentEnabledSetting(new ComponentName("com.example","MainActivity"),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,PackageManager.DONT_KILL_APP);
AndroidManifest.xml中
AndroidManifest.xml
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE>
我在上面已经同意尝试与两个(权限只授予给系统应用程序)和还试图标记,但没有运气
i have tried above permission with both (Permission is only granted to system apps) and also tried tag but no lucky
如何使用系统应用获准,
how to use system apps granted permission,
你能不能请你们帮我解决这个问题。
Could you please guys help me to resolve this issue
在此先感谢
推荐答案
您不能启用/禁用应用程序,除非你的应用程序是系统中的应用
You can not Enable/disable app unless your app is system app
这篇关于试图改变在android系统组件的状态安全异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文