use of com.lody.virtual.client.hook.base.HookBinderDelegate in project VirtualApp by asLody.
the class ActivityManagerPatch method inject.
@Override
public void inject() throws Throwable {
if (ActivityManagerNative.gDefault.type() == IActivityManager.TYPE) {
ActivityManagerNative.gDefault.set(getHookDelegate().getProxyInterface());
} else if (ActivityManagerNative.gDefault.type() == Singleton.TYPE) {
Object gDefault = ActivityManagerNative.gDefault.get();
Singleton.mInstance.set(gDefault, getHookDelegate().getProxyInterface());
}
HookBinderDelegate hookAMBinder = new HookBinderDelegate(getHookDelegate().getBaseInterface());
hookAMBinder.copyHooks(getHookDelegate());
ServiceManager.sCache.get().put(Context.ACTIVITY_SERVICE, hookAMBinder);
}
use of com.lody.virtual.client.hook.base.HookBinderDelegate in project VirtualApp by asLody.
the class ContextFixer method fixContext.
/**
* Fuck AppOps
*
* @param context Context
*/
public static void fixContext(Context context) {
try {
context.getPackageName();
} catch (Throwable e) {
return;
}
PatchManager.getInstance().checkEnv(GraphicsStatsPatch.class);
int deep = 0;
while (context instanceof ContextWrapper) {
context = ((ContextWrapper) context).getBaseContext();
deep++;
if (deep >= 10) {
return;
}
}
ContextImpl.mPackageManager.set(context, null);
try {
context.getPackageManager();
} catch (Throwable e) {
e.printStackTrace();
}
if (!VirtualCore.get().isVAppProcess()) {
return;
}
DropBoxManager dm = (DropBoxManager) context.getSystemService(Context.DROPBOX_SERVICE);
HookBinderDelegate boxBinder = PatchManager.getInstance().getHookObject(DropBoxManagerPatch.class);
if (boxBinder != null) {
try {
Reflect.on(dm).set("mService", boxBinder.getProxyInterface());
} catch (ReflectException e) {
e.printStackTrace();
}
}
String hostPkg = VirtualCore.get().getHostPkg();
ContextImpl.mBasePackageName.set(context, hostPkg);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
ContextImplKitkat.mOpPackageName.set(context, hostPkg);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
ContentResolverJBMR2.mPackageName.set(context.getContentResolver(), hostPkg);
}
}
use of com.lody.virtual.client.hook.base.HookBinderDelegate in project VirtualApp by asLody.
the class PackageManagerPatch method inject.
@Override
public void inject() throws Throwable {
final IInterface hookedPM = getHookDelegate().getProxyInterface();
ActivityThread.sPackageManager.set(hookedPM);
HookBinderDelegate pmHookBinder = new HookBinderDelegate(getHookDelegate().getBaseInterface());
pmHookBinder.copyHooks(getHookDelegate());
pmHookBinder.replaceService("package");
}
Aggregations