android permission - CHANGE_COMPONENT_ENABLED_STATE

给你一囗甜甜゛ 提交于 2019-12-21 18:34:13

问题


i need to use android.permission.CHANGE_COMPONENT_ENABLED_STATE permission in my code because i need to update the component of another apk of my project, but it don't seems really work for me

here is my code :

<permission
    android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"
    android:protectionLevel="signatureOrSystem"/>

final int permission = ctx.checkCallingPermission(android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);

final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
L.d(TAG, "allowedByPermission :" + allowedByPermission + " permission:" + permission);
if(allowedByPermission) {}

allowedByPermission always log a false.. not sure if i could miss something?


回答1:


First, your app would need <uses-permission>, not <permission>.

Second, your app cannot hold that permission, unless it is installed on the system partition (e.g., by a rooted device user) or is signed by the same signing key that signed the system firmware.



来源:https://stackoverflow.com/questions/19303633/android-permission-change-component-enabled-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!