Skip to content

Commit 229df1d

Browse files
authored
Merge pull request #1067 from so-lli/vxp
Android 11: fixed opening of many applications
2 parents 9c20336 + 7623a40 commit 229df1d

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed

VirtualApp/lib/src/main/java/com/lody/virtual/client/VClientImpl.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
import mirror.com.android.internal.content.ReferrerIntent;
7777
import mirror.dalvik.system.VMRuntime;
7878
import mirror.java.lang.ThreadGroupN;
79+
import mirror.android.security.net.config.ApplicationConfig;
7980

8081
import static com.lody.virtual.os.VUserHandle.getUserId;
8182

@@ -343,7 +344,8 @@ private void bindApplicationNoCheck(String packageName, String processName, Cond
343344
} else {
344345
VLog.w(TAG, "Xposed is disable..");
345346
}
346-
347+
if (Build.VERSION.SDK_INT >= 30)
348+
ApplicationConfig.setDefaultInstance.call(new Object[] { null });
347349
mInitialApplication = LoadedApk.makeApplication.call(data.info, false, null);
348350

349351
// ExposedBridge.patchAppClassLoader(context);

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

+10
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
463463
if (intent.getPackage() != null && isAppPkg(intent.getPackage())) {
464464
return ActivityManagerCompat.START_INTENT_NOT_RESOLVED;
465465
}
466+
467+
if (Build.VERSION.SDK_INT >= 30) {
468+
args[1] = VirtualCore.get().getContext().getPackageName();
469+
}
470+
466471
return method.invoke(who, args);
467472
}
468473
int res = VActivityManager.get().startActivity(intent, activityInfo, resultTo, options, resultWho, requestCode, VUserHandle.myUserId());
@@ -1386,6 +1391,11 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
13861391
return null;
13871392
}
13881393
args[nameIdx] = VASettings.getStubAuthority(targetVPid);
1394+
1395+
if (Build.VERSION.SDK_INT >= 30) {
1396+
args[1] = VirtualCore.get().getContext().getPackageName();
1397+
}
1398+
13891399
Object holder = method.invoke(who, args);
13901400
if (holder == null) {
13911401
return null;

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

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.location.LocationRequest;
55
import android.os.Build;
66

7+
import com.lody.virtual.client.core.VirtualCore;
78
import com.lody.virtual.client.hook.base.MethodProxy;
89
import com.lody.virtual.client.hook.base.ReplaceLastPkgMethodProxy;
910
import com.lody.virtual.client.ipc.VirtualLocationManager;
@@ -84,6 +85,11 @@ public Object call(final Object who, Method method, Object... args) throws Throw
8485
}
8586
return 0;
8687
}
88+
89+
if (Build.VERSION.SDK_INT >= 30) {
90+
args[3] = VirtualCore.get().getContext().getPackageName();
91+
}
92+
8793
return super.call(who, method, args);
8894
}
8995
}

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

+14-4
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,23 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
105105
if (getHostPkg().equals(pkg)) {
106106
return method.invoke(who, args);
107107
}
108-
String tag = (String) args[1];
109-
int id = (int) args[2];
108+
109+
int index_tag = 1;
110+
int index_id = 2;
111+
112+
if (Build.VERSION.SDK_INT >= 30) {
113+
index_tag = 2;
114+
index_id = 3;
115+
}
116+
117+
String tag = (String) args[index_tag];
118+
int id = (int) args[index_id];
119+
110120
id = VNotificationManager.get().dealNotificationId(id, pkg, tag, getAppUserId());
111121
tag = VNotificationManager.get().dealNotificationTag(id, pkg, tag, getAppUserId());
112122

113-
args[1] = tag;
114-
args[2] = id;
123+
args[index_tag] = tag;
124+
args[index_id] = id;
115125
return method.invoke(who, args);
116126
}
117127
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package mirror.android.security.net.config;
2+
3+
import mirror.RefClass;
4+
import mirror.RefStaticMethod;
5+
6+
public class ApplicationConfig {
7+
public static Class<?> TYPE = RefClass.load(ApplicationConfig.class, "android.security.net.config.ApplicationConfig");
8+
9+
public static RefStaticMethod setDefaultInstance;
10+
}

0 commit comments

Comments
 (0)