9

当我转储 Nexus 7 上所有应用程序的所有权限时,我(如预期)获得保护级别为 0(正常)、1(危险)、2(签名)的权限。没有任何记录低于 3 (SIGNATURE_OR_SYSTEM)*。

但也有很多权限的保护级别设置为“18”,有些权限设置为“50”。

我找不到任何关于这些值代表什么的文档。有人知道吗?

*它没有记录 3 以下的任何内容。

这些是记录的内容:

android.permission.ACCESS_CACHE_FILESYSTEM - 18
android.permission.ACCESS_CHECKIN_PROPERTIES - 18
android.permission.ACCESS_DOWNLOAD_MANAGER - 18
android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED - 18
android.permission.ACCESS_MTP - 18
android.permission.ALLOW_ANY_CODEC_FOR_PLAYBACK - 18
android.permission.BACKUP - 18
android.permission.BIND_APPWIDGET - 18
android.permission.BIND_DIRECTORY_SEARCH - 18
android.permission.BIND_KEYGUARD_APPWIDGET - 18
android.permission.BIND_REMOTEVIEWS - 18
android.permission.BIND_WALLPAPER - 18
android.permission.CALL_PRIVILEGED - 18
android.permission.CHANGE_COMPONENT_ENABLED_STATE - 18
android.permission.CHANGE_CONFIGURATION - 18
android.permission.CONNECTIVITY_INTERNAL - 18
android.permission.CONTROL_LOCATION_UPDATES - 18
android.permission.CRYPT_KEEPER - 18
android.permission.DELETE_CACHE_FILES - 18
android.permission.DELETE_PACKAGES - 18
android.permission.DOWNLOAD_CACHE_NON_PURGEABLE - 18
android.permission.GLOBAL_SEARCH - 18
android.permission.INSTALL_LOCATION_PROVIDER - 18
android.permission.INSTALL_PACKAGES - 18
android.permission.MANAGE_USB - 18
android.permission.MANAGE_USERS - 18
android.permission.MASTER_CLEAR - 18
android.permission.MODIFY_APPWIDGET_BIND_PERMISSIONS - 18
android.permission.MODIFY_NETWORK_ACCOUNTING - 18
android.permission.MODIFY_PHONE_STATE - 18
android.permission.MOUNT_FORMAT_FILESYSTEMS - 18
android.permission.MOUNT_UNMOUNT_FILESYSTEMS - 18
android.permission.MOVE_PACKAGE - 18
android.permission.PACKAGE_USAGE_STATS - 18
android.permission.PACKAGE_VERIFICATION_AGENT - 18
android.permission.PERFORM_CDMA_PROVISIONING - 18
android.permission.READ_FRAME_BUFFER - 18
android.permission.READ_NETWORK_USAGE_HISTORY - 18
android.permission.READ_PRIVILEGED_PHONE_STATE - 18
android.permission.REBOOT - 18
android.permission.RECEIVE_DATA_ACTIVITY_CHANGE - 18
android.permission.RECEIVE_EMERGENCY_BROADCAST - 18
android.permission.RETRIEVE_WINDOW_CONTENT - 18
android.permission.SEND_SMS_NO_CONFIRMATION - 18
android.permission.SERIAL_PORT - 18
android.permission.SET_TIME - 18
android.permission.SET_WALLPAPER_COMPONENT - 18
android.permission.SHUTDOWN - 18
android.permission.STATUS_BAR - 18
android.permission.STOP_APP_SWITCHES - 18
android.permission.UPDATE_DEVICE_STATS - 18
android.permission.UPDATE_LOCK - 18
android.permission.WRITE_APN_SETTINGS - 18
android.permission.WRITE_GSERVICES - 18
android.permission.WRITE_MEDIA_STORAGE - 18
com.android.chrome.TOS_ACKED - 18
com.android.launcher.permission.PRELOAD_WORKSPACE - 18
com.android.vending.TOS_ACKED - 18
com.android.vending.billing.ADD_CREDIT_CARD - 18
com.android.vending.billing.BILLING_ACCOUNT_SERVICE - 18
com.google.android.c2dm.permission.SEND - 18
com.google.android.gallery3d.permission.GALLERY_PROVIDER - 18
com.google.android.gtalkservice.permission.SEND_HEARTBEAT - 18
com.google.android.partnersetup.permission.UPDATE_CLIENT_ID - 18
com.google.android.permission.BROADCAST_DATA_MESSAGE - 18
com.google.android.providers.gsf.permission.WRITE_GSERVICES - 18
com.google.android.xmpp.permission.BROADCAST - 18
com.google.android.xmpp.permission.XMPP_ENDPOINT_BROADCAST - 18

android.permission.CHANGE_CONFIGURATION - 50
android.permission.DUMP - 50
android.permission.INTERACT_ACROSS_USERS - 50
android.permission.READ_LOGS - 50
android.permission.SET_ALWAYS_FINISH - 50
android.permission.SET_ANIMATION_SCALE - 50
android.permission.SET_DEBUG_APP - 50
android.permission.SET_PROCESS_LIMIT - 50
android.permission.SIGNAL_PERSISTENT_PROCESSES - 50
android.permission.WRITE_SECURE_SETTINGS - 50
4

2 回答 2

15

刚刚看到一个古老的未回答的问题。尽管您可能已经得到答案,但无论如何我都会回答。它可能会帮助其他人。:)

还有很多权限的保护级别设置为“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)。

我找不到任何关于这些值代表什么的文档。有人知道吗?

正如我在现有问题中回答的那样frameworks/base/core/res/AndroidManifest.xml,您可以在和中检查保护级别和这些权限的描述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" />

如果该 xml 块上有@hide注释,则您无法从文档中找到有关此权限的任何资源。

于 2013-03-08T08:46:38.637 回答
2

构成您所指的开发权限 0x20 是 Google 引入的一组权限,用于在 Android 开发期间使用,并且它们永远不会被PackageManager自动授予。为了能够使用它们,您必须授予 using adb shell pm grant permission

您可以看到执行此操作的代码以及 Google 在02/21/2012 提交中引入的更改。

于 2015-04-25T02:24:55.593 回答