Tabnine Logo
VEnvironment
Code IndexAdd Tabnine to your IDE (free)

How to use
VEnvironment
in
com.lody.virtual.os

Best Java code snippets using com.lody.virtual.os.VEnvironment (Showing top 20 results out of 315)

origin: android-hacker/VirtualXposed

public static File getDataAppPackageDirectory(String packageName) {
  return ensureCreated(new File(getDataAppDirectory(), packageName));
}
origin: android-hacker/VirtualXposed

/**
 * Serializing all accounts
 */
private void saveAllAccounts() {
  File accountFile = VEnvironment.getAccountConfigFile();
  Parcel dest = Parcel.obtain();
  try {
    dest.writeInt(1);
    List<VAccount> accounts = new ArrayList<>();
    for (int i = 0; i < this.accountsByUserId.size(); i++) {
      List<VAccount> list = this.accountsByUserId.valueAt(i);
      if (list != null) {
        accounts.addAll(list);
      }
    }
    dest.writeInt(accounts.size());
    for (VAccount account : accounts) {
      account.writeToParcel(dest, 0);
    }
    dest.writeLong(lastAccountChangeTime);
    FileOutputStream fileOutputStream = new FileOutputStream(accountFile);
    fileOutputStream.write(dest.marshall());
    fileOutputStream.close();
  } catch (Exception e) {
    e.printStackTrace();
  }
  dest.recycle();
}
origin: android-hacker/VirtualXposed

@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();
}
origin: android-hacker/VirtualXposed

public static File getAppLibDirectory(String packageName) {
  return ensureCreated(new File(getDataAppPackageDirectory(packageName), "lib"));
}
origin: android-hacker/VirtualXposed

public static File getDataUserPackageDirectory(int userId,
                        String packageName) {
  return ensureCreated(new File(getUserSystemDirectory(userId), packageName));
}
origin: android-hacker/VirtualXposed

private void uninstallPackageFully(PackageSetting ps) {
  String packageName = ps.packageName;
  try {
    BroadcastSystem.get().stopApp(packageName);
    VActivityManagerService.get().killAppByPkg(packageName, VUserHandle.USER_ALL);
    VEnvironment.getPackageResourcePath(packageName).delete();
    FileUtils.deleteDir(VEnvironment.getDataAppPackageDirectory(packageName));
    VEnvironment.getOdexFile(packageName).delete();
    for (int id : VUserManagerService.get().getUserIds()) {
      FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(id, packageName));
      FileUtils.deleteDir(VEnvironment.getVirtualPrivateStorageDir(id, packageName));
    }
    PackageCacheManager.remove(packageName);
  } catch (Exception e) {
    e.printStackTrace();
  } finally {
    notifyAppUninstalled(ps, -1);
  }
}
origin: android-hacker/VirtualXposed

void restoreFactoryState() {
  VLog.w(TAG, "Warning: Restore the factory state...");
  VEnvironment.getDalvikCacheDirectory().delete();
  VEnvironment.getUserSystemDirectory().delete();
  VEnvironment.getDataAppDirectory().delete();
}
origin: android-hacker/VirtualXposed

public void initUidList() {
  mSharedUserIdMap.clear();
  File uidFile = VEnvironment.getUidListFile();
  if (!loadUidList(uidFile)) {
    File bakUidFile = VEnvironment.getBakUidListFile();
    loadUidList(bakUidFile);
  }
}
origin: android-hacker/VirtualXposed

@Override
public boolean clearPackage(String packageName) throws RemoteException {
  try {
    BroadcastSystem.get().stopApp(packageName);
    VActivityManagerService.get().killAppByPkg(packageName, VUserHandle.USER_ALL);
    for (int id : VUserManagerService.get().getUserIds()) {
      FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(id, packageName));
      FileUtils.deleteDir(VEnvironment.getVirtualPrivateStorageDir(id, packageName));
    }
    return true;
  } catch (Exception e) {
    return false;
  }
}
origin: android-hacker/VirtualXposed

public static File getOdexFile(String packageName) {
  if (isAndroidO()) {
    // in Android O, the oatfile is relate with classloader, we must ensure the correct location to avoid repeated load dex.
    String instructionSet = VMRuntime.getCurrentInstructionSet.call();
    File oatDir = ensureCreated(new File(getDataAppPackageDirectory(packageName), "oat" + File.separator + instructionSet));
    return new File(oatDir, EncodeUtils.decode("YmFzZS5vZGV4")); // base.odex
  } else {
    // return new File(DALVIK_CACHE_DIRECTORY, "data@app@" + packageName + "-1@base.apk@classes.dex");
    return new File(DALVIK_CACHE_DIRECTORY, EncodeUtils.decode("ZGF0YUBhcHBA") +
        packageName +
        EncodeUtils.decode("LTFAYmFzZS5hcGtAY2xhc3Nlcy5kZXg="));
  }
}
origin: android-hacker/VirtualXposed

public static File getDataAppDirectory() {
  return ensureCreated(new File(getDataDirectory(), "app"));
}
origin: android-hacker/VirtualXposed

