Search in sources :

Example 1 with StaticHook

use of com.lody.virtual.client.hook.base.StaticHook in project VirtualApp by asLody.

the class SearchManagerPatch method onBindHooks.

@Override
protected void onBindHooks() {
    super.onBindHooks();
    addHook(new StaticHook("launchLegacyAssist"));
}
Also used : StaticHook(com.lody.virtual.client.hook.base.StaticHook)

Example 2 with StaticHook

use of com.lody.virtual.client.hook.base.StaticHook in project VirtualApp by asLody.

the class WindowManagerPatch method onBindHooks.

@Override
protected void onBindHooks() {
    super.onBindHooks();
    addHook(new StaticHook("addAppToken"));
    addHook(new StaticHook("setScreenCaptureDisabled"));
}
Also used : StaticHook(com.lody.virtual.client.hook.base.StaticHook)

Example 3 with StaticHook

use of com.lody.virtual.client.hook.base.StaticHook 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 4 with StaticHook

use of com.lody.virtual.client.hook.base.StaticHook in project VirtualApp by asLody.

the class NotificationManagerPatch method onBindHooks.

@Override
protected void onBindHooks() {
    super.onBindHooks();
    addHook(new ReplaceCallingPkgHook("enqueueToast"));
    addHook(new ReplaceCallingPkgHook("cancelToast"));
    addHook(new StaticHook("registerListener"));
    addHook(new StaticHook("unregisterListener"));
    addHook(new StaticHook("getAppActiveNotifications"));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        addHook(new ReplaceCallingPkgHook("areNotificationsEnabled"));
    }
    if ("samsung".equalsIgnoreCase(Build.BRAND) || "samsung".equalsIgnoreCase(Build.MANUFACTURER)) {
        addHook(new ReplaceCallingPkgHook("removeEdgeNotification"));
    }
}
Also used : ReplaceCallingPkgHook(com.lody.virtual.client.hook.base.ReplaceCallingPkgHook) StaticHook(com.lody.virtual.client.hook.base.StaticHook)

Example 5 with StaticHook

use of com.lody.virtual.client.hook.base.StaticHook in project VirtualApp by asLody.

the class WifiManagerPatch method onBindHooks.

@Override
protected void onBindHooks() {
    super.onBindHooks();
    addHook(new StaticHook("getConnectionInfo") {

        @Override
        public Object call(Object who, Method method, Object... args) throws Throwable {
            WifiInfo info = (WifiInfo) method.invoke(who, args);
            PhoneInfoDelegate delegate = VirtualCore.get().getPhoneInfoDelegate();
            if (info != null && delegate != null) {
                String oldMac = info.getMacAddress();
                if (oldMac != null) {
                    String newMac = delegate.getMacAddress(oldMac, getAppUserId());
                    if (!TextUtils.equals(oldMac, newMac)) {
                        mirror.android.net.wifi.WifiInfo.mMacAddress.set(info, newMac);
                    }
                }
            }
            return info;
        }
    });
}
Also used : PhoneInfoDelegate(com.lody.virtual.client.hook.delegate.PhoneInfoDelegate) StaticHook(com.lody.virtual.client.hook.base.StaticHook) Method(java.lang.reflect.Method) WifiInfo(android.net.wifi.WifiInfo)

Aggregations

StaticHook (com.lody.virtual.client.hook.base.StaticHook)5 ReplaceCallingPkgHook (com.lody.virtual.client.hook.base.ReplaceCallingPkgHook)2 Method (java.lang.reflect.Method)2 ActivityManager (android.app.ActivityManager)1 WifiInfo (android.net.wifi.WifiInfo)1 ReplaceLastUidHook (com.lody.virtual.client.hook.base.ReplaceLastUidHook)1 ResultStaticHook (com.lody.virtual.client.hook.base.ResultStaticHook)1 PhoneInfoDelegate (com.lody.virtual.client.hook.delegate.PhoneInfoDelegate)1 VActivityManager (com.lody.virtual.client.ipc.VActivityManager)1 AppTaskInfo (com.lody.virtual.remote.AppTaskInfo)1 List (java.util.List)1 IActivityManager (mirror.android.app.IActivityManager)1