@Override protected void after(MethodHookParam param) throws Throwable { if (mMethod != Methods.addGeofence && mMethod != Methods.addNmeaListener && mMethod != Methods.addProximityAlert && mMethod != Methods.removeUpdates && mMethod != Methods.requestLocationUpdates && mMethod != Methods.requestSingleUpdate) if (mMethod == Methods.isProviderEnabled) { if (isRestricted(param)) param.setResult(false); } else if (mMethod == Methods.getGpsStatus) { if (param.getResult() != null && isRestricted(param)) { GpsStatus status = (GpsStatus) param.getResult(); // private GpsSatellite mSatellites[] try { Field mSatellites = status.getClass().getDeclaredField("mSatellites"); mSatellites.setAccessible(true); mSatellites.set(status, new GpsSatellite[0]); } catch (Throwable ex) { Util.bug(null, ex); } } } else if (mMethod == Methods.getLastLocation || mMethod == Methods.getLastKnownLocation) { Location location = (Location) param.getResult(); if (location != null && isRestricted(param)) param.setResult(PrivacyManager.getDefacedLocation(Binder.getCallingUid(), location)); } else if (mMethod == Methods.getProviders) { if (param.getResult() != null && isRestricted(param)) param.setResult(new ArrayList<String>()); } else if (mMethod == Methods.sendExtraCommand) { if (isRestricted(param)) param.setResult(false); } else Util.log(this, Log.WARN, "Unknown method=" + param.method.getName()); }