刚刚看到一个老问题没有答案。虽然你可能已经得到了答案,但我还是会回答。它可能会帮助其他人。 :)
还有很多权限的保护级别设置为“18”,还有一些权限设置为“50”。
以下代码取自 Android Source 中的 PermissionInfo.java:
/**
* Additional flag for {@link #protectionLevel}, corresponding
* to the <code>system</code> value of
* {@link android.R.attr#protectionLevel}.
*/
public static final int PROTECTION_FLAG_SYSTEM = 0x10;
/**
* Additional flag for {@link #protectionLevel}, corresponding
* to the <code>development</code> value of
* {@link android.R.attr#protectionLevel}.
*/
public static final int PROTECTION_FLAG_DEVELOPMENT = 0x20;
因此,如果有签名/系统权限,级别将为 18(0x10 | 0x2)。如果该权限用于特殊开发工具,则为50(0x10 | 0x20 | 0x2)。
我找不到任何有关这些值代表什么的文档。有人知道吗?
As I 在现有问题中回答 https://stackoverflow.com/a/14887969/1365960,您可以在中查看保护级别以及这些权限的说明frameworks/base/core/res/AndroidManifest.xml
and frameworks/base/data/etc/platform.xml
。我在这里贴出一些供大家参考。
<!-- Configure an application for debugging. -->
<permission android:name="android.permission.SET_DEBUG_APP"
android:permissionGroup="android.permission-group.DEVELOPMENT_TOOLS"
android:protectionLevel="signature|system|development"
android:label="@string/permlab_setDebugApp"
android:description="@string/permdesc_setDebugApp" />
<!-- @hide Package verifier needs to have this permission before the PackageManager will
trust it to verify packages.
-->
<permission android:name="android.permission.PACKAGE_VERIFICATION_AGENT"
android:label="@string/permlab_packageVerificationAgent"
android:description="@string/permdesc_packageVerificationAgent"
android:protectionLevel="signature|system" />
如果有一个@hide
如果您在该 xml 块上添加注释,则无法从文档中找到有关此权限的任何资源。