简体   繁体   English

的角色 <uses-permission> 清单文件中标记?

[英]Role of <uses-permission> tag in manifest file?

I am new to Android development and I have been using the < uses-permission > tag in some of my previous applications. 我是Android开发的新手,在以前的某些应用程序中一直使用< uses-permission >标签。 However, I am still in the dark as to how the tag actually works. 但是,对于标签的实际工作方式,我还是一无所知。 I understand that the tag ensures that Android sign a 'contract' such that only the components part of the key-value pairs in the tag are included in an application. 据我了解,该标签可确保Android签署“合同”,从而仅将标签中键/值对的组件部分包含在应用程序中。 My question specifically is: 我的问题特别是:

Q. How do the key-value attributes of < uses-permission > tag impart the 'information' that Android requires to restrict an app from including features not mentioned in the tag's key-value pair? 问:< uses-permission >标签的键值属性如何赋予Android限制应用程序以包括标签的键值对中未提及的功能所需的“信息”?

My internet searches have not given me the answer I was looking for and any direction on this would be most appreciated. 我的互联网搜索没有给我我所需要的答案,对此的任何指导将是不胜感激的。

The permissions listed in that tag are presented to the user at install time. 该标签中列出的权限在安装时显示给用户。 Thus the user is forced to explicitly grant those permissions or not (by terminating the install). 因此,用户被迫明确地授予或不授予那些权限(通过终止安装)。

A permission is a restriction limiting access to a part of the code or to data on the device. The limitation is imposed to protect critical data and code that could be misused to distort or damage the user experience.

Requests a permission that the application must be granted in order for it to operate correctly. 请求必须授予该应用程序才能使其正常运行的权限。 Permissions are granted by the user when the application is installed, not while it's running. 权限是由用户在安装应用程序时而不是在运行时授予的。

For more info see uses-permission 有关更多信息,请参见uses-permission

The official docs explain how it works: 官方文档解释了它是如何工作的:

To make use of the protected APIs on the device, an application must define the capabilities it needs in its manifest. 要使用设备上受保护的API,应用程序必须在清单中定义其所需的功能。 When preparing to install an application, the system displays a dialog to the user that indicates the permissions requested and asks whether to continue the installation. 准备安装应用程序时,系统会向用户显示一个对话框,指示所请求的权限,并询问是否继续安装。 If the user continues with the installation, the system accepts that the user has granted all of the requested permissions. 如果用户继续安装,则系统将接受该用户已授予所有请求的权限。 The user can not grant or deny individual permissions -- the user must grant or deny all of the requested permissions as a block. 用户不能授予或拒绝单个权限-用户必须作为阻止来授予或拒绝所有请求的权限。

Once granted, the permissions are applied to the application as long as it is installed. 授予权限后,只要安装了权限,便将其应用于应用程序。 To avoid user confusion, the system does not notify the user again of the permissions granted to the application, and applications that are included in the core operating system or bundled by an OEM do not request permissions from the user. 为避免用户混淆,系统不会再次将授予该应用程序的权限通知用户,并且包含在核心操作系统中或由OEM捆绑的应用程序不会向用户请求权限。 Permissions are removed if an application is uninstalled, so a subsequent re-installation will again result in display of permissions. 如果卸载了应用程序,则权限将被删除,因此随后的重新安装将再次显示权限。

In the event that an application attempts to use a protected feature which has not been declared in the application's manifest, the permission failure will typically result in a security exception being thrown back to the application. 如果应用程序尝试使用未在应用程序清单中声明的​​受保护功能,则权限失败通常会导致将安全异常抛出给应用程序。 Protected API permission checks are enforced at the lowest possible level to prevent circumvention. 受保护的API权限检查将在最低级别执行,以防止被规避。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 解析Android Manifest File以使用python查找uses-permission标记 - Parsing Android Manifest File to look for the uses-permission tag using python 找不到清单文件中的使用权限 - Can't find uses-permission into manifest file Android 23不生成用户权限元素的清单文件 - Android 23 Not Generating Manifest file for uses-permission elements 错误:(15)标签 <uses-permission> 属性名称包含无效字符&#39;&#39;.Android清单 - Error:(15) Tag <uses-permission> attribute name has invalid character ' '.Android Manifest 在manifest.xml文件中使用权限与android权限的权限 - uses-permission vs permission for android permissions in the manifest.xml file <uses-permission> 与 <permission> 在Android 6.0中的Manifest.xml - <uses-permission> vs <permission> in Android 6.0 Manifest.xml 如何修复Android Manifest文件中的错误“Unsupported type&#39;use-permission&#39;” - How to fix the error “Unsupported type 'uses-permission'” in the Android Manifest file Android Studio 忽略清单使用权限条目 - Android Studio ignoring Manifest uses-permission entries 导出APK时为什么从清单中删除了使用权限? - Why is uses-permission removed from manifest when exporting APK? 该 <uses-permission> 元素必须是直接的孩子 <manifest> 根元素 - The <uses-permission> element must be a direct child of the <manifest> root element
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM