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

Commit 7982f3e5 authored by Wink Saville's avatar Wink Saville Committed by Gerrit Code Review
Browse files

Merge "Initialize RIL with the correct CDMA subscription mode setting"

parents f6dced1a 1584a505
Loading
Loading
Loading
Loading
+1 −27
Original line number Diff line number Diff line
@@ -48,9 +48,6 @@ public class PhoneFactory {
    static private Looper sLooper;
    static private Context sContext;

    static final int sPreferredCdmaSubscription =
                         CdmaSubscriptionSourceManager.PREFERRED_CDMA_SUBSCRIPTION;

    //***** Class Methods

    public static void makeDefaultPhones(Context context) {
@@ -108,30 +105,7 @@ public class PhoneFactory {
                        Settings.Global.PREFERRED_NETWORK_MODE, preferredNetworkMode);
                Rlog.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkMode));

                // Get cdmaSubscription
                // TODO: Change when the ril will provides a way to know at runtime
                //       the configuration, bug 4202572. And the ril issues the
                //       RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, bug 4295439.
                int cdmaSubscription;
                int lteOnCdma = TelephonyManager.getLteOnCdmaModeStatic();
                switch (lteOnCdma) {
                    case PhoneConstants.LTE_ON_CDMA_FALSE:
                        cdmaSubscription = CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_NV;
                        Rlog.i(LOG_TAG, "lteOnCdma is 0 use SUBSCRIPTION_FROM_NV");
                        break;
                    case PhoneConstants.LTE_ON_CDMA_TRUE:
                        cdmaSubscription = CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM;
                        Rlog.i(LOG_TAG, "lteOnCdma is 1 use SUBSCRIPTION_FROM_RUIM");
                        break;
                    case PhoneConstants.LTE_ON_CDMA_UNKNOWN:
                    default:
                        //Get cdmaSubscription mode from Settings.System
                        cdmaSubscription = Settings.Global.getInt(context.getContentResolver(),
                                Settings.Global.PREFERRED_CDMA_SUBSCRIPTION,
                                sPreferredCdmaSubscription);
                        Rlog.i(LOG_TAG, "lteOnCdma not set, using PREFERRED_CDMA_SUBSCRIPTION");
                        break;
                }
                int cdmaSubscription = CdmaSubscriptionSourceManager.getDefault(context);
                Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription);

                //reads the system properties and makes commandsinterface
+3 −3
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class CdmaSubscriptionSourceManager extends Handler {
        mCi = ci;
        mCi.registerForCdmaSubscriptionChanged(this, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
        mCi.registerForOn(this, EVENT_RADIO_ON, null);
        int subscriptionSource = getDefaultCdmaSubscriptionSource();
        int subscriptionSource = getDefault(context);
        mCdmaSubscriptionSource.set(subscriptionSource);
    }

@@ -134,9 +134,9 @@ public class CdmaSubscriptionSourceManager extends Handler {
     *
     * @return Default CDMA subscription source from Settings DB if present.
     */
    private int getDefaultCdmaSubscriptionSource() {
    public static int getDefault(Context context) {
        // Get the default value from the Settings
        int subscriptionSource = Settings.Global.getInt(mContext.getContentResolver(),
        int subscriptionSource = Settings.Global.getInt(context.getContentResolver(),
                Settings.Global.CDMA_SUBSCRIPTION_MODE, PREFERRED_CDMA_SUBSCRIPTION);
        return subscriptionSource;
    }