Skip to content

Commit c418d70

Browse files
committed
Android 10: fix provider hook
Signed-off-by: tiann <twsxtd@gmail.com>
1 parent 5961bd2 commit c418d70

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

VirtualApp/lib/src/main/java/com/lody/virtual/client/hook/providers/ProviderHook.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.os.Bundle;
99
import android.os.IInterface;
1010
import android.os.ParcelFileDescriptor;
11+
import android.util.Log;
1112

1213
import com.lody.virtual.client.hook.base.MethodBox;
1314
import com.lody.virtual.helper.compat.BuildCompat;
@@ -152,11 +153,14 @@ public Object invoke(Object proxy, Method method, Object... args) throws Throwab
152153
e.printStackTrace();
153154
}
154155
MethodBox methodBox = new MethodBox(method, mBase, args);
155-
int start = BuildCompat.isQ() ? 2 : (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? 1 : 0);
156+
int start = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 ? 1 : 0;
156157

157158
try {
158159
String name = method.getName();
159160
if ("call".equals(name)) {
161+
if (BuildCompat.isQ()) {
162+
start = 2;
163+
}
160164
String methodName = (String) args[start];
161165
String arg = (String) args[start + 1];
162166
Bundle extras = (Bundle) args[start + 2];
@@ -191,6 +195,7 @@ public Object invoke(Object proxy, Method method, Object... args) throws Throwab
191195
String mode = (String) args[start + 1];
192196
return openAssetFile(methodBox, url, mode);
193197
} else if ("query".equals(name)) {
198+
Log.i("mylog", "args: " + Arrays.toString(args));
194199
Uri url = (Uri) args[start];
195200
String[] projection = (String[]) args[start + 1];
196201
String selection = null;

0 commit comments

Comments
 (0)