Merge "eSIM deprecated API test Refactoring"

This commit is contained in:
Sandeep Jawalkar
2021-11-16 16:46:04 +00:00
committed by Android (Google) Code Review
8 changed files with 165 additions and 55 deletions

View File

@@ -164,14 +164,12 @@ public class SimSlotChangeHandler {
private void handleSimInsert(UiccSlotInfo removableSlotInfo) {
Log.i(TAG, "Handle SIM inserted.");
if (!isSuwFinished(mContext)) {
Log.i(TAG, "Still in SUW. Handle SIM insertion after SUW is finished");
setSuwRemovableSlotAction(mContext, LAST_USER_ACTION_IN_SUW_INSERT);
return;
}
if (removableSlotInfo.getIsActive()) {
if (removableSlotInfo.getPorts().stream().findFirst().get().isActive()) {
Log.i(TAG, "The removable slot is already active. Do nothing.");
return;
}
@@ -213,7 +211,8 @@ public class SimSlotChangeHandler {
List<SubscriptionInfo> groupedEmbeddedSubscriptions = getGroupedEmbeddedSubscriptions();
if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getIsActive()) {
if (groupedEmbeddedSubscriptions.size() == 0 || !removableSlotInfo.getPorts().stream()
.findFirst().get().isActive()) {
Log.i(TAG, "eSIM slot is active or no subscriptions exist. Do nothing.");
return;
}

View File

@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.telephony.UiccCardInfo;
import android.telephony.UiccPortInfo;
import android.telephony.UiccSlotInfo;
import android.telephony.euicc.EuiccManager;
import android.text.TextUtils;
@@ -116,9 +117,11 @@ public class SimSlotChangeReceiver extends BroadcastReceiver {
if (cardInfo == null) {
continue;
}
if (!TextUtils.isEmpty(slotInfo.getCardId())
|| !TextUtils.isEmpty(cardInfo.getIccId())) {
isAllCardStringsEmpty = false;
for (UiccPortInfo portInfo : cardInfo.getPorts()) {
if (!TextUtils.isEmpty(slotInfo.getCardId())
|| !TextUtils.isEmpty(portInfo.getIccId())) {
isAllCardStringsEmpty = false;
}
}
}
@@ -139,7 +142,7 @@ public class SimSlotChangeReceiver extends BroadcastReceiver {
return null;
}
return cardInfos.stream()
.filter(info -> info.getSlotIndex() == physicalSlotIndex)
.filter(info -> info.getPhysicalSlotIndex() == physicalSlotIndex)
.findFirst()
.orElse(null);
}