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:
Victoria Lease
2012-09-16 12:33:15 -07:00
parent 537d47f510
commit 09016ab4dd
6 changed files with 126 additions and 53 deletions

View File

@@ -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);
}
}