RikkaApps / Shizuku

Using system APIs directly with adb/root privileges from normal apps through a Java process started with app_process.
Apache License 2.0
10.73k stars 627 forks source link

Permission related NoSuchMethodError on Android 14 QPR2 B1 #373

Closed KieronQuinn closed 11 months ago

KieronQuinn commented 11 months ago

Please report bugs of Shizuku itself.

Requirements:

Reports not meet the requirements will be immediately closed.

Information:

Logs:

11-15 22:19:21.719 20664 20697 E AndroidRuntime: java.lang.NoSuchMethodError: No interface method grantRuntimePermission(Ljava/lang/String;Ljava/lang/String;I)V in class Landroid/permission/IPermissionManager; or its super classes (declaration of 'android.permission.IPermissionManager' appears in /system/framework/framework.jar!classes3.dex)
11-15 22:19:21.719 20664 20697 E AndroidRuntime:        at rikka.shizuku.l70.b(SourceFile:18)
11-15 22:19:21.719 20664 20697 E AndroidRuntime:        at rikka.shizuku.server.ShizukuService.j(SourceFile:127)
11-15 22:19:21.719 20664 20697 E AndroidRuntime:        at rikka.shizuku.qt$a.onTransact(SourceFile:6)
11-15 22:19:21.719 20664 20697 E AndroidRuntime:        at rikka.shizuku.server.c.onTransact(SourceFile:64)
11-15 22:19:21.719 20664 20697 E AndroidRuntime:        at rikka.shizuku.server.ShizukuService.onTransact(SourceFile:26)
11-15 22:19:21.719 20664 20697 E AndroidRuntime:        at android.os.Binder.execTransactInternal(Binder.java:1357)
11-15 22:19:21.719 20664 20697 E AndroidRuntime:        at android.os.Binder.execTransact(Binder.java:1301)
11-15 22:25:23.479 28364 28383 E AndroidRuntime: java.lang.NoSuchMethodError: No interface method revokeRuntimePermission(Ljava/lang/String;Ljava/lang/String;I)V in class Landroid/permission/IPermissionManager; or its super classes (declaration of 'android.permission.IPermissionManager' appears in /system/framework/framework.jar!classes3.dex)
11-15 22:25:23.479 28364 28383 E AndroidRuntime:        at rikka.shizuku.l70.c(SourceFile:23)
11-15 22:25:23.479 28364 28383 E AndroidRuntime:        at rikka.shizuku.server.ShizukuService.j(SourceFile:131)
11-15 22:25:23.479 28364 28383 E AndroidRuntime:        at rikka.shizuku.qt$a.onTransact(SourceFile:6)
11-15 22:25:23.479 28364 28383 E AndroidRuntime:        at rikka.shizuku.server.c.onTransact(SourceFile:64)
11-15 22:25:23.479 28364 28383 E AndroidRuntime:        at rikka.shizuku.server.ShizukuService.onTransact(SourceFile:26)
11-15 22:25:23.479 28364 28383 E AndroidRuntime:        at android.os.Binder.execTransactInternal(Binder.java:1357)
11-15 22:25:23.479 28364 28383 E AndroidRuntime:        at android.os.Binder.execTransact(Binder.java:1301)

Describe the bug:

There's been changes to the grant & revoke method signatures in IPermissionManager, they're now:

void grantRuntimePermission(String packageName, String permissionName, int deviceId, int userId)

and

void revokeRuntimePermission(String packageName, String permissionName, int deviceId, int userId, String reason)

deviceId is meant to be [Context.getDeviceId](https://developer.android.com/reference/android/content/Context#getDeviceId()), but I think it should be fine to send 0 for the time being as the device ID will always be 0 due to not running on virtual devices.

Additional context:

I did try to get a build running locally to fix this in a PR, but the Refine plugin is refusing to compile for me, throwing an exception due to not liking the hidden classes: Use deprecated refine class android.app.ActivityManagerHidden$5721935. Should be a relatively easy fix however.

KieronQuinn commented 11 months ago

Oops, mentioning this issue in the PR automatically closed it when merged.

Unfortunately it looks like the build of Hidden APIs isn't working due to a GPG issue in the action, which I don't have access to to resolve. @RikkaW would you be able to look at this at some point?

In the meantime I've built a custom version of Shizuku with the fix included it's linked at https://github.com/KieronQuinn/Smartspacer/issues/52