Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission is not a changeable permission type

Background: I was trying out the new Tiles and TileService and decided to recreate the USB Tethering tile from CyanogenMod. I used reflection to access Connectivity manager's methods.

Problem: One Such method is the isTetheringSupported() which causes java.lang.SecurityException: You either need MANAGE_USERS or CREATE_USERS permission to: query user

So I added the permissions to the manifest but every time I use pm grant it returns "Permission is not a changeable permission type"

According to this I should not get this error when signed with the debug key.

Question: How do I get those permissions?

like image 658
Anubhav Avatar asked Sep 06 '25 22:09

Anubhav


1 Answers

UPDATE: Via Xposed it is possible to hook into the PackageManger and remove the below check and then do pm grant... to successfully grant whatever permission. If someone sees this and needs help to do so comment below I'll help you out.

OLD ANSWER This code in the source

boolean isDevelopment =
            ((bp.protectionLevel&PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0);

doesn't check if your app is in development mode. It checks if the permission you are requesting has the protectionLevel attribute (set in manifest) set to development. And the permission you are trying to get seems not to have any elements declared in the manifest that could pass this check:

if (!isNormal && !isDangerous && !isDevelopment) {
        throw new SecurityException("Permission " + bp.name
                + " is not a changeable permission type");
    }

Just stumbled upon this with another permission. Seems there's sadly no way to get it.

like image 112
Alex Newman Avatar answered Sep 10 '25 13:09

Alex Newman