Merge "Revert implict min update interval to 1/6 of interval" into sc-dev am: e71b4d16cc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14885606

Change-Id: I9fa48f0abe0999b40e2af4ff53f3640536f3267e
This commit is contained in:
Soonil Nagarkar
2021-06-08 22:44:51 +00:00
committed by Automerger Merge Worker

View File

@@ -178,6 +178,7 @@ public final class LocationRequest implements Parcelable {
public static final int POWER_HIGH = 203; public static final int POWER_HIGH = 203;
private static final long IMPLICIT_MIN_UPDATE_INTERVAL = -1; 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 " @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, publicAlternatives = "Use {@link "
+ "LocationManager} methods to provide the provider explicitly.") + "LocationManager} methods to provide the provider explicitly.")
@@ -552,7 +553,7 @@ public final class LocationRequest implements Parcelable {
*/ */
public @IntRange(from = 0) long getMinUpdateIntervalMillis() { public @IntRange(from = 0) long getMinUpdateIntervalMillis() {
if (mMinUpdateIntervalMillis == IMPLICIT_MIN_UPDATE_INTERVAL) { if (mMinUpdateIntervalMillis == IMPLICIT_MIN_UPDATE_INTERVAL) {
return mInterval; return (long) (mInterval * IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR);
} else { } else {
// the min is only necessary in case someone use a deprecated function to mess with the // the min is only necessary in case someone use a deprecated function to mess with the
// interval or min update interval // 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 * 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 * 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 * 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 * <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 * 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 * 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() { public @NonNull Builder clearMinUpdateIntervalMillis() {
mMinUpdateIntervalMillis = IMPLICIT_MIN_UPDATE_INTERVAL; mMinUpdateIntervalMillis = IMPLICIT_MIN_UPDATE_INTERVAL;