DO NOT MERGE Let isLocationEnabledForUser() return true location setting
* In API 28, LocationManager#isLocationEnabled() and
LocationManager#isLocationEnabledForUser(UserHandle) always
return false when a device has neither LocationManager#GPS_PROVIDER
nor LocationManager#NETWORK_PROVIDER.
* Instead of letting setLocationEnabled() and isLocationEnabled()
depend on whether device has GPS or NETWORK location provider, this
CL changes these two APIs to directly use LOCATION_MODE setting to
store the location enable state
* Hence when LOCATION_PROVIDERS_ALLOWED contains a provider, the provider
may be used, but it is not guaranteed to exist
* Settings.java has two workarounds that actually convert:
- putInt(LOCATION_MODE, LOCATION_MODE_HIGH_ACCURACY)
=> putString(LOCATION_PROVIDERS_ALLOWED, "+gps");
=> putString(LOCATION_PROVIDERS_ALLOWED, "+network");
- getInt(LOCATION_MODE, LOCATION_MODE_HIGH_ACCURACY)
=> getString(LOCATION_PROVIDERS_ALLOWED):
- "gps,network" - LOCATION_MODE_HIGH_ACCURACY
- "gps" - LOCATION_MODE_SENSORS_ONLY
- "network" - LOCATION_MODE_BATTERY_SAVING
- others - LOCATION_MODE_OFF
* Hence this is NOT a new behavior
Bug: 121040693
Bug: 118242060
Bug: 127359153
Test: CTS tests,
android.bluetooth.cts.BluetoothLeScanTest#testBasicBleScan,
android.bluetooth.cts.BluetoothLeScanTest#testScanFilter,
android.location.cts.LocationManagerTest,
android.location2.cts.LocationManagerTest
Change-Id: I7972d8f97f4ca82c58c29641a081ef73fdcb106c
1 file changed