为何adb shell pm list permissions -g比adb shell pm list permissions列出更多权限?
adb shell pm list permissions -g Shows More Permissions Than the Plain Command Great question! Let me break down exactly why you're seeing a larger set of permissions when adding the -g flag:
Default behavior without
-g:
When you runadb shell pm list permissionswithout any flags, the command only outputs dangerous permissions. These are the permissions that require explicit user approval (like accessing the camera, location, or external storage) because they involve sensitive user data or device capabilities. The system filters out all other permission types by default to focus on the ones users and developers care about most for runtime authorization.What the
-gflag does:
The-gis shorthand for--group, and it changes the command's output to include all permission groups and every permission within each group. This means you'll see:- Normal permissions: These are automatically granted by the system without user input (e.g.,
android.permission.INTERNET,android.permission.VIBRATE) - Signature permissions: Permissions that only apps signed with the same certificate as the issuing app (often the system) can obtain
- Dangerous permissions (the ones shown by default)
- Special system-level permissions that don't fit into standard user-facing categories
- Normal permissions: These are automatically granted by the system without user input (e.g.,
Quick example:
If you run the plain command, you won't seeandroid.permission.INTERNET(since it's a normal permission). But add-g, and you'll find it listed under theandroid.permission-group.NETWORKgroup, along with other network-related permissions.
In short: The default command filters to show only high-stakes, user-authorizable permissions, while -g lifts that filter to display every permission available on the device, organized by their logical groups.
内容的提问来源于stack exchange,提问作者user9529969

