diff options
author | 2025-02-26 12:00:13 -0800 | |
---|---|---|
committer | 2025-02-26 15:59:42 -0800 | |
commit | e324fd74abb34d6745424206f1a0cb4febb335cb (patch) | |
tree | f32ac4cb241e236f4d2412646c2d3519e764eacf /location | |
parent | fd356738abe400daebc08bdc151d36e177c4bc8d (diff) |
Update the default fastest interval factor
Flag: android.location.flags.update_min_location_request_interval
Bug: 397444378
Test: atest LocationRequestTest
Change-Id: I98c914d9b7f7d088a2c3ba7869b2f496b907cdb5
Diffstat (limited to 'location')
-rw-r--r-- | location/java/android/location/LocationRequest.java | 9 | ||||
-rw-r--r-- | location/java/android/location/flags/location.aconfig | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java index 80b55e2c1244..5a993bfcc9cf 100644 --- a/location/java/android/location/LocationRequest.java +++ b/location/java/android/location/LocationRequest.java @@ -33,6 +33,7 @@ import android.annotation.SystemApi; import android.compat.annotation.ChangeId; import android.compat.annotation.EnabledAfter; import android.content.pm.PackageManager; +import android.location.flags.Flags; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; @@ -181,7 +182,8 @@ 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; + private static final double LEGACY_IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR = 1D / 6D; + private static final double IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR = 1D / 2D; private @Nullable String mProvider; private @Quality int mQuality; @@ -553,7 +555,10 @@ public final class LocationRequest implements Parcelable { */ public @IntRange(from = 0) long getMinUpdateIntervalMillis() { if (mMinUpdateIntervalMillis == IMPLICIT_MIN_UPDATE_INTERVAL) { - return (long) (mIntervalMillis * IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR); + if (Flags.updateMinLocationRequestInterval()) { + return (long) (mIntervalMillis * IMPLICIT_MIN_UPDATE_INTERVAL_FACTOR); + } + return (long) (mIntervalMillis * LEGACY_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 diff --git a/location/java/android/location/flags/location.aconfig b/location/java/android/location/flags/location.aconfig index 1b38982f48c1..83b1778fd611 100644 --- a/location/java/android/location/flags/location.aconfig +++ b/location/java/android/location/flags/location.aconfig @@ -168,3 +168,14 @@ flag { description: "Flag for GNSS assistance interface" bug: "209078566" } + +flag { + name: "update_min_location_request_interval" + namespace: "location" + description: "Flag for updating the default logic for the minimal interval for location request" + bug: "397444378" + metadata { + purpose: PURPOSE_BUGFIX + } +} + |