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

Commit 40dc7774 authored by Robert Greenwalt's avatar Robert Greenwalt
Browse files

Treat a SIM power cycle as first boot.

TL;DR - forget the previous subId used only for optimization
purposes if we get a SIM_READY notification.

We moved some code that poked the modem from a SIM_READY handler
to a onSubscriptionChanged handler and also protected it
with logic to only fire if the subId changed.  This caused
us to not poke the modem on SIM power cycle.  Some modems
do a SIM power cycle on airplane mode.  The result was
on these modems we weren't causing the modem to register with
the network after airplane mode.

This was often masked because if we were setup to try a
data call these devices were configured to try the data call
regardless of data registration and the act of trying a data call
would cause the modem to register with the network.

If during airplane mode you had turned on wifi, telephony would
stop trying to setup a data call (so we don't poke the network
all the time when on a better wifi connection) and the restoration of
that data request has been blocked until data-registration in the
new multisim code.

bug:19194287
Change-Id: I21b76b7c62a6161d8422b11a831c3747591c56f3
parent f323afdb
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

import com.android.internal.telephony.dataconnection.DcTrackerBase;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppState;
@@ -236,9 +237,11 @@ public abstract class ServiceStateTracker extends Handler {

    protected SubscriptionManager mSubscriptionManager;
    protected SubscriptionController mSubscriptionController;
    protected final OnSubscriptionsChangedListener mOnSubscriptionsChangedListener =
            new OnSubscriptionsChangedListener() {
        private int previousSubId = -1; // < 0 is invalid subId
    protected final SstSubscriptionsChangedListener mOnSubscriptionsChangedListener =
        new SstSubscriptionsChangedListener();

    protected class SstSubscriptionsChangedListener extends OnSubscriptionsChangedListener {
        public final AtomicInteger mPreviousSubId = new AtomicInteger(-1); // < 0 is invalid subId
        /**
         * Callback invoked when there is any change to any SubscriptionInfo. Typically
         * this method would invoke {@link SubscriptionManager#getActiveSubscriptionInfoList}
@@ -248,8 +251,7 @@ public abstract class ServiceStateTracker extends Handler {
            if (DBG) log("SubscriptionListener.onSubscriptionInfoChanged");
            // Set the network type, in case the radio does not restore it.
            int subId = mPhoneBase.getSubId();
            if (previousSubId != subId) {
                previousSubId = subId;
            if (mPreviousSubId.getAndSet(subId) != subId) {
                if (SubscriptionManager.isValidSubscriptionId(subId)) {
                    Context context = mPhoneBase.getContext();
                    int networkType = PhoneFactory.calculatePreferredNetworkType(context, subId);
+3 −0
Original line number Diff line number Diff line
@@ -315,6 +315,9 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
                break;

            case EVENT_SIM_READY:
                // Reset the mPreviousSubId so we treat a SIM power bounce
                // as a first boot.  See b/19194287
                mOnSubscriptionsChangedListener.mPreviousSubId.set(-1);
                pollState();
                // Signal strength polling stops when radio is off
                queueNextSignalStrengthPoll();