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

Commit 6812b2d8 authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Clean up LTE code change"

parents b9aa8e50 8c6452dd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

package com.android.internal.telephony.gsm;
package com.android.internal.telephony;

import android.telephony.ServiceState;

+86 −23
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ public abstract class ServiceStateTracker extends Handler {

    public SignalStrength mSignalStrength;

    // TODO - this should not be public
    public RestrictedState mRestrictedState = new RestrictedState();

    /* The otaspMode passed to PhoneStateListener#onOtaspChanged */
    static public final int OTASP_UNINITIALIZED = 0;
    static public final int OTASP_UNKNOWN = 1;
@@ -76,9 +79,14 @@ public abstract class ServiceStateTracker extends Handler {
     */
    protected boolean dontPollSignalStrength = false;

    protected RegistrantList networkAttachedRegistrants = new RegistrantList();
    protected RegistrantList roamingOnRegistrants = new RegistrantList();
    protected RegistrantList roamingOffRegistrants = new RegistrantList();
    protected RegistrantList mRoamingOnRegistrants = new RegistrantList();
    protected RegistrantList mRoamingOffRegistrants = new RegistrantList();
    protected RegistrantList mAttachedRegistrants = new RegistrantList();
    protected RegistrantList mDetachedRegistrants = new RegistrantList();
    protected RegistrantList mNetworkAttachedRegistrants = new RegistrantList();
    protected RegistrantList mPsRestrictEnabledRegistrants = new RegistrantList();
    protected RegistrantList mPsRestrictDisabledRegistrants = new RegistrantList();


    protected  static final boolean DBG = true;

@@ -165,7 +173,6 @@ public abstract class ServiceStateTracker extends Handler {
    protected static final String REGISTRATION_DENIED_AUTH = "Authentication Failure";

    public ServiceStateTracker() {

    }

    public boolean getDesiredPowerState() {
@@ -182,7 +189,7 @@ public abstract class ServiceStateTracker extends Handler {
     */
    public  void registerForRoamingOn(Handler h, int what, Object obj) {
        Registrant r = new Registrant(h, what, obj);
        roamingOnRegistrants.add(r);
        mRoamingOnRegistrants.add(r);

        if (ss.getRoaming()) {
            r.notifyRegistrant();
@@ -190,7 +197,7 @@ public abstract class ServiceStateTracker extends Handler {
    }

    public  void unregisterForRoamingOn(Handler h) {
        roamingOnRegistrants.remove(h);
        mRoamingOnRegistrants.remove(h);
    }

    /**
@@ -203,7 +210,7 @@ public abstract class ServiceStateTracker extends Handler {
     */
    public  void registerForRoamingOff(Handler h, int what, Object obj) {
        Registrant r = new Registrant(h, what, obj);
        roamingOffRegistrants.add(r);
        mRoamingOffRegistrants.add(r);

        if (!ss.getRoaming()) {
            r.notifyRegistrant();
@@ -211,7 +218,7 @@ public abstract class ServiceStateTracker extends Handler {
    }

    public  void unregisterForRoamingOff(Handler h) {
        roamingOffRegistrants.remove(h);
        mRoamingOffRegistrants.remove(h);
    }

    /**
@@ -282,43 +289,99 @@ public abstract class ServiceStateTracker extends Handler {
    protected abstract void setPowerStateToDesired();
    protected abstract void log(String s);

    private void logUnexpectedGsmMethodCall(String name) {
        log("SSST" + "Error! " + name + "() in ServiceStateTracker should not be " +
        "called, GsmServiceStateTracker inactive.");
    }

    public abstract int getCurrentDataConnectionState();
    public abstract boolean isConcurrentVoiceAndDataAllowed();

    /**
     * Registration point for transition into DataConnection attached.
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForDataConnectionAttached(Handler h, int what, Object obj) {
        logUnexpectedGsmMethodCall("registerForDataConnectionAttached");
    }
        Registrant r = new Registrant(h, what, obj);
        mAttachedRegistrants.add(r);

        if (getCurrentDataConnectionState() == ServiceState.STATE_IN_SERVICE) {
            r.notifyRegistrant();
        }
    }
    public void unregisterForDataConnectionAttached(Handler h) {
        logUnexpectedGsmMethodCall("unregisterForDataConnectionAttached");
        mAttachedRegistrants.remove(h);
    }

    /**
     * Registration point for transition into DataConnection detached.
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForDataConnectionDetached(Handler h, int what, Object obj) {
        logUnexpectedGsmMethodCall("registerForDataConnectionDetached");
    }
        Registrant r = new Registrant(h, what, obj);
        mDetachedRegistrants.add(r);

        if (getCurrentDataConnectionState() == ServiceState.STATE_OUT_OF_SERVICE) {
            r.notifyRegistrant();
        }
    }
    public void unregisterForDataConnectionDetached(Handler h) {
        logUnexpectedGsmMethodCall("unregisterForDataConnectionDetached");
        mDetachedRegistrants.remove(h);
    }

    /**
     * Registration point for transition into network attached.
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj in Message.obj
     */
    public void registerForNetworkAttached(Handler h, int what, Object obj) {
        Registrant r = new Registrant(h, what, obj);

        mNetworkAttachedRegistrants.add(r);
        if (ss.getState() == ServiceState.STATE_IN_SERVICE) {
            r.notifyRegistrant();
        }
    }
    public void unregisterForNetworkAttached(Handler h) {
        mNetworkAttachedRegistrants.remove(h);
    }

    /**
     * Registration point for transition into packet service restricted zone.
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForPsRestrictedEnabled(Handler h, int what, Object obj) {
        logUnexpectedGsmMethodCall("registerForPsRestrictedEnabled");
        Registrant r = new Registrant(h, what, obj);
        mPsRestrictEnabledRegistrants.add(r);

        if (mRestrictedState.isPsRestricted()) {
            r.notifyRegistrant();
        }
    }

    public void unregisterForPsRestrictedEnabled(Handler h) {
        logUnexpectedGsmMethodCall("unregisterForPsRestrictedEnabled");
        mPsRestrictEnabledRegistrants.remove(h);
    }

    /**
     * Registration point for transition out of packet service restricted zone.
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForPsRestrictedDisabled(Handler h, int what, Object obj) {
        logUnexpectedGsmMethodCall("registerForPsRestrictedDisabled");
        Registrant r = new Registrant(h, what, obj);
        mPsRestrictDisabledRegistrants.add(r);

        if (mRestrictedState.isPsRestricted()) {
            r.notifyRegistrant();
        }
    }

    public void unregisterForPsRestrictedDisabled(Handler h) {
        logUnexpectedGsmMethodCall("registerForPsRestrictedDisabled");
        mPsRestrictDisabledRegistrants.remove(h);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@ public class CDMAPhone extends PhoneBase {
        mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
        mCM.registerForOn(this, EVENT_RADIO_ON, null);
        mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
        mSST.registerForNetworkAttach(this, EVENT_REGISTERED_TO_NETWORK, null);
        mSST.registerForNetworkAttached(this, EVENT_REGISTERED_TO_NETWORK, null);
        mCM.registerForNVReady(this, EVENT_NV_READY, null);
        mCM.setEmergencyCallbackMode(this, EVENT_EMERGENCY_CALLBACK_MODE_ENTER, null);

@@ -225,7 +225,7 @@ public class CDMAPhone extends PhoneBase {
            mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
            mCM.unregisterForOn(this); //EVENT_RADIO_ON
            mCM.unregisterForNVReady(this); //EVENT_NV_READY
            mSST.unregisterForNetworkAttach(this); //EVENT_REGISTERED_TO_NETWORK
            mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
            mCM.unSetOnSuppServiceNotification(this);
            removeCallbacks(mExitEcmRunnable);

+4 −4
Original line number Diff line number Diff line
@@ -104,8 +104,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
        p.mCM.registerForDataNetworkStateChanged (this, EVENT_DATA_STATE_CHANGED, null);
        p.mCT.registerForVoiceCallEnded (this, EVENT_VOICE_CALL_ENDED, null);
        p.mCT.registerForVoiceCallStarted (this, EVENT_VOICE_CALL_STARTED, null);
        p.mSST.registerForCdmaDataConnectionAttached(this, EVENT_TRY_SETUP_DATA, null);
        p.mSST.registerForCdmaDataConnectionDetached(this, EVENT_CDMA_DATA_DETACHED, null);
        p.mSST.registerForDataConnectionAttached(this, EVENT_TRY_SETUP_DATA, null);
        p.mSST.registerForDataConnectionDetached(this, EVENT_CDMA_DATA_DETACHED, null);
        p.mSST.registerForRoamingOn(this, EVENT_ROAMING_ON, null);
        p.mSST.registerForRoamingOff(this, EVENT_ROAMING_OFF, null);
        p.mCM.registerForCdmaOtaProvision(this, EVENT_CDMA_OTA_PROVISION, null);
@@ -128,8 +128,8 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker {
        mPhone.mCM.unregisterForDataNetworkStateChanged(this);
        mCdmaPhone.mCT.unregisterForVoiceCallEnded(this);
        mCdmaPhone.mCT.unregisterForVoiceCallStarted(this);
        mCdmaPhone.mSST.unregisterForCdmaDataConnectionAttached(this);
        mCdmaPhone.mSST.unregisterForCdmaDataConnectionDetached(this);
        mCdmaPhone.mSST.unregisterForDataConnectionAttached(this);
        mCdmaPhone.mSST.unregisterForDataConnectionDetached(this);
        mCdmaPhone.mSST.unregisterForRoamingOn(this);
        mCdmaPhone.mSST.unregisterForRoamingOff(this);
        mPhone.mCM.unregisterForCdmaOtaProvision(this);
+6 −102
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ import android.os.Message;
import android.util.Log;
import android.util.EventLog;

import com.android.internal.telephony.gsm.RestrictedState;
import com.android.internal.telephony.RestrictedState;
import com.android.internal.telephony.gsm.GsmDataConnectionTracker;

public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
@@ -44,112 +44,16 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

    CDMALTEPhone mCdmaLtePhone;

    private RestrictedState rs;

    private int gprsState = ServiceState.STATE_OUT_OF_SERVICE;

    private int newGPRSState = ServiceState.STATE_OUT_OF_SERVICE;

    private RegistrantList gprsAttachedRegistrants = new RegistrantList();

    private RegistrantList gprsDetachedRegistrants = new RegistrantList();

    private RegistrantList psRestrictEnabledRegistrants = new RegistrantList();

    private RegistrantList psRestrictDisabledRegistrants = new RegistrantList();

    public CdmaLteServiceStateTracker(CDMALTEPhone phone) {
        super(phone);
        mCdmaLtePhone = phone;
        rs = new RestrictedState();
        log("CdmaLteServiceStateTracker Constructors");
    }

    // Added 9 new functions needed in GsmDataConnectionTracker, functions were
    // copied over from GsmServiceStateTracker.
    /**
     * Registration point for transition into GPRS attached.
     *
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForDataConnectionAttached(Handler h, int what, Object obj) {
        log("registerForDataConnectionAttached ");
        Registrant r = new Registrant(h, what, obj);
        gprsAttachedRegistrants.add(r);

        if (gprsState == ServiceState.STATE_IN_SERVICE) {
            r.notifyRegistrant();
        }
    }

    public void unregisterForDataConnectionAttached(Handler h) {
        gprsAttachedRegistrants.remove(h);
    }

    /**
     * Registration point for transition into GPRS detached.
     *
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForDataConnectionDetached(Handler h, int what, Object obj) {
        log("registerForDataConnectionDetached ");
        Registrant r = new Registrant(h, what, obj);
        gprsDetachedRegistrants.add(r);
        if (gprsState == ServiceState.STATE_OUT_OF_SERVICE) {
            r.notifyRegistrant();
        }
    }

    public void unregisterForDataConnectionDetached(Handler h) {
        gprsDetachedRegistrants.remove(h);
    }

    /**
     * Registration point for transition into packet service restricted zone.
     *
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForPsRestrictedEnabled(Handler h, int what, Object obj) {
        log("registerForPsRestrictedEnabled ");
        Registrant r = new Registrant(h, what, obj);
        psRestrictEnabledRegistrants.add(r);

        if (rs.isPsRestricted()) {
            r.notifyRegistrant();
        }
    }

    public void unregisterForPsRestrictedEnabled(Handler h) {
        psRestrictEnabledRegistrants.remove(h);
    }

    /**
     * Registration point for transition out of packet service restricted zone.
     *
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj
     */
    public void registerForPsRestrictedDisabled(Handler h, int what, Object obj) {
        log("registerForPsRestrictedDisabled ");
        Registrant r = new Registrant(h, what, obj);
        psRestrictDisabledRegistrants.add(r);

        if (rs.isPsRestricted()) {
            r.notifyRegistrant();
        }
    }

    public void unregisterForPsRestrictedDisabled(Handler h) {
        psRestrictDisabledRegistrants.remove(h);
    }

    /**
     * @return The current GPRS state. IN_SERVICE is the same as "attached" and
     *         OUT_OF_SERVICE is the same as detached.
@@ -426,7 +330,7 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
        }

        if (hasRegistered) {
            networkAttachedRegistrants.notifyRegistrants();
            mNetworkAttachedRegistrants.notifyRegistrants();
        }

        if (hasChanged) {
@@ -484,12 +388,12 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {

        if (hasCdmaDataConnectionAttached) {
            cdmaDataConnectionAttachedRegistrants.notifyRegistrants();
            gprsAttachedRegistrants.notifyRegistrants();
            mAttachedRegistrants.notifyRegistrants();
        }

        if (hasCdmaDataConnectionDetached) {
            cdmaDataConnectionDetachedRegistrants.notifyRegistrants();
            gprsDetachedRegistrants.notifyRegistrants();
            mDetachedRegistrants.notifyRegistrants();
        }

        if ((hasCdmaDataConnectionChanged || hasNetworkTypeChanged)
@@ -498,11 +402,11 @@ public class CdmaLteServiceStateTracker extends CdmaServiceStateTracker {
        }

        if (hasRoamingOn) {
            roamingOnRegistrants.notifyRegistrants();
            mRoamingOnRegistrants.notifyRegistrants();
        }

        if (hasRoamingOff) {
            roamingOffRegistrants.notifyRegistrants();
            mRoamingOffRegistrants.notifyRegistrants();
        }

        if (hasLocationChanged) {
Loading