Loading core/java/android/provider/Settings.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -3335,7 +3335,9 @@ public final class Settings { */ */ public static final int LOCATION_MODE_SENSORS_ONLY = 1; public static final int LOCATION_MODE_SENSORS_ONLY = 1; /** /** * Reduced power usage, such as limiting the number of GPS updates per hour. * 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}. */ */ public static final int LOCATION_MODE_BATTERY_SAVING = 2; public static final int LOCATION_MODE_BATTERY_SAVING = 2; /** /** Loading Loading @@ -4384,10 +4386,13 @@ public final class Settings { /** /** * Helper method for determining if a location provider is enabled. * Helper method for determining if a location provider is enabled. * * @param cr the content resolver to use * @param cr the content resolver to use * @param provider the location provider to query * @param provider the location provider to query * @return true if the provider is enabled * @return true if the provider is enabled * @deprecated use {@link #getInt(ContentResolver, String)} and {@link #LOCATION_MODE} * * @deprecated use {@link #LOCATION_MODE} or * {@link LocationManager#isProviderEnabled(String)} */ */ @Deprecated @Deprecated public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { Loading @@ -4400,8 +4405,8 @@ public final class Settings { * @param provider the location provider to query * @param provider the location provider to query * @param userId the userId to query * @param userId the userId to query * @return true if the provider is enabled * @return true if the provider is enabled * @deprecated use {@link #getIntForUser(ContentResolver, String, int, int)} and * @deprecated use {@link #LOCATION_MODE} or * {@link #LOCATION_MODE} * {@link LocationManager#isProviderEnabled(String)} * @hide * @hide */ */ @Deprecated @Deprecated Loading location/java/android/location/LocationManager.java +12 −6 Original line number Original line Diff line number Diff line Loading @@ -152,17 +152,18 @@ public class LocationManager { /** /** * Broadcast intent action when the configured location providers * Broadcast intent action when the configured location providers * change. If you're interacting with the * change. For use with {@link #isProviderEnabled(String)}. If you're interacting with the * {@link android.provider.Settings.Secure#LOCATION_MODE} API, * {@link android.provider.Settings.Secure#LOCATION_MODE} API, use {@link #MODE_CHANGED_ACTION} * use {@link #MODE_CHANGED_ACTION} instead. * instead. */ */ public static final String PROVIDERS_CHANGED_ACTION = public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; "android.location.PROVIDERS_CHANGED"; /** /** * Broadcast intent action when {@link android.provider.Settings.Secure#LOCATION_MODE} changes. * Broadcast intent action when {@link android.provider.Settings.Secure#LOCATION_MODE} changes. * If you're interacting with provider-based APIs such as {@link #getProviders(boolean)}, you * For use with the {@link android.provider.Settings.Secure#LOCATION_MODE} API. * use {@link #PROVIDERS_CHANGED_ACTION} instead. * 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 * In the future, there may be mode changes that do not result in * {@link #PROVIDERS_CHANGED_ACTION} broadcasts. * {@link #PROVIDERS_CHANGED_ACTION} broadcasts. Loading Loading @@ -1098,8 +1099,13 @@ public class LocationManager { * <p>If the user has enabled this provider in the Settings menu, true * <p>If the user has enabled this provider in the Settings menu, true * is returned otherwise false is returned * is returned otherwise false is returned * * * <p>Callers should instead use * {@link android.provider.Settings.Secure#LOCATION_MODE} * unless they depend on provider-specific APIs such as * {@link #requestLocationUpdates(String, long, float, LocationListener)}. * * @param provider the name of the provider * @param provider the name of the provider * @return true if the provider is enabled * @return true if the provider exists and is enabled * * * @throws IllegalArgumentException if provider is null * @throws IllegalArgumentException if provider is null * @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present Loading services/java/com/android/server/LocationManagerService.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -1773,8 +1773,12 @@ public class LocationManagerService extends ILocationManager.Stub { @Override @Override public boolean isProviderEnabled(String provider) { public boolean isProviderEnabled(String provider) { // TODO: remove this check in next release, see b/10696351 checkResolutionLevelIsSufficientForProviderUse(getCallerAllowedResolutionLevel(), checkResolutionLevelIsSufficientForProviderUse(getCallerAllowedResolutionLevel(), provider); provider); // Fused provider is accessed indirectly via criteria rather than the provider-based APIs, // so we discourage its use if (LocationManager.FUSED_PROVIDER.equals(provider)) return false; if (LocationManager.FUSED_PROVIDER.equals(provider)) return false; int uid = Binder.getCallingUid(); int uid = Binder.getCallingUid(); Loading Loading
core/java/android/provider/Settings.java +9 −4 Original line number Original line Diff line number Diff line Loading @@ -3335,7 +3335,9 @@ public final class Settings { */ */ public static final int LOCATION_MODE_SENSORS_ONLY = 1; public static final int LOCATION_MODE_SENSORS_ONLY = 1; /** /** * Reduced power usage, such as limiting the number of GPS updates per hour. * 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}. */ */ public static final int LOCATION_MODE_BATTERY_SAVING = 2; public static final int LOCATION_MODE_BATTERY_SAVING = 2; /** /** Loading Loading @@ -4384,10 +4386,13 @@ public final class Settings { /** /** * Helper method for determining if a location provider is enabled. * Helper method for determining if a location provider is enabled. * * @param cr the content resolver to use * @param cr the content resolver to use * @param provider the location provider to query * @param provider the location provider to query * @return true if the provider is enabled * @return true if the provider is enabled * @deprecated use {@link #getInt(ContentResolver, String)} and {@link #LOCATION_MODE} * * @deprecated use {@link #LOCATION_MODE} or * {@link LocationManager#isProviderEnabled(String)} */ */ @Deprecated @Deprecated public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { public static final boolean isLocationProviderEnabled(ContentResolver cr, String provider) { Loading @@ -4400,8 +4405,8 @@ public final class Settings { * @param provider the location provider to query * @param provider the location provider to query * @param userId the userId to query * @param userId the userId to query * @return true if the provider is enabled * @return true if the provider is enabled * @deprecated use {@link #getIntForUser(ContentResolver, String, int, int)} and * @deprecated use {@link #LOCATION_MODE} or * {@link #LOCATION_MODE} * {@link LocationManager#isProviderEnabled(String)} * @hide * @hide */ */ @Deprecated @Deprecated Loading
location/java/android/location/LocationManager.java +12 −6 Original line number Original line Diff line number Diff line Loading @@ -152,17 +152,18 @@ public class LocationManager { /** /** * Broadcast intent action when the configured location providers * Broadcast intent action when the configured location providers * change. If you're interacting with the * change. For use with {@link #isProviderEnabled(String)}. If you're interacting with the * {@link android.provider.Settings.Secure#LOCATION_MODE} API, * {@link android.provider.Settings.Secure#LOCATION_MODE} API, use {@link #MODE_CHANGED_ACTION} * use {@link #MODE_CHANGED_ACTION} instead. * instead. */ */ public static final String PROVIDERS_CHANGED_ACTION = public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED"; "android.location.PROVIDERS_CHANGED"; /** /** * Broadcast intent action when {@link android.provider.Settings.Secure#LOCATION_MODE} changes. * Broadcast intent action when {@link android.provider.Settings.Secure#LOCATION_MODE} changes. * If you're interacting with provider-based APIs such as {@link #getProviders(boolean)}, you * For use with the {@link android.provider.Settings.Secure#LOCATION_MODE} API. * use {@link #PROVIDERS_CHANGED_ACTION} instead. * 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 * In the future, there may be mode changes that do not result in * {@link #PROVIDERS_CHANGED_ACTION} broadcasts. * {@link #PROVIDERS_CHANGED_ACTION} broadcasts. Loading Loading @@ -1098,8 +1099,13 @@ public class LocationManager { * <p>If the user has enabled this provider in the Settings menu, true * <p>If the user has enabled this provider in the Settings menu, true * is returned otherwise false is returned * is returned otherwise false is returned * * * <p>Callers should instead use * {@link android.provider.Settings.Secure#LOCATION_MODE} * unless they depend on provider-specific APIs such as * {@link #requestLocationUpdates(String, long, float, LocationListener)}. * * @param provider the name of the provider * @param provider the name of the provider * @return true if the provider is enabled * @return true if the provider exists and is enabled * * * @throws IllegalArgumentException if provider is null * @throws IllegalArgumentException if provider is null * @throws SecurityException if no suitable permission is present * @throws SecurityException if no suitable permission is present Loading
services/java/com/android/server/LocationManagerService.java +4 −0 Original line number Original line Diff line number Diff line Loading @@ -1773,8 +1773,12 @@ public class LocationManagerService extends ILocationManager.Stub { @Override @Override public boolean isProviderEnabled(String provider) { public boolean isProviderEnabled(String provider) { // TODO: remove this check in next release, see b/10696351 checkResolutionLevelIsSufficientForProviderUse(getCallerAllowedResolutionLevel(), checkResolutionLevelIsSufficientForProviderUse(getCallerAllowedResolutionLevel(), provider); provider); // Fused provider is accessed indirectly via criteria rather than the provider-based APIs, // so we discourage its use if (LocationManager.FUSED_PROVIDER.equals(provider)) return false; if (LocationManager.FUSED_PROVIDER.equals(provider)) return false; int uid = Binder.getCallingUid(); int uid = Binder.getCallingUid(); Loading