想要授予 android.permission.CHANGE_CONFIGURATION 给我的 apk 文件。
我使用的adb命令:
pm grant com.maxmpz.equalizer android.permission.DUMP
但是总是显示这个错误:
PS C:\Users\Marhaba\Desktop\Desktop\platform-tools_r30.0.5-windows\platform-tools> ./adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
PS C:\Users\Marhaba\Desktop\Desktop\platform-tools_r30.0.5-windows\platform-tools>
PS C:\Users\Marhaba\Desktop\Desktop\platform-tools_r30.0.5-windows\platform-tools> ./adb devices
List of devices attached
69WSMZFEF6WG4DYT device
PS C:\Users\Marhaba\Desktop\Desktop\platform-tools_r30.0.5-windows\platform-tools> ./adb shell pm grant com.maxmpz.equalizer android.permission.DUMP
Security exception: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
at android.app.ContextImpl.enforce(ContextImpl.java:1955)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1983)
at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:2235)
at com.android.server.pm.permission.PermissionManagerService.access$900(PermissionManagerService.java:133)
at com.android.server.pm.permission.PermissionManagerService$PermissionManagerServiceInternalImpl.grantRuntimePermission(PermissionManagerService.java:3332)
at com.android.server.pm.PackageManagerService.grantRuntimePermission(PackageManagerService.java:6671)
at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2030)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:238)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:24187)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:5400)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4819)
at com.android.server.pm.OppoPackageManagerService.onTransact(OppoPackageManagerService.java:83)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
PS C:\Users\Marhaba\Desktop\Desktop\platform-tools_r30.0.5-windows\platform-tools> ./adb shell pm grant com.maxmpz.equalizer android.permission.DUMP
Security exception: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
java.lang.SecurityException: grantRuntimePermission: Neither user 2000 nor current process has android.permission.GRANT_RUNTIME_PERMISSIONS.
at android.app.ContextImpl.enforce(ContextImpl.java:1955)
at android.app.ContextImpl.enforceCallingOrSelfPermission(ContextImpl.java:1983)
at com.android.server.pm.permission.PermissionManagerService.grantRuntimePermission(PermissionManagerService.java:2235)
at com.android.server.pm.permission.PermissionManagerService.access$900(PermissionManagerService.java:133)
at com.android.server.pm.permission.PermissionManagerService$PermissionManagerServiceInternalImpl.grantRuntimePermission(PermissionManagerService.java:3332)
at com.android.server.pm.PackageManagerService.grantRuntimePermission(PackageManagerService.java:6671)
at com.android.server.pm.PackageManagerShellCommand.runGrantRevokePermission(PackageManagerShellCommand.java:2030)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:238)
at android.os.ShellCommand.exec(ShellCommand.java:104)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:24187)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:5400)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4819)
at com.android.server.pm.OppoPackageManagerService.onTransact(OppoPackageManagerService.java:83)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)
PS C:\Users\Marhaba\Desktop\Desktop\platform-tools_r30.0.5-windows\platform-tools> ok
android.permission.DUMP 只能授予系统应用程序(不适用于第三方应用程序):https://developer.android.com/reference/android/Manifest.permission#DUMP
下午授予 com.maxmpz.equalizer android.permission.DUMP
https://developer.android.com/reference/android/Manifest.permission#DUMP
下午授予 com.maxmpz.equalizer android.permission.DUMP