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

Commit 6432c2f4 authored by Nathan Harold's avatar Nathan Harold
Browse files

Move OTASP_* Consts from ServiceStateTracker to TelephonyManager

-Move the OTASP_* constants from SST
-Update references to those constants

Bug: 33414487
Change-Id: I1f7a8169ca21d7bc3ecd8d996b9f496a0f044662
parent aa577d3b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2685,7 +2685,7 @@ public class GsmCdmaPhone extends Phone {
        if (isPhoneTypeGsm()) {
            return false;
        } else {
            return mSST.getOtasp() != ServiceStateTracker.OTASP_NOT_NEEDED;
            return mSST.getOtasp() != TelephonyManager.OTASP_NOT_NEEDED;
        }
    }

+8 −18
Original line number Diff line number Diff line
@@ -123,16 +123,6 @@ public class ServiceStateTracker extends Handler {
    // TODO - this should not be public, right now used externally GsmConnetion.
    public RestrictedState mRestrictedState;

    /* The otaspMode passed to PhoneStateListener#onOtaspChanged */
    static public final int OTASP_UNINITIALIZED = 0;
    static public final int OTASP_UNKNOWN = 1;
    static public final int OTASP_NEEDED = 2;
    static public final int OTASP_NOT_NEEDED = 3;
    /**
     * OtaUtil has conflict enum 4: OtaUtils.OTASP_FAILURE_SPC_RETRIES
     */
    static public final int OTASP_SIM_UNPROVISIONED = 5;

    /**
     * A unique identifier to track requests associated with a poll
     * and ignore stale responses.  The value is a count-down of
@@ -468,7 +458,7 @@ public class ServiceStateTracker extends Handler {
    public static final String UNACTIVATED_MIN2_VALUE = "000000";
    public static final String UNACTIVATED_MIN_VALUE = "1111110111";
    // Current Otasp value
    private int mCurrentOtaspMode = OTASP_UNINITIALIZED;
    private int mCurrentOtaspMode = TelephonyManager.OTASP_UNINITIALIZED;
    /** if time between NITZ updates is less than mNitzUpdateSpacing the update may be ignored. */
    public static final int NITZ_UPDATE_SPACING_DEFAULT = 1000 * 60 * 10;
    private int mNitzUpdateSpacing = SystemProperties.getInt("ro.nitz_update_spacing",
@@ -558,7 +548,7 @@ public class ServiceStateTracker extends Handler {
        filter.addAction(ACTION_RADIO_OFF);
        context.registerReceiver(mIntentReceiver, filter);

        mPhone.notifyOtaspChanged(OTASP_UNINITIALIZED);
        mPhone.notifyOtaspChanged(TelephonyManager.OTASP_UNINITIALIZED);

        updatePhoneType();

@@ -1447,27 +1437,27 @@ public class ServiceStateTracker extends Handler {
        // if sim is not loaded, return otasp uninitialized
        if(!mPhone.getIccRecordsLoaded()) {
            if(DBG) log("getOtasp: otasp uninitialized due to sim not loaded");
            return OTASP_UNINITIALIZED;
            return TelephonyManager.OTASP_UNINITIALIZED;
        }
        // if voice tech is Gsm, return otasp not needed
        if(mPhone.isPhoneTypeGsm()) {
            if(DBG) log("getOtasp: otasp not needed for GSM");
            return OTASP_NOT_NEEDED;
            return TelephonyManager.OTASP_NOT_NEEDED;
        }
        // for ruim, min is null means require otasp.
        if (mIsSubscriptionFromRuim && mMin == null) {
            return OTASP_NEEDED;
            return TelephonyManager.OTASP_NEEDED;
        }
        if (mMin == null || (mMin.length() < 6)) {
            if (DBG) log("getOtasp: bad mMin='" + mMin + "'");
            provisioningState = OTASP_UNKNOWN;
            provisioningState = TelephonyManager.OTASP_UNKNOWN;
        } else {
            if ((mMin.equals(UNACTIVATED_MIN_VALUE)
                    || mMin.substring(0,6).equals(UNACTIVATED_MIN2_VALUE))
                    || SystemProperties.getBoolean("test_cdma_setup", false)) {
                provisioningState = OTASP_NEEDED;
                provisioningState = TelephonyManager.OTASP_NEEDED;
            } else {
                provisioningState = OTASP_NOT_NEEDED;
                provisioningState = TelephonyManager.OTASP_NOT_NEEDED;
            }
        }
        if (DBG) log("getOtasp: state=" + provisioningState);
+1 −1
Original line number Diff line number Diff line
@@ -2429,7 +2429,7 @@ public class DcTracker extends Handler {

                if (!enabled) {
                    // Send otasp_sim_unprovisioned so that SuW is able to proceed and notify users
                    mPhone.notifyOtaspChanged(ServiceStateTracker.OTASP_SIM_UNPROVISIONED);
                    mPhone.notifyOtaspChanged(TelephonyManager.OTASP_SIM_UNPROVISIONED);
                    // Tear down all metered apns
                    cleanUpAllConnections(true, Phone.REASON_CARRIER_ACTION_DISABLE_METERED_APN);
                } else {
+4 −4
Original line number Diff line number Diff line
@@ -266,11 +266,11 @@ public class DefaultPhoneNotifierTest extends TelephonyTest {

    @Test @SmallTest
    public void testNotifyOtaspChanged() throws Exception {
        mDefaultPhoneNotifierUT.notifyOtaspChanged(mPhone, ServiceStateTracker.OTASP_NEEDED);
        verify(mTelephonyRegisteryMock).notifyOtaspChanged(ServiceStateTracker.OTASP_NEEDED);
        mDefaultPhoneNotifierUT.notifyOtaspChanged(mPhone, TelephonyManager.OTASP_NEEDED);
        verify(mTelephonyRegisteryMock).notifyOtaspChanged(TelephonyManager.OTASP_NEEDED);

        mDefaultPhoneNotifierUT.notifyOtaspChanged(mPhone, ServiceStateTracker.OTASP_UNKNOWN);
        verify(mTelephonyRegisteryMock).notifyOtaspChanged(ServiceStateTracker.OTASP_UNKNOWN);
        mDefaultPhoneNotifierUT.notifyOtaspChanged(mPhone, TelephonyManager.OTASP_UNKNOWN);
        verify(mTelephonyRegisteryMock).notifyOtaspChanged(TelephonyManager.OTASP_UNKNOWN);
    }

    @Test @SmallTest