谷歌网站开发语言上海工商注册网官网

张小明 2026/1/6 17:01:11
谷歌网站开发语言,上海工商注册网官网,网页编辑格式,企业网站都没的百度快照咋办背景#xff1a; 经常我们在做framework开发时候#xff0c;看到某些权限时候会有对权限定义进行深入查看#xff0c;例如上一篇文章#xff1a; 聊一聊豆包AI手机助手高度敏感权限CAPTURE_SECURE_VIDEO_OUTPUT 中就有看到关键字保护级别#xff1a;android:protectionLe…背景经常我们在做framework开发时候看到某些权限时候会有对权限定义进行深入查看例如上一篇文章聊一聊豆包AI手机助手高度敏感权限CAPTURE_SECURE_VIDEO_OUTPUT中就有看到关键字保护级别android:protectionLevel“signature|role”。也有其他权限看到是android:protectionLevel“normal”看到这里就有vip学员朋友提出针对这个xml保护级别protectionLevel到底代表什么意思除了常见的signature这个级别属于我们常见知道的的外又还有哪些protectionLevel呢这个问题确实是个好问题要解答这个问题就需要深入看一下这块的源码分析下面马哥带大家来一起解答。源码剖析protectionLevel对应的xml部分先看看权限及保护级别的定义frameworks/base/core/res/AndroidManifest.xml!-- SystemApi TestApi hide Allows an application to change to remove/kill tasks --permissionandroid:nameandroid.permission.REMOVE_TASKSandroid:protectionLevelsignature|recents|role/!-- deprecated Use MANAGE_ACTIVITY_TASKS instead. SystemApi TestApi hide Allows an application to create/manage/remove stacks --permissionandroid:nameandroid.permission.MANAGE_ACTIVITY_STACKSandroid:protectionLevelsignature/一般这里里面的关键signaturerecentsrole一般都是有在对应attrs.xml中有定义是不可以随意对写一个字符signaturexxxrole1xxx的这样写的不对会直接报错。那么是在哪里进行定义的呢这里可以如果大家不知道具体在哪个attrs的xml文件定义可以通过grep来查找定位在frameworks/base/core/res/res/values目录进行查找关键字“protectionLevel”。testtest:~/disk_2T/aosp16/frameworks/base/core/res/res/values$grepprotectionLevel./ -rn ./public-final.xml:37:publictypeattrnameprotectionLevelid0x01010009/./attrs_manifest.xml:183: permanent protectionLevel. If you are creating a custom permissioninan ./attrs_manifest.xml:184: application, you can define a protectionLevel attribute with one of the ./attrs_manifest.xml:185: values listed below. If no protectionLevel is definedfora custom ./attrs_manifest.xml:194:attrnameprotectionLevel./attrs_manifest.xml:2438:attrnameprotectionLevel/可以看到这里查找到了原来是在attrs_manifest.xml中进行的定义。这里看看对应的xml定义部分frameworks/base/core/res/res/values/attrs_manifest.xml!-- Characterizes the potential risk implied in a permission and indicates the procedure the system should follow when determining whether to grant the permission to an application requesting it. {link android.Manifest.permission Standard permissions} have a predefined and permanent protectionLevel. If you are creating a custom permission in an application, you can define a protectionLevel attribute with one of the values listed below. If no protectionLevel is defined for a custom permission, the system assigns the default (normal). pEach protection level consists of a base permission type and zero or more flags. Use the following functions to extract those. pre int basePermissionType permissionInfo.getProtection(); int permissionFlags permissionInfo.getProtectionFlags(); /pre --attrnameprotectionLevel!-- strongBase permission type/strong: a lower-risk permission that gives an application access to isolated application-level features, with minimal risk to other applications, the system, or the user. The system automatically grants this type of permission to a requesting application at installation, without asking for the users explicit approval (though the user always has the option to review these permissions before installing). --flagnamenormalvalue0/!-- strongBase permission type/strong: a higher-risk permission that would give a requesting application access to private user data or control over the device that can negatively impact the user. Because this type of permission introduces potential risk, the system may not automatically grant it to the requesting application. For example, any dangerous permissions requested by an application may be displayed to the user and require confirmation before proceeding, or some other approach may be taken to avoid the user automatically allowing the use of such facilities. --flagnamedangerousvalue1/!-- strongBase permission type/strong: a permission that the system is to grant only if the requesting application is signed with the same certificate as the application that declared the permission. If the certificates match, the system automatically grants the permission without notifying the user or asking for the users explicit approval. --flagnamesignaturevalue2/!-- Old synonym for signature|privileged. Deprecated in API level 23. Base permission type: a permission that the system is to grant only to packages in the Android system image emor/em that are signed with the same certificates. Please avoid using this option, as the signature protection level should be sufficient for most needs and works regardless of exactly where applications are installed. This permission is used for certain special situations where multiple vendors have applications built in to a system image which need to share specific features explicitly because they are being built together. --flagnamesignatureOrSystemvalue3/!-- strongBase permission type/strong: a permission that is managed internally by the system and only granted according to the protection flags. --flagnameinternalvalue4/!-- Additional flag from base permission type: this permission can also be granted to any applications installed as privileged apps on the system image. Please avoid using this option, as the signature protection level should be sufficient for most needs and works regardless of exactly where applications are installed. This permission flag is used for certain special situations where multiple vendors have applications built in to a system image which need to share specific features explicitly because they are being built together. --flagnameprivilegedvalue0x10/!-- Old synonym for privileged. Deprecated in API level 23. --flagnamesystemvalue0x10/!-- Additional flag from base permission type: this permission can also (optionally) be granted to development applications. Although undocumented, the permission state used to be shared by all users (including future users), but it is managed per-user since API level 31. --flagnamedevelopmentvalue0x20/!-- Additional flag from base permission type: this permission is closely associated with an app op for controlling access. --flagnameappopvalue0x40/!-- Additional flag from base permission type: this permission can be automatically granted to apps that target API levels below {link android.os.Build.VERSION_CODES#M} (before runtime permissions were introduced). --flagnamepre23value0x80/!-- Additional flag from base permission type: this permission can be automatically granted to system apps that install packages. --flagnameinstallervalue0x100/!-- Additional flag from base permission type: this permission can be automatically granted to system apps that verify packages. --flagnameverifiervalue0x200/!-- Additional flag from base permission type: this permission can be automatically granted any application pre-installed on the system image (not just privileged apps). --flagnamepreinstalledvalue0x400/!-- Additional flag from base permission type: this permission can be automatically granted to the setup wizard app --flagnamesetupvalue0x800/!-- Additional flag from base permission type: this permission can be granted to instant apps --flagnameinstantvalue0x1000/!-- Additional flag from base permission type: this permission can only be granted to apps that target runtime permissions ({link android.os.Build.VERSION_CODES#M} and above) --flagnameruntimevalue0x2000/!-- Additional flag from base permission type: this permission can be granted only if its protection level is signature, the requesting app resides on the OEM partition, and the OEM has allowlisted the app to receive this permission by the OEM. --flagnameoemvalue0x4000/!-- Additional flag from base permission type: this permission can be granted to privileged apps in vendor partition. --flagnamevendorPrivilegedvalue0x8000/!-- Additional flag from base permission type: this permission can be automatically granted to the system default text classifier --flagnametextClassifiervalue0x10000/!-- Additional flag from base permission type: this permission automatically granted to device configurator --flagnameconfiguratorvalue0x80000/!-- Additional flag from base permission type: this permission designates the app that will approve the sharing of incident reports. --flagnameincidentReportApprovervalue0x100000/!-- Additional flag from base permission type: this permission can be automatically granted to the system app predictor --flagnameappPredictorvalue0x200000/!-- Additional flag from base permission type: this permission can also be granted if the requesting application is included in the mainline module}. --flagnamemodulevalue0x400000/!-- Additional flag from base permission type: this permission can be automatically granted to the system companion device manager service --flagnamecompanionvalue0x800000/!-- Additional flag from base permission type: this permission will be granted to the retail demo app, as defined by the OEM. This flag has been replaced by the retail demo role and is a no-op since Android V. --flagnameretailDemovalue0x1000000/!-- Additional flag from base permission type: this permission will be granted to the recents app. --flagnamerecentsvalue0x2000000/!-- Additional flag from base permission type: this permission is managed by role. --flagnamerolevalue0x4000000/!-- Additional flag from base permission type: this permission can also be granted if the requesting application is signed by, or has in its signing lineage, any of the certificate digests declared in {link android.R.attr#knownCerts}. --flagnameknownSignervalue0x8000000//attr上面xml其实也自带了相关的注释非常详细大概意思就是protectionLevel中在xml中的只可以是上面这些每个保护字符都是有自己的含义具体含义可以看注释哈这些字符都会变成一个个的int类型的数字。比如name“signature”这种最后就被转换成数字2。flagnamesignaturevalue2/那么数字2又被谁使用呢这里注释中可以看看出来是PermissionInfo的getProtectionFlags方法/** * Return the additional flags in {link #protectionLevel}. */ProtectionFlagspublicintgetProtectionFlags(){returnprotectionLevel~PROTECTION_MASK_BASE;}protectionLevel代码部分frameworks/base/core/java/android/content/pm/PermissionInfo.java代表权限保护级别的变量/** * The level of access this permission is protecting, as per * {link android.R.attr#protectionLevel}. Consists of * a base permission type and zero or more flags. Use the following functions * to extract them. * * pre * int basePermissionType permissionInfo.getProtection(); * int permissionFlags permissionInfo.getProtectionFlags(); * /pre * * p/pBase permission types are {link #PROTECTION_NORMAL}, * {link #PROTECTION_DANGEROUS}, {link #PROTECTION_SIGNATURE}, {link #PROTECTION_INTERNAL} * and the deprecated {link #PROTECTION_SIGNATURE_OR_SYSTEM}. * Flags are listed under {link android.R.attr#protectionLevel}. * * deprecated Use #getProtection() and #getProtectionFlags() instead. */DeprecatedpublicintprotectionLevel;一般这个变量值有以下这些/** * Information you can retrieve about a particular security permission * known to the system. This corresponds to information collected from the * AndroidManifest.xmls lt;permissiongt; tags. */publicclassPermissionInfoextendsPackageItemInfoimplementsParcelable{/** * A normal application value for {link #protectionLevel}, corresponding * to the codenormal/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_NORMAL0;/** * Dangerous value for {link #protectionLevel}, corresponding * to the codedangerous/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_DANGEROUS1;/** * System-level value for {link #protectionLevel}, corresponding * to the codesignature/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_SIGNATURE2;/** * deprecated Use {link #PROTECTION_SIGNATURE}|{link #PROTECTION_FLAG_PRIVILEGED} * instead. */DeprecatedpublicstaticfinalintPROTECTION_SIGNATURE_OR_SYSTEM3;/** * System-level value for {link #protectionLevel}, corresponding * to the codeinternal/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_INTERNAL4;/** hide */IntDef(flagfalse,prefix{PROTECTION_},value{PROTECTION_NORMAL,PROTECTION_DANGEROUS,PROTECTION_SIGNATURE,PROTECTION_SIGNATURE_OR_SYSTEM,PROTECTION_INTERNAL,})Retention(RetentionPolicy.SOURCE)publicinterfaceProtection{}/** * Additional flag for {link #protectionLevel}, corresponding * to the codeprivileged/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_PRIVILEGED0x10;/** * deprecated Old name for {link #PROTECTION_FLAG_PRIVILEGED}, which * is now very confusing because it only applies to privileged apps, not all * apps on the system image. */DeprecatedpublicstaticfinalintPROTECTION_FLAG_SYSTEM0x10;/** * Additional flag for {link #protectionLevel}, corresponding * to the codedevelopment/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_DEVELOPMENT0x20;/** * Additional flag for {link #protectionLevel}, corresponding * to the codeappop/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_APPOP0x40;/** * Additional flag for {link #protectionLevel}, corresponding * to the codepre23/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_PRE230x80;/** * Additional flag for {link #protectionLevel}, corresponding * to the codeinstaller/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_INSTALLER0x100;/** * Additional flag for {link #protectionLevel}, corresponding * to the codeverifier/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_VERIFIER0x200;/** * Additional flag for {link #protectionLevel}, corresponding * to the codepreinstalled/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_PREINSTALLED0x400;/** * Additional flag for {link #protectionLevel}, corresponding * to the codesetup/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_SETUP0x800;/** * Additional flag for {link #protectionLevel}, corresponding * to the codeinstant/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_INSTANT0x1000;/** * Additional flag for {link #protectionLevel}, corresponding * to the coderuntime/code value of * {link android.R.attr#protectionLevel}. */publicstaticfinalintPROTECTION_FLAG_RUNTIME_ONLY0x2000;/** * Additional flag for {link #protectionLevel}, corresponding * to the codeoem/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_OEM0x4000;/** * Additional flag for {${link #protectionLevel}, corresponding * to the codevendorPrivileged/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_VENDOR_PRIVILEGED0x8000;/** * Additional flag for {link #protectionLevel}, corresponding * to the codetext_classifier/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER0x10000;/** * Additional flag for {${link #protectionLevel}, corresponding * to the codewellbeing/code value of * {link android.R.attr#protectionLevel}. * * deprecated this protectionLevel is obsolete. Permissions previously granted through this * protectionLevel have been migrated to use coderole/code instead * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_WELLBEING0x20000;/** * Additional flag for {link #protectionLevel}, corresponding to the * {code documenter} value of {link android.R.attr#protectionLevel}. * * deprecated this protectionLevel is obsolete. Permissions previously granted * through this protectionLevel have been migrated to use coderole/code instead * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_DOCUMENTER0x40000;/** * Additional flag for {link #protectionLevel}, corresponding to the * {code configurator} value of {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_CONFIGURATOR0x80000;/** * Additional flag for {${link #protectionLevel}, corresponding * to the codeincident_report_approver/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_INCIDENT_REPORT_APPROVER0x100000;/** * Additional flag for {link #protectionLevel}, corresponding * to the codeapp_predictor/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_APP_PREDICTOR0x200000;/** * Additional flag for {link #protectionLevel}, corresponding * to the codemodule/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_MODULE0x400000;/** * Additional flag for {link #protectionLevel}, corresponding * to the codecompanion/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_COMPANION0x800000;/** * Additional flag for {link #protectionLevel}, corresponding * to the coderetailDemo/code value of * {link android.R.attr#protectionLevel}. * * deprecated This flag has been replaced by the * {link android.R.string#config_defaultRetailDemo retail demo role} and is a * no-op since {link Build.VERSION_CODES#VANILLA_ICE_CREAM}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_RETAIL_DEMO0x1000000;/** * Additional flag for {link #protectionLevel}, corresponding * to the coderecents/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_RECENTS0x2000000;/** * Additional flag for {link #protectionLevel}, corresponding to the coderole/code value of * {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_ROLE0x4000000;/** * Additional flag for {link #protectionLevel}, correspoinding to the {code knownSigner} value * of {link android.R.attr#protectionLevel}. * * hide */SystemApipublicstaticfinalintPROTECTION_FLAG_KNOWN_SIGNER0x8000000;/** hide */IntDef(flagtrue,prefix{PROTECTION_FLAG_},value{PROTECTION_FLAG_PRIVILEGED,PROTECTION_FLAG_SYSTEM,PROTECTION_FLAG_DEVELOPMENT,PROTECTION_FLAG_APPOP,PROTECTION_FLAG_PRE23,PROTECTION_FLAG_INSTALLER,PROTECTION_FLAG_VERIFIER,PROTECTION_FLAG_PREINSTALLED,PROTECTION_FLAG_SETUP,PROTECTION_FLAG_INSTANT,PROTECTION_FLAG_RUNTIME_ONLY,PROTECTION_FLAG_OEM,PROTECTION_FLAG_VENDOR_PRIVILEGED,PROTECTION_FLAG_SYSTEM_TEXT_CLASSIFIER,PROTECTION_FLAG_CONFIGURATOR,PROTECTION_FLAG_INCIDENT_REPORT_APPROVER,PROTECTION_FLAG_APP_PREDICTOR,PROTECTION_FLAG_COMPANION,PROTECTION_FLAG_RETAIL_DEMO,PROTECTION_FLAG_RECENTS,PROTECTION_FLAG_ROLE,PROTECTION_FLAG_KNOWN_SIGNER,PROTECTION_FLAG_MODULE,})xml中值如何转换成java的protectionLevel变量这块可以看一下如下代码到此就把学员关于权限的protectionLevel保护级别部分进行了全面的剖析。原文参考https://mp.weixin.qq.com/s/3GNkarfoiab7akLtdtZanA
版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!

