@Override public void updateDeviceInfo(int userId, VDeviceInfo info) throws RemoteException { synchronized (mDeviceInfos) { if (info != null) { mDeviceInfos.put(userId, info); mPersistenceLayer.save(); } } }
private VLocConfig getOrCreateConfig(int userId, String pkg) { Map<String, VLocConfig> pkgs = mLocConfigs.get(userId); if (pkgs == null) { pkgs = new HashMap<>(); mLocConfigs.put(userId, pkgs); } VLocConfig config = pkgs.get(pkg); if (config == null) { config = new VLocConfig(); config.mode = MODE_CLOSE; pkgs.put(pkg, config); } return config; }
@Override public void readPersistenceData(Parcel p) { SparseArray<VDeviceInfo> infos = mService.getDeviceInfos(); infos.clear(); int size = p.readInt(); while (size-- > 0) { int userId = p.readInt(); VDeviceInfo info = new VDeviceInfo(p); infos.put(userId, info); } }
@Override public void readPersistenceData(Parcel p) { mGlobalConfig.set(new VLocConfig(p)); mLocConfigs.clear(); int size = p.readInt(); while (size-- > 0) { int userId = p.readInt(); //noinspection unchecked Map<String, VLocConfig> pkgs = p.readHashMap(getClass().getClassLoader()); mLocConfigs.put(userId, pkgs); } } };
/** * Puts a key/value pair into the array, optimizing for the case where * the key is greater than all existing keys in the array. */ public void append(int key, E value) { if (mSize != 0 && key <= mKeys[mSize - 1]) { put(key, value); return; } if (mGarbage && mSize >= mKeys.length) { gc(); } int pos = mSize; if (pos >= mKeys.length) { int n = ContainerHelpers.idealIntArraySize(pos + 1); int[] nkeys = new int[n]; Object[] nvalues = new Object[n]; // Log.e("SparseArray", "grow " + mKeys.length + " to " + n); System.arraycopy(mKeys, 0, nkeys, 0, mKeys.length); System.arraycopy(mValues, 0, nvalues, 0, mValues.length); mKeys = nkeys; mValues = nvalues; } mKeys[pos] = key; mValues[pos] = value; mSize = pos + 1; }
public E put(String name, int uid, E value) { SparseArray<E> uids = mMap.get(name); if (uids == null) { uids = new SparseArray<E>(2); mMap.put(name, uids); } uids.put(uid, value); return value; }
@Override public VDeviceInfo getDeviceInfo(int userId) throws RemoteException { VDeviceInfo info; synchronized (mDeviceInfos) { info = mDeviceInfos.get(userId); if (info == null) { info = generateDeviceInfo(); mDeviceInfos.put(userId, info); mPersistenceLayer.save(); } } return info; }
synchronized (mProcessNames) { mProcessNames.put(app.processName, app.vuid, app); mPidsSelfLocked.put(app.pid, app);
mJobSessions.put(jobId, session); } else { emptyCallback(callback, jobId);
@Override public void updateDeviceInfo(int userId, VDeviceInfo info) { synchronized (mDeviceInfos) { if (info != null) { mDeviceInfos.put(userId, info); mPersistenceLayer.save(); } } }
@Override public void updateDeviceInfo(int userId, VDeviceInfo info) { synchronized (mDeviceInfos) { if (info != null) { mDeviceInfos.put(userId, info); mPersistenceLayer.save(); } } }
public ServerInterface(Class<?> interfaceClass) { this.interfaceClass = interfaceClass; Method[] methods = interfaceClass.getMethods(); codeToInterfaceMethod = new SparseArray<>(methods.length); methodToIPCMethodMap = new HashMap<>(methods.length); for (int i = 0; i < methods.length; i++) { int code = Binder.FIRST_CALL_TRANSACTION + i; IPCMethod ipcMethod = new IPCMethod(code, methods[i], interfaceClass.getName()); codeToInterfaceMethod.put(code, ipcMethod); methodToIPCMethodMap.put(methods[i], ipcMethod); } }
private VLocConfig getOrCreateConfig(int userId, String pkg) { Map<String, VLocConfig> pkgs = mLocConfigs.get(userId); if (pkgs == null) { pkgs = new HashMap<>(); mLocConfigs.put(userId, pkgs); } VLocConfig config = pkgs.get(pkg); if (config == null) { config = new VLocConfig(); config.mode = MODE_CLOSE; pkgs.put(pkg, config); } return config; }
@Override public void readPersistenceData(Parcel p) { SparseArray<VDeviceInfo> infos = mService.getDeviceInfos(); infos.clear(); int size = p.readInt(); while (size-- > 0) { int userId = p.readInt(); VDeviceInfo info = new VDeviceInfo(p); infos.put(userId, info); } }
@Override public void readPersistenceData(Parcel p) { mGlobalConfig.set(new VLocConfig(p)); mLocConfigs.clear(); int size = p.readInt(); while (size-- > 0) { int userId = p.readInt(); //noinspection unchecked Map<String, VLocConfig> pkgs = p.readHashMap(getClass().getClassLoader()); mLocConfigs.put(userId, pkgs); } } };
@Override public void readPersistenceData(Parcel p) { SparseArray<VDeviceInfo> infos = mService.getDeviceInfos(); infos.clear(); int size = p.readInt(); while (size-- > 0) { int userId = p.readInt(); VDeviceInfo info = new VDeviceInfo(p); infos.put(userId, info); } }
@Override public void readPersistenceData(Parcel p) { mGlobalConfig.set(new VLocConfig(p)); mLocConfigs.clear(); int size = p.readInt(); while (size-- > 0) { int userId = p.readInt(); //noinspection unchecked Map<String, VLocConfig> pkgs = p.readHashMap(getClass().getClassLoader()); mLocConfigs.put(userId, pkgs); } } };
public E put(String name, int uid, E value) { SparseArray<E> uids = mMap.get(name); if (uids == null) { uids = new SparseArray<E>(2); mMap.put(name, uids); } uids.put(uid, value); return value; }
@Override public VDeviceInfo getDeviceInfo(int userId) { VDeviceInfo info; synchronized (mDeviceInfos) { info = mDeviceInfos.get(userId); if (info == null) { info = generateRandomDeviceInfo(); mDeviceInfos.put(userId, info); mPersistenceLayer.save(); } } return info; }
public E put(String name, int uid, E value) { SparseArray<E> uids = mMap.get(name); if (uids == null) { uids = new SparseArray<E>(2); mMap.put(name, uids); } uids.put(uid, value); return value; }