Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3caadb77 authored by Neil Fuller's avatar Neil Fuller
Browse files

Change from system prop to config

Stop using the system property "ro.sys.time_detector_update_diff" to set
the value that controls how different a suggestion has to be from the
system clock before the system clock is updated.  Use config.xml
instead. System properties are unusual and unneccessary for config like
this.

There are no other references to "ro.sys.time_detector_update_diff" in
our codebase, and none found on the internet, only one mention of it in
our bug tracker by me, so this should be a safe change and easy for
manufacturers to migrate if they are using the system property.

Bug: 282679588
Test: treehugger only
Change-Id: If9d5c77575012c7ec8bb6c5e74e5e80082903254
parent 2668168a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1830,6 +1830,11 @@
        <item>telephony</item>
    </string-array>

    <!-- The difference in millis that has to exist between a time suggestion under
         consideration by the time_detector and the system clock before the system clock will be
         changed. -->
    <integer name="config_timeDetectorAutoUpdateDiffMillis">2000</integer>

    <!-- Enables the GnssTimeUpdate service. This is the global switch for enabling Gnss time based
         suggestions to TimeDetector service. See also config_autoTimeSourcesPriority. -->
    <bool name="config_enableGnssTimeUpdateService">false</bool>
+1 −0
Original line number Diff line number Diff line
@@ -2229,6 +2229,7 @@
  <java-symbol type="string" name="config_persistentDataPackageName" />
  <java-symbol type="string" name="config_deviceConfiguratorPackageName" />
  <java-symbol type="array" name="config_autoTimeSourcesPriority" />
  <java-symbol type="integer" name="config_timeDetectorAutoUpdateDiffMillis" />
  <java-symbol type="bool" name="config_enableGnssTimeUpdateService" />
  <java-symbol type="bool" name="config_enableGeolocationTimeZoneDetection" />
  <java-symbol type="bool" name="config_enablePrimaryLocationTimeZoneProvider" />
+2 −6
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.database.ContentObserver;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -65,8 +64,6 @@ import java.util.function.Supplier;
 */
final class ServiceConfigAccessorImpl implements ServiceConfigAccessor {

    private static final int SYSTEM_CLOCK_UPDATE_THRESHOLD_MILLIS_DEFAULT = 2 * 1000;

    /**
     * An absolute threshold at/below which the system clock confidence can be upgraded. i.e. if the
     * detector receives a high-confidence time and the current system clock is +/- this value from
@@ -122,9 +119,8 @@ final class ServiceConfigAccessorImpl implements ServiceConfigAccessor {
        mConfigOriginPrioritiesSupplier = new ConfigOriginPrioritiesSupplier(context);
        mServerFlagsOriginPrioritiesSupplier =
                new ServerFlagsOriginPrioritiesSupplier(mServerFlags);
        mSystemClockUpdateThresholdMillis =
                SystemProperties.getInt("ro.sys.time_detector_update_diff",
                        SYSTEM_CLOCK_UPDATE_THRESHOLD_MILLIS_DEFAULT);
        mSystemClockUpdateThresholdMillis = context.getResources().getInteger(
                R.integer.config_timeDetectorAutoUpdateDiffMillis);

        // Wire up the config change listeners for anything that could affect ConfigurationInternal.
        // Use the main thread for event delivery, listeners can post to their chosen thread.