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

Commit d54004f4 authored by zoey chen's avatar zoey chen
Browse files

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

Bug: 145967955
Test: make
Change-Id: I8b948d1d416e1eb79e34be073b8ad81645d5ebb1
Merged-In: I8b948d1d416e1eb79e34be073b8ad81645d5ebb1
parent e9b3f330
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);
    }