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)) {
private VirtualLocationService() { mPersistenceLayer.read(); }
@Override public void setGlobalCell(VCell cell) throws RemoteException { mGlobalConfig.cell = cell; mPersistenceLayer.save(); }
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(); } }
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)) {
@Override public void setGlobalAllCell(List<VCell> cell) throws RemoteException { mGlobalConfig.allCell = cell; mPersistenceLayer.save(); }
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(); } }
private VirtualLocationService() { mPersistenceLayer.read(); }
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)) {
@Override public void setGlobalNeighboringCell(List<VCell> cell) throws RemoteException { mGlobalConfig.neighboringCell = cell; mPersistenceLayer.save(); }
private VirtualLocationService() { mPersistenceLayer.read(); }
@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; } }