@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); finish(); Intent intent = getIntent(); StubActivityRecord r = new StubActivityRecord(intent); if (r.intent == null) { return; } r.intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT); VActivityManager.get().startActivity(r.intent, r.userId); } }
VActivityManager.get().addPendingIntent(sender.asBinder(), creator);
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IInterface caller = (IInterface) args[0]; IBinder token = (IBinder) args[1]; Intent service = (Intent) args[2]; String resolvedType = (String) args[3]; IServiceConnection conn = (IServiceConnection) args[4]; int flags = (int) args[5]; int userId = VUserHandle.myUserId(); if (isServerProcess()) { userId = service.getIntExtra("_VA_|_user_id_", VUserHandle.USER_NULL); } if (userId == VUserHandle.USER_NULL) { return method.invoke(who, args); } ServiceInfo serviceInfo = VirtualCore.get().resolveServiceInfo(service, userId); if (serviceInfo != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { service.setComponent(new ComponentName(serviceInfo.packageName, serviceInfo.name)); } conn = ServiceConnectionDelegate.getDelegate(conn); return VActivityManager.get().bindService(caller.asBinder(), token, service, resolvedType, conn, flags, userId); } return method.invoke(who, args); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IBinder token = (IBinder) args[0]; return VActivityManager.get().getActivityForToken(token); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IBinder token = (IBinder) args[0]; return VActivityManager.get().getCallingActivity(token); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IBinder token = (IBinder) args[0]; Intent service = (Intent) args[1]; boolean doRebind = (boolean) args[2]; VActivityManager.get().unbindFinished(token, service, doRebind); return 0; }
int res = VActivityManager.get().startActivity(intent, activityInfo, resultTo, options, resultWho, requestCode, VUserHandle.myUserId()); if (res != 0 && resultTo != null && requestCode > 0) { VActivityManager.get().sendActivityResult(resultTo, resultWho, requestCode); ActivityClientRecord r = VActivityManager.get().getActivityRecord(resultTo); if (r != null && r.activity != null) { try {
@Override public synchronized Object call(Object who, Method method, Object... args) throws Throwable { List<ActivityManager.RunningAppProcessInfo> infoList = (List<ActivityManager.RunningAppProcessInfo>) method .invoke(who, args); if (infoList != null) { for (ActivityManager.RunningAppProcessInfo info : infoList) { if (VActivityManager.get().isAppPid(info.pid)) { List<String> pkgList = VActivityManager.get().getProcessPkgList(info.pid); String processName = VActivityManager.get().getAppProcessName(info.pid); if (processName != null) { info.processName = processName; } info.pkgList = pkgList.toArray(new String[pkgList.size()]); info.uid = VUserHandle.getAppId(VActivityManager.get().getUidByPid(info.pid)); } } } return infoList; } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IBinder token = (IBinder) args[0]; if (!VActivityManager.get().isVAServiceToken(token)) { return method.invoke(who, args); } int type = (int) args[1]; int startId = (int) args[2]; int res = (int) args[3]; VActivityManager.get().serviceDoneExecuting(token, type, startId, res); return 0; }
@Override public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable { IBinder token = (IBinder) args[0]; ActivityClientRecord r = VActivityManager.get().getActivityRecord(token); boolean taskRemoved = VActivityManager.get().onActivityDestroy(token); if (!taskRemoved && r != null && r.activity != null && r.info.getThemeResource() != 0) { try { TypedValue out = new TypedValue(); Resources.Theme theme = r.activity.getResources().newTheme(); theme.applyStyle(r.info.getThemeResource(), true); if (theme.resolveAttribute(android.R.attr.windowAnimationStyle, out, true)) { TypedArray array = theme.obtainStyledAttributes(out.data, new int[]{ android.R.attr.activityCloseEnterAnimation, android.R.attr.activityCloseExitAnimation }); r.activity.overridePendingTransition(array.getResourceId(0, 0), array.getResourceId(1, 0)); array.recycle(); } } catch (Throwable e) { e.printStackTrace(); } } return super.afterCall(who, method, args, result); }
ProviderInfo info = VPackageManager.get().resolveContentProvider(name, 0, userId); if (info != null && info.enabled && isAppPkg(info.packageName)) { int targetVPid = VActivityManager.get().initProcess(info.packageName, info.processName, userId); if (targetVPid == -1) { return null; IInterface provider = ContentProviderHolderOreo.provider.get(holder); if (provider != null) { provider = VActivityManager.get().acquireProviderClient(userId, info); IInterface provider = IActivityManager.ContentProviderHolder.provider.get(holder); if (provider != null) { provider = VActivityManager.get().acquireProviderClient(userId, info);
public void killApp(String pkg, int userId) { VActivityManager.get().killAppByPkg(pkg, userId); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IBinder token = (IBinder) args[0]; if (!VActivityManager.get().isVAServiceToken(token)) { return method.invoke(who, args); } Intent intent = (Intent) args[1]; IBinder service = (IBinder) args[2]; VActivityManager.get().publishService(token, intent, service); return 0; }
return null; VActivityManager.get().processRestarted(info.packageName, info.processName, saveInstance.userId); VActivityManager.get().onActivityCreate(ComponentUtils.toComponentName(info), caller, token, info, intent, ComponentUtils.getTaskAffinity(info), taskId, info.launchMode, info.flags); ClassLoader appClassLoader = VClientImpl.get().getClassLoader(info.applicationInfo); intent.setExtrasClassLoader(appClassLoader);
@Override public Object call(Object who, Method method, Object... args) throws Throwable { ComponentName componentName = (ComponentName) args[0]; IBinder token = (IBinder) args[1]; if (!VActivityManager.get().isVAServiceToken(token)) { return method.invoke(who, args); } int startId = (int) args[2]; if (componentName != null) { return VActivityManager.get().stopServiceToken(componentName, token, startId); } return method.invoke(who, args); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { IServiceConnection conn = (IServiceConnection) args[0]; ServiceConnectionDelegate delegate = ServiceConnectionDelegate.removeDelegate(conn); if (delegate == null) { return method.invoke(who, args); } return VActivityManager.get().unbindService(delegate); }
@Override public void finishActivity(IBinder token) { VActivityManager.get().finishActivity(token); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { List<ActivityManager.RunningTaskInfo> runningTaskInfos = (List<ActivityManager.RunningTaskInfo>) method .invoke(who, args); for (ActivityManager.RunningTaskInfo info : runningTaskInfos) { AppTaskInfo taskInfo = VActivityManager.get().getTaskInfo(info.id); if (taskInfo != null) { info.topActivity = taskInfo.topActivity; info.baseActivity = taskInfo.baseActivity; } } return runningTaskInfos; }
private void handleReceiver(ReceiverData data) { BroadcastReceiver.PendingResult result = data.resultData.build(); try { if (!isBound()) { bindApplication(data.component.getPackageName(), data.processName); } Context context = mInitialApplication.getBaseContext(); Context receiverContext = ContextImpl.getReceiverRestrictedContext.call(context); String className = data.component.getClassName(); BroadcastReceiver receiver = (BroadcastReceiver) context.getClassLoader().loadClass(className).newInstance(); mirror.android.content.BroadcastReceiver.setPendingResult.call(receiver, result); data.intent.setExtrasClassLoader(context.getClassLoader()); if (data.intent.getComponent() == null) { data.intent.setComponent(data.component); } receiver.onReceive(receiverContext, data.intent); if (mirror.android.content.BroadcastReceiver.getPendingResult.call(receiver) != null) { result.finish(); } } catch (Exception e) { // must be this for misjudge of anti-virus!! throw new RuntimeException(String.format("Unable to start receiver: %s ", data.component), e); } VActivityManager.get().broadcastFinish(data.resultData); }
ActivityClientRecord r = VActivityManager.get().getActivityRecord(token); if (r != null) { r.activity = activity;