@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)); } }
NativeEngine.redirectDirectory(new File(storageRoot, "Android/data/").getAbsolutePath(), privatePath); NativeEngine.redirectDirectory(storageRoot, vsPath);
@SuppressLint("SdCardPath") private void RedirectSDCardPaths(Map<String, String> paths) { paths.forEach((key, value) -> { String redirectkey = key.endsWith("/") || key.length() == 0 ? key : key + "/"; String redirectvalue = value.startsWith("/") ? value : VEnvironment.getUserDirectory() + "/" + value; if (redirectkey.startsWith("/")) { NativeEngine.redirectDirectory(redirectkey, redirectvalue); } else { NativeEngine.redirectDirectory("/mnt/sdcard/" + redirectkey, redirectvalue); NativeEngine.redirectDirectory("/storage/emulated/0/" + redirectkey, redirectvalue); NativeEngine.redirectDirectory("/storage/self/primary/" + redirectkey, redirectvalue); NativeEngine.redirectDirectory("/sdcard/" + redirectkey, redirectvalue); } }); }
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);
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)); } }
NativeEngine.redirectDirectory(new File(storageRoot, "Android/data/").getAbsolutePath(), privatePath); NativeEngine.redirectDirectory(storageRoot, vsPath);
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); "baidu", "backup", "backups", "Ccb", "cmblife", "Documents", "facishare", "libs", "msc", "Qmap", "QQBrowser", "Subtitles", "system", info.dataDir + "/app_tbs/", info.dataDir + "/files/xlog/", info.dataDir + "/tinker/", info.dataDir + "/files/ali-s/logRecord/", info.dataDir + "/files/logs/"), RootDirKiller); NativeEngine.redirectDirectory(info.dataDir + "/cache/", VirtualCore.get().getContext().getCacheDir().getAbsolutePath()); NativeEngine.redirectDirectory(info.dataDir + "/code_cache/", VirtualCore.get().getContext().getCodeCacheDir().getAbsolutePath()); RedirectSameDstPaths(Collections.singletonList(""), VEnvironment.getCacheDirectory().getAbsolutePath()); RedirectSameDstPaths(getProcPIDList(), RootDirKiller);