Reputation: 1303
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?
Upvotes: 4
Views: 4084
Reputation: 1007322
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.
Upvotes: 5