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

Commit cdf284b7 authored by Fan Zhang's avatar Fan Zhang
Browse files

Make Settings robotest work with tot Robolectric

Bug: 116278591
Test: make -j RunSettingsRoboTests
Change-Id: I32cb2fcf6094675f79d2fc24702ef6298a9691e4
parent dd3feeb1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ public class AppLocationPermissionPreferenceController extends
    @Override
    public boolean isAvailable() {
        return Settings.Global.getInt(mContext.getContentResolver(),
                android.provider.Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED, 1)
                == 1;
                Settings.Global.LOCATION_SETTINGS_LINK_TO_PERMISSIONS_ENABLED, 1) == 1;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public class CarrierPreferenceController extends BasePreferenceController {

    public CarrierPreferenceController(Context context, String key) {
        super(context, key);
        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        mCarrierConfigManager = new CarrierConfigManager(context);
        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
    }
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ public class MobileDataPreferenceController extends TogglePreferenceController

    public MobileDataPreferenceController(Context context, String key) {
        super(context, key);
        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        mSubscriptionManager = context.getSystemService(SubscriptionManager.class);
        mDataContentObserver = new DataContentObserver(new Handler(Looper.getMainLooper()));
        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+8 −8
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ public class MobileNetworkUtils {
     * Returns true if Wifi calling is enabled for at least one phone.
     */
    public static boolean isWifiCallingEnabled(Context context) {
        int phoneCount = TelephonyManager.from(context).getPhoneCount();
        int phoneCount = context.getSystemService(TelephonyManager.class).getPhoneCount();
        for (int i = 0; i < phoneCount; i++) {
            if (isWifiCallingEnabled(context, i)) {
                return true;
@@ -218,7 +218,7 @@ public class MobileNetworkUtils {
     */
    public static void setMobileDataEnabled(Context context, int subId, boolean enabled,
            boolean disableOtherSubscriptions) {
        final TelephonyManager telephonyManager = TelephonyManager.from(context)
        final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(subId);
        final SubscriptionManager subscriptionManager = context.getSystemService(
                SubscriptionManager.class);
@@ -230,7 +230,7 @@ public class MobileNetworkUtils {
            if (subInfoList != null) {
                for (SubscriptionInfo subInfo : subInfoList) {
                    if (subInfo.getSubscriptionId() != subId) {
                        TelephonyManager.from(context).createForSubscriptionId(
                        context.getSystemService(TelephonyManager.class).createForSubscriptionId(
                                subInfo.getSubscriptionId()).setDataEnabled(false);
                    }
                }
@@ -245,7 +245,7 @@ public class MobileNetworkUtils {
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            return false;
        }
        final TelephonyManager telephonyManager = TelephonyManager.from(context)
        final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(subId);
        final PersistableBundle carrierConfig = context.getSystemService(
                CarrierConfigManager.class).getConfigForSubId(subId);
@@ -307,7 +307,7 @@ public class MobileNetworkUtils {
    }

    private static boolean isGsmBasicOptions(Context context, int subId) {
        final TelephonyManager telephonyManager = TelephonyManager.from(context)
        final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(subId);
        final PersistableBundle carrierConfig = context.getSystemService(
                CarrierConfigManager.class).getConfigForSubId(subId);
@@ -329,7 +329,7 @@ public class MobileNetworkUtils {
     * settings
     */
    public static boolean isWorldMode(Context context, int subId) {
        final TelephonyManager telephonyManager = TelephonyManager.from(context)
        final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(subId);
        boolean worldModeOn = false;
        final String configString = context.getString(R.string.config_world_mode);
@@ -404,7 +404,7 @@ public class MobileNetworkUtils {
     */
    public static boolean isTdscdmaSupported(Context context, int subId) {
        return isTdscdmaSupported(context,
                TelephonyManager.from(context).createForSubscriptionId(subId));
                context.getSystemService(TelephonyManager.class).createForSubscriptionId(subId));
    }

    //TODO(b/117651939): move it to telephony
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ public class RoamingPreferenceController extends TogglePreferenceController impl

    public RoamingPreferenceController(Context context, String key) {
        super(context, key);
        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        mCarrierConfigManager = context.getSystemService(CarrierConfigManager.class);
        mDataContentObserver = new DataContentObserver(new Handler(Looper.getMainLooper()));
        mSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
Loading