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

Commit c344eb87 authored by Neil Fuller's avatar Neil Fuller
Browse files

Remove mysterious test logic

Remove mysterious test logic that probably
isn't used.

It was added in frameworks/base commit
a27421a306c49fbe9b3823b30f7ab1cd58b28854 to
GsmServiceStateTracker.

The logic can be removed because the
system property is used for testing, and
even if it were, controlling behavior based
on whether the realtime clock value is odd
or even is strange.

Test:
atest FrameworksTelephonyTests:com.android.internal.telephony.NitzStateMachineTest

Test: build / boot / see above
Bug: 63743683
Change-Id: I51de9a81eaaa49974dcc94dffcd22c1f417728fa
parent 4c54ef3c
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();