From 005355975cb549f934207a0acdb501f82bdebfcc Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Fri, 9 Oct 2020 12:13:13 +0100 Subject: [PATCH] Add a system property for geotz Add a system property that can be used to enable the Geolocation Time Zone Detection feature. Previously it was hardcoded. $ adb shell setprop \ persist.sys.location_time_zone_detection_feature_enabled 1 ... and a reboot to turn it on. Bug: 151304765 Test: build / boot / flip / manual test Change-Id: If8aa682cde05c18058a09bfd34b75d7ba9e5e46e --- .../timezonedetector/TimeZoneDetectorService.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java index d09cd38d76809..68a086da50375 100644 --- a/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java +++ b/services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java @@ -30,6 +30,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.ShellCallback; +import android.os.SystemProperties; import android.util.ArrayMap; import android.util.IndentingPrintWriter; import android.util.Slog; @@ -58,11 +59,14 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub private static final String TAG = "TimeZoneDetectorService"; /** - * A compile time constant "feature switch" for enabling / disabling location-based time zone - * detection on Android. If this is {@code false}, there should be few / little changes in - * behavior with previous releases and little overhead associated with geolocation components. + * A "feature switch" for enabling / disabling location-based time zone detection. If this is + * {@code false}, there should be few / little changes in behavior with previous releases and + * little overhead associated with geolocation components. + * TODO(b/151304765) Remove this when the feature is on for all. */ - public static final boolean GEOLOCATION_TIME_ZONE_DETECTION_ENABLED = false; + public static final boolean GEOLOCATION_TIME_ZONE_DETECTION_ENABLED = + SystemProperties.getBoolean( + "persist.sys.location_time_zone_detection_feature_enabled", false); /** * Handles the service lifecycle for {@link TimeZoneDetectorService} and