diff --git a/profiler/build.gradle.kts b/profiler/build.gradle.kts index bb061392d0..d0eab70288 100644 --- a/profiler/build.gradle.kts +++ b/profiler/build.gradle.kts @@ -50,7 +50,9 @@ dependencies { implementation(libs.google.protobuf.java) implementation(libs.rikka.hidden.compat) - implementation(libs.rikka.hidden.stub) + // compileOnly: packaged stubs make R8 treat framework interfaces as unimplemented app classes + // and rewrite calls through them to throws. + compileOnly(libs.rikka.hidden.stub) implementation(platform(libs.compose.bom)) implementation(libs.compose.runtime) diff --git a/subprojects/privileged-services/build.gradle.kts b/subprojects/privileged-services/build.gradle.kts index 2d1317759c..12e120e02e 100644 --- a/subprojects/privileged-services/build.gradle.kts +++ b/subprojects/privileged-services/build.gradle.kts @@ -22,6 +22,8 @@ dependencies { api(libs.androidx.annotation) implementation(libs.rikka.hidden.compat) - implementation(libs.rikka.hidden.stub) + // compileOnly: packaged stubs make R8 treat framework interfaces as unimplemented app classes + // and rewrite calls through them to throws. + compileOnly(libs.rikka.hidden.stub) implementation(libs.rikka.refine.runtime) } diff --git a/subprojects/privileged-services/consumer-rules.pro b/subprojects/privileged-services/consumer-rules.pro index e69de29bb2..7bc4af4a99 100644 --- a/subprojects/privileged-services/consumer-rules.pro +++ b/subprojects/privileged-services/consumer-rules.pro @@ -0,0 +1,9 @@ +# Shizuku instantiates user services reflectively from the ComponentName class name +# (UserService.create), so R8 sees no constructor call and empties the class. +-keep class org.appdevforall.cotg.profiler.ProfilerUserService { public (...); } + +# The framework calls these observer callbacks over binder, so R8 sees no caller and drops +# them. The rules target the adapters because their hidden-API superclasses are compile-only +# and invisible to R8. +-keep class rikka.hidden.compat.adapter.** { public *; } +-keep class * extends rikka.hidden.compat.adapter.ProcessObserverAdapter { public *; } diff --git a/subprojects/shizuku-server/consumer-rules.pro b/subprojects/shizuku-server/consumer-rules.pro new file mode 100644 index 0000000000..92cbd2f70f --- /dev/null +++ b/subprojects/shizuku-server/consumer-rules.pro @@ -0,0 +1,11 @@ +# The starter launches the server by class name through app_process (starter.cpp), so R8 +# sees no caller and strips it; pairing then succeeds but the server dies with +# ClassNotFoundException. +-keep class rikka.shizuku.server.ShizukuService { public static void main(java.lang.String[]); } + +# The framework calls these observer callbacks over binder, so R8 sees no caller and drops +# them; the server then dies with AbstractMethodError on the first callback. The rules target +# the adapters because their hidden-API superclasses are compile-only and invisible to R8. +-keep class rikka.hidden.compat.adapter.** { public *; } +-keep class * extends rikka.hidden.compat.adapter.ProcessObserverAdapter { public *; } +-keep class * extends rikka.hidden.compat.adapter.UidObserverAdapter { public *; } diff --git a/subprojects/shizuku-starter/consumer-rules.pro b/subprojects/shizuku-starter/consumer-rules.pro new file mode 100644 index 0000000000..0eae73459c --- /dev/null +++ b/subprojects/shizuku-starter/consumer-rules.pro @@ -0,0 +1,3 @@ +# User-service processes are started by class name through app_process +# (ServiceStarter.commandForUserService), so R8 sees no caller of main. +-keep class moe.shizuku.starter.ServiceStarter { public static void main(java.lang.String[]); }