Loading api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -2954,7 +2954,7 @@ package android.location { method public void setLocationControllerExtraPackage(java.lang.String); method public void setLocationControllerExtraPackageEnabled(boolean); method public void setLocationEnabledForUser(boolean, android.os.UserHandle); method public boolean setProviderEnabledForUser(java.lang.String, boolean, android.os.UserHandle); method public deprecated boolean setProviderEnabledForUser(java.lang.String, boolean, android.os.UserHandle); method public boolean unregisterGnssBatchedLocationCallback(android.location.BatchedLocationCallback); } Loading config/hiddenapi-greylist.txt +0 −1 Original line number Diff line number Diff line Loading @@ -490,7 +490,6 @@ Landroid/location/ILocationManager$Stub;->asInterface(Landroid/os/IBinder;)Landr Landroid/location/ILocationManager$Stub;->TRANSACTION_getAllProviders:I Landroid/location/ILocationManager;->getAllProviders()Ljava/util/List; Landroid/location/ILocationManager;->getNetworkProviderPackage()Ljava/lang/String; Landroid/location/ILocationManager;->reportLocation(Landroid/location/Location;Z)V Landroid/location/INetInitiatedListener$Stub;-><init>()V Landroid/location/INetInitiatedListener;->sendNiResponse(II)Z Landroid/location/LocationManager$ListenerTransport;-><init>(Landroid/location/LocationManager;Landroid/location/LocationListener;Landroid/os/Looper;)V Loading core/java/android/provider/Settings.java +6 −105 Original line number Diff line number Diff line Loading @@ -5030,10 +5030,6 @@ public final class Settings { public static boolean putStringForUser(@NonNull ContentResolver resolver, @NonNull String name, @Nullable String value, @Nullable String tag, boolean makeDefault, @UserIdInt int userHandle) { if (LOCATION_MODE.equals(name)) { // Map LOCATION_MODE to underlying location provider storage API return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle); } if (MOVED_TO_GLOBAL.contains(name)) { Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" + " to android.provider.Settings.Global"); Loading Loading @@ -5186,10 +5182,6 @@ public final class Settings { /** @hide */ @UnsupportedAppUsage public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { if (LOCATION_MODE.equals(name)) { // Map from to underlying location provider storage API to location mode return getLocationModeForUser(cr, userHandle); } String v = getStringForUser(cr, name, userHandle); try { return v != null ? Integer.parseInt(v) : def; Loading Loading @@ -5224,10 +5216,6 @@ public final class Settings { /** @hide */ public static int getIntForUser(ContentResolver cr, String name, int userHandle) throws SettingNotFoundException { if (LOCATION_MODE.equals(name)) { // Map from to underlying location provider storage API to location mode return getLocationModeForUser(cr, userHandle); } String v = getStringForUser(cr, name, userHandle); try { return Integer.parseInt(v); Loading Loading @@ -5810,9 +5798,8 @@ public final class Settings { * this value being present in settings.db or on ContentObserver notifications on the * corresponding Uri. * * @deprecated use {@link #LOCATION_MODE} and * {@link LocationManager#MODE_CHANGED_ACTION} (or * {@link LocationManager#PROVIDERS_CHANGED_ACTION}) * @deprecated Providers should not be controlled individually. See {@link #LOCATION_MODE} * documentation for information on reading/writing location information. */ @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; Loading @@ -5830,9 +5817,7 @@ public final class Settings { * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} * to receive changes in this value. * * @deprecated To check location status, use {@link LocationManager#isLocationEnabled()}. To * get the status of a location provider, use * {@link LocationManager#isProviderEnabled(String)}. * @deprecated To check location mode, use {@link LocationManager#isLocationEnabled()}. */ @Deprecated public static final String LOCATION_MODE = "location_mode"; Loading Loading @@ -5861,9 +5846,7 @@ public final class Settings { /** * Location access disabled. * * @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}. */ @Deprecated public static final int LOCATION_MODE_OFF = 0; Loading @@ -5883,9 +5866,7 @@ public final class Settings { * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to * {@link android.location.Criteria#POWER_MEDIUM}. * * @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}. */ @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; Loading @@ -5893,9 +5874,7 @@ public final class Settings { /** * Best-effort location computation allowed. * * @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}. */ @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; Loading Loading @@ -8778,84 +8757,6 @@ public final class Settings { userId); } } /** * Thread-safe method for setting the location mode to one of * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. * Necessary because the mode is a composite of the underlying location provider * settings. * * @param cr the content resolver to use * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} * @param userId the userId for which to change mode * @return true if the value was set, false on database errors * * @throws IllegalArgumentException if mode is not one of the supported values * * @deprecated To enable/disable location, use * {@link LocationManager#setLocationEnabledForUser(boolean, int)}. * To enable/disable a specific location provider, use * {@link LocationManager#setProviderEnabledForUser(String, boolean, int)}. */ @Deprecated private static boolean setLocationModeForUser( ContentResolver cr, int mode, int userId) { synchronized (mLocationSettingsLock) { boolean gps = false; boolean network = false; switch (mode) { case LOCATION_MODE_OFF: break; case LOCATION_MODE_SENSORS_ONLY: gps = true; break; case LOCATION_MODE_BATTERY_SAVING: network = true; break; case LOCATION_MODE_HIGH_ACCURACY: gps = true; network = true; break; default: throw new IllegalArgumentException("Invalid location mode: " + mode); } boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser( cr, LocationManager.NETWORK_PROVIDER, network, userId); boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser( cr, LocationManager.GPS_PROVIDER, gps, userId); return gpsSuccess && nlpSuccess; } } /** * Thread-safe method for reading the location mode, returns one of * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary * because the mode is a composite of the underlying location provider settings. * * @param cr the content resolver to use * @param userId the userId for which to read the mode * @return the location mode */ private static final int getLocationModeForUser(ContentResolver cr, int userId) { synchronized (mLocationSettingsLock) { boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( cr, LocationManager.GPS_PROVIDER, userId); boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser( cr, LocationManager.NETWORK_PROVIDER, userId); if (gpsEnabled && networkEnabled) { return LOCATION_MODE_HIGH_ACCURACY; } else if (gpsEnabled) { return LOCATION_MODE_SENSORS_ONLY; } else if (networkEnabled) { return LOCATION_MODE_BATTERY_SAVING; } else { return LOCATION_MODE_OFF; } } } } /** Loading location/java/android/location/ILocationManager.aidl +0 −7 Original line number Diff line number Diff line Loading @@ -89,7 +89,6 @@ interface ILocationManager List<String> getAllProviders(); List<String> getProviders(in Criteria criteria, boolean enabledOnly); String getBestProvider(in Criteria criteria, boolean enabledOnly); boolean providerMeetsCriteria(String provider, in Criteria criteria); ProviderProperties getProviderProperties(String provider); String getNetworkProviderPackage(); void setLocationControllerExtraPackage(String packageName); Loading @@ -98,9 +97,7 @@ interface ILocationManager boolean isLocationControllerExtraPackageEnabled(); boolean isProviderEnabledForUser(String provider, int userId); boolean setProviderEnabledForUser(String provider, boolean enabled, int userId); boolean isLocationEnabledForUser(int userId); void setLocationEnabledForUser(boolean enabled, int userId); void addTestProvider(String name, in ProviderProperties properties, String opPackageName); void removeTestProvider(String provider, String opPackageName); void setTestProviderLocation(String provider, in Location loc, String opPackageName); Loading @@ -114,10 +111,6 @@ interface ILocationManager // --- internal --- // --- deprecated --- void reportLocation(in Location location, boolean passive); void reportLocationBatch(in List<Location> locations); // for reporting callback completion void locationCallbackFinished(ILocationListener listener); Loading location/java/android/location/LocationManager.java +17 −12 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import com.android.internal.location.ProviderProperties; Loading Loading @@ -1282,11 +1283,13 @@ public class LocationManager { @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) { try { mService.setLocationEnabledForUser(enabled, userHandle.getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.LOCATION_MODE, enabled ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY : Settings.Secure.LOCATION_MODE_OFF, userHandle.getIdentifier()); } /** Loading Loading @@ -1372,20 +1375,22 @@ public class LocationManager { * @return true if the value was set, false on database errors * * @throws IllegalArgumentException if provider is null * @deprecated Do not manipulate providers individually, use * {@link #setLocationEnabledForUser(boolean, UserHandle)} instead. * @hide */ @Deprecated @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) 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(); } return Settings.Secure.setLocationProviderEnabledForUser( mContext.getContentResolver(), provider, enabled, userHandle.getIdentifier()); } /** Loading Loading @@ -1578,7 +1583,7 @@ public class LocationManager { */ @Deprecated public void clearTestProviderEnabled(String provider) { setTestProviderEnabled(provider, true); setTestProviderEnabled(provider, false); } /** Loading Loading
api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -2954,7 +2954,7 @@ package android.location { method public void setLocationControllerExtraPackage(java.lang.String); method public void setLocationControllerExtraPackageEnabled(boolean); method public void setLocationEnabledForUser(boolean, android.os.UserHandle); method public boolean setProviderEnabledForUser(java.lang.String, boolean, android.os.UserHandle); method public deprecated boolean setProviderEnabledForUser(java.lang.String, boolean, android.os.UserHandle); method public boolean unregisterGnssBatchedLocationCallback(android.location.BatchedLocationCallback); } Loading
config/hiddenapi-greylist.txt +0 −1 Original line number Diff line number Diff line Loading @@ -490,7 +490,6 @@ Landroid/location/ILocationManager$Stub;->asInterface(Landroid/os/IBinder;)Landr Landroid/location/ILocationManager$Stub;->TRANSACTION_getAllProviders:I Landroid/location/ILocationManager;->getAllProviders()Ljava/util/List; Landroid/location/ILocationManager;->getNetworkProviderPackage()Ljava/lang/String; Landroid/location/ILocationManager;->reportLocation(Landroid/location/Location;Z)V Landroid/location/INetInitiatedListener$Stub;-><init>()V Landroid/location/INetInitiatedListener;->sendNiResponse(II)Z Landroid/location/LocationManager$ListenerTransport;-><init>(Landroid/location/LocationManager;Landroid/location/LocationListener;Landroid/os/Looper;)V Loading
core/java/android/provider/Settings.java +6 −105 Original line number Diff line number Diff line Loading @@ -5030,10 +5030,6 @@ public final class Settings { public static boolean putStringForUser(@NonNull ContentResolver resolver, @NonNull String name, @Nullable String value, @Nullable String tag, boolean makeDefault, @UserIdInt int userHandle) { if (LOCATION_MODE.equals(name)) { // Map LOCATION_MODE to underlying location provider storage API return setLocationModeForUser(resolver, Integer.parseInt(value), userHandle); } if (MOVED_TO_GLOBAL.contains(name)) { Log.w(TAG, "Setting " + name + " has moved from android.provider.Settings.Secure" + " to android.provider.Settings.Global"); Loading Loading @@ -5186,10 +5182,6 @@ public final class Settings { /** @hide */ @UnsupportedAppUsage public static int getIntForUser(ContentResolver cr, String name, int def, int userHandle) { if (LOCATION_MODE.equals(name)) { // Map from to underlying location provider storage API to location mode return getLocationModeForUser(cr, userHandle); } String v = getStringForUser(cr, name, userHandle); try { return v != null ? Integer.parseInt(v) : def; Loading Loading @@ -5224,10 +5216,6 @@ public final class Settings { /** @hide */ public static int getIntForUser(ContentResolver cr, String name, int userHandle) throws SettingNotFoundException { if (LOCATION_MODE.equals(name)) { // Map from to underlying location provider storage API to location mode return getLocationModeForUser(cr, userHandle); } String v = getStringForUser(cr, name, userHandle); try { return Integer.parseInt(v); Loading Loading @@ -5810,9 +5798,8 @@ public final class Settings { * this value being present in settings.db or on ContentObserver notifications on the * corresponding Uri. * * @deprecated use {@link #LOCATION_MODE} and * {@link LocationManager#MODE_CHANGED_ACTION} (or * {@link LocationManager#PROVIDERS_CHANGED_ACTION}) * @deprecated Providers should not be controlled individually. See {@link #LOCATION_MODE} * documentation for information on reading/writing location information. */ @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed"; Loading @@ -5830,9 +5817,7 @@ public final class Settings { * notifications for the corresponding Uri. Use {@link LocationManager#MODE_CHANGED_ACTION} * to receive changes in this value. * * @deprecated To check location status, use {@link LocationManager#isLocationEnabled()}. To * get the status of a location provider, use * {@link LocationManager#isProviderEnabled(String)}. * @deprecated To check location mode, use {@link LocationManager#isLocationEnabled()}. */ @Deprecated public static final String LOCATION_MODE = "location_mode"; Loading Loading @@ -5861,9 +5846,7 @@ public final class Settings { /** * Location access disabled. * * @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}. */ @Deprecated public static final int LOCATION_MODE_OFF = 0; Loading @@ -5883,9 +5866,7 @@ public final class Settings { * with {@link android.location.Criteria#POWER_HIGH} may be downgraded to * {@link android.location.Criteria#POWER_MEDIUM}. * * @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}. */ @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; Loading @@ -5893,9 +5874,7 @@ public final class Settings { /** * Best-effort location computation allowed. * * @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}. */ @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; Loading Loading @@ -8778,84 +8757,6 @@ public final class Settings { userId); } } /** * Thread-safe method for setting the location mode to one of * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. * Necessary because the mode is a composite of the underlying location provider * settings. * * @param cr the content resolver to use * @param mode such as {@link #LOCATION_MODE_HIGH_ACCURACY} * @param userId the userId for which to change mode * @return true if the value was set, false on database errors * * @throws IllegalArgumentException if mode is not one of the supported values * * @deprecated To enable/disable location, use * {@link LocationManager#setLocationEnabledForUser(boolean, int)}. * To enable/disable a specific location provider, use * {@link LocationManager#setProviderEnabledForUser(String, boolean, int)}. */ @Deprecated private static boolean setLocationModeForUser( ContentResolver cr, int mode, int userId) { synchronized (mLocationSettingsLock) { boolean gps = false; boolean network = false; switch (mode) { case LOCATION_MODE_OFF: break; case LOCATION_MODE_SENSORS_ONLY: gps = true; break; case LOCATION_MODE_BATTERY_SAVING: network = true; break; case LOCATION_MODE_HIGH_ACCURACY: gps = true; network = true; break; default: throw new IllegalArgumentException("Invalid location mode: " + mode); } boolean nlpSuccess = Settings.Secure.setLocationProviderEnabledForUser( cr, LocationManager.NETWORK_PROVIDER, network, userId); boolean gpsSuccess = Settings.Secure.setLocationProviderEnabledForUser( cr, LocationManager.GPS_PROVIDER, gps, userId); return gpsSuccess && nlpSuccess; } } /** * Thread-safe method for reading the location mode, returns one of * {@link #LOCATION_MODE_HIGH_ACCURACY}, {@link #LOCATION_MODE_SENSORS_ONLY}, * {@link #LOCATION_MODE_BATTERY_SAVING}, or {@link #LOCATION_MODE_OFF}. Necessary * because the mode is a composite of the underlying location provider settings. * * @param cr the content resolver to use * @param userId the userId for which to read the mode * @return the location mode */ private static final int getLocationModeForUser(ContentResolver cr, int userId) { synchronized (mLocationSettingsLock) { boolean gpsEnabled = Settings.Secure.isLocationProviderEnabledForUser( cr, LocationManager.GPS_PROVIDER, userId); boolean networkEnabled = Settings.Secure.isLocationProviderEnabledForUser( cr, LocationManager.NETWORK_PROVIDER, userId); if (gpsEnabled && networkEnabled) { return LOCATION_MODE_HIGH_ACCURACY; } else if (gpsEnabled) { return LOCATION_MODE_SENSORS_ONLY; } else if (networkEnabled) { return LOCATION_MODE_BATTERY_SAVING; } else { return LOCATION_MODE_OFF; } } } } /** Loading
location/java/android/location/ILocationManager.aidl +0 −7 Original line number Diff line number Diff line Loading @@ -89,7 +89,6 @@ interface ILocationManager List<String> getAllProviders(); List<String> getProviders(in Criteria criteria, boolean enabledOnly); String getBestProvider(in Criteria criteria, boolean enabledOnly); boolean providerMeetsCriteria(String provider, in Criteria criteria); ProviderProperties getProviderProperties(String provider); String getNetworkProviderPackage(); void setLocationControllerExtraPackage(String packageName); Loading @@ -98,9 +97,7 @@ interface ILocationManager boolean isLocationControllerExtraPackageEnabled(); boolean isProviderEnabledForUser(String provider, int userId); boolean setProviderEnabledForUser(String provider, boolean enabled, int userId); boolean isLocationEnabledForUser(int userId); void setLocationEnabledForUser(boolean enabled, int userId); void addTestProvider(String name, in ProviderProperties properties, String opPackageName); void removeTestProvider(String provider, String opPackageName); void setTestProviderLocation(String provider, in Location loc, String opPackageName); Loading @@ -114,10 +111,6 @@ interface ILocationManager // --- internal --- // --- deprecated --- void reportLocation(in Location location, boolean passive); void reportLocationBatch(in List<Location> locations); // for reporting callback completion void locationCallbackFinished(ILocationListener listener); Loading
location/java/android/location/LocationManager.java +17 −12 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import android.util.Log; import com.android.internal.location.ProviderProperties; Loading Loading @@ -1282,11 +1283,13 @@ public class LocationManager { @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) public void setLocationEnabledForUser(boolean enabled, UserHandle userHandle) { try { mService.setLocationEnabledForUser(enabled, userHandle.getIdentifier()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Settings.Secure.putIntForUser( mContext.getContentResolver(), Settings.Secure.LOCATION_MODE, enabled ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY : Settings.Secure.LOCATION_MODE_OFF, userHandle.getIdentifier()); } /** Loading Loading @@ -1372,20 +1375,22 @@ public class LocationManager { * @return true if the value was set, false on database errors * * @throws IllegalArgumentException if provider is null * @deprecated Do not manipulate providers individually, use * {@link #setLocationEnabledForUser(boolean, UserHandle)} instead. * @hide */ @Deprecated @SystemApi @RequiresPermission(WRITE_SECURE_SETTINGS) 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(); } return Settings.Secure.setLocationProviderEnabledForUser( mContext.getContentResolver(), provider, enabled, userHandle.getIdentifier()); } /** Loading Loading @@ -1578,7 +1583,7 @@ public class LocationManager { */ @Deprecated public void clearTestProviderEnabled(String provider) { setTestProviderEnabled(provider, true); setTestProviderEnabled(provider, false); } /** Loading