Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1602,6 +1602,9 @@ config_timeZoneRulesUpdateTrackingEnabled are true.] --> <integer name="config_timeZoneRulesCheckRetryCount">5</integer> <!-- Whether the geolocation time zone detection feature is enabled. --> <bool name="config_enableGeolocationTimeZoneDetection" translatable="false">false</bool> <!-- Whether to enable primary location time zone provider overlay which allows the primary location time zone provider to be replaced by an app at run-time. When disabled, only the config_primaryLocationTimeZoneProviderPackageName package will be searched for the primary Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2165,6 +2165,7 @@ <java-symbol type="string" name="config_defaultNetworkScorerPackageName" /> <java-symbol type="string" name="config_persistentDataPackageName" /> <java-symbol type="string" name="config_deviceConfiguratorPackageName" /> <java-symbol type="bool" name="config_enableGeolocationTimeZoneDetection" /> <java-symbol type="bool" name="config_enablePrimaryLocationTimeZoneOverlay" /> <java-symbol type="string" name="config_primaryLocationTimeZoneProviderPackageName" /> <java-symbol type="bool" name="config_enableSecondaryLocationTimeZoneOverlay" /> Loading services/core/java/com/android/server/location/timezone/LocationTimeZoneManagerService.java +4 −3 Original line number Diff line number Diff line Loading @@ -79,8 +79,8 @@ public class LocationTimeZoneManagerService extends Binder { @Override public void onStart() { if (TimeZoneDetectorService.GEOLOCATION_TIME_ZONE_DETECTION_ENABLED) { Context context = getContext(); if (TimeZoneDetectorService.isGeoLocationTimeZoneDetectionEnabled(context)) { mService = new LocationTimeZoneManagerService(context); // The service currently exposes no LocalService or Binder API, but it extends Loading @@ -93,7 +93,8 @@ public class LocationTimeZoneManagerService extends Binder { @Override public void onBootPhase(int phase) { if (TimeZoneDetectorService.GEOLOCATION_TIME_ZONE_DETECTION_ENABLED) { Context context = getContext(); if (TimeZoneDetectorService.isGeoLocationTimeZoneDetectionEnabled(context)) { if (phase == PHASE_SYSTEM_SERVICES_READY) { // The location service must be functioning after this boot phase. mService.onSystemReady(); Loading services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java +21 −8 Original line number Diff line number Diff line Loading @@ -59,14 +59,25 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub private static final String TAG = "TimeZoneDetectorService"; /** * 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. * A "feature switch" for location-based time zone detection. If this is {@code false}. It is * initialized and never refreshed; it affects what services are started on boot so consistency * is important. */ public static final boolean GEOLOCATION_TIME_ZONE_DETECTION_ENABLED = SystemProperties.getBoolean( @Nullable private static Boolean sGeoLocationTimeZoneDetectionEnabled; /** Returns {@code true} if the location-based time zone detection feature is enabled. */ public static boolean isGeoLocationTimeZoneDetectionEnabled(Context context) { if (sGeoLocationTimeZoneDetectionEnabled == null) { // The config value is expected to be the main switch. Platform developers can also // enable the feature using a persistent system property. sGeoLocationTimeZoneDetectionEnabled = context.getResources().getBoolean( com.android.internal.R.bool.config_enableGeolocationTimeZoneDetection) || SystemProperties.getBoolean( "persist.sys.location_time_zone_detection_feature_enabled", false); } return sGeoLocationTimeZoneDetectionEnabled; } /** * Handles the service lifecycle for {@link TimeZoneDetectorService} and Loading @@ -84,9 +95,11 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub Context context = getContext(); Handler handler = FgThread.getHandler(); boolean geolocationTimeZoneDetectionEnabled = isGeoLocationTimeZoneDetectionEnabled(context); TimeZoneDetectorStrategy timeZoneDetectorStrategy = TimeZoneDetectorStrategyImpl.create( context, handler, GEOLOCATION_TIME_ZONE_DETECTION_ENABLED); context, handler, geolocationTimeZoneDetectionEnabled); // Create and publish the local service for use by internal callers. TimeZoneDetectorInternal internal = Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -1602,6 +1602,9 @@ config_timeZoneRulesUpdateTrackingEnabled are true.] --> <integer name="config_timeZoneRulesCheckRetryCount">5</integer> <!-- Whether the geolocation time zone detection feature is enabled. --> <bool name="config_enableGeolocationTimeZoneDetection" translatable="false">false</bool> <!-- Whether to enable primary location time zone provider overlay which allows the primary location time zone provider to be replaced by an app at run-time. When disabled, only the config_primaryLocationTimeZoneProviderPackageName package will be searched for the primary Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -2165,6 +2165,7 @@ <java-symbol type="string" name="config_defaultNetworkScorerPackageName" /> <java-symbol type="string" name="config_persistentDataPackageName" /> <java-symbol type="string" name="config_deviceConfiguratorPackageName" /> <java-symbol type="bool" name="config_enableGeolocationTimeZoneDetection" /> <java-symbol type="bool" name="config_enablePrimaryLocationTimeZoneOverlay" /> <java-symbol type="string" name="config_primaryLocationTimeZoneProviderPackageName" /> <java-symbol type="bool" name="config_enableSecondaryLocationTimeZoneOverlay" /> Loading
services/core/java/com/android/server/location/timezone/LocationTimeZoneManagerService.java +4 −3 Original line number Diff line number Diff line Loading @@ -79,8 +79,8 @@ public class LocationTimeZoneManagerService extends Binder { @Override public void onStart() { if (TimeZoneDetectorService.GEOLOCATION_TIME_ZONE_DETECTION_ENABLED) { Context context = getContext(); if (TimeZoneDetectorService.isGeoLocationTimeZoneDetectionEnabled(context)) { mService = new LocationTimeZoneManagerService(context); // The service currently exposes no LocalService or Binder API, but it extends Loading @@ -93,7 +93,8 @@ public class LocationTimeZoneManagerService extends Binder { @Override public void onBootPhase(int phase) { if (TimeZoneDetectorService.GEOLOCATION_TIME_ZONE_DETECTION_ENABLED) { Context context = getContext(); if (TimeZoneDetectorService.isGeoLocationTimeZoneDetectionEnabled(context)) { if (phase == PHASE_SYSTEM_SERVICES_READY) { // The location service must be functioning after this boot phase. mService.onSystemReady(); Loading
services/core/java/com/android/server/timezonedetector/TimeZoneDetectorService.java +21 −8 Original line number Diff line number Diff line Loading @@ -59,14 +59,25 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub private static final String TAG = "TimeZoneDetectorService"; /** * 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. * A "feature switch" for location-based time zone detection. If this is {@code false}. It is * initialized and never refreshed; it affects what services are started on boot so consistency * is important. */ public static final boolean GEOLOCATION_TIME_ZONE_DETECTION_ENABLED = SystemProperties.getBoolean( @Nullable private static Boolean sGeoLocationTimeZoneDetectionEnabled; /** Returns {@code true} if the location-based time zone detection feature is enabled. */ public static boolean isGeoLocationTimeZoneDetectionEnabled(Context context) { if (sGeoLocationTimeZoneDetectionEnabled == null) { // The config value is expected to be the main switch. Platform developers can also // enable the feature using a persistent system property. sGeoLocationTimeZoneDetectionEnabled = context.getResources().getBoolean( com.android.internal.R.bool.config_enableGeolocationTimeZoneDetection) || SystemProperties.getBoolean( "persist.sys.location_time_zone_detection_feature_enabled", false); } return sGeoLocationTimeZoneDetectionEnabled; } /** * Handles the service lifecycle for {@link TimeZoneDetectorService} and Loading @@ -84,9 +95,11 @@ public final class TimeZoneDetectorService extends ITimeZoneDetectorService.Stub Context context = getContext(); Handler handler = FgThread.getHandler(); boolean geolocationTimeZoneDetectionEnabled = isGeoLocationTimeZoneDetectionEnabled(context); TimeZoneDetectorStrategy timeZoneDetectorStrategy = TimeZoneDetectorStrategyImpl.create( context, handler, GEOLOCATION_TIME_ZONE_DETECTION_ENABLED); context, handler, geolocationTimeZoneDetectionEnabled); // Create and publish the local service for use by internal callers. TimeZoneDetectorInternal internal = Loading