[Settings] Remove EID from SimStatusDialog
Remove EID field. Bug: 260540995 Test: local Change-Id: I0da91b6e0f21d11aa9ba1660e759b532eb7b7c35
This commit is contained in:
@@ -22,7 +22,6 @@ import android.annotation.Nullable;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.ServiceConnection;
|
||||
@@ -47,7 +46,6 @@ import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
|
||||
import android.telephony.TelephonyCallback;
|
||||
import android.telephony.TelephonyDisplayInfo;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.telephony.UiccCardInfo;
|
||||
import android.telephony.euicc.EuiccManager;
|
||||
import android.telephony.ims.ImsException;
|
||||
import android.telephony.ims.ImsMmTelManager;
|
||||
@@ -64,17 +62,13 @@ import com.android.settings.R;
|
||||
import com.android.settingslib.DeviceInfoUtils;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
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.
|
||||
*/
|
||||
public class SimStatusDialogController implements LifecycleObserver,
|
||||
DialogInterface.OnShowListener {
|
||||
public class SimStatusDialogController implements LifecycleObserver {
|
||||
|
||||
private final static String TAG = "SimStatusDialogCtrl";
|
||||
|
||||
@@ -105,12 +99,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
||||
@VisibleForTesting
|
||||
final static int ICCID_INFO_VALUE_ID = R.id.icc_id_value;
|
||||
@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;
|
||||
@VisibleForTesting
|
||||
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 mIsRegisteredListener = false;
|
||||
private AtomicReference<String> mEid = null;
|
||||
|
||||
private final BroadcastReceiver mAreaInfoReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
@@ -239,8 +226,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
requestForUpdateEid();
|
||||
|
||||
if (mSubscriptionInfo == null) {
|
||||
return;
|
||||
}
|
||||
@@ -268,19 +253,6 @@ public class SimStatusDialogController implements LifecycleObserver,
|
||||
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
|
||||
*/
|
||||
@@ -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() {
|
||||
if (mSubscriptionInfo == null) {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user