summaryrefslogtreecommitdiffstats
path: root/location
diff options
context:
space:
mode:
authorDavid Christie <dnchrist@google.com>2013-07-19 11:31:42 -0700
committerDavid Christie <dnchrist@google.com>2013-07-22 16:50:13 -0700
commit82edc9b3482307a8e93655aadabb4f9ad24efe46 (patch)
treecb82eabd1b6c11293eb6cb0dbea2e6ad00ca7d2b /location
parent757ec7837db85eae675cda5cfaf94040268327fd (diff)
downloadframeworks_base-82edc9b3482307a8e93655aadabb4f9ad24efe46.zip
frameworks_base-82edc9b3482307a8e93655aadabb4f9ad24efe46.tar.gz
frameworks_base-82edc9b3482307a8e93655aadabb4f9ad24efe46.tar.bz2
Add WorkSource capability to LocationManager
Change-Id: I0fbbad0879b87ecc75a503bf7963356595bf4b96
Diffstat (limited to 'location')
-rw-r--r--location/java/android/location/LocationRequest.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java
index 68f540b..5ebba93 100644
--- a/location/java/android/location/LocationRequest.java
+++ b/location/java/android/location/LocationRequest.java
@@ -19,6 +19,7 @@ package android.location;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
+import android.os.WorkSource;
import android.util.TimeUtils;
@@ -145,6 +146,7 @@ public final class LocationRequest implements Parcelable {
private long mExpireAt = Long.MAX_VALUE; // no expiry
private int mNumUpdates = Integer.MAX_VALUE; // no expiry
private float mSmallestDisplacement = 0.0f; // meters
+ private WorkSource mWorkSource = new WorkSource();
private String mProvider = LocationManager.FUSED_PROVIDER; // for deprecated APIs that explicitly request a provider
@@ -233,6 +235,7 @@ public final class LocationRequest implements Parcelable {
mNumUpdates = src.mNumUpdates;
mSmallestDisplacement = src.mSmallestDisplacement;
mProvider = src.mProvider;
+ mWorkSource = src.mWorkSource;
}
/**
@@ -493,6 +496,16 @@ public final class LocationRequest implements Parcelable {
return mSmallestDisplacement;
}
+ /** @hide */
+ public void setWorkSource(WorkSource workSource) {
+ mWorkSource = workSource;
+ }
+
+ /** @hide */
+ public WorkSource getWorkSource() {
+ return mWorkSource;
+ }
+
private static void checkInterval(long millis) {
if (millis < 0) {
throw new IllegalArgumentException("invalid interval: " + millis);
@@ -538,6 +551,8 @@ public final class LocationRequest implements Parcelable {
request.setSmallestDisplacement(in.readFloat());
String provider = in.readString();
if (provider != null) request.setProvider(provider);
+ WorkSource workSource = in.readParcelable(WorkSource.class.getClassLoader());
+ if (workSource != null) request.setWorkSource(workSource);
return request;
}
@Override
@@ -560,6 +575,7 @@ public final class LocationRequest implements Parcelable {
parcel.writeInt(mNumUpdates);
parcel.writeFloat(mSmallestDisplacement);
parcel.writeString(mProvider);
+ parcel.writeParcelable(mWorkSource, 0);
}
/** @hide */