diff options
author | Victoria Lease <violets@google.com> | 2012-09-23 15:06:58 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-23 15:06:59 -0700 |
commit | 17e3e9e53c5fb9c92c8972a8d92659c6bef85831 (patch) | |
tree | e7d429e36069f950f9c2b47ed66b55acf4fb0a87 /location/java/android | |
parent | e3f2ac9e526e5b4de4d2ae113e644c1cb14b1ce6 (diff) | |
parent | 09016ab4dd056a16809419d612cb865a14980880 (diff) | |
download | frameworks_base-17e3e9e53c5fb9c92c8972a8d92659c6bef85831.zip frameworks_base-17e3e9e53c5fb9c92c8972a8d92659c6bef85831.tar.gz frameworks_base-17e3e9e53c5fb9c92c8972a8d92659c6bef85831.tar.bz2 |
Merge "Do not use passive GPS data for COARSE only apps." into jb-mr1-dev
Diffstat (limited to 'location/java/android')
-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 2d94ddc..672e378 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; @@ -893,4 +903,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. |