Search in sources :

Example 1 with AppTaskInfo

use of com.lody.virtual.remote.AppTaskInfo in project VirtualApp by asLody.

the class TaskRecord method getAppTaskInfo.

AppTaskInfo getAppTaskInfo() {
    int len = activities.size();
    if (len <= 0) {
        return null;
    }
    ComponentName top = activities.get(len - 1).component;
    return new AppTaskInfo(taskId, taskRoot, taskRoot.getComponent(), top);
}
Also used : AppTaskInfo(com.lody.virtual.remote.AppTaskInfo) ComponentName(android.content.ComponentName)

Example 2 with AppTaskInfo

use of com.lody.virtual.remote.AppTaskInfo in project VirtualApp by asLody.

the class ActivityManagerPatch method onBindHooks.

@Override
protected void onBindHooks() {
    super.onBindHooks();
    if (VirtualCore.get().isVAppProcess()) {
        addHook(new ReplaceLastUidHook("checkPermissionWithToken"));
        addHook(new isUserRunning());
        addHook(new ResultStaticHook("updateConfiguration", 0));
        addHook(new ReplaceCallingPkgHook("setAppLockedVerifying"));
        addHook(new StaticHook("checkUriPermission") {

            @Override
            public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable {
                return PackageManager.PERMISSION_GRANTED;
            }
        });
        addHook(new StaticHook("getRecentTasks") {

            @Override
            public Object call(Object who, Method method, Object... args) throws Throwable {
                Object _infos = method.invoke(who, args);
                //noinspection unchecked
                List<ActivityManager.RecentTaskInfo> infos = ParceledListSliceCompat.isReturnParceledListSlice(method) ? ParceledListSlice.getList.call(_infos) : (List) _infos;
                for (ActivityManager.RecentTaskInfo info : infos) {
                    AppTaskInfo taskInfo = VActivityManager.get().getTaskInfo(info.id);
                    if (taskInfo == null) {
                        continue;
                    }
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                        info.baseActivity = taskInfo.baseActivity;
                        info.topActivity = taskInfo.topActivity;
                    }
                    info.origActivity = taskInfo.baseActivity;
                    info.baseIntent = taskInfo.baseIntent;
                }
                return _infos;
            }
        });
    }
}
Also used : ReplaceLastUidHook(com.lody.virtual.client.hook.base.ReplaceLastUidHook) ReplaceCallingPkgHook(com.lody.virtual.client.hook.base.ReplaceCallingPkgHook) StaticHook(com.lody.virtual.client.hook.base.StaticHook) ResultStaticHook(com.lody.virtual.client.hook.base.ResultStaticHook) Method(java.lang.reflect.Method) ActivityManager(android.app.ActivityManager) IActivityManager(mirror.android.app.IActivityManager) VActivityManager(com.lody.virtual.client.ipc.VActivityManager) AppTaskInfo(com.lody.virtual.remote.AppTaskInfo) ResultStaticHook(com.lody.virtual.client.hook.base.ResultStaticHook) List(java.util.List)

Example 3 with AppTaskInfo

use of com.lody.virtual.remote.AppTaskInfo in project VirtualApp by asLody.

the class GetTasks method call.

@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;
}
Also used : AppTaskInfo(com.lody.virtual.remote.AppTaskInfo) List(java.util.List) ActivityManager(android.app.ActivityManager) VActivityManager(com.lody.virtual.client.ipc.VActivityManager)

Aggregations

AppTaskInfo (com.lody.virtual.remote.AppTaskInfo)3 ActivityManager (android.app.ActivityManager)2 VActivityManager (com.lody.virtual.client.ipc.VActivityManager)2 List (java.util.List)2 ComponentName (android.content.ComponentName)1 ReplaceCallingPkgHook (com.lody.virtual.client.hook.base.ReplaceCallingPkgHook)1 ReplaceLastUidHook (com.lody.virtual.client.hook.base.ReplaceLastUidHook)1 ResultStaticHook (com.lody.virtual.client.hook.base.ResultStaticHook)1 StaticHook (com.lody.virtual.client.hook.base.StaticHook)1 Method (java.lang.reflect.Method)1 IActivityManager (mirror.android.app.IActivityManager)1