File appDir = VEnvironment.getDataAppPackageDirectory(pkg.packageName);
File libDir = new File(appDir, "lib");
if (res.isUpdate) {
  FileUtils.deleteDir(libDir);
  VEnvironment.getOdexFile(pkg.packageName).delete();
  VActivityManagerService.get().killAppByPkg(pkg.packageName, VUserHandle.USER_ALL);
  if (VirtualRuntime.isArt()) {
    try {
      ArtDexOptimizer.compileDex2Oat(ps.apkPath, VEnvironment.getOdexFile(ps.packageName).getPath());
    } catch (IOException e) {
      e.printStackTrace();
      DexFile.loadDex(ps.apkPath, VEnvironment.getOdexFile(ps.packageName).getPath(), 0).close();
    } catch (IOException e) {
      e.printStackTrace();
origin: android-hacker/VirtualXposed

public static File getPackageCacheFile(String packageName) {
  return new File(getDataAppPackageDirectory(packageName), "package.ini");
}
origin: darkskygit/VirtualApp

  NativeEngine.redirectDirectory("/data/user_de/0/" + info.packageName, info.dataDir);
String libPath = VEnvironment.getAppLibDirectory(info.packageName).getAbsolutePath();
String TencentDirRedirect = new File(VEnvironment.getUserDirectory(), info.packageName + (userId == 0 ? "" : String.valueOf(userId))).getAbsolutePath();
String RootDirKiller = "/system/lost+found"; // VEnvironment.getUserDirectory() + "/.nomedia"
if (!info.packageName.contains("tencent")) TencentDirRedirect = RootDirKiller;
RedirectSameDstPaths(Arrays.asList(new File(VEnvironment.getUserSystemDirectory(userId), info.packageName + "/lib").getAbsolutePath(),
    "/data/data/" + info.packageName + "/lib/", "/data/user/0/" + info.packageName + "/lib/"), libPath);
RedirectSDCardPaths(new HashMap<String, String>() {{
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);
origin: android-hacker/VirtualXposed

public static File getPackageInstallerStageDir() {
  return ensureCreated(new File(DATA_DIRECTORY, ".session_dir"));
}
origin: android-hacker/VirtualXposed

public static File getVirtualStorageDir(String packageName, int userId) {
  File virtualStorageBaseDir = getVirtualStorageBaseDir();
  // Apps may share sdcard files, we can not separate them by package.
  if (virtualStorageBaseDir == null) {
    return null;
  }
  File userBase = new File(virtualStorageBaseDir, String.valueOf(userId));
  return ensureCreated(userBase);
}
origin: android-hacker/VirtualXposed

public static File getVirtualPrivateStorageDir(int userId, String packageName) {
  File file = new File(getVirtualPrivateStorageDir(userId), packageName);
  return ensureCreated(file);
}
origin: bzsome/VirtualApp-x326

private void cleanUpResidualFiles(PackageSetting ps) {
  File dataAppDir = VEnvironment.getDataAppPackageDirectory(ps.packageName);
  FileUtils.deleteDir(dataAppDir);
  for (int userId : VUserManagerService.get().getUserIds()) {
    FileUtils.deleteDir(VEnvironment.getDataUserPackageDirectory(userId, ps.packageName));
  }
}
origin: android-hacker/VirtualXposed

private static void initApplicationAsUser(ApplicationInfo ai, int userId) {
  ai.dataDir = VEnvironment.getDataUserPackageDirectory(userId, ai.packageName).getPath();
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    ApplicationInfoL.scanSourceDir.set(ai, ai.dataDir);
    ApplicationInfoL.scanPublicSourceDir.set(ai, ai.dataDir);
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
    if(Build.VERSION.SDK_INT < 26) {
      ApplicationInfoN.deviceEncryptedDataDir.set(ai, ai.dataDir);
      ApplicationInfoN.credentialEncryptedDataDir.set(ai, ai.dataDir);
    }
    ApplicationInfoN.deviceProtectedDataDir.set(ai, ai.dataDir);
    ApplicationInfoN.credentialProtectedDataDir.set(ai, ai.dataDir);
  }
}
origin: bzsome/VirtualApp-x326

  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);
com.lody.virtual.osVEnvironment

Most used methods

  • ensureCreated
  • getAccountConfigFile
  • getAppLibDirectory
  • getBakUidListFile
  • getDalvikCacheDirectory
  • getDataAppDirectory
  • getDataAppPackageDirectory
  • getDataDirectory
  • getDataUserPackageDirectory
  • getDeviceInfoFile
  • getJobConfigFile
  • getOdexFile
  • getJobConfigFile,
  • getOdexFile,
  • getPackageCacheFile,
  • getPackageInstallerStageDir,
  • getPackageListFile,
  • getPackageResourcePath,
  • getSignatureFile,
  • getSystemSecureDirectory,
  • getUidListFile,
  • getUserSystemDirectory

Popular in Java

  • Making http post requests using okhttp
  • findViewById (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Notification (javax.management)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now