diff options
author | David Christie <dnchrist@google.com> | 2013-07-30 11:36:48 -0700 |
---|---|---|
committer | David Christie <dnchrist@google.com> | 2013-08-01 14:31:48 -0700 |
commit | 40e5782f5c79ea660b98b8875086f592367bc1d2 (patch) | |
tree | 8fdfd3a5bbe90b996c71e933230b7138505fdaa7 /location/java | |
parent | 930524ade21464a4f8cbbf80fed7039f4e813965 (diff) | |
download | frameworks_base-40e5782f5c79ea660b98b8875086f592367bc1d2.zip frameworks_base-40e5782f5c79ea660b98b8875086f592367bc1d2.tar.gz frameworks_base-40e5782f5c79ea660b98b8875086f592367bc1d2.tar.bz2 |
Allow a particular LocationRequest to be excluded from
AppOps monitoring as long as the client as the appropriate
permission (UPDATE_DEVICE_STATS).
Change-Id: I7223a53bc1551e6498302a22eb310c8c5b5684b0
Diffstat (limited to 'location/java')
-rw-r--r-- | location/java/android/location/LocationRequest.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java index 5ebba93..ee748d39 100644 --- a/location/java/android/location/LocationRequest.java +++ b/location/java/android/location/LocationRequest.java @@ -147,6 +147,7 @@ public final class LocationRequest implements Parcelable { private int mNumUpdates = Integer.MAX_VALUE; // no expiry private float mSmallestDisplacement = 0.0f; // meters private WorkSource mWorkSource = new WorkSource(); + private boolean mHideFromAppOps = false; // True if this request shouldn't be counted by AppOps private String mProvider = LocationManager.FUSED_PROVIDER; // for deprecated APIs that explicitly request a provider @@ -236,6 +237,7 @@ public final class LocationRequest implements Parcelable { mSmallestDisplacement = src.mSmallestDisplacement; mProvider = src.mProvider; mWorkSource = src.mWorkSource; + mHideFromAppOps = src.mHideFromAppOps; } /** @@ -506,6 +508,16 @@ public final class LocationRequest implements Parcelable { return mWorkSource; } + /** @hide */ + public void setHideFromAppOps(boolean hideFromAppOps) { + mHideFromAppOps = hideFromAppOps; + } + + /** @hide */ + public boolean getHideFromAppOps() { + return mHideFromAppOps; + } + private static void checkInterval(long millis) { if (millis < 0) { throw new IllegalArgumentException("invalid interval: " + millis); @@ -549,6 +561,7 @@ public final class LocationRequest implements Parcelable { request.setExpireAt(in.readLong()); request.setNumUpdates(in.readInt()); request.setSmallestDisplacement(in.readFloat()); + request.setHideFromAppOps(in.readInt() != 0); String provider = in.readString(); if (provider != null) request.setProvider(provider); WorkSource workSource = in.readParcelable(WorkSource.class.getClassLoader()); @@ -574,6 +587,7 @@ public final class LocationRequest implements Parcelable { parcel.writeLong(mExpireAt); parcel.writeInt(mNumUpdates); parcel.writeFloat(mSmallestDisplacement); + parcel.writeInt(mHideFromAppOps ? 1 : 0); parcel.writeString(mProvider); parcel.writeParcelable(mWorkSource, 0); } |