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

Commit 2a7c0d37 authored by Sandeep Gutta's avatar Sandeep Gutta Committed by Pengquan Meng
Browse files

Telephony(MSIM): Default NW mode property for each slot

For dual SIM devices, add provision to configure different default
Network modes for each slot, using the existing system property to
configure this default network modes.

Bug: 28384694
Test: manual - Checked different default NW mode can be set
for each slot.
Merged-Id: I72b11522cb51a425e28ddc407014387a20cb2cd7
Change-Id: I72b11522cb51a425e28ddc407014387a20cb2cd7
parent 0db51ad5
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.os.UserHandle;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.provider.Settings.Secure;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;

@@ -2594,14 +2595,25 @@ class DatabaseHelper extends SQLiteOpenHelper {
            loadSetting(stmt, Settings.Global.CALL_AUTO_RETRY, 0);

            // Set the preferred network mode to target desired value or Default
            // value defined in RILConstants
            int type;
            type = RILConstants.PREFERRED_NETWORK_MODE;
            loadSetting(stmt, Settings.Global.PREFERRED_NETWORK_MODE, type);
            // value defined in system property
            String val = "";
            String mode;
            for (int phoneId = 0;
                    phoneId < TelephonyManager.getDefault().getPhoneCount(); phoneId++) {
                mode = TelephonyManager.getTelephonyProperty(phoneId,
                        "ro.telephony.default_network",
                        Integer.toString(RILConstants.PREFERRED_NETWORK_MODE));
                if (phoneId == 0) {
                    val = mode;
                } else {
                    val = val + "," + mode;
                }
            }
            loadSetting(stmt, Settings.Global.PREFERRED_NETWORK_MODE, val);

            // Set the preferred cdma subscription source to target desired value or default
            // value defined in Phone
            type = SystemProperties.getInt("ro.telephony.default_cdma_sub",
            int type = SystemProperties.getInt("ro.telephony.default_cdma_sub",
                    Phone.PREFERRED_CDMA_SUBSCRIPTION);
            loadSetting(stmt, Settings.Global.CDMA_SUBSCRIPTION_MODE, type);

+3 −2
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ package com.android.internal.telephony;
 */

import android.os.SystemProperties;
import android.telephony.TelephonyManager;

/**
 * {@hide}
@@ -162,8 +163,8 @@ public interface RILConstants {
    int NETWORK_MODE_LTE_TDSCDMA_GSM_WCDMA   = 20; /* TD-SCDMA, GSM/WCDMA and LTE */
    int NETWORK_MODE_TDSCDMA_CDMA_EVDO_GSM_WCDMA  = 21; /*TD-SCDMA,EvDo,CDMA,GSM/WCDMA*/
    int NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA = 22; /* TD-SCDMA/LTE/GSM/WCDMA, CDMA, and EvDo */
    int PREFERRED_NETWORK_MODE      = SystemProperties.getInt("ro.telephony.default_network",
            NETWORK_MODE_WCDMA_PREF);
    int PREFERRED_NETWORK_MODE = Integer.parseInt(TelephonyManager.getTelephonyProperty(0,
            "ro.telephony.default_network", Integer.toString(NETWORK_MODE_WCDMA_PREF)));

    int BAND_MODE_UNSPECIFIED = 0;      //"unspecified" (selected by baseband automatically)
    int BAND_MODE_EURO = 1;             //"EURO band" (GSM-900 / DCS-1800 / WCDMA-IMT-2000)