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

Commit 94f6d2f6 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android Git Automerger
Browse files

am 3f7b3ae9: Merge "Allow us back on the network after carrier-detatch" into mnc-dev

* commit '3f7b3ae9':
  Allow us back on the network after carrier-detatch
parents 1a4cdcaf 3f7b3ae9
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -193,6 +193,13 @@ public class DcSwitchStateMachine extends StateMachine {
            final PhoneBase pb = (PhoneBase)((PhoneProxy)mPhone).getActivePhone();
            pb.mCi.setDataAllowed(true, obtainMessage(EVENT_DATA_ALLOWED,
                    ++mCurrentAllowedSequence, 0));
            // if we're on a carrier that unattaches us if we're idle for too long
            // (on wifi) and they won't re-attach until we poke them.  Poke them!
            // essentially react as Attached does here in Attaching.
            if (pb.mDcTracker.getAutoAttachOnCreation()) {
                if (DBG) log("AttachingState executeAll due to autoAttach");
                DctController.getInstance().executeAllRequests(mId);
            }
        }

        @Override
@@ -205,11 +212,16 @@ public class DcSwitchStateMachine extends StateMachine {
                    apnRequest.log("DcSwitchStateMachine.AttachingState: REQ_CONNECT");
                    if (DBG) log("AttachingState: REQ_CONNECT, apnRequest=" + apnRequest);

                    final PhoneBase pb = (PhoneBase)((PhoneProxy)mPhone).getActivePhone();
                    if (pb.mDcTracker.getAutoAttachOnCreation() == false) {
                        // do nothing - wait til we attach and then we'll execute all requests
                    } else {
                        apnRequest.log("DcSwitchStateMachine processing due to autoAttach");
                        DctController.getInstance().executeRequest(apnRequest);
                    }
                    retVal = HANDLED;
                    break;
                }

                case EVENT_DATA_ALLOWED: {
                    AsyncResult ar = (AsyncResult)msg.obj;
                    if (mCurrentAllowedSequence != msg.arg1) {
@@ -253,6 +265,14 @@ public class DcSwitchStateMachine extends StateMachine {
                    if (DBG) {
                        log("AttachingState: REQ_DISCONNECT_ALL" );
                    }
                    final PhoneBase pb = (PhoneBase)((PhoneProxy)mPhone).getActivePhone();
                    if (pb.mDcTracker.getAutoAttachOnCreation()) {
                        // if AutoAttachOnCreation, then we may have executed requests
                        // without ever actually getting to Attached, so release the request
                        // here in that case.
                        if (DBG) log("releasingAll due to autoAttach");
                        DctController.getInstance().releaseAllRequests(mId);
                    }

                    // modem gets unhappy if we try to detach while attaching
                    // wait til attach finishes.
+5 −5
Original line number Diff line number Diff line
@@ -695,7 +695,7 @@ public final class DcTracker extends DcTrackerBase {
            notifyOffApnsOfAvailability(Phone.REASON_DATA_ATTACHED);
        }
        if (mAutoAttachOnCreationConfig) {
            mAutoAttachOnCreation = true;
            mAutoAttachOnCreation.set(true);
        }
        setupDataOnConnectableApns(Phone.REASON_DATA_ATTACHED);
    }
@@ -742,7 +742,7 @@ public final class DcTracker extends DcTrackerBase {
            state = mPhone.getCallTracker().getState();
        }
        boolean allowed =
                    (attachedState || mAutoAttachOnCreation) &&
                    (attachedState || mAutoAttachOnCreation.get()) &&
                    recordsLoaded &&
                    (state == PhoneConstants.State.IDLE ||
                     mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) &&
@@ -754,7 +754,7 @@ public final class DcTracker extends DcTrackerBase {
                    desiredPowerState;
        if (!allowed && DBG) {
            String reason = "";
            if (!(attachedState || mAutoAttachOnCreation)) {
            if (!(attachedState || mAutoAttachOnCreation.get())) {
                reason += " - Attached= " + attachedState;
            }
            if (!recordsLoaded) reason += " - SIM not loaded";
@@ -1313,8 +1313,8 @@ public final class DcTracker extends DcTrackerBase {
        Message msg = obtainMessage();
        msg.what = DctConstants.EVENT_DATA_SETUP_COMPLETE;
        msg.obj = apnContext;
        dcac.bringUp(apnContext, getInitialMaxRetry(), profileId, radioTech, mAutoAttachOnCreation,
                msg);
        dcac.bringUp(apnContext, getInitialMaxRetry(), profileId, radioTech,
                mAutoAttachOnCreation.get(), msg);

        if (DBG) log("setupData: initing!");
        return true;
+8 −3
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.PriorityQueue;
@@ -235,7 +236,7 @@ public abstract class DcTrackerBase extends Handler {

    // When false we will not auto attach and manually attaching is required.
    protected boolean mAutoAttachOnCreationConfig = false;
    protected boolean mAutoAttachOnCreation = false;
    protected AtomicBoolean mAutoAttachOnCreation = new AtomicBoolean(false);

    // State of screen
    // (TODO: Reconsider tying directly to screen, maybe this is
@@ -617,7 +618,7 @@ public abstract class DcTrackerBase extends Handler {
        }

        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mPhone.getContext());
        mAutoAttachOnCreation = sp.getBoolean(PhoneBase.DATA_DISABLED_ON_BOOT_KEY, false);
        mAutoAttachOnCreation.set(sp.getBoolean(PhoneBase.DATA_DISABLED_ON_BOOT_KEY, false));

        mSubscriptionManager = SubscriptionManager.from(mPhone.getContext());
        mSubscriptionManager
@@ -1914,6 +1915,10 @@ public abstract class DcTrackerBase extends Handler {
        sendMessage(msg);
    }

    public boolean getAutoAttachOnCreation() {
        return mAutoAttachOnCreation.get();
    }

    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        pw.println("DcTrackerBase:");
        pw.println(" RADIO_TESTS=" + RADIO_TESTS);
@@ -1943,7 +1948,7 @@ public abstract class DcTrackerBase extends Handler {
        pw.println(" mIsWifiConnected=" + mIsWifiConnected);
        pw.println(" mReconnectIntent=" + mReconnectIntent);
        pw.println(" mCidActive=" + mCidActive);
        pw.println(" mAutoAttachOnCreation=" + mAutoAttachOnCreation);
        pw.println(" mAutoAttachOnCreation=" + mAutoAttachOnCreation.get());
        pw.println(" mIsScreenOn=" + mIsScreenOn);
        pw.println(" mUniqueIdGenerator=" + mUniqueIdGenerator);
        pw.flush();