Root/Shizuku: Fix not being able to bind the service interface after AGP updating AGP 8.0.2->8.1.2 - #705
Merged
Conversation
…AGP updating AGP 8.0.2->8.1.2 Closes #689
Member
Author
|
Before: After the AGP update: The AGP update changed AIDL generation: Index: app-common-io/build/generated/aidl_source_output_dir/debug/out/eu/darken/sdmse/common/root/service/RootServiceConnection.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app-common-io/build/generated/aidl_source_output_dir/debug/out/eu/darken/sdmse/common/root/service/RootServiceConnection.java b/app-common-io/build/generated/aidl_source_output_dir/debug/out/eu/darken/sdmse/common/root/service/RootServiceConnection.java
--- a/app-common-io/build/generated/aidl_source_output_dir/debug/out/eu/darken/sdmse/common/root/service/RootServiceConnection.java
+++ b/app-common-io/build/generated/aidl_source_output_dir/debug/out/eu/darken/sdmse/common/root/service/RootServiceConnection.java (date 1696953379599)
@@ -31,6 +31,7 @@
/** Local-side IPC implementation stub class. */
public static abstract class Stub extends android.os.Binder implements eu.darken.sdmse.common.root.service.RootServiceConnection
{
+ private static final java.lang.String DESCRIPTOR = "eu.darken.sdmse.common.root.service.RootServiceConnection";
/** Construct the stub at attach it to the interface. */
public Stub()
{
@@ -58,9 +59,6 @@
@Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
{
java.lang.String descriptor = DESCRIPTOR;
- if (code >= android.os.IBinder.FIRST_CALL_TRANSACTION && code <= android.os.IBinder.LAST_CALL_TRANSACTION) {
- data.enforceInterface(descriptor);
- }
switch (code)
{
case INTERFACE_TRANSACTION:
@@ -68,43 +66,43 @@
reply.writeString(descriptor);
return true;
}
- }
- switch (code)
- {
case TRANSACTION_checkBase:
{
+ data.enforceInterface(descriptor);
java.lang.String _result = this.checkBase();
reply.writeNoException();
reply.writeString(_result);
- break;
+ return true;
}
case TRANSACTION_getFileOps:
{
+ data.enforceInterface(descriptor);
eu.darken.sdmse.common.files.local.ipc.FileOpsConnection _result = this.getFileOps();
reply.writeNoException();
- reply.writeStrongInterface(_result);
- break;
+ reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
+ return true;
}
case TRANSACTION_getPkgOps:
{
+ data.enforceInterface(descriptor);
eu.darken.sdmse.common.pkgs.pkgops.ipc.PkgOpsConnection _result = this.getPkgOps();
reply.writeNoException();
- reply.writeStrongInterface(_result);
- break;
+ reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
+ return true;
}
case TRANSACTION_getShellOps:
{
+ data.enforceInterface(descriptor);
eu.darken.sdmse.common.shell.ipc.ShellOpsConnection _result = this.getShellOps();
reply.writeNoException();
- reply.writeStrongInterface(_result);
- break;
+ reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
+ return true;
}
default:
{
return super.onTransact(code, data, reply, flags);
}
}
- return true;
}
private static class Proxy implements eu.darken.sdmse.common.root.service.RootServiceConnection
{
@@ -129,6 +127,9 @@
try {
_data.writeInterfaceToken(DESCRIPTOR);
boolean _status = mRemote.transact(Stub.TRANSACTION_checkBase, _data, _reply, 0);
+ if (!_status && getDefaultImpl() != null) {
+ return getDefaultImpl().checkBase();
+ }
_reply.readException();
_result = _reply.readString();
}
@@ -146,6 +147,9 @@
try {
_data.writeInterfaceToken(DESCRIPTOR);
boolean _status = mRemote.transact(Stub.TRANSACTION_getFileOps, _data, _reply, 0);
+ if (!_status && getDefaultImpl() != null) {
+ return getDefaultImpl().getFileOps();
+ }
_reply.readException();
_result = eu.darken.sdmse.common.files.local.ipc.FileOpsConnection.Stub.asInterface(_reply.readStrongBinder());
}
@@ -163,6 +167,9 @@
try {
_data.writeInterfaceToken(DESCRIPTOR);
boolean _status = mRemote.transact(Stub.TRANSACTION_getPkgOps, _data, _reply, 0);
+ if (!_status && getDefaultImpl() != null) {
+ return getDefaultImpl().getPkgOps();
+ }
_reply.readException();
_result = eu.darken.sdmse.common.pkgs.pkgops.ipc.PkgOpsConnection.Stub.asInterface(_reply.readStrongBinder());
}
@@ -180,6 +187,9 @@
try {
_data.writeInterfaceToken(DESCRIPTOR);
boolean _status = mRemote.transact(Stub.TRANSACTION_getShellOps, _data, _reply, 0);
+ if (!_status && getDefaultImpl() != null) {
+ return getDefaultImpl().getShellOps();
+ }
_reply.readException();
_result = eu.darken.sdmse.common.shell.ipc.ShellOpsConnection.Stub.asInterface(_reply.readStrongBinder());
}
@@ -189,13 +199,29 @@
}
return _result;
}
+ public static eu.darken.sdmse.common.root.service.RootServiceConnection sDefaultImpl;
}
static final int TRANSACTION_checkBase = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
static final int TRANSACTION_getFileOps = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
static final int TRANSACTION_getPkgOps = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
static final int TRANSACTION_getShellOps = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
+ public static boolean setDefaultImpl(eu.darken.sdmse.common.root.service.RootServiceConnection impl) {
+ // Only one user of this interface can use this function
+ // at a time. This is a heuristic to detect if two different
+ // users in the same process use this function.
+ if (Stub.Proxy.sDefaultImpl != null) {
+ throw new IllegalStateException("setDefaultImpl() called twice");
+ }
+ if (impl != null) {
+ Stub.Proxy.sDefaultImpl = impl;
+ return true;
+ }
+ return false;
+ }
+ public static eu.darken.sdmse.common.root.service.RootServiceConnection getDefaultImpl() {
+ return Stub.Proxy.sDefaultImpl;
+ }
}
- public static final java.lang.String DESCRIPTOR = "eu.darken.sdmse.common.root.service.RootServiceConnection";
public java.lang.String checkBase() throws android.os.RemoteException;
public eu.darken.sdmse.common.files.local.ipc.FileOpsConnection getFileOps() throws android.os.RemoteException;
public eu.darken.sdmse.common.pkgs.pkgops.ipc.PkgOpsConnection getPkgOps() throws android.os.RemoteException; |
d4rken
added a commit
that referenced
this pull request
Oct 14, 2023
As guessed, was an R8 issue. Before the AGP update (i.e. on 8.0.2) the DESCRIPTOR field was implicitly kept. After moving to AGP 8.1.2 and fixing the reflection access (#705) works, but R8 will remove the field. So this PR adds rules to keep the `DESCRIPTOR` field for Root and Shizuku. Fixes #721 Fixes #722
d4rken
added a commit
that referenced
this pull request
Oct 14, 2023
As guessed, was an R8 issue. Before the AGP update (i.e. on 8.0.2) the DESCRIPTOR field was implicitly kept. After moving to AGP 8.1.2 and fixing the reflection access (#705) works, but R8 will remove the field. So this PR adds rules to keep the `DESCRIPTOR` field for Root and Shizuku. Fixes #721 Fixes #722
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #689
Full stacktrace was: