@@ -55,6 +55,8 @@ public static void installProxy(PackageManager manager) {
55
55
sMethods .put ("getProviderInfo" , new getProviderInfo ());
56
56
sMethods .put ("queryIntentActivities" , new queryIntentActivities ());
57
57
sMethods .put ("queryIntentServices" , new queryIntentServices ());
58
+ sMethods .put ("resolveActivity" , new resolveActivity ());
59
+ sMethods .put ("resolveActivityAsUser" , new resolveActivityAsUser ());
58
60
}
59
61
60
62
public static class getPackageInfo extends MethodDelegate {
@@ -157,7 +159,7 @@ public Object beforeInvoke(Object target, Method method, Object[] args) {
157
159
String className = ((ComponentName )args [0 ]).getClassName ();
158
160
PluginDescriptor pluginDescriptor = PluginLoader .getPluginDescriptorByClassName (className );
159
161
if (pluginDescriptor != null ) {
160
- getServiceInfo (pluginDescriptor , className );
162
+ return getServiceInfo (pluginDescriptor , className );
161
163
}
162
164
163
165
return super .beforeInvoke (target , method , args );
@@ -180,7 +182,6 @@ public Object beforeInvoke(Object target, Method method, Object[] args) {
180
182
providerInfo .enabled = true ;
181
183
providerInfo .exported = info .isExported ();
182
184
providerInfo .applicationInfo = getApplicationInfo (pluginDescriptor );
183
- providerInfo .metaData = getMeta (pluginDescriptor .getMetaData ());
184
185
providerInfo .authority = info .getAuthority ();
185
186
return providerInfo ;
186
187
}
@@ -237,6 +238,38 @@ public Object beforeInvoke(Object target, Method method, Object[] args) {
237
238
}
238
239
}
239
240
241
+ //public abstract ResolveInfo resolveActivity(Intent intent, int flags);
242
+ public static class resolveActivity extends MethodDelegate {
243
+ @ Override
244
+ public Object beforeInvoke (Object target , Method method , Object [] args ) {
245
+ LogUtil .e ("beforeInvoke" , method .getName ());
246
+ ArrayList <String > classNames = PluginLoader .matchPlugin ((Intent ) args [0 ], PluginDescriptor .ACTIVITY );
247
+ if (classNames != null && classNames .size () > 0 ) {
248
+ PluginDescriptor pluginDescriptor = PluginLoader .getPluginDescriptorByClassName (classNames .get (0 ));
249
+ ResolveInfo info = new ResolveInfo ();
250
+ info .activityInfo = getActivityInfo (pluginDescriptor , classNames .get (0 ));
251
+ return info ;
252
+ }
253
+ return super .beforeInvoke (target , method , args );
254
+ }
255
+ }
256
+
257
+ //public abstract ResolveInfo resolveActivityAsUser(Intent intent, int flags, int userId);
258
+ public static class resolveActivityAsUser extends MethodDelegate {
259
+ @ Override
260
+ public Object beforeInvoke (Object target , Method method , Object [] args ) {
261
+ LogUtil .e ("beforeInvoke" , method .getName ());
262
+ ArrayList <String > classNames = PluginLoader .matchPlugin ((Intent ) args [0 ], PluginDescriptor .ACTIVITY );
263
+ if (classNames != null && classNames .size () > 0 ) {
264
+ PluginDescriptor pluginDescriptor = PluginLoader .getPluginDescriptorByClassName (classNames .get (0 ));
265
+ ResolveInfo info = new ResolveInfo ();
266
+ info .activityInfo = getActivityInfo (pluginDescriptor , classNames .get (0 ));
267
+ return info ;
268
+ }
269
+ return super .beforeInvoke (target , method , args );
270
+ }
271
+ }
272
+
240
273
private static Bundle getMeta (HashMap <String , String > map ) {
241
274
//TODO 可以缓存起来
242
275
Bundle meta = new Bundle ();
@@ -279,7 +312,6 @@ private static ActivityInfo getActivityInfo(PluginDescriptor pluginDescriptor, S
279
312
activityInfo .exported = false ;
280
313
activityInfo .applicationInfo = getApplicationInfo (pluginDescriptor );
281
314
activityInfo .taskAffinity = null ;//需要时再加上
282
- activityInfo .metaData = getMeta (pluginDescriptor .getMetaData ());
283
315
284
316
if (pluginDescriptor .getType (className ) == PluginDescriptor .ACTIVITY ) {
285
317
PluginActivityInfo detail = pluginDescriptor .getActivityInfos ().get (className );
@@ -301,7 +333,6 @@ private static ServiceInfo getServiceInfo(PluginDescriptor pluginDescriptor, Str
301
333
serviceInfo .enabled = true ;
302
334
serviceInfo .exported = false ;
303
335
serviceInfo .applicationInfo = getApplicationInfo (pluginDescriptor );
304
- serviceInfo .metaData = getMeta (pluginDescriptor .getMetaData ());
305
336
return serviceInfo ;
306
337
}
307
338
0 commit comments