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

Commit a62554e5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Create a new implementation of NitzStateMachine"

parents 0c279d60 963c98ad
Loading
Loading
Loading
Loading
+19 −6
Original line number Diff line number Diff line
@@ -350,14 +350,27 @@ public final class MccTable {
     * @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
     */
    private static void setTimezoneFromMccIfNeeded(Context context, int mcc) {
        if (!TimeServiceHelper.isTimeZoneSettingInitializedStatic()) {
        // Switch to use the time service helper associated with the NitzStateMachine impl
        // being used. This logic will be removed once the old implementation is removed.
        if (TelephonyComponentFactory.USE_NEW_NITZ_STATE_MACHINE) {
            if (!NewTimeServiceHelper.isTimeZoneSettingInitializedStatic()) {
                String zoneId = defaultTimeZoneForMcc(mcc);
                if (zoneId != null && zoneId.length() > 0) {
                    // Set time zone based on MCC
                TimeServiceHelper.setDeviceTimeZoneStatic(context, zoneId);
                    NewTimeServiceHelper.setDeviceTimeZoneStatic(context, zoneId);
                    Slog.d(LOG_TAG, "timezone set to " + zoneId);
                }
            }
        } else {
            if (!OldTimeServiceHelper.isTimeZoneSettingInitializedStatic()) {
                String zoneId = defaultTimeZoneForMcc(mcc);
                if (zoneId != null && zoneId.length() > 0) {
                    // Set time zone based on MCC
                    OldTimeServiceHelper.setDeviceTimeZoneStatic(context, zoneId);
                    Slog.d(LOG_TAG, "timezone set to " + zoneId);
                }
            }
        }
    }

    /**
+533 −0

File added.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ import android.provider.Settings;
 * new service.
 */
// Non-final to allow mocking.
public class TimeServiceHelper {
public class NewTimeServiceHelper {

    /**
     * Callback interface for automatic detection enable/disable changes.
@@ -57,7 +57,7 @@ public class TimeServiceHelper {
    private Listener mListener;

    /** Creates a TimeServiceHelper */
    public TimeServiceHelper(Context context) {
    public NewTimeServiceHelper(Context context) {
        mContext = context;
        mCr = context.getContentResolver();
    }
+4 −4

File changed.

Preview size limit exceeded, changes collapsed.

+193 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading