Do not use passive GPS data for COARSE only apps.
FusionEngine now attaches a secondary location that has never seen GPS data to its result. LocationFudger uses the GPS-less location so that COARSE apps never see data from the GPS provider. When the previous location is updated, the previous GPS-less location is carried over if the location update was GPS-only. Additionally, apps without FINE permission are not notified when GPS location changes, and any attempt to use GPS_PROVIDER without FINE permission is met by a stern SecurityException. Bug: 7153659 Change-Id: I12f26725782892038ce1133561e1908d91378a4a
This commit is contained in:
@@ -59,6 +59,16 @@ public class Location implements Parcelable {
|
||||
*/
|
||||
public static final int FORMAT_SECONDS = 2;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final String EXTRA_COARSE_LOCATION = "coarseLocation";
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public static final String EXTRA_NO_GPS_LOCATION = "noGPSLocation";
|
||||
|
||||
private String mProvider;
|
||||
private long mTime = 0;
|
||||
private long mElapsedRealtimeNano = 0;
|
||||
@@ -897,4 +907,36 @@ public class Location implements Parcelable {
|
||||
parcel.writeFloat(mAccuracy);
|
||||
parcel.writeBundle(mExtras);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one of the optional extra {@link Location}s that can be attached
|
||||
* to this Location.
|
||||
*
|
||||
* @param key the key associated with the desired extra Location
|
||||
* @return the extra Location, or null if unavailable
|
||||
* @hide
|
||||
*/
|
||||
public Location getExtraLocation(String key) {
|
||||
if (mExtras != null) {
|
||||
Parcelable value = mExtras.getParcelable(key);
|
||||
if (value instanceof Location) {
|
||||
return (Location) value;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attaches an extra {@link Location} to this Location.
|
||||
*
|
||||
* @param key the key associated with the Location extra
|
||||
* @param location the Location to attach
|
||||
* @hide
|
||||
*/
|
||||
public void setExtraLocation(String key, Location value) {
|
||||
if (mExtras == null) {
|
||||
mExtras = new Bundle();
|
||||
}
|
||||
mExtras.putParcelable(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user