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

Commit b1908d62 authored by Sooraj Sasindran's avatar Sooraj Sasindran
Browse files

Make sure all pollState request handled by handler thread.

Make sure all pollState request handled by handler thread.

Bug: 145145737
Test: unit test and system test to see no regression
FrameworksTelephonyTests: Passed: 69, Failed: 0, Ignored: 1, Assumption Failed: 0
Merged-In: I4763909e24cac74245ba0faae2132e519e6ba223
Change-Id: I4763909e24cac74245ba0faae2132e519e6ba223
parent 873f7ed4
Loading
Loading
Loading
Loading
+14 −17
Original line number Original line Diff line number Diff line
@@ -281,6 +281,7 @@ public class ServiceStateTracker extends Handler {
    protected static final int EVENT_PHYSICAL_CHANNEL_CONFIG           = 55;
    protected static final int EVENT_PHYSICAL_CHANNEL_CONFIG           = 55;
    protected static final int EVENT_CELL_LOCATION_RESPONSE            = 56;
    protected static final int EVENT_CELL_LOCATION_RESPONSE            = 56;
    protected static final int EVENT_CARRIER_CONFIG_CHANGED            = 57;
    protected static final int EVENT_CARRIER_CONFIG_CHANGED            = 57;
    private static final int EVENT_POLL_STATE_REQUEST                  = 58;


    /**
    /**
     * The current service state.
     * The current service state.
@@ -1217,7 +1218,7 @@ public class ServiceStateTracker extends Handler {
                        SubscriptionManager.INVALID_SUBSCRIPTION_ID);
                        SubscriptionManager.INVALID_SUBSCRIPTION_ID);
                mPrevSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
                mPrevSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
                mIsSimReady = true;
                mIsSimReady = true;
                pollState();
                pollStateInternal(false);
                // Signal strength polling stops when radio is off
                // Signal strength polling stops when radio is off
                queueNextSignalStrengthPoll();
                queueNextSignalStrengthPoll();
                break;
                break;
@@ -1234,11 +1235,11 @@ public class ServiceStateTracker extends Handler {
                // This will do nothing in the 'radio not available' case
                // This will do nothing in the 'radio not available' case
                setPowerStateToDesired();
                setPowerStateToDesired();
                // These events are modem triggered, so pollState() needs to be forced
                // These events are modem triggered, so pollState() needs to be forced
                modemTriggeredPollState();
                pollStateInternal(true);
                break;
                break;


            case EVENT_NETWORK_STATE_CHANGED:
            case EVENT_NETWORK_STATE_CHANGED:
                modemTriggeredPollState();
                pollStateInternal(true);
                break;
                break;


            case EVENT_GET_SIGNAL_STRENGTH:
            case EVENT_GET_SIGNAL_STRENGTH:
@@ -1444,7 +1445,7 @@ public class ServiceStateTracker extends Handler {
                if (mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
                if (mPhone.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE) {
                    // Subscription will be read from SIM I/O
                    // Subscription will be read from SIM I/O
                    if (DBG) log("Receive EVENT_RUIM_READY");
                    if (DBG) log("Receive EVENT_RUIM_READY");
                    pollState();
                    pollStateInternal(false);
                } else {
                } else {
                    if (DBG) log("Receive EVENT_RUIM_READY and Send Request getCDMASubscription.");
                    if (DBG) log("Receive EVENT_RUIM_READY and Send Request getCDMASubscription.");
                    getSubscriptionInfoAndStartPollingThreads();
                    getSubscriptionInfoAndStartPollingThreads();
@@ -1537,7 +1538,7 @@ public class ServiceStateTracker extends Handler {
                        // SID/NID/PRL is loaded. Poll service state
                        // SID/NID/PRL is loaded. Poll service state
                        // again to update to the roaming state with
                        // again to update to the roaming state with
                        // the latest variables.
                        // the latest variables.
                        pollState();
                        pollStateInternal(false);
                    }
                    }
                }
                }
                break;
                break;
@@ -1618,6 +1619,10 @@ public class ServiceStateTracker extends Handler {
                onCarrierConfigChanged();
                onCarrierConfigChanged();
                break;
                break;


            case EVENT_POLL_STATE_REQUEST:
                pollStateInternal(false);
                break;

            default:
            default:
                log("Unhandled message with number: " + msg.what);
                log("Unhandled message with number: " + msg.what);
                break;
                break;
@@ -3019,18 +3024,10 @@ public class ServiceStateTracker extends Handler {
     */
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    public void pollState() {
    public void pollState() {
        pollState(false);
        sendEmptyMessage(EVENT_POLL_STATE_REQUEST);
    }
    /**
     * We insist on polling even if the radio says its off.
     * Used when we get a network changed notification
     * but the radio is off - part of iwlan hack
     */
    private void modemTriggeredPollState() {
        pollState(true);
    }
    }


    public void pollState(boolean modemTriggered) {
    private void pollStateInternal(boolean modemTriggered) {
        mPollingContext = new int[1];
        mPollingContext = new int[1];
        mPollingContext[0] = 0;
        mPollingContext[0] = 0;


@@ -4733,7 +4730,7 @@ public class ServiceStateTracker extends Handler {
        // Sometimes the network registration information comes before carrier config is ready.
        // Sometimes the network registration information comes before carrier config is ready.
        // For some cases like roaming/non-roaming overriding, we need carrier config. So it's
        // For some cases like roaming/non-roaming overriding, we need carrier config. So it's
        // important to poll state again when carrier config is ready.
        // important to poll state again when carrier config is ready.
        pollState();
        pollStateInternal(false);
    }
    }


    private void updateLteEarfcnLists(PersistableBundle config) {
    private void updateLteEarfcnLists(PersistableBundle config) {
@@ -5023,7 +5020,7 @@ public class ServiceStateTracker extends Handler {
        mCi.getCDMASubscription(obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));
        mCi.getCDMASubscription(obtainMessage(EVENT_POLL_STATE_CDMA_SUBSCRIPTION));


        // Get Registration Information
        // Get Registration Information
        pollState();
        pollStateInternal(false);
    }
    }


    private void handleCdmaSubscriptionSource(int newSubscriptionSource) {
    private void handleCdmaSubscriptionSource(int newSubscriptionSource) {