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

Commit b3982235 authored by Jack Yu's avatar Jack Yu
Browse files

Fixed the incorrect signal strength info displayed after call end.

We should query the signal stregnth information from the modem
when RAT family changes instead of relying on the next unsolicited
signal strength information indication coming from the modem,
which might take a long time to come or even not come. By proactively
querying the info, we can make sure the up-to-date signal strength
is showing up on the UI.

bug: 22724699
Change-Id: I4c80b281cffb28a871d4e754f43c43b9809244a4
parent 746b6b52
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
                        states.length + " states=" + states);
            }

            int type = 0;
            int newDataRAT = ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN;
            int regState = -1;
            if (states.length > 0) {
                try {
@@ -167,7 +167,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

                    // states[3] (if present) is the current radio technology
                    if (states.length >= 4 && states[3] != null) {
                        type = Integer.parseInt(states[3]);
                        newDataRAT = Integer.parseInt(states[3]);
                    }
                } catch (NumberFormatException ex) {
                    loge("handlePollStateResultMessage: error parsing GprsRegistrationState: "
@@ -243,7 +243,24 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
                }
            }

            mNewSS.setRilDataRadioTechnology(type);
            // If the unsolicited signal strength comes just before data RAT family changes (i.e.
            // from UNKNOWN to LTE, CDMA to LTE, LTE to CDMA), the signal bar might display
            // the wrong information until the next unsolicited signal strength information coming
            // from the modem, which might take a long time to come or even not come at all.
            // In order to provide the best user experience, we query the latest signal
            // information so it will show up on the UI on time.

            int oldDataRAT = mSS.getRilDataRadioTechnology();
            if ((oldDataRAT == ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN &&
                    newDataRAT != ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN) ||
                    (ServiceState.isCdma(oldDataRAT) &&
                            newDataRAT == ServiceState.RIL_RADIO_TECHNOLOGY_LTE) ||
                    (oldDataRAT == ServiceState.RIL_RADIO_TECHNOLOGY_LTE &&
                            ServiceState.isCdma(newDataRAT))) {
                mCi.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));
            }

            mNewSS.setRilDataRadioTechnology(newDataRAT);
            int dataRegState = regCodeToServiceState(regState);
            mNewSS.setDataRegState(dataRegState);
            // voice roaming state in done while handling EVENT_POLL_STATE_REGISTRATION_CDMA
@@ -251,7 +268,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
            if (DBG) {
                log("handlPollStateResultMessage: CdmaLteSST setDataRegState=" + dataRegState
                        + " regState=" + regState
                        + " dataRadioTechnology=" + type);
                        + " dataRadioTechnology=" + newDataRAT);
            }
        } else {
            super.handlePollStateResultMessage(what, ar);
+6 −0
Original line number Diff line number Diff line
@@ -210,6 +210,12 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            mAutoTimeZoneObserver);
        setSignalStrengthDefaultValues();

        // Query signal strength from the modem after service tracker is created (i.e. boot up,
        // switching between GSM and CDMA phone), because the unsolicited signal strength
        // information might come late or even never come. This will get the accurate signal
        // strength information displayed on the UI.
        mCi.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));

        mHbpcdUtils = new HbpcdUtils(phone.getContext());

        // Reset OTASP state in case previously set by another service
+6 −0
Original line number Diff line number Diff line
@@ -238,6 +238,12 @@ final class GsmServiceStateTracker extends ServiceStateTracker {

        setSignalStrengthDefaultValues();

        // Query signal strength from the modem after service tracker is created (i.e. boot up,
        // switching between GSM and CDMA phone), because the unsolicited signal strength
        // information might come late or even never come. This will get the accurate signal
        // strength information displayed on the UI.
        mCi.getSignalStrength(obtainMessage(EVENT_GET_SIGNAL_STRENGTH));

        // Monitor locale change
        IntentFilter filter = new IntentFilter();
        filter.addAction(Intent.ACTION_LOCALE_CHANGED);