Search in sources :

Example 1 with PhoneInfoDelegate

use of com.lody.virtual.client.hook.delegate.PhoneInfoDelegate 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

WifiInfo (android.net.wifi.WifiInfo)1 StaticHook (com.lody.virtual.client.hook.base.StaticHook)1 PhoneInfoDelegate (com.lody.virtual.client.hook.delegate.PhoneInfoDelegate)1 Method (java.lang.reflect.Method)1