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

Commit 191fcbb5 authored by Amit Mahajan's avatar Amit Mahajan
Browse files

Change to use DATA_ROAMING setting correctly with subId.

Bug: 18466745
Change-Id: Ib2d7979d164ca3cf32c6619340fae1dc578ca686
parent 80f67ef9
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -446,10 +446,10 @@ public class PhoneFactory {
        Rlog.d(LOG_TAG, "set mobile_data: " + enabled);

        // Update the current data roaming flag
        enabled = Settings.Global.getInt(sContext.getContentResolver(),
                Settings.Global.DATA_ROAMING + subId, 0) != 0;
        enabled = TelephonyManager.getIntWithSubId(sContext.getContentResolver(),
                Settings.Global.DATA_ROAMING, subId, 0) != 0;
        Settings.Global.putInt(sContext.getContentResolver(),
                Settings.Global.DATA_ROAMING, enabled ? 1 : 0);
                Settings.Global.DATA_ROAMING + subId, enabled ? 1 : 0);
        Rlog.d(LOG_TAG, "set data_roaming: " + enabled);
    }

+6 −3
Original line number Diff line number Diff line
@@ -398,7 +398,8 @@ public abstract class DcTrackerBase extends Handler {

        public void register() {
            mResolver.registerContentObserver(
                    Settings.Global.getUriFor(Settings.Global.DATA_ROAMING), false, this);
                    Settings.Global.getUriFor(Settings.Global.DATA_ROAMING + mPhone.getSubId()),
                    false, this);
        }

        public void unregister() {
@@ -755,9 +756,11 @@ public abstract class DcTrackerBase extends Handler {
        try {
            final ContentResolver resolver = mPhone.getContext().getContentResolver();
            final int phoneSubId = mPhone.getSubId();
            return Settings.Global.getInt(resolver, Settings.Global.DATA_ROAMING + phoneSubId) != 0;
            return TelephonyManager.getIntWithSubId(resolver, Settings.Global.DATA_ROAMING,
                    phoneSubId) != 0;
        } catch (SettingNotFoundException snfe) {
            return false;
            return "true".equalsIgnoreCase(SystemProperties.get("ro.com.android.dataroaming",
                    "false"));
        }
    }