private void notifyLocation(Map listeners) { if (listeners != null) { try { if (!listeners.isEmpty()) { VLocation vLocation = VirtualLocationManager.get().getLocation(); if (vLocation != null) { Location location = vLocation.toSysLocation(); //noinspection unchecked Set<Map.Entry> entries = listeners.entrySet(); for (Map.Entry entry : entries) { Object value = entry.getValue(); if (value != null) { try { LocationManager.ListenerTransport.onLocationChanged.call(value, location); } catch (Throwable e) { e.printStackTrace(); } } } } } } catch (Throwable e) { e.printStackTrace(); } } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { List<VCell> cells = VirtualLocationManager.get().getAllCell(getAppUserId(), getAppPkg()); if (cells != null) { List<CellInfo> result = new ArrayList<CellInfo>(); for (VCell cell : cells) { result.add(createCellInfo(cell)); } return result; } } return super.call(who, method, args); } }
VirtualLocationManager locationManager = VirtualLocationManager.get(); if (locationManager.getMode(userId, info.packageName) <= 0) { locationManager.setMode(userId, info.packageName, 1); locationManager.setGlobalCell(new VCell()); locationManager.setGlobalLocation(new VLocation()); locationManager.setGlobalNeighboringCell(new ArrayList<>());
private void readLocation(LocationData locationData) { locationData.mode = VirtualLocationManager.get().getMode(locationData.userId, locationData.packageName); locationData.location = VirtualLocationManager.get().getLocation(locationData.userId, locationData.packageName); }
private void saveLocation(LocationData locationData) { if(locationData.location == null||locationData.location.isEmpty()){ VirtualLocationManager.get().setMode(locationData.userId, locationData.packageName, 0); }else if(locationData.mode != 2){ VirtualLocationManager.get().setMode(locationData.userId, locationData.packageName, 2); } VirtualLocationManager.get().setLocation(locationData.userId, locationData.packageName, locationData.location); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { VCell cell = VirtualLocationManager.get().getCell(getAppUserId(), getAppPkg()); if (cell != null) { return getCellLocationInternal(cell); } } return super.call(who, method, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { List<VCell> cells = VirtualLocationManager.get().getNeighboringCell(getAppUserId(), getAppPkg()); if (cells != null) { List<NeighboringCellInfo> infos = new ArrayList<>(); for (VCell cell : cells) { NeighboringCellInfo info = new NeighboringCellInfo(); mirror.android.telephony.NeighboringCellInfo.mLac.set(info, cell.lac); mirror.android.telephony.NeighboringCellInfo.mCid.set(info, cell.cid); mirror.android.telephony.NeighboringCellInfo.mRssi.set(info, 6); infos.add(info); } return infos; } } return super.call(who, method, args); } }
public List<VCell> getNeighboringCell(int userId, String pkg) { try { return getRemote().getNeighboringCell(userId, pkg); } catch (RemoteException e) { return VirtualRuntime.crash(e); } }
public int getMode() { return getMode(MethodProxy.getAppUserId(), MethodProxy.getAppPkg()); }
public VLocation getLocation() { return getLocation(MethodProxy.getAppUserId(), MethodProxy.getAppPkg()); }
public IVirtualLocationManager getRemote() { if (mRemote == null || (!mRemote.asBinder().pingBinder() && !VirtualCore.get().isVAppProcess())) { synchronized (this) { Object remote = getRemoteInterface(); mRemote = LocalProxyUtils.genProxy(IVirtualLocationManager.class, remote); } } return mRemote; }
private void readLocation(LocationData locationData) { locationData.mode = VirtualLocationManager.get().getMode(locationData.userId, locationData.packageName); locationData.location = VirtualLocationManager.get().getLocation(locationData.userId, locationData.packageName); }
private void saveLocation(LocationData locationData) { if (locationData.location == null || locationData.location.isEmpty()) { VirtualLocationManager.get().setMode(locationData.userId, locationData.packageName, 0); } else if (locationData.mode != 2) { VirtualLocationManager.get().setMode(locationData.userId, locationData.packageName, 2); } VirtualLocationManager.get().setLocation(locationData.userId, locationData.packageName, locationData.location); }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { VCell cell = VirtualLocationManager.get().getCell(getAppUserId(), getAppPkg()); if (cell != null) { return getCellLocationInternal(cell); } } return super.call(who, method, args); } }
@Override public Object call(Object who, Method method, Object... args) throws Throwable { if (isFakeLocationEnable()) { List<VCell> cells = VirtualLocationManager.get().getNeighboringCell(getAppUserId(), getAppPkg()); if (cells != null) { List<NeighboringCellInfo> infos = new ArrayList<>(); for (VCell cell : cells) { NeighboringCellInfo info = new NeighboringCellInfo(); mirror.android.telephony.NeighboringCellInfo.mLac.set(info, cell.lac); mirror.android.telephony.NeighboringCellInfo.mCid.set(info, cell.cid); mirror.android.telephony.NeighboringCellInfo.mRssi.set(info, 6); infos.add(info); } return infos; } } return super.call(who, method, args); } }
public VCell getCell(int userId, String pkg) { try { return getRemote().getCell(userId, pkg); } catch (RemoteException e) { return VirtualRuntime.crash(e); } }
public int getMode() { return getMode(MethodProxy.getAppUserId(), MethodProxy.getAppPkg()); }
public VLocation getLocation() { return getLocation(MethodProxy.getAppUserId(), MethodProxy.getAppPkg()); }
public IVirtualLocationManager getRemote() { if (mRemote == null || (!mRemote.asBinder().pingBinder() && !VirtualCore.get().isVAppProcess())) { synchronized (this) { Object remote = getRemoteInterface(); mRemote = LocalProxyUtils.genProxy(IVirtualLocationManager.class, remote); } } return mRemote; }