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

Commit 5736ddbd authored by Harish Kurva's avatar Harish Kurva Committed by Adnan Begovic
Browse files

[PATCH] (PICCOLO-4847) [PATCH] Force data attach when data is re


 enabled after carrier-detatch.

Some networks detach from PS when data is disabled for a time
period. DcTracker handles this scenario using mAutoAttachOnCreation
flag. However DcSwitchStateMachine doesnot execute requests until
PS is attached. This leads to no data in case of WIFI disconnect.
So extend the same logic to DcSwitchStateMachine.

TICKET: PAELLA-172
Change-Id: Icad3cac52a8225355b73887e0201382820d4ae8c
Signed-off-by: default avatarHarish Kurva <hkurva@codeaurora.org>
Signed-off-by: default avatarAdnan Begovic <adnan@cyngn.com>
parent ee07de8b
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -157,6 +157,14 @@ public class DcSwitchStateMachine extends StateMachine {
                log("AttachingState: Data already registered. Move to Attached");
                transitionTo(mAttachedState);
            }
            final PhoneBase pb = (PhoneBase)((PhoneProxy)mPhone).getActivePhone();
            // 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
@@ -165,10 +173,16 @@ public class DcSwitchStateMachine extends StateMachine {

            switch (msg.what) {
                case DcSwitchAsyncChannel.REQ_CONNECT: {
                    if (DBG) {
                        log("AttachingState: REQ_CONNECT");
                    }
                    RequestInfo apnRequest = (RequestInfo)msg.obj;
                    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 {
                        if (DBG) log("AttachingState executeAll due to autoAttach");
                        DctController.getInstance().executeRequest(apnRequest);
                    }
                    mAc.replyToMessage(msg, DcSwitchAsyncChannel.RSP_CONNECT,
                            PhoneConstants.APN_REQUEST_STARTED);
                    retVal = HANDLED;
+6 −6
Original line number Diff line number Diff line
@@ -845,7 +845,7 @@ public final class DcTracker extends DcTrackerBase {
            notifyOffApnsOfAvailability(Phone.REASON_DATA_ATTACHED);
        }
        if (mAutoAttachOnCreationConfig) {
            mAutoAttachOnCreation = true;
            mAutoAttachOnCreation.set(true);
        }
        setupDataOnConnectableApns(Phone.REASON_DATA_ATTACHED);
    }
@@ -890,7 +890,7 @@ public final class DcTracker extends DcTrackerBase {
            state = mPhone.getCallTracker().getState();
        }
        boolean allowed =
                    (attachedState || mAutoAttachOnCreation) &&
                    (attachedState || mAutoAttachOnCreation.get()) &&
                    (subscriptionFromNv || recordsLoaded) &&
                    (state == PhoneConstants.State.IDLE ||
                     mPhone.getServiceStateTracker().isConcurrentVoiceAndDataAllowed()) &&
@@ -901,8 +901,8 @@ public final class DcTracker extends DcTrackerBase {
                    desiredPowerState;
        if (!allowed && DBG) {
            String reason = "";
            if (!(attachedState || mAutoAttachOnCreation)) {
                reason += " - Attached= " + attachedState;
            if (!(attachedState || mAutoAttachOnCreation.get())) {
                reason += " - Attached= " + attachedState.get();
            }
            if (!(subscriptionFromNv || recordsLoaded)) {
                reason += " - SIM not loaded and not NV subscription";
@@ -1480,8 +1480,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.Map.Entry;
import java.util.Objects;
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;
@@ -237,7 +238,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
@@ -610,7 +611,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
@@ -1954,6 +1955,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);
@@ -1984,7 +1989,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();