Android 权限:如何了解哪些权限是危险的,哪些是正常的?
Android 定义了一组第三方应用程序可以请求的权限。 权限按敏感度分类;大多数权限要么是“正常”,要么是“危险”。普通权限自动授予,不提示用户;安装应用程序时会向用户提供危险权限,并要求用户同意授予这些权限。
问题:对于我想到的任何特定 Android 权限,我如何判断它是正常权限还是危险权限?是否有危险权限列表和正常权限列表?
(我知道第三方应用程序可以声明自己的权限。我只是询问标准权限。我知道可能无法获得 100% 完整的列表。我只是在寻找尽力而为的;某些东西总比没有好。)
有关相关但不同的问题,另请参阅在哪里可以获得 Android 权限列表(但是,那就是另一个问题;它没有正常与危险的区别,而且我不一定需要完整的列表)。
Android defines a set of permissions that third-party apps can request. Permissions are categorized by sensitivity; most permissions are either "normal" or "dangerous". Normal permissions are granted automatically, without prompting the user; dangerous permissions are presented to the user when the app is installed and the user is asked to consent to granting them.
Question: For any particular Android permission I have in mind, how can I tell whether it is a normal permission or a dangerous permission? Is there a list of dangerous permissions and a list of normal permissions?
(I know that third-party apps can declare their own permissions. I'm only asking about standard permissions. I know it may not be possible to get a 100%-complete list. I'm only looking for best-effort; something is better than nothing.)
For a related but different question, see also Where can I get a list of Android permissions (however, that's a different question; it doesn't at the normal vs dangerous distinction, and I don't necessarily need a complete list).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
AFAIK,这里的文档是错误的。
权限,据我所知,所有权限都有此行为。
这可能会演变为始终显示危险权限,而如果有足够的危险权限,则正常权限可能会“低于首屏”。
您可以查看源代码。
AFAIK, the documentation is wrong here.
AFAIK, all permissions have this behavior.
What this may have morphed into is that dangerous permissions are always displayed and normal permissions are ones that might be "below the fold" if there are enough dangerous ones.
You can look at the source code.
我发现这篇博文按保护级别列出了“默认”权限。我想,这就是您正在寻找的列表。
不过,该列表可能在此期间发生了变化,因为该帖子已经发布了 10 个月。它提供了示例代码供您自行重新编译列表。
I found this blogpost listing the "default" permissions by protection level. I think, this is the kind of list you were looking for.
The list might have changed in the meantime though, as the post is 10 months old. It provides sample code to recompile the list by yourself.
从 android M 开始,权限将在运行时授予。正常权限不需要用户同意,但危险权限需要用户向应用程序授予权限。
普通权限: https://developer.android.com/guide/topics/ security/normal-permissions.html
危险权限:危险权限涵盖应用程序需要涉及用户隐私信息的数据或资源的区域https://developer.android.com/guide/topics/security/permissions .html#正常危险
From android M permissions will be granted at runtime. User consent is not required for Normal permissions but for Dangerous permissions user is required to grant the permission to application.
Normal permissions: https://developer.android.com/guide/topics/security/normal-permissions.html
Dangerous permissions: Dangerous permissions cover areas where the app wants data or resources that involve the user's private information https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous
这里是一篇很好的文章,它描述了有关运行时权限、
正常权限
、危险权限 的所有内容
Here is a good article which describes every thing about run time permissions ,
Normal permissions
Dangerous permissions
在 Android Studio 中,您可以打开 AndroidManifest.xml 并对您使用的每个权限按 F1,然后您可以查看文档可能显示的是否存在危险。
in Android Studio,you can open your AndroidManifest.xml and press F1 on every permission you used then you can see if it is dangerous which the doc may shows.
新的权限会随着新的 Android 版本的发布而添加,因此代码中包含的任何列表都将过时。
如果您需要一种面向未来的方法,则可以在运行时确定权限是否危险。
如果权限存在危险,此扩展函数将返回
true
。例如:
New permissions are added as new Android versions are released, so any list included in your code will go out of date.
If you need a future-proof approach, it's possible to determine at runtime whether a permission is dangerous.
This extension function returns
true
if a permission is dangerous.For example:
,下面是取自官方文档的普通权限列表:
为了更简单起见 级别 23,以下权限被分类为 PROTECTION_NORMAL:
这里是危险权限和权限的列表组:
For more simplicity, below are list of Normal permissions taken from official docs:
As of API level 23, the following permissions are classified as PROTECTION_NORMAL:
And here is list of Dangerous permissions and permission groups: