[GH-ISSUE #66] Can't executing grant permission command #51

Open
opened 2026-03-04 02:11:09 +03:00 by kerem · 13 comments
Owner

Originally created by @gplcn on GitHub (Apr 2, 2022).
Original GitHub issue: https://github.com/tytydraco/LADB/issues/66

When i submit command adb shell pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS,the result is :

Exception occurred while executing 'grant':
java.lang.IllegalArgumentException: Unknown permission: android.permission.PACKAGE_USAGE_STATS
	at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermissionInternal(PermissionManagerService.java:1467)
	at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1426)
	at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2300)
	at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:251)
	at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
	at android.os.ShellCommand.exec(ShellCommand.java:44)
	at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22179)
	at android.os.Binder.shellCommand(Binder.java:929)
	at android.os.Binder.onTransact(Binder.java:813)
	at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4687)
	at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4405)
	at android.os.Binder.execTransactInternal(Binder.java:1159)
	at android.os.Binder.execTransact(Binder.java:1123)
Originally created by @gplcn on GitHub (Apr 2, 2022). Original GitHub issue: https://github.com/tytydraco/LADB/issues/66 When i submit command `adb shell pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS`,the result is : ``` Exception occurred while executing 'grant': java.lang.IllegalArgumentException: Unknown permission: android.permission.PACKAGE_USAGE_STATS at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermissionInternal(PermissionManagerService.java:1467) at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1426) at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2300) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:251) at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98) at android.os.ShellCommand.exec(ShellCommand.java:44) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22179) at android.os.Binder.shellCommand(Binder.java:929) at android.os.Binder.onTransact(Binder.java:813) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4687) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4405) at android.os.Binder.execTransactInternal(Binder.java:1159) at android.os.Binder.execTransact(Binder.java:1123) ```
Author
Owner

@Rozia13 commented on GitHub (Apr 10, 2022):

When i submit command adb shell pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS,the result is :

Exception occurred while executing 'grant':
java.lang.IllegalArgumentException: Unknown permission: android.permission.PACKAGE_USAGE_STATS
	at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermissionInternal(PermissionManagerService.java:1467)
	at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1426)
	at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2300)
	at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:251)
	at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
	at android.os.ShellCommand.exec(ShellCommand.java:44)
	at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22179)
	at android.os.Binder.shellCommand(Binder.java:929)
	at android.os.Binder.onTransact(Binder.java:813)
	at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4687)
	at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4405)
	at android.os.Binder.execTransactInternal(Binder.java:1159)
	at android.os.Binder.execTransact(Binder.java:1123)
<!-- gh-comment-id:1094307407 --> @Rozia13 commented on GitHub (Apr 10, 2022): > When i submit command `adb shell pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS`,the result is : > ``` > Exception occurred while executing 'grant': > java.lang.IllegalArgumentException: Unknown permission: android.permission.PACKAGE_USAGE_STATS > at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermissionInternal(PermissionManagerService.java:1467) > at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:1426) > at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2300) > at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:251) > at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98) > at android.os.ShellCommand.exec(ShellCommand.java:44) > at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22179) > at android.os.Binder.shellCommand(Binder.java:929) > at android.os.Binder.onTransact(Binder.java:813) > at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4687) > at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4405) > at android.os.Binder.execTransactInternal(Binder.java:1159) > at android.os.Binder.execTransact(Binder.java:1123) > ```
Author
Owner

@Kashifrazabb commented on GitHub (Apr 12, 2022):

Same. Have you got the solution?

<!-- gh-comment-id:1097171667 --> @Kashifrazabb commented on GitHub (Apr 12, 2022): Same. Have you got the solution?
Author
Owner

@N-X-T commented on GitHub (Apr 14, 2022):

LADB auto jump to shell, try sending "pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS"

<!-- gh-comment-id:1099083350 --> @N-X-T commented on GitHub (Apr 14, 2022): LADB auto jump to shell, try sending "pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS"
Author
Owner

@gplcn commented on GitHub (Apr 14, 2022):

No

| |
sdgaopeilei
|
|
@.***
|

---- 回复的原邮件 ----
| 发件人 | @.> |
| 日期 | 2022年04月13日 04:14 |
| 收件人 | @.
> |
| 抄送至 | @.@.> |
| 主题 | Re: [tytydraco/LADB] Can't executing grant permission command (Issue #66) |

Same. Have you got the solution?


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>

<!-- gh-comment-id:1099096442 --> @gplcn commented on GitHub (Apr 14, 2022): No | | sdgaopeilei | | ***@***.*** | ---- 回复的原邮件 ---- | 发件人 | ***@***.***> | | 日期 | 2022年04月13日 04:14 | | 收件人 | ***@***.***> | | 抄送至 | ***@***.******@***.***> | | 主题 | Re: [tytydraco/LADB] Can't executing grant permission command (Issue #66) | Same. Have you got the solution? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***>
Author
Owner

@gplcn commented on GitHub (Apr 14, 2022):

Tried it before, but it didn't work.

| |
sdgaopeilei
|
|
@.***
|

