@SuppressLint("SdCardPath") private void startIOUniformer() { ApplicationInfo info = mBoundApplication.appInfo; int userId = VUserHandle.myUserId(); String wifiMacAddressFile = deviceInfo.getWifiFile(userId).getPath(); NativeEngine.redirectDirectory("/sys/class/net/wlan0/address", wifiMacAddressFile); NativeEngine.redirectDirectory("/sys/class/net/eth0/address", wifiMacAddressFile); NativeEngine.redirectDirectory("/sys/class/net/wifi/address", wifiMacAddressFile); NativeEngine.redirectDirectory("/data/data/" + info.packageName, info.dataDir); NativeEngine.redirectDirectory("/data/user/0/" + info.packageName, info.dataDir); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { NativeEngine.redirectDirectory("/data/user_de/0/" + info.packageName, info.dataDir); } String libPath = VEnvironment.getAppLibDirectory(info.packageName).getAbsolutePath(); String userLibPath = new File(VEnvironment.getUserSystemDirectory(userId), info.packageName + "/lib").getAbsolutePath(); NativeEngine.redirectDirectory(userLibPath, libPath); NativeEngine.redirectDirectory("/data/data/" + info.packageName + "/lib/", libPath); NativeEngine.redirectDirectory("/data/user/0/" + info.packageName + "/lib/", libPath); File dataUserLib = new File(VEnvironment.getDataUserPackageDirectory(userId, info.packageName), "lib"); if (!dataUserLib.exists()) { try { Os.symlink(libPath, dataUserLib.getPath()); } catch (ErrnoException e) { VLog.w(TAG, "symlink error", e); } } setupVirtualStorage(info, userId); NativeEngine.enableIORedirect(); }
public static void enableIORedirect() { try { String soPath = String.format("/data/data/%s/lib/libva++.so", VirtualCore.get().getHostPkg()); if (!new File(soPath).exists()) { throw new RuntimeException("io redirect failed."); } redirectDirectory(VESCAPE, "/"); nativeEnableIORedirect(soPath, Build.VERSION.SDK_INT, BuildCompat.getPreviewSDKInt()); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
public static String getRedirectedPath(String redirectPath) { try { return nativeGetRedirectedPath(redirectPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } return redirectPath; }
startIOUniformer(); NativeEngine.launchEngine(); Object mainThread = VirtualCore.mainThread(); NativeEngine.startDexOverride(); Context context = createPackageContext(data.appInfo.packageName); try {
public static void redirectFile(String origPath, String newPath) { if (origPath.endsWith("/")) { origPath = origPath.substring(0, origPath.length() - 1); } if (newPath.endsWith("/")) { newPath = newPath.substring(0, newPath.length() - 1); } try { nativeIORedirect(origPath, newPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
public static void whitelist(String path, boolean directory) { if (directory && !path.endsWith("/")) { path = path + "/"; } else if (!directory && path.endsWith("/")) { path = path.substring(0, path.length() - 1); } try { nativeIOWhitelist(path); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
public static void forbid(String path) { if (!path.endsWith("/")) { path = path + "/"; } try { nativeIOForbid(path); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
@Override public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable { int uid = (int) result; return NativeEngine.onGetUid(uid); } }
public static String resverseRedirectedPath(String origPath) { try { return nativeReverseRedirectedPath(origPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } return origPath; }
static void launchEngine() { if (sFlag) { return; } Method[] methods = {NativeMethods.gOpenDexFileNative, NativeMethods.gCameraNativeSetup, NativeMethods.gAudioRecordNativeCheckPermission}; try { nativeLaunchEngine(methods, VirtualCore.get().getHostPkg(), VirtualRuntime.isArt(), Build.VERSION.SDK_INT, NativeMethods.gCameraMethodType); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } sFlag = true; }
public static void enableIORedirect() { try { String soPath = String.format("/data/data/%s/lib/libva++.so", VirtualCore.get().getHostPkg()); if (!new File(soPath).exists()) { throw new RuntimeException("Unable to find the so."); } nativeEnableIORedirect(soPath, Build.VERSION.SDK_INT, BuildCompat.getPreviewSDKInt()); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
startIOUniformer(); NativeEngine.launchEngine(); Object mainThread = VirtualCore.mainThread(); NativeEngine.startDexOverride(); Context context = createPackageContext(data.appInfo.packageName); System.setProperty("java.io.tmpdir", context.getCacheDir().getAbsolutePath());
public static void redirectDirectory(String origPath, String newPath) { if (!origPath.endsWith("/")) { origPath = origPath + "/"; } if (!newPath.endsWith("/")) { newPath = newPath + "/"; } try { nativeIORedirect(origPath, newPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
public static void whitelist(String path, boolean directory) { if (directory && !path.endsWith("/")) { path = path + "/"; } else if (!directory && path.endsWith("/")) { path = path.substring(0, path.length() - 1); } try { nativeIOWhitelist(path); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
public static void forbid(String path) { if (!path.endsWith("/")) { path = path + "/"; } try { nativeIOForbid(path); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } }
@Override public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable { int uid = (int) result; return NativeEngine.onGetUid(uid); } }
public static String resverseRedirectedPath(String origPath) { try { return nativeReverseRedirectedPath(origPath); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } return origPath; }
static void launchEngine(String currPackageName) { if (sFlag) { return; } Method[] methods = {NativeMethods.gOpenDexFileNative, NativeMethods.gCameraNativeSetup, NativeMethods.gAudioRecordNativeCheckPermission}; try { nativeLaunchEngine(methods, currPackageName, VirtualCore.get().getHostPkg(), VirtualRuntime.isArt(), Build.VERSION.SDK_INT, NativeMethods.gCameraMethodType); } catch (Throwable e) { VLog.e(TAG, VLog.getStackTraceString(e)); } sFlag = true; }
int userId = VUserHandle.myUserId(); String wifiMacAddressFile = deviceInfo.getWifiFile(userId).getPath(); NativeEngine.redirectDirectory("/sys/class/net/wlan0/address", wifiMacAddressFile); NativeEngine.redirectDirectory("/sys/class/net/eth0/address", wifiMacAddressFile); NativeEngine.redirectDirectory("/sys/class/net/wifi/address", wifiMacAddressFile); NativeEngine.redirectDirectory("/data/data/" + info.packageName, info.dataDir); NativeEngine.redirectDirectory("/data/user/0/" + info.packageName, info.dataDir); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { NativeEngine.redirectDirectory("/data/user_de/0/" + info.packageName, info.dataDir); NativeEngine.redirectDirectory(userLibPath, libPath); NativeEngine.redirectDirectory("/data/data/" + info.packageName + "/lib/", libPath); NativeEngine.redirectDirectory("/data/user/0/" + info.packageName + "/lib/", libPath); HashSet<String> mountPoints = getMountPoints(); for (String mountPoint : mountPoints) { NativeEngine.redirectDirectory(mountPoint, vsPath); NativeEngine.enableIORedirect();
startIOUniformer(); NativeEngine.launchEngine(data.appInfo.packageName); Object mainThread = VirtualCore.mainThread(); NativeEngine.startDexOverride(); Context context = createPackageContext(data.appInfo.packageName); try {