LADB icon indicating copy to clipboard operation
LADB copied to clipboard

Can't executing grant permission command

Open gplcn opened this issue 2 years ago • 12 comments

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)

gplcn avatar Apr 02 '22 08:04 gplcn

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)

Rozia13 avatar Apr 10 '22 16:04 Rozia13

Same. Have you got the solution?

Kashifrazabb avatar Apr 12 '22 20:04 Kashifrazabb

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

N-X-T avatar Apr 14 '22 11:04 N-X-T

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: @.***>

gplcn avatar Apr 14 '22 11:04 gplcn

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: @.***>

gplcn avatar Apr 14 '22 11:04 gplcn

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

mirh avatar Jun 10 '22 17:06 mirh

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.

teou1 avatar Oct 14 '22 11:10 teou1

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

mirh avatar Oct 15 '22 02:10 mirh

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.

teou1 avatar Oct 15 '22 07:10 teou1

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.

mirh avatar Oct 15 '22 11:10 mirh

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.

tytydraco avatar Oct 15 '22 20:10 tytydraco

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?

Luisdeugarza avatar Jun 21 '24 07:06 Luisdeugarza