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

Commit 467c5502 authored by Neil Fuller's avatar Neil Fuller Committed by Android (Google) Code Review
Browse files

Merge "Remove mysterious test logic"

parents 4371cd52 c344eb87
Loading
Loading
Loading
Loading
+2 −16
Original line number Diff line number Diff line
@@ -98,15 +98,6 @@ public class NitzStateMachine {
            return ignoreNitz != null && ignoreNitz.equals("yes");
        }

        /**
         * Returns true if the {@code telephony.test.ignore.nitz} system property is set to
         * 'y', 'yes', '1', 'true' or 'on' AND the current uptime is an odd number.
         */
        public boolean getIgnoreNitzForTests() {
            return SystemProperties.getBoolean(TelephonyProperties.PROPERTY_IGNORE_NITZ, false)
                    && ((SystemClock.uptimeMillis() & 1) == 0);
        }

        /**
         * Sets the {@code gsm.nitz.time} system property.
         */
@@ -595,17 +586,13 @@ public class NitzStateMachine {
     * @param iso Country code from network MCC
     */
    public void updateTimeZoneByNetworkCountryCode(String iso) {
        // Test both paths if ignore nitz for tests is true
        boolean testOneUniqueOffsetPath = mDeviceState.getIgnoreNitzForTests();

        List<String> uniqueZoneIds = TimeUtils.getTimeZoneIdsWithUniqueOffsets(iso);
        if ((uniqueZoneIds.size() == 1) || testOneUniqueOffsetPath) {
        if (uniqueZoneIds.size() == 1) {
            String zoneId = uniqueZoneIds.get(0);
            if (DBG) {
                Rlog.d(LOG_TAG, "updateTimeZoneByNetworkCountryCode: no nitz but one TZ for iso-cc="
                        + iso
                        + " with zone.getID=" + zoneId
                        + " testOneUniqueOffsetPath=" + testOneUniqueOffsetPath);
                        + " with zone.getID=" + zoneId);
            }
            mTimeZoneLog.log("updateTimeZoneByNetworkCountryCode: set time zone=" + zoneId
                    + " iso=" + iso);
@@ -615,7 +602,6 @@ public class NitzStateMachine {
                Rlog.d(LOG_TAG,
                        "updateTimeZoneByNetworkCountryCode: there are " + uniqueZoneIds.size()
                                + " unique offsets for iso-cc='" + iso
                                + " testOneUniqueOffsetPath=" + testOneUniqueOffsetPath
                                + "', do nothing");
            }
        }
+0 −2
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ public class NitzStateMachineTest extends TelephonyTest {

        // Configure device state
        when(mDeviceState.getIgnoreNitz()).thenReturn(false);
        when(mDeviceState.getIgnoreNitzForTests()).thenReturn(false);
        when(mDeviceState.getNitzUpdateDiffMillis()).thenReturn(2000);
        when(mDeviceState.getNitzUpdateSpacingMillis()).thenReturn(1000 * 60 * 10);
        when(mDeviceState.elapsedRealtime()).thenReturn(123456789L);
@@ -68,7 +67,6 @@ public class NitzStateMachineTest extends TelephonyTest {
        // Confirm all mDeviceState side effects were verified. We don't care about retrievals of
        // device state.
        verify(mDeviceState, atLeast(0)).getIgnoreNitz();
        verify(mDeviceState, atLeast(0)).getIgnoreNitzForTests();
        verify(mDeviceState, atLeast(0)).getNitzUpdateDiffMillis();
        verify(mDeviceState, atLeast(0)).getNitzUpdateSpacingMillis();
        verify(mDeviceState, atLeast(0)).elapsedRealtime();