@Override public void setGlobalCell(VCell cell) throws RemoteException { mGlobalConfig.cell = cell; mPersistenceLayer.save(); }
private VirtualLocationService() { mPersistenceLayer.read(); }
public void save() { Parcel p = Parcel.obtain(); try { writeMagic(p); p.writeInt(getCurrentVersion()); writePersistenceData(p); FileOutputStream fos = new FileOutputStream(mPersistenceFile); fos.write(p.marshall()); fos.close(); } catch (Exception e) { e.printStackTrace(); } finally { p.recycle(); } }
if (!verifyMagic(p)) { onPersistenceFileDamage(); throw new IOException("Invalid persistence file."); int currentVersion = getCurrentVersion(); if (fileVersion != getCurrentVersion()) { if (!onVersionConflict(fileVersion, currentVersion)) { throw new IOException("Unable to process the bad version persistence file."); readPersistenceData(p); } catch (Exception e) { if (!(e instanceof FileNotFoundException)) {
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); NativeLibraryHelperCompat.copyNativeBinaries(new File(path), libDir); if (!dependSystem) { File privatePackageFile = new File(appDir, "base.apk"); File parentFolder = privatePackageFile.getParentFile(); if (!parentFolder.exists() && !parentFolder.mkdirs()) { VLog.w(TAG, "Warning: unable to create folder : " + privatePackageFile.getPath()); } else if (privatePackageFile.exists() && !privatePackageFile.delete()) { VLog.w(TAG, "Warning: unable to delete file : " + privatePackageFile.getPath()); FileUtils.copyFile(packageFile, privatePackageFile); } catch (IOException e) { privatePackageFile.delete(); if (VirtualRuntime.isArt()) { try { ArtDexOptimizer.compileDex2Oat(ps.apkPath, VEnvironment.getOdexFile(ps.packageName).getPath()); } catch (IOException e) { e.printStackTrace();
pb.redirectErrorStream(true); final Process dex2oatProcess = pb.start(); StreamConsumer.consumeInputStream(dex2oatProcess.getInputStream()); StreamConsumer.consumeInputStream(dex2oatProcess.getErrorStream()); try { final int ret = dex2oatProcess.waitFor();
@Override public void setGlobalAllCell(List<VCell> cell) throws RemoteException { mGlobalConfig.allCell = cell; mPersistenceLayer.save(); }
@Override public void setGlobalNeighboringCell(List<VCell> cell) throws RemoteException { mGlobalConfig.neighboringCell = cell; mPersistenceLayer.save(); }
@Override public void setLocation(int userId, String pkg, VLocation loc) throws RemoteException { getOrCreateConfig(userId, pkg).location = loc; mPersistenceLayer.save(); }
@Override public int getMode(int userId, String pkg) throws RemoteException { synchronized (mLocConfigs) { VLocConfig config = getOrCreateConfig(userId, pkg); mPersistenceLayer.save(); return config.mode; } }
@Override public void setCell(int userId, String pkg, VCell cell) throws RemoteException { getOrCreateConfig(userId, pkg).cell = cell; mPersistenceLayer.save(); }
@Override public void setNeighboringCell(int userId, String pkg, List<VCell> cell) throws RemoteException { getOrCreateConfig(userId, pkg).neighboringCell = cell; mPersistenceLayer.save(); }
@Override public void setMode(int userId, String pkg, int mode) throws RemoteException { synchronized (mLocConfigs) { getOrCreateConfig(userId, pkg).mode = mode; mPersistenceLayer.save(); } }
@Override public void setAllCell(int userId, String pkg, List<VCell> cell) throws RemoteException { getOrCreateConfig(userId, pkg).allCell = cell; mPersistenceLayer.save(); }
@Override public VLocation getLocation(int userId, String pkg) throws RemoteException { VLocConfig config = getOrCreateConfig(userId, pkg); mPersistenceLayer.save(); switch (config.mode) { case MODE_USE_SELF: return config.location; case MODE_USE_GLOBAL: return mGlobalConfig.location; case MODE_CLOSE: default: return null; } }
@Override public VCell getCell(int userId, String pkg) throws RemoteException { VLocConfig config = getOrCreateConfig(userId, pkg); mPersistenceLayer.save(); switch (config.mode) { case MODE_USE_SELF: return config.cell; case MODE_USE_GLOBAL: return mGlobalConfig.cell; case MODE_CLOSE: default: return null; } }
@Override public List<VCell> getAllCell(int userId, String pkg) throws RemoteException { VLocConfig config = getOrCreateConfig(userId, pkg); mPersistenceLayer.save(); switch (config.mode) { case MODE_USE_SELF: return config.allCell; case MODE_USE_GLOBAL: return mGlobalConfig.allCell; case MODE_CLOSE: default: return null; } }
@Override public List<VCell> getNeighboringCell(int userId, String pkg) throws RemoteException { VLocConfig config = getOrCreateConfig(userId, pkg); mPersistenceLayer.save(); switch (config.mode) { case MODE_USE_SELF: return config.neighboringCell; case MODE_USE_GLOBAL: return mGlobalConfig.neighboringCell; case MODE_CLOSE: default: return null; } }
@Override public void setGlobalAllCell(List<VCell> cell) throws RemoteException { mGlobalConfig.allCell = cell; mPersistenceLayer.save(); }
@Override public void setGlobalNeighboringCell(List<VCell> cell) throws RemoteException { mGlobalConfig.neighboringCell = cell; mPersistenceLayer.save(); }