Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -38869,6 +38869,7 @@ package android.provider { field @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; // 0x2 field @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; // 0x3 field @Deprecated public static final int LOCATION_MODE_OFF = 0; // 0x0 field @Deprecated public static final int LOCATION_MODE_ON = 3; // 0x3 field @Deprecated public static final int LOCATION_MODE_SENSORS_ONLY = 1; // 0x1 field @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; field @Deprecated public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock"; core/java/android/provider/Settings.java +28 −27 Original line number Diff line number Diff line Loading @@ -5874,30 +5874,24 @@ public final class Settings { "unknown_sources_default_reversed"; /** * Comma-separated list of location providers that activities may access. Do not rely on * this value being present in settings.db or on ContentObserver notifications on the * Comma-separated list of location providers that are accessible. Do not rely on * this value being present or correct, or on ContentObserver notifications on the * corresponding Uri. * * @deprecated Providers should not be controlled individually. See {@link #LOCATION_MODE} * documentation for information on reading/writing location information. * @deprecated The preferred methods for checking provider status and listening for changes * are via {@link LocationManager#isProviderEnabled(String)} and * {@link LocationManager#PROVIDERS_CHANGED_ACTION}. */ @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; /** * The degree of location access enabled by the user. * <p> * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location * modes that might be added in the future. * <p> * Note: do not rely on this value being present in settings.db or on ContentObserver * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} * to receive changes in this value. * The current location mode of the device. Do not rely on this value being present or on * ContentObserver notifications on the corresponding Uri. * * @deprecated To check location mode, use {@link LocationManager#isLocationEnabled()}. * @deprecated The preferred methods for checking location mode and listening for changes * are via {@link LocationManager#isLocationEnabled()} and * {@link LocationManager#MODE_CHANGED_ACTION}. */ @Deprecated public static final String LOCATION_MODE = "location_mode"; Loading @@ -5924,7 +5918,7 @@ public final class Settings { public static final int LOCATION_CHANGER_QUICK_SETTINGS = 2; /** * Location access disabled. * Location mode is off. * * @deprecated See {@link #LOCATION_MODE}. */ Loading @@ -5932,33 +5926,40 @@ public final class Settings { public static final int LOCATION_MODE_OFF = 0; /** * Network Location Provider disabled, but GPS and other sensors enabled. * This mode no longer has any distinct meaning, but is interpreted as the location mode is * on. * * @deprecated To check location status, use {@link LocationManager#isLocationEnabled()}. To * get the status of a location provider, use * {@link LocationManager#isProviderEnabled(String)}. * @deprecated See {@link #LOCATION_MODE_ON}. */ @Deprecated public static final int LOCATION_MODE_SENSORS_ONLY = 1; /** * Reduced power usage, such as limiting the number of GPS updates per hour. Requests * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to * {@link android.location.Criteria#POWER_MEDIUM}. * This mode no longer has any distinct meaning, but is interpreted as the location mode is * on. * * @deprecated See {@link #LOCATION_MODE}. * @deprecated See {@link #LOCATION_MODE_ON}. */ @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; /** * Best-effort location computation allowed. * This mode no longer has any distinct meaning, but is interpreted as the location mode is * on. * * @deprecated See {@link #LOCATION_MODE}. * @deprecated See {@link #LOCATION_MODE_ON}. */ @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; /** * Location mode is on. * * @deprecated See {@link #LOCATION_MODE}. */ @Deprecated public static final int LOCATION_MODE_ON = LOCATION_MODE_HIGH_ACCURACY; /** * A flag containing settings used for biometric weak * @hide Loading location/java/android/location/LocationManager.java +46 −62 Original line number Diff line number Diff line Loading @@ -181,22 +181,14 @@ public class LocationManager { "android.location.GPS_ENABLED_CHANGE"; /** * Broadcast intent action when the configured location providers * change. For use with {@link #isProviderEnabled(String)}. If you're interacting with the * {@link android.provider.Settings.Secure#LOCATION_MODE} API, use {@link #MODE_CHANGED_ACTION} * instead. * Broadcast intent action when the set of enabled location providers changes. To check the * status of a provider, use {@link #isProviderEnabled(String)}. */ public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; /** * Broadcast intent action when {@link android.provider.Settings.Secure#LOCATION_MODE} changes. * For use with the {@link android.provider.Settings.Secure#LOCATION_MODE} API. * If you're interacting with {@link #isProviderEnabled(String)}, use * {@link #PROVIDERS_CHANGED_ACTION} instead. * * In the future, there may be mode changes that do not result in * {@link #PROVIDERS_CHANGED_ACTION} broadcasts. * Broadcast intent action when the device location mode changes. To check the location mode, * use {@link #isLocationEnabled()}. */ public static final String MODE_CHANGED_ACTION = "android.location.MODE_CHANGED"; Loading @@ -207,8 +199,10 @@ public class LocationManager { * If you're interacting with {@link #isProviderEnabled(String)}, use * {@link #PROVIDERS_CHANGED_ACTION} instead. * * @deprecated Do not use. * @hide */ @Deprecated public static final String MODE_CHANGING_ACTION = "com.android.settings.location.MODE_CHANGING"; /** Loading Loading @@ -299,7 +293,7 @@ public class LocationManager { "com.android.settings.location.FOOTER_STRING"; // Map from LocationListeners to their associated ListenerTransport objects private HashMap<LocationListener,ListenerTransport> mListeners = private final HashMap<LocationListener, ListenerTransport> mListeners = new HashMap<LocationListener,ListenerTransport>(); private class ListenerTransport extends ILocationListener.Stub { Loading Loading @@ -1264,39 +1258,20 @@ public class LocationManager { } /** * Returns the current enabled/disabled status of location * Returns the current enabled/disabled state of location. To listen for changes, see * {@link #MODE_CHANGED_ACTION}. * * @return true if location is enabled. false if location is disabled. * @return true if location is enabled and false if location is disabled. */ public boolean isLocationEnabled() { return isLocationEnabledForUser(Process.myUserHandle()); } /** * Method for enabling or disabling location. * * @param enabled true to enable location. false to disable location * @param userHandle the user to set * * @hide */ @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) { Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.LOCATION_MODE, enabled ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY : Settings.Secure.LOCATION_MODE_OFF, userHandle.getIdentifier()); } /** * Returns the current enabled/disabled status of location * Returns the current enabled/disabled state of location. * * @param userHandle the user to query * @return true location is enabled. false if location is disabled. * @return true if location is enabled and false if location is disabled. * * @hide */ Loading @@ -1310,19 +1285,32 @@ public class LocationManager { } /** * Returns the current enabled/disabled status of the given provider. * Enables or disables the location setting. * * <p>If the user has enabled this provider in the Settings menu, true * is returned otherwise false is returned * @param enabled true to enable location and false to disable location. * @param userHandle the user to set * * <p>Callers should instead use {@link #isLocationEnabled()} * unless they depend on provider-specific APIs such as * {@link #requestLocationUpdates(String, long, float, LocationListener)}. * @hide */ @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) { Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.LOCATION_MODE, enabled ? Settings.Secure.LOCATION_MODE_ON : Settings.Secure.LOCATION_MODE_OFF, userHandle.getIdentifier()); } /** * Returns the current enabled/disabled status of the given provider. To listen for changes, see * {@link #PROVIDERS_CHANGED_ACTION}. * * <p> * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this * method would throw {@link SecurityException} if the location permissions * were not sufficient to use the specified provider. * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this method would throw * {@link SecurityException} if the location permissions were not sufficient to use the * specified provider. * * @param provider the name of the provider * @return true if the provider exists and is enabled Loading @@ -1334,19 +1322,13 @@ public class LocationManager { } /** * Returns the current enabled/disabled status of the given provider and user. * * <p>If the user has enabled this provider in the Settings menu, true * is returned otherwise false is returned * * <p>Callers should instead use {@link #isLocationEnabled()} * unless they depend on provider-specific APIs such as * {@link #requestLocationUpdates(String, long, float, LocationListener)}. * Returns the current enabled/disabled status of the given provider and user. Callers should * prefer {@link #isLocationEnabledForUser(UserHandle)} unless they depend on provider-specific * APIs. * * <p> * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this * method would throw {@link SecurityException} if the location permissions * were not sufficient to use the specified provider. * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this method would throw * {@link SecurityException} if the location permissions were not sufficient to use the * specified provider. * * @param provider the name of the provider * @param userHandle the user to query Loading @@ -1367,12 +1349,14 @@ public class LocationManager { } /** * Method for enabling or disabling a single location provider. * Method for enabling or disabling a single location provider. This method is deprecated and * functions as a best effort. It should not be relied on in any meaningful sense as providers * may no longer be enabled or disabled by clients. * * @param provider the name of the provider * @param enabled true to enable the provider. false to disable the provider * @param userHandle the user to set * @return true if the value was set, false on database errors * @return true if the value was set, false otherwise * * @throws IllegalArgumentException if provider is null * @deprecated Do not manipulate providers individually, use Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -4231,7 +4231,7 @@ public class SettingsProvider extends ContentProvider { String defLocationMode = Integer.toString( !TextUtils.isEmpty(locationProvidersAllowed.getValue()) ? Secure.LOCATION_MODE_HIGH_ACCURACY ? Secure.LOCATION_MODE_ON : Secure.LOCATION_MODE_OFF); secureSettings.insertSettingLocked( Secure.LOCATION_MODE, defLocationMode, Loading services/core/java/com/android/server/LocationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2200,7 +2200,7 @@ public class LocationManagerService extends ILocationManager.Stub { return false; } if (mBackgroundThrottlePackageWhitelist.contains(record.mReceiver.mIdentity.mPackageName)) { if (mIgnoreSettingsPackageWhitelist.contains(record.mReceiver.mIdentity.mPackageName)) { return true; } Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -38869,6 +38869,7 @@ package android.provider { field @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; // 0x2 field @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; // 0x3 field @Deprecated public static final int LOCATION_MODE_OFF = 0; // 0x0 field @Deprecated public static final int LOCATION_MODE_ON = 3; // 0x3 field @Deprecated public static final int LOCATION_MODE_SENSORS_ONLY = 1; // 0x1 field @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; field @Deprecated public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
core/java/android/provider/Settings.java +28 −27 Original line number Diff line number Diff line Loading @@ -5874,30 +5874,24 @@ public final class Settings { "unknown_sources_default_reversed"; /** * Comma-separated list of location providers that activities may access. Do not rely on * this value being present in settings.db or on ContentObserver notifications on the * Comma-separated list of location providers that are accessible. Do not rely on * this value being present or correct, or on ContentObserver notifications on the * corresponding Uri. * * @deprecated Providers should not be controlled individually. See {@link #LOCATION_MODE} * documentation for information on reading/writing location information. * @deprecated The preferred methods for checking provider status and listening for changes * are via {@link LocationManager#isProviderEnabled(String)} and * {@link LocationManager#PROVIDERS_CHANGED_ACTION}. */ @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; /** * The degree of location access enabled by the user. * <p> * When used with {@link #putInt(ContentResolver, String, int)}, must be one of {@link * #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, {@link * #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. When used with {@link * #getInt(ContentResolver, String)}, the caller must gracefully handle additional location * modes that might be added in the future. * <p> * Note: do not rely on this value being present in settings.db or on ContentObserver * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} * to receive changes in this value. * The current location mode of the device. Do not rely on this value being present or on * ContentObserver notifications on the corresponding Uri. * * @deprecated To check location mode, use {@link LocationManager#isLocationEnabled()}. * @deprecated The preferred methods for checking location mode and listening for changes * are via {@link LocationManager#isLocationEnabled()} and * {@link LocationManager#MODE_CHANGED_ACTION}. */ @Deprecated public static final String LOCATION_MODE = "location_mode"; Loading @@ -5924,7 +5918,7 @@ public final class Settings { public static final int LOCATION_CHANGER_QUICK_SETTINGS = 2; /** * Location access disabled. * Location mode is off. * * @deprecated See {@link #LOCATION_MODE}. */ Loading @@ -5932,33 +5926,40 @@ public final class Settings { public static final int LOCATION_MODE_OFF = 0; /** * Network Location Provider disabled, but GPS and other sensors enabled. * This mode no longer has any distinct meaning, but is interpreted as the location mode is * on. * * @deprecated To check location status, use {@link LocationManager#isLocationEnabled()}. To * get the status of a location provider, use * {@link LocationManager#isProviderEnabled(String)}. * @deprecated See {@link #LOCATION_MODE_ON}. */ @Deprecated public static final int LOCATION_MODE_SENSORS_ONLY = 1; /** * Reduced power usage, such as limiting the number of GPS updates per hour. Requests * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to * {@link android.location.Criteria#POWER_MEDIUM}. * This mode no longer has any distinct meaning, but is interpreted as the location mode is * on. * * @deprecated See {@link #LOCATION_MODE}. * @deprecated See {@link #LOCATION_MODE_ON}. */ @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; /** * Best-effort location computation allowed. * This mode no longer has any distinct meaning, but is interpreted as the location mode is * on. * * @deprecated See {@link #LOCATION_MODE}. * @deprecated See {@link #LOCATION_MODE_ON}. */ @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; /** * Location mode is on. * * @deprecated See {@link #LOCATION_MODE}. */ @Deprecated public static final int LOCATION_MODE_ON = LOCATION_MODE_HIGH_ACCURACY; /** * A flag containing settings used for biometric weak * @hide Loading
location/java/android/location/LocationManager.java +46 −62 Original line number Diff line number Diff line Loading @@ -181,22 +181,14 @@ public class LocationManager { "android.location.GPS_ENABLED_CHANGE"; /** * Broadcast intent action when the configured location providers * change. For use with {@link #isProviderEnabled(String)}. If you're interacting with the * {@link android.provider.Settings.Secure#LOCATION_MODE} API, use {@link #MODE_CHANGED_ACTION} * instead. * Broadcast intent action when the set of enabled location providers changes. To check the * status of a provider, use {@link #isProviderEnabled(String)}. */ public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; /** * Broadcast intent action when {@link android.provider.Settings.Secure#LOCATION_MODE} changes. * For use with the {@link android.provider.Settings.Secure#LOCATION_MODE} API. * If you're interacting with {@link #isProviderEnabled(String)}, use * {@link #PROVIDERS_CHANGED_ACTION} instead. * * In the future, there may be mode changes that do not result in * {@link #PROVIDERS_CHANGED_ACTION} broadcasts. * Broadcast intent action when the device location mode changes. To check the location mode, * use {@link #isLocationEnabled()}. */ public static final String MODE_CHANGED_ACTION = "android.location.MODE_CHANGED"; Loading @@ -207,8 +199,10 @@ public class LocationManager { * If you're interacting with {@link #isProviderEnabled(String)}, use * {@link #PROVIDERS_CHANGED_ACTION} instead. * * @deprecated Do not use. * @hide */ @Deprecated public static final String MODE_CHANGING_ACTION = "com.android.settings.location.MODE_CHANGING"; /** Loading Loading @@ -299,7 +293,7 @@ public class LocationManager { "com.android.settings.location.FOOTER_STRING"; // Map from LocationListeners to their associated ListenerTransport objects private HashMap<LocationListener,ListenerTransport> mListeners = private final HashMap<LocationListener, ListenerTransport> mListeners = new HashMap<LocationListener,ListenerTransport>(); private class ListenerTransport extends ILocationListener.Stub { Loading Loading @@ -1264,39 +1258,20 @@ public class LocationManager { } /** * Returns the current enabled/disabled status of location * Returns the current enabled/disabled state of location. To listen for changes, see * {@link #MODE_CHANGED_ACTION}. * * @return true if location is enabled. false if location is disabled. * @return true if location is enabled and false if location is disabled. */ public boolean isLocationEnabled() { return isLocationEnabledForUser(Process.myUserHandle()); } /** * Method for enabling or disabling location. * * @param enabled true to enable location. false to disable location * @param userHandle the user to set * * @hide */ @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) { Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.LOCATION_MODE, enabled ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY : Settings.Secure.LOCATION_MODE_OFF, userHandle.getIdentifier()); } /** * Returns the current enabled/disabled status of location * Returns the current enabled/disabled state of location. * * @param userHandle the user to query * @return true location is enabled. false if location is disabled. * @return true if location is enabled and false if location is disabled. * * @hide */ Loading @@ -1310,19 +1285,32 @@ public class LocationManager { } /** * Returns the current enabled/disabled status of the given provider. * Enables or disables the location setting. * * <p>If the user has enabled this provider in the Settings menu, true * is returned otherwise false is returned * @param enabled true to enable location and false to disable location. * @param userHandle the user to set * * <p>Callers should instead use {@link #isLocationEnabled()} * unless they depend on provider-specific APIs such as * {@link #requestLocationUpdates(String, long, float, LocationListener)}. * @hide */ @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) { Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.LOCATION_MODE, enabled ? Settings.Secure.LOCATION_MODE_ON : Settings.Secure.LOCATION_MODE_OFF, userHandle.getIdentifier()); } /** * Returns the current enabled/disabled status of the given provider. To listen for changes, see * {@link #PROVIDERS_CHANGED_ACTION}. * * <p> * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this * method would throw {@link SecurityException} if the location permissions * were not sufficient to use the specified provider. * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this method would throw * {@link SecurityException} if the location permissions were not sufficient to use the * specified provider. * * @param provider the name of the provider * @return true if the provider exists and is enabled Loading @@ -1334,19 +1322,13 @@ public class LocationManager { } /** * Returns the current enabled/disabled status of the given provider and user. * * <p>If the user has enabled this provider in the Settings menu, true * is returned otherwise false is returned * * <p>Callers should instead use {@link #isLocationEnabled()} * unless they depend on provider-specific APIs such as * {@link #requestLocationUpdates(String, long, float, LocationListener)}. * Returns the current enabled/disabled status of the given provider and user. Callers should * prefer {@link #isLocationEnabledForUser(UserHandle)} unless they depend on provider-specific * APIs. * * <p> * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this * method would throw {@link SecurityException} if the location permissions * were not sufficient to use the specified provider. * Before API version {@link android.os.Build.VERSION_CODES#LOLLIPOP}, this method would throw * {@link SecurityException} if the location permissions were not sufficient to use the * specified provider. * * @param provider the name of the provider * @param userHandle the user to query Loading @@ -1367,12 +1349,14 @@ public class LocationManager { } /** * Method for enabling or disabling a single location provider. * Method for enabling or disabling a single location provider. This method is deprecated and * functions as a best effort. It should not be relied on in any meaningful sense as providers * may no longer be enabled or disabled by clients. * * @param provider the name of the provider * @param enabled true to enable the provider. false to disable the provider * @param userHandle the user to set * @return true if the value was set, false on database errors * @return true if the value was set, false otherwise * * @throws IllegalArgumentException if provider is null * @deprecated Do not manipulate providers individually, use Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -4231,7 +4231,7 @@ public class SettingsProvider extends ContentProvider { String defLocationMode = Integer.toString( !TextUtils.isEmpty(locationProvidersAllowed.getValue()) ? Secure.LOCATION_MODE_HIGH_ACCURACY ? Secure.LOCATION_MODE_ON : Secure.LOCATION_MODE_OFF); secureSettings.insertSettingLocked( Secure.LOCATION_MODE, defLocationMode, Loading
services/core/java/com/android/server/LocationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2200,7 +2200,7 @@ public class LocationManagerService extends ILocationManager.Stub { return false; } if (mBackgroundThrottlePackageWhitelist.contains(record.mReceiver.mIdentity.mPackageName)) { if (mIgnoreSettingsPackageWhitelist.contains(record.mReceiver.mIdentity.mPackageName)) { return true; } Loading