Merge "[Settings] Cannot use UnsupportedAppUsage API, use #hasIccCard() to replace" am: 814b7c40cb
Change-Id: I42233960cd715d506fc899f845ba7818a56e6886
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user