3
3
import android .content .ComponentName ;
4
4
import android .content .Intent ;
5
5
import android .content .pm .ActivityInfo ;
6
- import android .content .pm .ApplicationInfo ;
7
6
import android .content .pm .ServiceInfo ;
8
7
import android .os .Handler ;
9
8
import android .os .IBinder ;
19
18
import com .lody .virtual .remote .InstalledAppInfo ;
20
19
import com .lody .virtual .remote .StubActivityRecord ;
21
20
21
+ import java .util .List ;
22
+
23
+ import me .weishu .exposed .ExposedBridge ;
22
24
import mirror .android .app .ActivityManagerNative ;
23
25
import mirror .android .app .ActivityThread ;
24
26
import mirror .android .app .IActivityManager ;
@@ -107,6 +109,8 @@ private boolean handleLaunchActivity(Message msg) {
107
109
ComponentName caller = saveInstance .caller ;
108
110
IBinder token = ActivityThread .ActivityClientRecord .token .get (r );
109
111
ActivityInfo info = saveInstance .info ;
112
+ ClassLoader appClassLoader = VClientImpl .get ().getClassLoader (info .applicationInfo );
113
+
110
114
if (VClientImpl .get ().getToken () == null ) {
111
115
InstalledAppInfo installedAppInfo = VirtualCore .get ().getInstalledAppInfo (info .packageName , 0 );
112
116
if (installedAppInfo == null ){
@@ -117,6 +121,12 @@ private boolean handleLaunchActivity(Message msg) {
117
121
return false ;
118
122
}
119
123
if (!VClientImpl .get ().isBound ()) {
124
+ ExposedBridge .initOnce (VirtualCore .get ().getContext (), info .applicationInfo , appClassLoader );
125
+ List <InstalledAppInfo > installedApps = VirtualCore .get ().getInstalledApps (0 );
126
+ for (InstalledAppInfo installedApp : installedApps ) {
127
+ ExposedBridge .loadModule (installedApp .apkPath , installedApp .getOdexFile ().getParent (),
128
+ installedApp .libPath , info .applicationInfo , appClassLoader );
129
+ }
120
130
VClientImpl .get ().bindApplication (info .packageName , info .processName );
121
131
getH ().sendMessageAtFrontOfQueue (Message .obtain (msg ));
122
132
return false ;
@@ -127,8 +137,8 @@ private boolean handleLaunchActivity(Message msg) {
127
137
false
128
138
);
129
139
VActivityManager .get ().onActivityCreate (ComponentUtils .toComponentName (info ), caller , token , info , intent , ComponentUtils .getTaskAffinity (info ), taskId , info .launchMode , info .flags );
130
- ClassLoader appClassLoader = VClientImpl . get (). getClassLoader ( info . applicationInfo );
131
- intent .setExtrasClassLoader (appClassLoader );
140
+
141
+ intent .setExtrasClassLoader (ExposedBridge . getAppClassLoaderWithXposed ( appClassLoader ) );
132
142
ActivityThread .ActivityClientRecord .intent .set (r , intent );
133
143
ActivityThread .ActivityClientRecord .activityInfo .set (r , info );
134
144
return true ;
0 commit comments