遵义建站贵阳专业网站建设

前言 基于Java的大学校园水电管理系统通过信息化手段提高了水电管理的效率和准确性,优化了资源配置,提升了服务质量。未来,可以进一步完善系统的功能,如增加智能预警功能、优化用户界面等,以更好地满足用户需求。同时&…

张小明 2026/1/5 7:27:10 网站建设

17我们一起做网站辽宁省城乡建设网站

最近,科技圈的焦点无疑集中在了豆包 AI 手机身上。在遭遇腾讯系(微信)的“技术限制”后,阿里系 App 也被曝出采取了类似的禁止或限制登录措施。两大中国互联网的“超级生态”,在面对一个初生的 AI 硬件载体时&#xff…

张小明 2026/1/4 11:29:50 网站建设

网站域名更换相应内容微信的微网站

为什么传统爬虫会错过80%的相关内容?当你在研究物价水平变化对房租价格的影响时,传统关键词爬虫可能只能找到包含"物价变化"和"房租"的页面,却完全遗漏了讨论"消费价格指数变动"、"租赁市场"、"…

张小明 2026/1/4 14:52:11 网站建设

网站建设实习生怎么样利用建站系统wordpress建设网站

QQScreenShot终极指南:免费强大的电脑截图工具完整使用教程 【免费下载链接】QQScreenShot 电脑QQ截图工具提取版,支持文字提取、图片识别、截长图、qq录屏。默认截图文件名为ScreenShot日期 项目地址: https://gitcode.com/gh_mirrors/qq/QQScreenShot QQSc…

张小明 2026/1/6 5:13:23 网站建设

地方门户网站系统建设方案邯郸市教育公共服务平台

特征工程调优实战指南:从参数配置到业务价值 【免费下载链接】featuretools An open source python library for automated feature engineering 项目地址: https://gitcode.com/gh_mirrors/fe/featuretools 你是否曾在自动化特征工程中遇到这样的困扰&#…

张小明 2026/1/5 14:18:58 网站建设