Merge "request location based country detector in WiFi ON" into sc-dev am: 08fe5faf25

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13473668

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I4097783cd5946feaa0e4830df015fbdcf01e8e94
This commit is contained in:
Chinmay Dhodapkar
2021-02-24 21:18:12 +00:00
committed by Automerger Merge Worker

View File

@@ -320,13 +320,15 @@ public class ComprehensiveCountryDetector extends CountryDetectorBase {
"(source: " + detectedCountry.getSource()
+ ", countryISO: " + detectedCountry.getCountryIso() + ")")
+ " isAirplaneModeOff()=" + isAirplaneModeOff()
+ " isWifiOn()=" + isWifiOn()
+ " mListener=" + mListener
+ " isGeoCoderImplemnted()=" + isGeoCoderImplemented());
}
if (startLocationBasedDetection && (detectedCountry == null
|| detectedCountry.getSource() > Country.COUNTRY_SOURCE_LOCATION)
&& isAirplaneModeOff() && mListener != null && isGeoCoderImplemented()) {
&& (isAirplaneModeOff() || isWifiOn()) && mListener != null
&& isGeoCoderImplemented()) {
if (DEBUG) Slog.d(TAG, "run startLocationBasedDetector()");
// Start finding location when the source is less reliable than the
// location and the airplane mode is off (as geocoder will not
@@ -387,6 +389,11 @@ public class ComprehensiveCountryDetector extends CountryDetectorBase {
mContext.getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0) == 0;
}
protected boolean isWifiOn() {
return Settings.Global.getInt(
mContext.getContentResolver(), Settings.Global.WIFI_ON, 0) != 0;
}
/**
* Notify the country change.
*/