diff options
author | Victoria Lease <violets@google.com> | 2012-09-16 12:33:15 -0700 |
---|---|---|
committer | Victoria Lease <violets@google.com> | 2012-09-21 13:45:41 -0700 |
commit | 09016ab4dd056a16809419d612cb865a14980880 (patch) | |
tree | e920e568aeac8e75b2f4b9e815047bf7c4a8f2af /location | |
parent | 537d47f510ce49acee09516ed5dde680d910ff94 (diff) | |
download | frameworks_base-09016ab4dd056a16809419d612cb865a14980880.zip frameworks_base-09016ab4dd056a16809419d612cb865a14980880.tar.gz frameworks_base-09016ab4dd056a16809419d612cb865a14980880.tar.bz2 |
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
Diffstat (limited to 'location')
-rw-r--r-- | location/java/android/location/Location.java | 42 | ||||
-rw-r--r-- | location/java/android/location/LocationRequest.java | 2 |
2 files changed, 43 insertions, 1 deletions
diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java index 40cb1a8..f6bf76c 100644 --- a/location/java/android/location/Location.java +++ b/location/java/android/location/Location.java @@ -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); + } } diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java index b1863b8..f4f7b09 100644 --- a/location/java/android/location/LocationRequest.java +++ b/location/java/android/location/LocationRequest.java @@ -144,7 +144,7 @@ public final class LocationRequest implements Parcelable { private int mNumUpdates = Integer.MAX_VALUE; // no expiry private float mSmallestDisplacement = 0.0f; // meters - private String mProvider = null; // for deprecated API's that explicitly request a provider + private String mProvider = LocationManager.FUSED_PROVIDER; // for deprecated APIs that explicitly request a provider /** * Create a location request with default parameters. |