summaryrefslogtreecommitdiff
path: root/android/location
diff options
context:
space:
mode:
authorJustin Klaassen <justinklaassen@google.com>2018-04-03 23:21:57 -0400
committerJustin Klaassen <justinklaassen@google.com>2018-04-03 23:21:57 -0400
commit4d01eeaffaa720e4458a118baa137a11614f00f7 (patch)
tree66751893566986236788e3c796a7cc5e90d05f52 /android/location
parenta192cc2a132cb0ee8588e2df755563ec7008c179 (diff)
downloadandroid-28-4d01eeaffaa720e4458a118baa137a11614f00f7.tar.gz
Import Android SDK Platform P [4697573]
/google/data/ro/projects/android/fetch_artifact \ --bid 4697573 \ --target sdk_phone_armv7-win_sdk \ sdk-repo-linux-sources-4697573.zip AndroidVersion.ApiLevel has been modified to appear as 28 Change-Id: If80578c3c657366cc9cf75f8db13d46e2dd4e077
Diffstat (limited to 'android/location')
-rw-r--r--android/location/GnssMeasurement.java135
-rw-r--r--android/location/LocationManager.java166
-rw-r--r--android/location/LocationRequest.java3
3 files changed, 256 insertions, 48 deletions
diff --git a/android/location/GnssMeasurement.java b/android/location/GnssMeasurement.java
index 412cc291..2152e1ed 100644
--- a/android/location/GnssMeasurement.java
+++ b/android/location/GnssMeasurement.java
@@ -83,6 +83,20 @@ public final class GnssMeasurement implements Parcelable {
*/
public static final int MULTIPATH_INDICATOR_NOT_DETECTED = 2;
+ /**
+ * GNSS measurement tracking loop state
+ * @hide
+ */
+ @IntDef(flag = true, prefix = { "STATE_" }, value = {
+ STATE_CODE_LOCK, STATE_BIT_SYNC, STATE_SUBFRAME_SYNC,
+ STATE_TOW_DECODED, STATE_MSEC_AMBIGUOUS, STATE_SYMBOL_SYNC, STATE_GLO_STRING_SYNC,
+ STATE_GLO_TOD_DECODED, STATE_BDS_D2_BIT_SYNC, STATE_BDS_D2_SUBFRAME_SYNC,
+ STATE_GAL_E1BC_CODE_LOCK, STATE_GAL_E1C_2ND_CODE_LOCK, STATE_GAL_E1B_PAGE_SYNC,
+ STATE_SBAS_SYNC, STATE_TOW_KNOWN, STATE_GLO_TOD_KNOWN
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface State {}
+
/** This GNSS measurement's tracking state is invalid or unknown. */
public static final int STATE_UNKNOWN = 0;
/** This GNSS measurement's tracking state has code lock. */
@@ -133,29 +147,68 @@ public final class GnssMeasurement implements Parcelable {
private static final int STATE_ALL = 0x3fff; // 2 bits + 4 bits + 4 bits + 4 bits = 14 bits
/**
- * The state of the 'Accumulated Delta Range' is invalid or unknown.
+ * GNSS measurement accumulated delta range state
+ * @hide
+ */
+ @IntDef(flag = true, prefix = { "ADR_STATE_" }, value = {
+ ADR_STATE_VALID, ADR_STATE_RESET, ADR_STATE_CYCLE_SLIP, ADR_STATE_HALF_CYCLE_RESOLVED,
+ ADR_STATE_HALF_CYCLE_REPORTED
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface AdrState {}
+
+ /**
+ * The state of the value {@link #getAccumulatedDeltaRangeMeters()} is invalid or unknown.
*/
public static final int ADR_STATE_UNKNOWN = 0;
/**
- * The state of the 'Accumulated Delta Range' is valid.
+ * The state of the {@link #getAccumulatedDeltaRangeMeters()} is valid.
*/
public static final int ADR_STATE_VALID = (1<<0);
/**
- * The state of the 'Accumulated Delta Range' has detected a reset.
+ * The state of the {@link #getAccumulatedDeltaRangeMeters()} has detected a reset.
*/
public static final int ADR_STATE_RESET = (1<<1);
/**
- * The state of the 'Accumulated Delta Range' has a cycle slip detected.
+ * The state of the {@link #getAccumulatedDeltaRangeMeters()} has a cycle slip detected.
*/
public static final int ADR_STATE_CYCLE_SLIP = (1<<2);
/**
+ * Reports whether the value {@link #getAccumulatedDeltaRangeMeters()} has resolved the half
+ * cycle ambiguity.
+ *
+ * <p> When this bit is set, the {@link #getAccumulatedDeltaRangeMeters()} corresponds to the
+ * carrier phase measurement plus an accumulated integer number of carrier full cycles.
+ *
+ * <p> When this bit is unset, the {@link #getAccumulatedDeltaRangeMeters()} corresponds to the
+ * carrier phase measurement plus an accumulated integer number of carrier half cycles.
+ */
+ public static final int ADR_STATE_HALF_CYCLE_RESOLVED = (1<<3);
+
+ /**
+ * Reports whether the flag {@link #ADR_STATE_HALF_CYCLE_RESOLVED} has been reported by the
+ * GNSS hardware.
+ *
+ * <p> When this bit is set, the value of {@link #getAccumulatedDeltaRangeUncertaintyMeters()}
+ * can be low (centimeter level) whether or not the half cycle ambiguity is resolved.
+ *
+ * <p> When this bit is unset, the value of {@link #getAccumulatedDeltaRangeUncertaintyMeters()}
+ * is larger, to cover the potential error due to half cycle ambiguity being unresolved.
+ */
+ public static final int ADR_STATE_HALF_CYCLE_REPORTED = (1<<4);
+
+ /**
* All the 'Accumulated Delta Range' flags.
+ * @hide
*/
- private static final int ADR_ALL = ADR_STATE_VALID | ADR_STATE_RESET | ADR_STATE_CYCLE_SLIP;
+ @TestApi
+ public static final int ADR_STATE_ALL =
+ ADR_STATE_VALID | ADR_STATE_RESET | ADR_STATE_CYCLE_SLIP |
+ ADR_STATE_HALF_CYCLE_RESOLVED | ADR_STATE_HALF_CYCLE_REPORTED;
// End enumerations in sync with gps.h
@@ -278,6 +331,7 @@ public final class GnssMeasurement implements Parcelable {
*
* <p>This value helps interpret {@link #getReceivedSvTimeNanos()}.
*/
+ @State
public int getState() {
return mState;
}
@@ -287,7 +341,7 @@ public final class GnssMeasurement implements Parcelable {
* @hide
*/
@TestApi
- public void setState(int value) {
+ public void setState(@State int value) {
mState = value;
}
@@ -557,6 +611,7 @@ public final class GnssMeasurement implements Parcelable {
* <p>It indicates whether {@link #getAccumulatedDeltaRangeMeters()} is reset or there is a
* cycle slip (indicating 'loss of lock').
*/
+ @AdrState
public int getAccumulatedDeltaRangeState() {
return mAccumulatedDeltaRangeState;
}
@@ -566,7 +621,7 @@ public final class GnssMeasurement implements Parcelable {
* @hide
*/
@TestApi
- public void setAccumulatedDeltaRangeState(int value) {
+ public void setAccumulatedDeltaRangeState(@AdrState int value) {
mAccumulatedDeltaRangeState = value;
}
@@ -589,7 +644,15 @@ public final class GnssMeasurement implements Parcelable {
if ((mAccumulatedDeltaRangeState & ADR_STATE_CYCLE_SLIP) == ADR_STATE_CYCLE_SLIP) {
builder.append("CycleSlip|");
}
- int remainingStates = mAccumulatedDeltaRangeState & ~ADR_ALL;
+ if ((mAccumulatedDeltaRangeState & ADR_STATE_HALF_CYCLE_RESOLVED) ==
+ ADR_STATE_HALF_CYCLE_RESOLVED) {
+ builder.append("HalfCycleResolved|");
+ }
+ if ((mAccumulatedDeltaRangeState & ADR_STATE_HALF_CYCLE_REPORTED)
+ == ADR_STATE_HALF_CYCLE_REPORTED) {
+ builder.append("HalfCycleReported|");
+ }
+ int remainingStates = mAccumulatedDeltaRangeState & ~ADR_STATE_ALL;
if (remainingStates > 0) {
builder.append("Other(");
builder.append(Integer.toBinaryString(remainingStates));
@@ -674,7 +737,7 @@ public final class GnssMeasurement implements Parcelable {
* L5 = 1176.45 MHz, varying GLO channels, etc. If the field is not set, it is the primary
* common use central frequency, e.g. L1 = 1575.45 MHz for GPS.
*
- * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same time, two raw
+ * <p> For an L1, L5 receiver tracking a satellite on L1 and L5 at the same time, two raw
* measurement objects will be reported for this same satellite, in one of the measurement
* objects, all the values related to L1 will be filled, and in the other all of the values
* related to L5 will be filled.
@@ -709,7 +772,10 @@ public final class GnssMeasurement implements Parcelable {
/**
* Returns {@code true} if {@link #getCarrierCycles()} is available, {@code false} otherwise.
+ *
+ * @deprecated use {@link #getAccumulatedDeltaRangeState()} instead.
*/
+ @Deprecated
public boolean hasCarrierCycles() {
return isFlagSet(HAS_CARRIER_CYCLES);
}
@@ -720,16 +786,24 @@ public final class GnssMeasurement implements Parcelable {
* <p>The reference frequency is given by the value of {@link #getCarrierFrequencyHz()}.
*
* <p>The value is only available if {@link #hasCarrierCycles()} is {@code true}.
+ *
+ * @deprecated use {@link #getAccumulatedDeltaRangeMeters()} instead.
*/
+ @Deprecated
public long getCarrierCycles() {
return mCarrierCycles;
}
/**
* Sets the number of full carrier cycles between the satellite and the receiver.
+ *
+ * @deprecated use {@link #setAccumulatedDeltaRangeMeters(double)}
+ * and {@link #setAccumulatedDeltaRangeState(int)} instead.
+ *
* @hide
*/
@TestApi
+ @Deprecated
public void setCarrierCycles(long value) {
setFlag(HAS_CARRIER_CYCLES);
mCarrierCycles = value;
@@ -737,9 +811,13 @@ public final class GnssMeasurement implements Parcelable {
/**
* Resets the number of full carrier cycles between the satellite and the receiver.
+ *
+ * @deprecated use {@link #setAccumulatedDeltaRangeMeters(double)}
+ * and {@link #setAccumulatedDeltaRangeState(int)} instead.
* @hide
*/
@TestApi
+ @Deprecated
public void resetCarrierCycles() {
resetFlag(HAS_CARRIER_CYCLES);
mCarrierCycles = Long.MIN_VALUE;
@@ -747,7 +825,10 @@ public final class GnssMeasurement implements Parcelable {
/**
* Returns {@code true} if {@link #getCarrierPhase()} is available, {@code false} otherwise.
+ *
+ * @deprecated use {@link #getAccumulatedDeltaRangeState()} instead.
*/
+ @Deprecated
public boolean hasCarrierPhase() {
return isFlagSet(HAS_CARRIER_PHASE);
}
@@ -764,16 +845,24 @@ public final class GnssMeasurement implements Parcelable {
* <p>The error estimate for this value is {@link #getCarrierPhaseUncertainty()}.
*
* <p>The value is only available if {@link #hasCarrierPhase()} is {@code true}.
+ *
+ * @deprecated use {@link #getAccumulatedDeltaRangeMeters()} instead.
*/
+ @Deprecated
public double getCarrierPhase() {
return mCarrierPhase;
}
/**
* Sets the RF phase detected by the receiver.
+ *
+ * @deprecated use {@link #setAccumulatedDeltaRangeMeters(double)}
+ * and {@link #setAccumulatedDeltaRangeState(int)} instead.
+ *
* @hide
*/
@TestApi
+ @Deprecated
public void setCarrierPhase(double value) {
setFlag(HAS_CARRIER_PHASE);
mCarrierPhase = value;
@@ -781,9 +870,14 @@ public final class GnssMeasurement implements Parcelable {
/**
* Resets the RF phase detected by the receiver.
+ *
+ * @deprecated use {@link #setAccumulatedDeltaRangeMeters(double)}
+ * and {@link #setAccumulatedDeltaRangeState(int)} instead.
+ *
* @hide
*/
@TestApi
+ @Deprecated
public void resetCarrierPhase() {
resetFlag(HAS_CARRIER_PHASE);
mCarrierPhase = Double.NaN;
@@ -792,7 +886,10 @@ public final class GnssMeasurement implements Parcelable {
/**
* Returns {@code true} if {@link #getCarrierPhaseUncertainty()} is available, {@code false}
* otherwise.
+ *
+ * @deprecated use {@link #getAccumulatedDeltaRangeState()} instead.
*/
+ @Deprecated
public boolean hasCarrierPhaseUncertainty() {
return isFlagSet(HAS_CARRIER_PHASE_UNCERTAINTY);
}
@@ -803,16 +900,24 @@ public final class GnssMeasurement implements Parcelable {
* <p>The uncertainty is represented as an absolute (single sided) value.
*
* <p>The value is only available if {@link #hasCarrierPhaseUncertainty()} is {@code true}.
+ *
+ * @deprecated use {@link #getAccumulatedDeltaRangeUncertaintyMeters()} instead.
*/
+ @Deprecated
public double getCarrierPhaseUncertainty() {
return mCarrierPhaseUncertainty;
}
/**
* Sets the Carrier-phase's uncertainty (1-Sigma) in cycles.
+ *
+ * @deprecated use {@link #setAccumulatedDeltaRangeUncertaintyMeters(double)}
+ * and {@link #setAccumulatedDeltaRangeState(int)} instead.
+ *
* @hide
*/
@TestApi
+ @Deprecated
public void setCarrierPhaseUncertainty(double value) {
setFlag(HAS_CARRIER_PHASE_UNCERTAINTY);
mCarrierPhaseUncertainty = value;
@@ -820,9 +925,14 @@ public final class GnssMeasurement implements Parcelable {
/**
* Resets the Carrier-phase's uncertainty (1-Sigma) in cycles.
+ *
+ * @deprecated use {@link #setAccumulatedDeltaRangeUncertaintyMeters(double)}
+ * and {@link #setAccumulatedDeltaRangeState(int)} instead.
+ *
* @hide
*/
@TestApi
+ @Deprecated
public void resetCarrierPhaseUncertainty() {
resetFlag(HAS_CARRIER_PHASE_UNCERTAINTY);
mCarrierPhaseUncertainty = Double.NaN;
@@ -859,7 +969,7 @@ public final class GnssMeasurement implements Parcelable {
case MULTIPATH_INDICATOR_NOT_DETECTED:
return "NotDetected";
default:
- return "<Invalid:" + mMultipathIndicator + ">";
+ return "<Invalid: " + mMultipathIndicator + ">";
}
}
@@ -916,11 +1026,12 @@ public final class GnssMeasurement implements Parcelable {
* number. Hence in cases of strong jamming, in the band of this signal, this value will go more
* negative.
*
- * <p>Note: Different hardware designs (e.g. antenna, pre-amplification, or other RF HW
+ * <p> Note: Different hardware designs (e.g. antenna, pre-amplification, or other RF HW
* components) may also affect the typical output of of this value on any given hardware design
* in an open sky test - the important aspect of this output is that changes in this value are
* indicative of changes on input signal power in the frequency band for this measurement.
- * <p>The value is only available if {@link #hasAutomaticGainControlLevelDb()} is {@code true}
+ *
+ * <p> The value is only available if {@link #hasAutomaticGainControlLevelDb()} is {@code true}
*/
public double getAutomaticGainControlLevelDb() {
return mAutomaticGainControlLevelInDb;
diff --git a/android/location/LocationManager.java b/android/location/LocationManager.java
index 9db9d332..a5239580 100644
--- a/android/location/LocationManager.java
+++ b/android/location/LocationManager.java
@@ -23,6 +23,8 @@ import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
import android.Manifest;
import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.annotation.RequiresFeature;
import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
@@ -30,6 +32,7 @@ import android.annotation.SystemService;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -38,11 +41,16 @@ import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.provider.Settings;
+import android.text.TextUtils;
+import android.util.ArraySet;
import android.util.Log;
import com.android.internal.location.ProviderProperties;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
/**
* This class provides access to the system location services. These
@@ -60,6 +68,7 @@ import java.util.List;
* location will be obfuscated to a coarse level of accuracy.
*/
@SystemService(Context.LOCATION_SERVICE)
+@RequiresFeature(PackageManager.FEATURE_LOCATION)
public class LocationManager {
private static final String TAG = "LocationManager";
@@ -228,10 +237,60 @@ public class LocationManager {
"android.location.HIGH_POWER_REQUEST_CHANGE";
/**
- * The value returned by {@link LocationManager#getGnssHardwareModelName()} when the hardware
- * does not support providing the actual value.
+ * Broadcast intent action for Settings app to inject a footer at the bottom of location
+ * settings.
+ *
+ * <p>This broadcast is used for two things:
+ * <ol>
+ * <li>For receivers to inject a footer with provided text. This is for use only by apps
+ * that are included in the system image. </li>
+ * <li>For receivers to know their footer is injected under location settings.</li>
+ * </ol>
+ *
+ * <p>To inject a footer to location settings, you must declare a broadcast receiver of
+ * {@link LocationManager#SETTINGS_FOOTER_DISPLAYED_ACTION} in the manifest as so:
+ * <pre>
+ * &lt;receiver android:name="com.example.android.footer.MyFooterInjector"&gt;
+ * &lt;intent-filter&gt;
+ * &lt;action android:name="com.android.settings.location.INJECT_FOOTER" /&gt;
+ * &lt;/intent-filter&gt;
+ * &lt;meta-data
+ * android:name="com.android.settings.location.FOOTER_STRING"
+ * android:resource="@string/my_injected_footer_string" /&gt;
+ * &lt;/receiver&gt;
+ * </pre>
+ *
+ * <p>On entering location settings, Settings app will send a
+ * {@link #SETTINGS_FOOTER_DISPLAYED_ACTION} broadcast to receivers whose footer is successfully
+ * injected. On leaving location settings, the footer becomes not visible to users. Settings app
+ * will send a {@link #SETTINGS_FOOTER_REMOVED_ACTION} broadcast to those receivers.
+ *
+ * @hide
*/
- public static final String GNSS_HARDWARE_MODEL_NAME_UNKNOWN = "Model Name Unknown";
+ public static final String SETTINGS_FOOTER_DISPLAYED_ACTION =
+ "com.android.settings.location.DISPLAYED_FOOTER";
+
+ /**
+ * Broadcast intent action when location settings footer is not visible to users.
+ *
+ * <p>See {@link #SETTINGS_FOOTER_DISPLAYED_ACTION} for more detail on how to use.
+ *
+ * @hide
+ */
+ public static final String SETTINGS_FOOTER_REMOVED_ACTION =
+ "com.android.settings.location.REMOVED_FOOTER";
+
+ /**
+ * Metadata name for {@link LocationManager#SETTINGS_FOOTER_DISPLAYED_ACTION} broadcast
+ * receivers to specify a string resource id as location settings footer text. This is for use
+ * only by apps that are included in the system image.
+ *
+ * <p>See {@link #SETTINGS_FOOTER_DISPLAYED_ACTION} for more detail on how to use.
+ *
+ * @hide
+ */
+ public static final String METADATA_SETTINGS_FOOTER_STRING =
+ "com.android.settings.location.FOOTER_STRING";
// Map from LocationListeners to their associated ListenerTransport objects
private HashMap<LocationListener,ListenerTransport> mListeners =
@@ -1184,18 +1243,46 @@ public class LocationManager {
*
* @param enabled true to enable location. false to disable location
* @param userHandle the user to set
- * @return true if the value was set, false on database errors
*
* @hide
*/
@SystemApi
@RequiresPermission(WRITE_SECURE_SETTINGS)
public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) {
- try {
- mService.setLocationEnabledForUser(enabled, userHandle.getIdentifier());
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
+ final List<String> allProvidersList = getAllProviders();
+ // Update all providers on device plus gps and network provider when disabling location.
+ Set<String> allProvidersSet = new ArraySet<>(allProvidersList.size() + 2);
+ allProvidersSet.addAll(allProvidersList);
+ // When disabling location, disable gps and network provider that could have been enabled by
+ // location mode api.
+ if (enabled == false) {
+ allProvidersSet.add(GPS_PROVIDER);
+ allProvidersSet.add(NETWORK_PROVIDER);
+ }
+ if (allProvidersSet.isEmpty()) {
+ return;
+ }
+ // to ensure thread safety, we write the provider name with a '+' or '-'
+ // and let the SettingsProvider handle it rather than reading and modifying
+ // the list of enabled providers.
+ final String prefix = enabled ? "+" : "-";
+ StringBuilder locationProvidersAllowed = new StringBuilder();
+ for (String provider : allProvidersSet) {
+ checkProvider(provider);
+ if (provider.equals(PASSIVE_PROVIDER)) {
+ continue;
+ }
+ locationProvidersAllowed.append(prefix);
+ locationProvidersAllowed.append(provider);
+ locationProvidersAllowed.append(",");
}
+ // Remove the trailing comma
+ locationProvidersAllowed.setLength(locationProvidersAllowed.length() - 1);
+ Settings.Secure.putStringForUser(
+ mContext.getContentResolver(),
+ Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
+ locationProvidersAllowed.toString(),
+ userHandle.getIdentifier());
}
/**
@@ -1208,11 +1295,22 @@ public class LocationManager {
*/
@SystemApi
public boolean isLocationEnabledForUser(UserHandle userHandle) {
- try {
- return mService.isLocationEnabledForUser(userHandle.getIdentifier());
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
+ final String allowedProviders = Settings.Secure.getStringForUser(
+ mContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED,
+ userHandle.getIdentifier());
+ if (allowedProviders == null) {
+ return false;
+ }
+ final List<String> providerList = Arrays.asList(allowedProviders.split(","));
+ for(String provider : getAllProviders()) {
+ if (provider.equals(PASSIVE_PROVIDER)) {
+ continue;
+ }
+ if (providerList.contains(provider)) {
+ return true;
+ }
}
+ return false;
}
/**
@@ -1236,13 +1334,7 @@ public class LocationManager {
* @throws IllegalArgumentException if provider is null
*/
public boolean isProviderEnabled(String provider) {
- checkProvider(provider);
-
- try {
- return mService.isProviderEnabled(provider);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ return isProviderEnabledForUser(provider, Process.myUserHandle());
}
/**
@@ -1270,12 +1362,9 @@ public class LocationManager {
@SystemApi
public boolean isProviderEnabledForUser(String provider, UserHandle userHandle) {
checkProvider(provider);
-
- try {
- return mService.isProviderEnabledForUser(provider, userHandle.getIdentifier());
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ String allowedProviders = Settings.Secure.getStringForUser(mContext.getContentResolver(),
+ Settings.Secure.LOCATION_PROVIDERS_ALLOWED, userHandle.getIdentifier());
+ return TextUtils.delimitedStringContains(allowedProviders, ',', provider);
}
/**
@@ -1294,13 +1383,16 @@ public class LocationManager {
public boolean setProviderEnabledForUser(
String provider, boolean enabled, UserHandle userHandle) {
checkProvider(provider);
-
- try {
- return mService.setProviderEnabledForUser(
- provider, enabled, userHandle.getIdentifier());
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
+ // to ensure thread safety, we write the provider name with a '+' or '-'
+ // and let the SettingsProvider handle it rather than reading and modifying
+ // the list of enabled providers.
+ if (enabled) {
+ provider = "+" + provider;
+ } else {
+ provider = "-" + provider;
}
+ return Settings.Secure.putStringForUser(mContext.getContentResolver(),
+ Settings.Secure.LOCATION_PROVIDERS_ALLOWED, provider, userHandle.getIdentifier());
}
/**
@@ -2109,7 +2201,9 @@ public class LocationManager {
/**
* Returns the model year of the GNSS hardware and software build.
*
- * May return 0 if the model year is less than 2016.
+ * <p> More details, such as build date, may be available in {@link #getGnssHardwareModelName()}.
+ *
+ * <p> May return 0 if the model year is less than 2016.
*/
public int getGnssYearOfHardware() {
try {
@@ -2123,10 +2217,12 @@ public class LocationManager {
* Returns the Model Name (including Vendor and Hardware/Software Version) of the GNSS hardware
* driver.
*
- * Will return {@link LocationManager#GNSS_HARDWARE_MODEL_NAME_UNKNOWN} when the GNSS hardware
- * abstraction layer does not support providing this value.
+ * <p> No device-specific serial number or ID is returned from this API.
+ *
+ * <p> Will return null when the GNSS hardware abstraction layer does not support providing
+ * this value.
*/
- @NonNull
+ @Nullable
public String getGnssHardwareModelName() {
try {
return mService.getGnssHardwareModelName();
diff --git a/android/location/LocationRequest.java b/android/location/LocationRequest.java
index 6abba954..96a0817a 100644
--- a/android/location/LocationRequest.java
+++ b/android/location/LocationRequest.java
@@ -339,7 +339,8 @@ public final class LocationRequest implements Parcelable {
* substantially restrict power.
*
* <p>In this mode, the GNSS chipset will not, on average, run power hungry operations like RF &
- * signal searches for more than one second per interval {@link #mInterval}
+ * signal searches for more than one second per interval (specified by
+ * {@link #setInterval(long)}).
*
* @param enabled Enable or disable low power mode
* @return the same object, so that setters can be chained