权限不是可更改的权限类型 [英] Permission is not a changeable permission type

查看:1009
本文介绍了权限不是可更改的权限类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我正在尝试新的Tiles和TileService,并决定从

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.

问题:一种方法是isTetheringSupported()导致java.lang.SecurityException: You either need MANAGE_USERS or CREATE_USERS permission to: query user

因此我将权限添加到清单中,但是每次使用pm grant时,它都会返回权限不是可更改的权限类型"

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?

推荐答案

更新: 通过 Xposed 可以挂接到PackageManger并删除以下检查,然后执行pm grant...来成功授予任何权限.如果有人看到此消息并需要帮助,请在下方评论,我会为您提供帮助.

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);

不检查您的应用程序是否处于开发模式.它检查您请求的权限是否将protectionLevel属性(在清单中设置)设置为development. 而且,您试图获得的许可似乎没有在清单中声明任何可以通过此检查的元素:

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.

这篇关于权限不是可更改的权限类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