[Settings] Remove EID from SimStatusDialog
Remove EID field. Bug: 260540995 Test: local Change-Id: I0da91b6e0f21d11aa9ba1660e759b532eb7b7c35
This commit is contained in:
@@ -156,15 +156,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/device_info_not_available"/>
|
android:text="@string/device_info_not_available"/>
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/device_info_dialog_label"
|
|
||||||
android:id="@+id/esim_id_label"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/status_esim_id"/>
|
|
||||||
|
|
||||||
<include layout="@xml/esim_eid_and_qrcode" />
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/device_info_dialog_label"
|
style="@style/device_info_dialog_label"
|
||||||
android:id="@+id/ims_reg_state_label"
|
android:id="@+id/ims_reg_state_label"
|
||||||
|
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2022 The Android Open Source Project
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
style="@style/device_info_dialog_value"
|
|
||||||
android:id="@+id/esim_id_value"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textIsSelectable="true"
|
|
||||||
android:text="@string/device_info_not_available"/>
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/esim_id_qrcode"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
tools:ignore="ContentDescription" />
|
|
||||||
|
|
||||||
</merge>
|
|
@@ -22,7 +22,6 @@ import android.annotation.Nullable;
|
|||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.ServiceConnection;
|
import android.content.ServiceConnection;
|
||||||
@@ -47,7 +46,6 @@ import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
|
|||||||
import android.telephony.TelephonyCallback;
|
import android.telephony.TelephonyCallback;
|
||||||
import android.telephony.TelephonyDisplayInfo;
|
import android.telephony.TelephonyDisplayInfo;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.telephony.UiccCardInfo;
|
|
||||||
import android.telephony.euicc.EuiccManager;
|
import android.telephony.euicc.EuiccManager;
|
||||||
import android.telephony.ims.ImsException;
|
import android.telephony.ims.ImsException;
|
||||||
import android.telephony.ims.ImsMmTelManager;
|
import android.telephony.ims.ImsMmTelManager;
|
||||||
@@ -64,17 +62,13 @@ import com.android.settings.R;
|
|||||||
import com.android.settingslib.DeviceInfoUtils;
|
import com.android.settingslib.DeviceInfoUtils;
|
||||||
import com.android.settingslib.Utils;
|
import com.android.settingslib.Utils;
|
||||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||||
import com.android.settingslib.utils.ThreadUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller for Sim Status information within the About Phone Settings page.
|
* Controller for Sim Status information within the About Phone Settings page.
|
||||||
*/
|
*/
|
||||||
public class SimStatusDialogController implements LifecycleObserver,
|
public class SimStatusDialogController implements LifecycleObserver {
|
||||||
DialogInterface.OnShowListener {
|
|
||||||
|
|
||||||
private final static String TAG = "SimStatusDialogCtrl";
|
private final static String TAG = "SimStatusDialogCtrl";
|
||||||
|
|
||||||
@@ -105,12 +99,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final static int ICCID_INFO_VALUE_ID = R.id.icc_id_value;
|
final static int ICCID_INFO_VALUE_ID = R.id.icc_id_value;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final static int EID_INFO_LABEL_ID = R.id.esim_id_label;
|
|
||||||
@VisibleForTesting
|
|
||||||
final static int EID_INFO_VALUE_ID = R.id.esim_id_value;
|
|
||||||
@VisibleForTesting
|
|
||||||
final static int EID_INFO_QRCODE_ID = R.id.esim_id_qrcode;
|
|
||||||
@VisibleForTesting
|
|
||||||
final static int IMS_REGISTRATION_STATE_LABEL_ID = R.id.ims_reg_state_label;
|
final static int IMS_REGISTRATION_STATE_LABEL_ID = R.id.ims_reg_state_label;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
final static int IMS_REGISTRATION_STATE_VALUE_ID = R.id.ims_reg_state_value;
|
final static int IMS_REGISTRATION_STATE_VALUE_ID = R.id.ims_reg_state_value;
|
||||||
@@ -162,7 +150,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
|||||||
|
|
||||||
private boolean mShowLatestAreaInfo;
|
private boolean mShowLatestAreaInfo;
|
||||||
private boolean mIsRegisteredListener = false;
|
private boolean mIsRegisteredListener = false;
|
||||||
private AtomicReference<String> mEid = null;
|
|
||||||
|
|
||||||
private final BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
@@ -239,8 +226,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
requestForUpdateEid();
|
|
||||||
|
|
||||||
if (mSubscriptionInfo == null) {
|
if (mSubscriptionInfo == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -268,19 +253,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
|||||||
updateImsRegistrationState();
|
updateImsRegistrationState();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback when dialog end of show().
|
|
||||||
*/
|
|
||||||
public void onShow(DialogInterface dialog) {
|
|
||||||
if (mEid != null) {
|
|
||||||
String eidText = mEid.get();
|
|
||||||
if (eidText != null) {
|
|
||||||
// Present QR code after the completion of layout
|
|
||||||
mDialog.setQrCode(EID_INFO_QRCODE_ID, eidText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deinitialization works
|
* Deinitialization works
|
||||||
*/
|
*/
|
||||||
@@ -633,71 +605,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
protected void requestForUpdateEid() {
|
|
||||||
ThreadUtils.postOnBackgroundThread(() -> {
|
|
||||||
mEid = getEid(mSlotIndex);
|
|
||||||
ThreadUtils.postOnMainThread(() -> updateEid(mEid));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
public AtomicReference<String> getEid(int slotIndex) {
|
|
||||||
boolean shouldHaveEid = false;
|
|
||||||
String eid = null;
|
|
||||||
if (getTelephonyManager().getActiveModemCount() > MAX_PHONE_COUNT_SINGLE_SIM) {
|
|
||||||
// Get EID per-SIM in multi-SIM mode
|
|
||||||
final Map<Integer, Integer> mapping = mTelephonyManager
|
|
||||||
.getLogicalToPhysicalSlotMapping();
|
|
||||||
final int pSlotId = mapping.getOrDefault(slotIndex,
|
|
||||||
SubscriptionManager.INVALID_SIM_SLOT_INDEX);
|
|
||||||
|
|
||||||
if (pSlotId != SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
|
|
||||||
final List<UiccCardInfo> infos = getTelephonyManager().getUiccCardsInfo();
|
|
||||||
|
|
||||||
for (UiccCardInfo info : infos) {
|
|
||||||
if (info.getPhysicalSlotIndex() == pSlotId) {
|
|
||||||
if (info.isEuicc()) {
|
|
||||||
shouldHaveEid = true;
|
|
||||||
eid = info.getEid();
|
|
||||||
if (TextUtils.isEmpty(eid)) {
|
|
||||||
eid = mEuiccManager.createForCardId(info.getCardId()).getEid();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (mEuiccManager.isEnabled()) {
|
|
||||||
// Get EID of default eSIM in single-SIM mode
|
|
||||||
shouldHaveEid = true;
|
|
||||||
eid = mEuiccManager.getEid();
|
|
||||||
}
|
|
||||||
if ((!shouldHaveEid) && (eid == null)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new AtomicReference<String>(eid);
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
|
||||||
protected void updateEid(AtomicReference<String> eid) {
|
|
||||||
boolean removeQrCode = true;
|
|
||||||
if (eid == null) {
|
|
||||||
mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID);
|
|
||||||
mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID);
|
|
||||||
mDialog.removeSettingFromScreen(EID_INFO_QRCODE_ID);
|
|
||||||
} else {
|
|
||||||
String eidText = eid.get();
|
|
||||||
if (eidText != null) {
|
|
||||||
mDialog.setText(EID_INFO_VALUE_ID, eidText);
|
|
||||||
removeQrCode = (eidText == "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (removeQrCode) {
|
|
||||||
mDialog.removeSettingFromScreen(EID_INFO_QRCODE_ID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isImsRegistrationStateShowUp() {
|
private boolean isImsRegistrationStateShowUp() {
|
||||||
if (mSubscriptionInfo == null) {
|
if (mSubscriptionInfo == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@@ -19,14 +19,11 @@ package com.android.settings.deviceinfo.simstatus;
|
|||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
@@ -35,7 +32,6 @@ import androidx.fragment.app.FragmentManager;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||||
import com.android.settings.deviceinfo.PhoneNumberUtil;
|
import com.android.settings.deviceinfo.PhoneNumberUtil;
|
||||||
import com.android.settingslib.qrcode.QrCodeGenerator;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
@@ -84,7 +80,6 @@ public class SimStatusDialogFragment extends InstrumentedDialogFragment {
|
|||||||
Dialog dlg = builder.setView(mRootView).create();
|
Dialog dlg = builder.setView(mRootView).create();
|
||||||
dlg.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
|
dlg.getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
|
||||||
WindowManager.LayoutParams.FLAG_SECURE);
|
WindowManager.LayoutParams.FLAG_SECURE);
|
||||||
dlg.setOnShowListener(mController);
|
|
||||||
|
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
@@ -107,8 +102,7 @@ public class SimStatusDialogFragment extends InstrumentedDialogFragment {
|
|||||||
**/
|
**/
|
||||||
private static final int[] sViewIdsInDigitFormat = IntStream
|
private static final int[] sViewIdsInDigitFormat = IntStream
|
||||||
.of(SimStatusDialogController.ICCID_INFO_VALUE_ID,
|
.of(SimStatusDialogController.ICCID_INFO_VALUE_ID,
|
||||||
SimStatusDialogController.PHONE_NUMBER_VALUE_ID,
|
SimStatusDialogController.PHONE_NUMBER_VALUE_ID)
|
||||||
SimStatusDialogController.EID_INFO_VALUE_ID)
|
|
||||||
.sorted().toArray();
|
.sorted().toArray();
|
||||||
|
|
||||||
public void setText(int viewId, CharSequence text) {
|
public void setText(int viewId, CharSequence text) {
|
||||||
@@ -128,19 +122,4 @@ public class SimStatusDialogFragment extends InstrumentedDialogFragment {
|
|||||||
textView.setText(text);
|
textView.setText(text);
|
||||||
textView.setTextIsSelectable(enableCopy);
|
textView.setTextIsSelectable(enableCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQrCode(int viewId, String qrcodeText) {
|
|
||||||
ImageView qrCodeView = (ImageView) mRootView.findViewById(viewId);
|
|
||||||
|
|
||||||
Bitmap qrCodeBitmap = null;
|
|
||||||
try {
|
|
||||||
qrCodeBitmap = QrCodeGenerator.encodeQrCode(qrcodeText, qrCodeView.getWidth());
|
|
||||||
} catch (Exception exception) {
|
|
||||||
Log.w(TAG, "Error when presenting QR code in + " + qrCodeView, exception);
|
|
||||||
}
|
|
||||||
if (qrCodeBitmap == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
qrCodeView.setImageBitmap(qrCodeBitmap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -18,8 +18,6 @@ package com.android.settings.deviceinfo.simstatus;
|
|||||||
|
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_DATA_NETWORK_TYPE_VALUE_ID;
|
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_DATA_NETWORK_TYPE_VALUE_ID;
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_VOICE_NETWORK_TYPE_VALUE_ID;
|
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_VOICE_NETWORK_TYPE_VALUE_ID;
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.EID_INFO_LABEL_ID;
|
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.EID_INFO_VALUE_ID;
|
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_LABEL_ID;
|
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_LABEL_ID;
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_VALUE_ID;
|
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_VALUE_ID;
|
||||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.IMS_REGISTRATION_STATE_LABEL_ID;
|
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.IMS_REGISTRATION_STATE_LABEL_ID;
|
||||||
@@ -115,12 +113,8 @@ public class SimStatusDialogControllerTest {
|
|||||||
private LifecycleOwner mLifecycleOwner;
|
private LifecycleOwner mLifecycleOwner;
|
||||||
private Lifecycle mLifecycle;
|
private Lifecycle mLifecycle;
|
||||||
private AtomicBoolean mEuiccEnabled;
|
private AtomicBoolean mEuiccEnabled;
|
||||||
private AtomicReference<String> mEid;
|
|
||||||
private AtomicInteger mUpdatePhoneNumberCount;
|
private AtomicInteger mUpdatePhoneNumberCount;
|
||||||
|
|
||||||
private static final String TEST_EID_FROM_CARD = "11111111111111111111111111111111";
|
|
||||||
private static final String TEST_EID_FROM_MANAGER = "22222222222222222222222222222222";
|
|
||||||
|
|
||||||
private static final int MAX_PHONE_COUNT_DUAL_SIM = 2;
|
private static final int MAX_PHONE_COUNT_DUAL_SIM = 2;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -149,21 +143,12 @@ public class SimStatusDialogControllerTest {
|
|||||||
|
|
||||||
mUpdatePhoneNumberCount = new AtomicInteger();
|
mUpdatePhoneNumberCount = new AtomicInteger();
|
||||||
mEuiccEnabled = new AtomicBoolean(false);
|
mEuiccEnabled = new AtomicBoolean(false);
|
||||||
mEid = new AtomicReference<String>("");
|
|
||||||
mController = new SimStatusDialogController(mDialog, mLifecycle, 0 /* phone id */) {
|
mController = new SimStatusDialogController(mDialog, mLifecycle, 0 /* phone id */) {
|
||||||
@Override
|
@Override
|
||||||
public TelephonyManager getTelephonyManager() {
|
public TelephonyManager getTelephonyManager() {
|
||||||
return mTelephonyManager;
|
return mTelephonyManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void requestForUpdateEid() {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AtomicReference<String> getEid(int slotIndex) {
|
|
||||||
return mEuiccEnabled.get() ? mEid : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updatePhoneNumber() {
|
public void updatePhoneNumber() {
|
||||||
super.updatePhoneNumber();
|
super.updatePhoneNumber();
|
||||||
@@ -205,7 +190,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
doReturn(carrierName).when(mSubscriptionInfo).getCarrierName();
|
doReturn(carrierName).when(mSubscriptionInfo).getCarrierName();
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).setText(NETWORK_PROVIDER_VALUE_ID, carrierName);
|
verify(mDialog).setText(NETWORK_PROVIDER_VALUE_ID, carrierName);
|
||||||
}
|
}
|
||||||
@@ -213,7 +197,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void initialize_shouldUpdatePhoneNumber() {
|
public void initialize_shouldUpdatePhoneNumber() {
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
assertTrue(mUpdatePhoneNumberCount.get() > 0);
|
assertTrue(mUpdatePhoneNumberCount.get() > 0);
|
||||||
}
|
}
|
||||||
@@ -223,7 +206,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
|
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).removeSettingFromScreen(OPERATOR_INFO_LABEL_ID);
|
verify(mDialog).removeSettingFromScreen(OPERATOR_INFO_LABEL_ID);
|
||||||
verify(mDialog).removeSettingFromScreen(OPERATOR_INFO_VALUE_ID);
|
verify(mDialog).removeSettingFromScreen(OPERATOR_INFO_VALUE_ID);
|
||||||
@@ -234,7 +216,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mServiceState.getState()).thenReturn(ServiceState.STATE_IN_SERVICE);
|
when(mServiceState.getState()).thenReturn(ServiceState.STATE_IN_SERVICE);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String inServiceText = ResourcesUtils.getResourcesString(
|
final String inServiceText = ResourcesUtils.getResourcesString(
|
||||||
mContext, "radioInfo_service_in");
|
mContext, "radioInfo_service_in");
|
||||||
@@ -246,7 +227,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mServiceState.getState()).thenReturn(ServiceState.STATE_POWER_OFF);
|
when(mServiceState.getState()).thenReturn(ServiceState.STATE_POWER_OFF);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String offServiceText = ResourcesUtils.getResourcesString(
|
final String offServiceText = ResourcesUtils.getResourcesString(
|
||||||
mContext, "radioInfo_service_off");
|
mContext, "radioInfo_service_off");
|
||||||
@@ -261,7 +241,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
ServiceState.STATE_OUT_OF_SERVICE);
|
ServiceState.STATE_OUT_OF_SERVICE);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String offServiceText = ResourcesUtils.getResourcesString(
|
final String offServiceText = ResourcesUtils.getResourcesString(
|
||||||
mContext, "radioInfo_service_out");
|
mContext, "radioInfo_service_out");
|
||||||
@@ -275,7 +254,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mServiceState.getDataRegistrationState()).thenReturn(ServiceState.STATE_IN_SERVICE);
|
when(mServiceState.getDataRegistrationState()).thenReturn(ServiceState.STATE_IN_SERVICE);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String inServiceText = ResourcesUtils.getResourcesString(
|
final String inServiceText = ResourcesUtils.getResourcesString(
|
||||||
mContext, "radioInfo_service_in");
|
mContext, "radioInfo_service_in");
|
||||||
@@ -291,7 +269,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
setupCellSignalStrength_lteWcdma(lteDbm, lteAsu, wcdmaDbm, wcdmaAsu);
|
setupCellSignalStrength_lteWcdma(lteDbm, lteAsu, wcdmaDbm, wcdmaAsu);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
||||||
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
||||||
@@ -307,7 +284,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
setupCellSignalStrength_lteCdma(lteDbm, lteAsu, cdmaDbm, cdmaAsu);
|
setupCellSignalStrength_lteCdma(lteDbm, lteAsu, cdmaDbm, cdmaAsu);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
||||||
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
||||||
@@ -324,7 +300,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
setupCellSignalStrength_lteOnly(lteDbm, lteAsu);
|
setupCellSignalStrength_lteOnly(lteDbm, lteAsu);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
final String signalStrengthString = ResourcesUtils.getResourcesString(
|
||||||
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
mContext, "sim_signal_strength", lteDbm, lteAsu);
|
||||||
@@ -337,7 +312,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
TelephonyManager.NETWORK_TYPE_EDGE);
|
TelephonyManager.NETWORK_TYPE_EDGE);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).setText(CELL_VOICE_NETWORK_TYPE_VALUE_ID,
|
verify(mDialog).setText(CELL_VOICE_NETWORK_TYPE_VALUE_ID,
|
||||||
SimStatusDialogController.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
|
SimStatusDialogController.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
|
||||||
@@ -349,7 +323,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
TelephonyManager.NETWORK_TYPE_EDGE);
|
TelephonyManager.NETWORK_TYPE_EDGE);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).setText(CELL_DATA_NETWORK_TYPE_VALUE_ID,
|
verify(mDialog).setText(CELL_DATA_NETWORK_TYPE_VALUE_ID,
|
||||||
SimStatusDialogController.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
|
SimStatusDialogController.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE));
|
||||||
@@ -360,7 +333,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mServiceState.getRoaming()).thenReturn(true);
|
when(mServiceState.getRoaming()).thenReturn(true);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String roamingOnString = ResourcesUtils.getResourcesString(
|
final String roamingOnString = ResourcesUtils.getResourcesString(
|
||||||
mContext, "radioInfo_roaming_in");
|
mContext, "radioInfo_roaming_in");
|
||||||
@@ -372,7 +344,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mServiceState.getRoaming()).thenReturn(false);
|
when(mServiceState.getRoaming()).thenReturn(false);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
final String roamingOffString = ResourcesUtils.getResourcesString(
|
final String roamingOffString = ResourcesUtils.getResourcesString(
|
||||||
mContext, "radioInfo_roaming_not");
|
mContext, "radioInfo_roaming_not");
|
||||||
@@ -385,7 +356,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false);
|
CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL, false);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
||||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_VALUE_ID);
|
verify(mDialog).removeSettingFromScreen(ICCID_INFO_VALUE_ID);
|
||||||
@@ -397,7 +367,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, false);
|
CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL, false);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_LABEL_ID);
|
verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_LABEL_ID);
|
||||||
verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_VALUE_ID);
|
verify(mDialog, times(2)).removeSettingFromScreen(SIGNAL_STRENGTH_VALUE_ID);
|
||||||
@@ -409,7 +378,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(null);
|
when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(null);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog, times(2)).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any());
|
verify(mDialog, times(2)).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any());
|
||||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
||||||
@@ -423,403 +391,10 @@ public class SimStatusDialogControllerTest {
|
|||||||
doReturn(iccid).when(mTelephonyManager).getSimSerialNumber();
|
doReturn(iccid).when(mTelephonyManager).getSimSerialNumber();
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).setText(ICCID_INFO_VALUE_ID, iccid);
|
verify(mDialog).setText(ICCID_INFO_VALUE_ID, iccid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initialize_updateEid_shouldNotSetEid() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo1 = new UiccCardInfo(
|
|
||||||
false, // isEuicc
|
|
||||||
0, // cardId
|
|
||||||
null, // eid
|
|
||||||
0, // slotIndex
|
|
||||||
true, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
"123451234567890", // iccId
|
|
||||||
0, // portIdx
|
|
||||||
0, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo1);
|
|
||||||
UiccCardInfo uiccCardInfo2 = new UiccCardInfo(
|
|
||||||
true, // isEuicc
|
|
||||||
1, // cardId
|
|
||||||
null, // eid (unavailable)
|
|
||||||
1, // slotIndex
|
|
||||||
false, // isRemovable
|
|
||||||
false,
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
null, // iccId
|
|
||||||
1, // portIdx
|
|
||||||
1, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
uiccCardInfos.add(uiccCardInfo2);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 1);
|
|
||||||
slotMapping.put(1, 0);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
|
||||||
mEuiccEnabled.set(true);
|
|
||||||
mEid.set(null);
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Keep 'Not available' if neither the card nor the associated manager can provide EID.
|
|
||||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
|
||||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initialize_updateEid_shouldSetEidFromCard() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo1 = new UiccCardInfo(
|
|
||||||
true, // isEuicc
|
|
||||||
0, // cardId
|
|
||||||
TEST_EID_FROM_CARD, // eid
|
|
||||||
0, // slotIndex
|
|
||||||
false, // isRemovable
|
|
||||||
false,
|
|
||||||
Collections.singletonList(new UiccPortInfo(
|
|
||||||
null, // iccId
|
|
||||||
0, // portIdx
|
|
||||||
0, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)));
|
|
||||||
uiccCardInfos.add(uiccCardInfo1);
|
|
||||||
UiccCardInfo uiccCardInfo2 = new UiccCardInfo(
|
|
||||||
false, // isEuicc
|
|
||||||
1, // cardId
|
|
||||||
null, // eid
|
|
||||||
1, // slotIndex
|
|
||||||
true, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
"123451234567890", // iccId
|
|
||||||
1, // portIdx
|
|
||||||
1, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo2);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 0);
|
|
||||||
slotMapping.put(1, 1);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
|
||||||
mEuiccEnabled.set(true);
|
|
||||||
mEid.set(TEST_EID_FROM_CARD);
|
|
||||||
when(mEuiccManager.createForCardId(0)).thenReturn(mEuiccManager);
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Set EID retrieved from the card.
|
|
||||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_CARD);
|
|
||||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initialize_updateEid_shouldSetEidFromManager() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo1 = new UiccCardInfo(
|
|
||||||
false, // isEuicc
|
|
||||||
0, // cardId
|
|
||||||
null, // eid
|
|
||||||
0, // slotIndex
|
|
||||||
true, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
"123451234567890", // iccId
|
|
||||||
1, // portIdx
|
|
||||||
1, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo1);
|
|
||||||
UiccCardInfo uiccCardInfo2 = new UiccCardInfo(
|
|
||||||
true, // isEuicc
|
|
||||||
1, // cardId
|
|
||||||
null, // eid (unavailable)
|
|
||||||
1, // slotIndex
|
|
||||||
false, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
null, // iccId
|
|
||||||
1, // portIdx
|
|
||||||
1, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
uiccCardInfos.add(uiccCardInfo2);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 1);
|
|
||||||
slotMapping.put(1, 0);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
|
||||||
mEuiccEnabled.set(true);
|
|
||||||
mEid.set(TEST_EID_FROM_MANAGER);
|
|
||||||
when(mEuiccManager.createForCardId(0)).thenThrow(
|
|
||||||
new RuntimeException("Unexpected card ID was specified"));
|
|
||||||
when(mEuiccManager.createForCardId(1)).thenReturn(mEuiccManager);
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Set EID retrieved from the manager associated with the card which cannot provide EID.
|
|
||||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_MANAGER);
|
|
||||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@Ignore
|
|
||||||
public void initialize_updateEid_shouldRemoveEid() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_DUAL_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo1 = new UiccCardInfo(
|
|
||||||
false, // isEuicc
|
|
||||||
0, // cardId
|
|
||||||
null, // eid
|
|
||||||
0, // slotIndex
|
|
||||||
true, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
"123451234567890", // iccId
|
|
||||||
0, // portIdx
|
|
||||||
0, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo1);
|
|
||||||
UiccCardInfo uiccCardInfo2 = new UiccCardInfo(
|
|
||||||
true, // isEuicc
|
|
||||||
1, // cardId
|
|
||||||
TEST_EID_FROM_CARD, // eid
|
|
||||||
1, // slotIndex
|
|
||||||
false, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
null, // iccId
|
|
||||||
1, // portIdx
|
|
||||||
1, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo2);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 0);
|
|
||||||
slotMapping.put(1, 1);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
|
||||||
mEuiccEnabled.set(true);
|
|
||||||
mEid.set(null);
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Remove EID if the card is not eUICC.
|
|
||||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
|
||||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_LABEL_ID));
|
|
||||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initialize_updateEid_shouldNotSetEidInSingleSimMode() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo = new UiccCardInfo(
|
|
||||||
true, // isEuicc
|
|
||||||
0, // cardId
|
|
||||||
TEST_EID_FROM_CARD, // eid (not used)
|
|
||||||
0, // slotIndex
|
|
||||||
false, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
null, // iccId
|
|
||||||
0, // portIdx
|
|
||||||
0, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 0);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
|
||||||
mEuiccEnabled.set(true);
|
|
||||||
mEid.set(null);
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Keep 'Not available' if the default eUICC manager cannot provide EID in Single SIM mode.
|
|
||||||
verify(mDialog, never()).setText(eq(EID_INFO_VALUE_ID), any());
|
|
||||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initialize_updateEid_shouldSetEidInSingleSimModeWithEnabledEuicc() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo = new UiccCardInfo(
|
|
||||||
true, // isEuicc (eUICC slot is selected)
|
|
||||||
0, // cardId
|
|
||||||
TEST_EID_FROM_CARD, // eid (not used)
|
|
||||||
0, // slotIndex
|
|
||||||
false, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
null, // iccId
|
|
||||||
0, // portIdx
|
|
||||||
0, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
uiccCardInfos.add(uiccCardInfo);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 0);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
|
||||||
mEuiccEnabled.set(true);
|
|
||||||
mEid.set(TEST_EID_FROM_MANAGER);
|
|
||||||
when(mEuiccManager.createForCardId(anyInt())).thenThrow(
|
|
||||||
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
|
||||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_MANAGER);
|
|
||||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initialize_updateEid_shouldSetEidInSingleSimModeWithDisabledEuicc() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo = new UiccCardInfo(
|
|
||||||
false, // isEuicc (eUICC slot is not selected)
|
|
||||||
0, // cardId
|
|
||||||
null, // eid
|
|
||||||
0, // slotIndex
|
|
||||||
true, // isRemovable
|
|
||||||
false, // isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
"123451234567890", // iccId
|
|
||||||
0, // portIdx
|
|
||||||
0, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 0);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(true);
|
|
||||||
mEuiccEnabled.set(true);
|
|
||||||
mEid.set(TEST_EID_FROM_MANAGER);
|
|
||||||
when(mEuiccManager.createForCardId(anyInt())).thenThrow(
|
|
||||||
new RuntimeException("EID shall be retrieved from the default eUICC manager"));
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Set EID retrieved from the default eUICC manager in Single SIM mode.
|
|
||||||
verify(mDialog).setText(EID_INFO_VALUE_ID, TEST_EID_FROM_MANAGER);
|
|
||||||
verify(mDialog, never()).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void initialize_updateEid_shouldRemoveEidInSingleSimMode() {
|
|
||||||
when(mTelephonyManager.getActiveModemCount()).thenReturn(MAX_PHONE_COUNT_SINGLE_SIM);
|
|
||||||
|
|
||||||
ArrayList<UiccCardInfo> uiccCardInfos = new ArrayList<>();
|
|
||||||
UiccCardInfo uiccCardInfo = new UiccCardInfo(
|
|
||||||
false, // isEuicc
|
|
||||||
0, // cardId
|
|
||||||
null, // eid
|
|
||||||
0, // slotIndex
|
|
||||||
true, // isRemovable
|
|
||||||
false, //isMultipleEnabledProfileSupported
|
|
||||||
Collections.singletonList(
|
|
||||||
new UiccPortInfo(
|
|
||||||
"123451234567890", // iccId
|
|
||||||
0, // portIdx
|
|
||||||
0, // logicalSlotIdx
|
|
||||||
true // isActive
|
|
||||||
)
|
|
||||||
));
|
|
||||||
uiccCardInfos.add(uiccCardInfo);
|
|
||||||
when(mTelephonyManager.getUiccCardsInfo()).thenReturn(uiccCardInfos);
|
|
||||||
|
|
||||||
Map<Integer, Integer> slotMapping = new HashMap<>();
|
|
||||||
slotMapping.put(0, 0);
|
|
||||||
when(mTelephonyManager.getLogicalToPhysicalSlotMapping()).thenReturn(slotMapping);
|
|
||||||
|
|
||||||
when(mEuiccManager.isEnabled()).thenReturn(false);
|
|
||||||
mEuiccEnabled.set(false);
|
|
||||||
mEid.set(null);
|
|
||||||
|
|
||||||
mController.initialize();
|
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
// Remove EID if the default eUICC manager indicates that eSIM is not enabled.
|
|
||||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_LABEL_ID));
|
|
||||||
verify(mDialog).removeSettingFromScreen(eq(EID_INFO_VALUE_ID));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void initialize_imsRegistered_shouldSetImsRegistrationStateSummaryToRegisterd() {
|
public void initialize_imsRegistered_shouldSetImsRegistrationStateSummaryToRegisterd() {
|
||||||
@@ -828,7 +403,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(true);
|
when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(true);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).setText(IMS_REGISTRATION_STATE_VALUE_ID,
|
verify(mDialog).setText(IMS_REGISTRATION_STATE_VALUE_ID,
|
||||||
mContext.getString(R.string.ims_reg_status_registered));
|
mContext.getString(R.string.ims_reg_status_registered));
|
||||||
@@ -842,7 +416,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(false);
|
when(mTelephonyManager.isImsRegistered(anyInt())).thenReturn(false);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).setText(IMS_REGISTRATION_STATE_VALUE_ID,
|
verify(mDialog).setText(IMS_REGISTRATION_STATE_VALUE_ID,
|
||||||
mContext.getString(R.string.ims_reg_status_not_registered));
|
mContext.getString(R.string.ims_reg_status_not_registered));
|
||||||
@@ -855,7 +428,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, true);
|
CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, true);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog, never()).removeSettingFromScreen(IMS_REGISTRATION_STATE_VALUE_ID);
|
verify(mDialog, never()).removeSettingFromScreen(IMS_REGISTRATION_STATE_VALUE_ID);
|
||||||
}
|
}
|
||||||
@@ -867,7 +439,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, false);
|
CarrierConfigManager.KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL, false);
|
||||||
|
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
|
|
||||||
verify(mDialog).removeSettingFromScreen(IMS_REGISTRATION_STATE_LABEL_ID);
|
verify(mDialog).removeSettingFromScreen(IMS_REGISTRATION_STATE_LABEL_ID);
|
||||||
verify(mDialog).removeSettingFromScreen(IMS_REGISTRATION_STATE_VALUE_ID);
|
verify(mDialog).removeSettingFromScreen(IMS_REGISTRATION_STATE_VALUE_ID);
|
||||||
@@ -878,7 +449,6 @@ public class SimStatusDialogControllerTest {
|
|||||||
doReturn(null).when(mTelephonyManager).getSignalStrength();
|
doReturn(null).when(mTelephonyManager).getSignalStrength();
|
||||||
// we should not crash when running the following line
|
// we should not crash when running the following line
|
||||||
mController.initialize();
|
mController.initialize();
|
||||||
mController.updateEid(mController.getEid(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupCellSignalStrength_lteWcdma(int lteDbm, int lteAsu, int wcdmaDbm,
|
private void setupCellSignalStrength_lteWcdma(int lteDbm, int lteAsu, int wcdmaDbm,
|
||||||
|
Reference in New Issue
Block a user