From 77e8fe6243f92dc1f9c31838e1a474342ead0540 Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Thu, 10 Sep 2020 14:27:24 +0100 Subject: [PATCH] Disable geolocation time zone detection Time zone detection code was not referring to the "enable feature" boolean for the upcoming geolocation time zone detection feature in some necessary places, leading the time zone detector to conclude the feature was enabled. That meant devices would ignore telephony time zone suggestions, but because geolocation isn't implemented fully yet, there were no geo-based suggestions. This meant the device would just sit on its existing time zone. This change puts in the necessary checks. Bug: 167904672 Test: build / boot / manually verify telephony info is being used Change-Id: I7be2dbaa2afd1806b2ba248c3be3f9d5251650e1 --- .../TimeZoneDetectorCallbackImpl.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java index d640323255390..6a12b7c8f9a5b 100644 --- a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java +++ b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorCallbackImpl.java @@ -117,12 +117,13 @@ public final class TimeZoneDetectorCallbackImpl implements TimeZoneDetectorStrat @Override public ConfigurationInternal getConfigurationInternal(@UserIdInt int userId) { + boolean geoDetectionEnabled = mGeoDetectionFeatureEnabled && isGeoDetectionEnabled(userId); return new ConfigurationInternal.Builder(userId) .setUserConfigAllowed(isUserConfigAllowed(userId)) .setAutoDetectionSupported(isAutoDetectionSupported()) .setAutoDetectionEnabled(isAutoDetectionEnabled()) .setLocationEnabled(isLocationEnabled(userId)) - .setGeoDetectionEnabled(isGeoDetectionEnabled(userId)) + .setGeoDetectionEnabled(geoDetectionEnabled) .build(); } @@ -167,9 +168,11 @@ public final class TimeZoneDetectorCallbackImpl implements TimeZoneDetectorStrat final boolean autoDetectionEnabled = configuration.isAutoDetectionEnabled(); setAutoDetectionEnabled(autoDetectionEnabled); - final int userId = configuration.getUserId(); - final boolean geoTzDetectionEnabled = configuration.isGeoDetectionEnabled(); - setGeoDetectionEnabled(userId, geoTzDetectionEnabled); + if (mGeoDetectionFeatureEnabled) { + final int userId = configuration.getUserId(); + final boolean geoTzDetectionEnabled = configuration.isGeoDetectionEnabled(); + setGeoDetectionEnabled(userId, geoTzDetectionEnabled); + } } } @@ -211,4 +214,4 @@ public final class TimeZoneDetectorCallbackImpl implements TimeZoneDetectorStrat return mContext.getSystemService(ConnectivityManager.class) .isNetworkSupported(ConnectivityManager.TYPE_MOBILE); } -} \ No newline at end of file +}