Skip to content

Commit 41a6cdc

Browse files
author
tiann
committed
FIX: replace package for getContentProvider in Android Q
1 parent aa87f9f commit 41a6cdc

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

VirtualApp/lib/src/main/java/com/lody/virtual/client/hook/proxies/am/MethodProxies.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,14 @@ public String getMethodName() {
196196

197197
@Override
198198
public int getProviderNameIndex() {
199-
if (BuildCompat.isQ()) {
200-
return 1;
201-
}
202199
return 0;
203200
}
204201

202+
@Override
203+
public int getPackageIndex() {
204+
return super.getPackageIndex();
205+
}
206+
205207
@Override
206208
public boolean isEnable() {
207209
return isAppProcess();
@@ -1392,6 +1394,13 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
13921394
}
13931395
return holder;
13941396
}
1397+
1398+
if (BuildCompat.isQ()) {
1399+
int packageIndex = getPackageIndex();
1400+
if (packageIndex > 0 && args[packageIndex] instanceof String) {
1401+
args[packageIndex] = getHostPkg();
1402+
}
1403+
}
13951404
Object holder = method.invoke(who, args);
13961405
if (holder != null) {
13971406
if (BuildCompat.isOreo()) {
@@ -1422,6 +1431,13 @@ public int getProviderNameIndex() {
14221431
return 1;
14231432
}
14241433

1434+
public int getPackageIndex() {
1435+
if (BuildCompat.isQ()) {
1436+
return 1;
1437+
}
1438+
return -1;
1439+
}
1440+
14251441
@Override
14261442
public boolean isEnable() {
14271443
return isAppProcess();

0 commit comments

Comments
 (0)