summaryrefslogtreecommitdiff
path: root/location
diff options
context:
space:
mode:
authorDaniel Norman <danielnorman@google.com>2021-06-18 15:33:36 -0700
committerScott Lobdell <slobdell@google.com>2021-06-21 23:21:54 +0000
commitb6d6690a3594cd78966e26508247d4ab1b66776f (patch)
tree43afd0520ff98b8729b5c8f73ef2ee1c7e77041a /location
parent71c831703ae59baf47e0afe611fecd714c481cdf (diff)
parent233ce9ef453bc7b47f7ac5d0eb1d5fda0ce845ab (diff)
Merge SP1A.210616.001
Change-Id: I9acdc955f698dbebb8fad19cfd5cb71fcdd27b45
Diffstat (limited to 'location')
-rw-r--r--location/java/android/location/LocationRequest.java10
-rw-r--r--location/java/android/location/provider/LocationProviderBase.java16
2 files changed, 17 insertions, 9 deletions
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java
index cb56ee5318ee..a3842a1ffd0a 100644
--- a/location/java/android/location/LocationRequest.java
+++ b/location/java/android/location/LocationRequest.java
@@ -178,6 +178,7 @@ public final class LocationRequest implements Parcelable {
public static final int POWER_HIGH = 203;
private static final long IMPLICIT_MIN_UPDATE_INTERVAL = -1;
+ private static final double IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR = 1D / 6D;
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, publicAlternatives = "Use {@link "
+ "LocationManager} methods to provide the provider explicitly.")
@@ -552,7 +553,7 @@ public final class LocationRequest implements Parcelable {
*/
public @IntRange(from = 0) long getMinUpdateIntervalMillis() {
if (mMinUpdateIntervalMillis == IMPLICIT_MIN_UPDATE_INTERVAL) {
- return mInterval;
+ return (long) (mInterval * IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR);
} else {
// the min is only necessary in case someone use a deprecated function to mess with the
// interval or min update interval
@@ -1018,7 +1019,9 @@ public final class LocationRequest implements Parcelable {
* Sets an explicit minimum update interval. If location updates are available faster than
* the request interval then an update will only occur if the minimum update interval has
* expired since the last location update. Defaults to no explicit minimum update interval
- * set, which means the minimum update interval is the same as the interval.
+ * set, which means some sensible default between 0 and the interval will be chosen. The
+ * exact value is not specified at the moment. If an exact known value is required, clients
+ * should set an explicit value themselves.
*
* <p class=note><strong>Note:</strong> Some allowance for jitter is already built into the
* minimum update interval, so you need not worry about updates blocked simply because they
@@ -1037,7 +1040,8 @@ public final class LocationRequest implements Parcelable {
/**
* Clears an explicitly set minimum update interval and reverts to an implicit minimum
- * update interval (ie, the minimum update interval is the same value as the interval).
+ * update interval (ie, the minimum update interval is some sensible default between 0 and
+ * the interval).
*/
public @NonNull Builder clearMinUpdateIntervalMillis() {
mMinUpdateIntervalMillis = IMPLICIT_MIN_UPDATE_INTERVAL;
diff --git a/location/java/android/location/provider/LocationProviderBase.java b/location/java/android/location/provider/LocationProviderBase.java
index eada22cd94dc..88a24794411c 100644
--- a/location/java/android/location/provider/LocationProviderBase.java
+++ b/location/java/android/location/provider/LocationProviderBase.java
@@ -62,6 +62,10 @@ import java.util.Objects;
* <p>The service should have an intent filter in place for the location provider it wishes to
* implements. Defaults for some providers are specified as constants in this class.
*
+ * <p>Location providers are identified by their UID / package name / attribution tag. Based on this
+ * identity, location providers may be given some special privileges (such as making special
+ * requests to other location providers).
+ *
* @hide
*/
@SystemApi
@@ -95,14 +99,14 @@ public abstract class LocationProviderBase {
public static final String ACTION_FUSED_PROVIDER =
"com.android.location.service.FusedLocationProvider";
- private final String mTag;
- private final @Nullable String mAttributionTag;
- private final IBinder mBinder;
+ final String mTag;
+ final @Nullable String mAttributionTag;
+ final IBinder mBinder;
// write locked on mBinder, read lock is optional depending on atomicity requirements
- private @Nullable volatile ILocationProviderManager mManager;
- private volatile ProviderProperties mProperties;
- private volatile boolean mAllowed;
+ volatile @Nullable ILocationProviderManager mManager;
+ volatile ProviderProperties mProperties;
+ volatile boolean mAllowed;
public LocationProviderBase(@NonNull Context context, @NonNull String tag,
@NonNull ProviderProperties properties) {