---- 回复的原邮件 ----
| 发件人 | @.> |
| 日期 | 2022年04月14日 19:19 |
| 收件人 | @.
> |
| 抄送至 | @.@.> |
| 主题 | Re: [tytydraco/LADB] Can't executing grant permission command (Issue #66) |

LADB auto jump to shell, try sending "pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS"


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: @.***>

<!-- gh-comment-id:1099098492 --> @gplcn commented on GitHub (Apr 14, 2022): Tried it before, but it didn't work. | | sdgaopeilei | | ***@***.*** | ---- 回复的原邮件 ---- | 发件人 | ***@***.***> | | 日期 | 2022年04月14日 19:19 | | 收件人 | ***@***.***> | | 抄送至 | ***@***.******@***.***> | | 主题 | Re: [tytydraco/LADB] Can't executing grant permission command (Issue #66) | LADB auto jump to shell, try sending "pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS" — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: ***@***.***>
Author
Owner

@mirh commented on GitHub (Jun 10, 2022):

The "adb shell" part is already assumed by LADB.
You have just to enter pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS

<!-- gh-comment-id:1152602564 --> @mirh commented on GitHub (Jun 10, 2022): The "adb shell" part is already assumed by LADB. You have just to enter `pm grant com.arumcomm.crashlogviewer android.permission.PACKAGE_USAGE_STATS`
Author
Owner

@teou1 commented on GitHub (Oct 14, 2022):

And type everything manually, that error indicates wrong permission name, if you are copy pasting it from somewhere you might have caught a space with it.

<!-- gh-comment-id:1278903929 --> @teou1 commented on GitHub (Oct 14, 2022): And type everything manually, that error indicates wrong permission name, if you are copy pasting it from somewhere you might have caught a space with it.
Author
Owner

@mirh commented on GitHub (Oct 15, 2022):

Spaces shouldn't cause any issue in a cli.. and copy pasting is usually more robust to errors.

<!-- gh-comment-id:1279632162 --> @mirh commented on GitHub (Oct 15, 2022): Spaces shouldn't cause any issue in a cli.. and copy pasting is usually _more_ robust to errors.
Author
Owner

@teou1 commented on GitHub (Oct 15, 2022):

In a nomal desktop OS yes, and if someone pastes the wrong type of quote or hyphen or nonenglish encoding the shell says so....but android adb throws weird and not understandable errors like this, so it is worth trying. Just my experience, it happened to me. Maybe i am wrong.

<!-- gh-comment-id:1279680072 --> @teou1 commented on GitHub (Oct 15, 2022): In a nomal desktop OS yes, and if someone pastes the wrong type of quote or hyphen or nonenglish encoding the shell says so....but android adb throws weird and not understandable errors like this, so it is worth trying. Just my experience, it happened to me. Maybe i am wrong.
Author
Owner

@mirh commented on GitHub (Oct 15, 2022):

I reckon unicode handling may be odd yes, especially if you are going from a CP 850 cmd.exe to the native unix shell.
But I don't think I have ever seen anything bad with spaces.

<!-- gh-comment-id:1279721139 --> @mirh commented on GitHub (Oct 15, 2022): I reckon unicode handling may be odd yes, especially if you are going from a CP 850 cmd.exe to the native unix shell. But I don't think I have ever seen anything bad with spaces.
Author
Owner

@tytydraco commented on GitHub (Oct 15, 2022):

I have a feeling that either the permission name you're entering is wrong (android.permission.PACKAGE_USAGE_STATS) or maybe, which OEM do you have? If it's like Xiaomi or something it might be removed in the OS.

<!-- gh-comment-id:1279825157 --> @tytydraco commented on GitHub (Oct 15, 2022): I have a feeling that either the permission name you're entering is wrong (android.permission.PACKAGE_USAGE_STATS) or maybe, which OEM do you have? If it's like Xiaomi or something it might be removed in the OS.
Author
Owner

@Luisdeugarza commented on GitHub (Jun 21, 2024):

I have a feeling that either the permission name you're entering is wrong (android.permission.PACKAGE_USAGE_STATS) or maybe, which OEM do you have? If it's like Xiaomi or something it might be removed in the OS.

I have a Xiaomi and I have this problem, what I can do?

<!-- gh-comment-id:2182193422 --> @Luisdeugarza commented on GitHub (Jun 21, 2024): > I have a feeling that either the permission name you're entering is wrong (android.permission.PACKAGE_USAGE_STATS) or maybe, which OEM do you have? If it's like Xiaomi or something it might be removed in the OS. I have a Xiaomi and I have this problem, what I can do?
Author
Owner

@talhacomak commented on GitHub (Jun 19, 2025):

In some Xiaomi devices, the WRITE_SECURE_SETTINGS not given to the ladb app, so it can not give the WRITE_SECURE_SETTINGS or any secure permissions to any app.
Maybe this information would be added to the README

<!-- gh-comment-id:2988609891 --> @talhacomak commented on GitHub (Jun 19, 2025): In some Xiaomi devices, the WRITE_SECURE_SETTINGS not given to the ladb app, so it can not give the WRITE_SECURE_SETTINGS or any secure permissions to any app. Maybe this information would be added to the README
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LADB#51
No description provided.