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

Commit a9ecbf1d authored by Huaibin Yang's avatar Huaibin Yang Committed by Linux Build Service Account
Browse files

Add two fixes for MuiltiSim support

Use getDefaultDataSubId to get default data network type. Currently using
getDefaultSubscription() may return voice network subId.

Provide database flags per subscription specific for both mobile data
and roaming options.

CRs-Fixed: 963773
Change-Id: I1d40bc5c84b4428d7066b28003e5b2c5d852b6f7
parent 7f7eba3b
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -2617,6 +2617,13 @@ class DatabaseHelper extends SQLiteOpenHelper {
                            SystemProperties.get("ro.com.android.dataroaming",
                                    "false")) ? 1 : 0);

            int phoneCount = TelephonyManager.getDefault().getPhoneCount();
            for (int phoneId = 0; phoneId < phoneCount; phoneId++) {
                loadSetting(stmt, Settings.Global.DATA_ROAMING + phoneId,
                        "true".equalsIgnoreCase(SystemProperties.get(
                        "ro.com.android.dataroaming", "true")) ? 1 : 0);
            }

            loadBooleanSetting(stmt, Settings.Global.DEVICE_PROVISIONED,
                    R.bool.def_device_provisioned);

@@ -2640,6 +2647,14 @@ class DatabaseHelper extends SQLiteOpenHelper {
                            SystemProperties.get("ro.com.android.mobiledata",
                                    "true")) ? 1 : 0);

            // SUB specific flags for Multisim devices
            for (int phoneId = 0; phoneId < phoneCount; phoneId++) {
                // Mobile Data default, based on build
                loadSetting(stmt, Settings.Global.MOBILE_DATA + phoneId,
                        "true".equalsIgnoreCase(SystemProperties.get(
                        "ro.com.android.mobiledata", "true")) ? 1 : 0);
            }

            loadBooleanSetting(stmt, Settings.Global.NETSTATS_ENABLED,
                    R.bool.def_netstats_enabled);

@@ -2690,7 +2705,6 @@ class DatabaseHelper extends SQLiteOpenHelper {

            // Set the preferred network mode to target desired value or Default
            // value defined in system property
            int phoneCount = TelephonyManager.getDefault().getPhoneCount();
            String val = "";
            String mode = "";
            for (int phoneId = 0; phoneId < phoneCount; phoneId++) {
+10 −3
Original line number Diff line number Diff line
@@ -1551,7 +1551,7 @@ public class TelephonyManager {
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     */
    public int getDataNetworkType() {
        return getDataNetworkType(getSubId());
        return getDataNetworkType(getDefaultDataSubscriptionId());
    }

    /**
@@ -3483,6 +3483,13 @@ public class TelephonyManager {
        return SubscriptionManager.getDefaultSubscriptionId();
    }

    /**
     * Returns Default Data subscription.
     */
    private static int getDefaultDataSubscriptionId() {
        return SubscriptionManager.getDefaultDataSubscriptionId();
    }

    /**
     * Returns Default phone.
     */
@@ -4563,7 +4570,7 @@ public class TelephonyManager {
    /** @hide */
    @SystemApi
    public void setDataEnabled(boolean enable) {
        setDataEnabled(SubscriptionManager.getDefaultDataSubscriptionId(), enable);
        setDataEnabled(getDefaultDataSubscriptionId(), enable);
    }

    /** @hide */
@@ -4582,7 +4589,7 @@ public class TelephonyManager {
    /** @hide */
    @SystemApi
    public boolean getDataEnabled() {
        return getDataEnabled(SubscriptionManager.getDefaultDataSubscriptionId());
        return getDataEnabled(getDefaultDataSubscriptionId());
    }

    /** @hide */