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

Commit 814b7c40 authored by Zoey Chen's avatar Zoey Chen Committed by Gerrit Code Review
Browse files

Merge "[Settings] Cannot use UnsupportedAppUsage API, use #hasIccCard() to replace"

parents 5c262a92 d54004f4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class SimLockPreferenceController extends BasePreferenceController {
    private final CarrierConfigManager mCarrierConfigManager;
    private final UserManager mUserManager;
    private final SubscriptionManager mSubscriptionManager;
    private final TelephonyManager mTelephonyManager;
    private TelephonyManager mTelephonyManager;

    public SimLockPreferenceController(Context context) {
        super(context, KEY_SIM_LOCK);
@@ -99,7 +99,9 @@ public class SimLockPreferenceController extends BasePreferenceController {

        if (subInfoList != null) {
            for (SubscriptionInfo subInfo : subInfoList) {
                if (mTelephonyManager.hasIccCard(subInfo.getSimSlotIndex())) {
                mTelephonyManager = mTelephonyManager
                        .createForSubscriptionId(subInfo.getSimSlotIndex());
                if (mTelephonyManager.hasIccCard()) {
                    return true;
                }
            }
+2 −1
Original line number Diff line number Diff line
@@ -141,7 +141,8 @@ public class SimLockPreferenceControllerTest {
        final List<SubscriptionInfo> subscriptionInfoList = new ArrayList<>();
        SubscriptionInfo info = mock(SubscriptionInfo.class);
        subscriptionInfoList.add(info);
        when(mTelephonyManager.hasIccCard(anyInt())).thenReturn(true);
        when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
        when(mTelephonyManager.hasIccCard()).thenReturn(true);
        when(mSubscriptionManager.getActiveSubscriptionInfoList(eq(true)))
                .thenReturn(subscriptionInfoList);
    }