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

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

Remove unnecessary condition branch

Remove unnecessary condition branch: the branch will never be used
because:
a) nitzSignal, which is assigned from mLatestNitzSignal, is dereferenced
a few lines above.
b) mLatestNitzSignal is either set or checked before calls to
updateTimeZoneFromCountryAndNitz()

Bug: 140712361
Test: Treehugger only
Change-Id: I8330f8ee8254c1b7875a13535a46e0f5e4bdbc07
parent 7d8cdd26
Loading
Loading
Loading
Loading
+4 −8
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import com.android.internal.util.IndentingPrintWriter;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Objects;

/**
 * {@hide}
@@ -144,8 +145,10 @@ public final class NitzStateMachineImpl implements NitzStateMachine {
    }

    private void updateTimeZoneFromCountryAndNitz() {
        // This method must only be called after mLatestNitzSignal has been set to a non-null
        // value.
        TimestampedValue<NitzData> nitzSignal = Objects.requireNonNull(mLatestNitzSignal);
        String isoCountryCode = mDeviceState.getNetworkCountryIsoForPhone();
        TimestampedValue<NitzData> nitzSignal = mLatestNitzSignal;

        // TimeZone.getDefault() returns a default zone (GMT) even when time zone have never
        // been set which makes it difficult to tell if it's what the user / time zone detection
@@ -185,13 +188,6 @@ public final class NitzStateMachineImpl implements NitzStateMachine {
                mTimeZoneLog.log(logMsg);

                zoneId = lookupResult != null ? lookupResult.getTimeZone().getID() : null;
            } else if (mLatestNitzSignal == null) {
                if (DBG) {
                    Rlog.d(LOG_TAG,
                            "updateTimeZoneFromCountryAndNitz: No cached NITZ data available,"
                                    + " not setting zone");
                }
                zoneId = null;
            } else if (isNitzSignalOffsetInfoBogus(nitzSignal, isoCountryCode)) {
                String logMsg = "updateTimeZoneFromCountryAndNitz: Received NITZ looks bogus, "
                        + " isoCountryCode=" + isoCountryCode