Fix the IndexOutOfBoundsException
Bug: 276460284 Test: build pass Change-Id: If70bd4624b9b94aafa0930f0deba106cff5a2212
This commit is contained in:
@@ -438,6 +438,7 @@ public class SubscriptionUtil {
|
||||
}
|
||||
|
||||
}
|
||||
Log.d(TAG, "getSelectableSubscriptionInfoList: " + selectableList);
|
||||
return selectableList;
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,6 @@ import com.android.settings.sim.SwitchToEsimConfirmDialogActivity;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -100,6 +99,9 @@ public class SimSlotChangeHandler {
|
||||
|
||||
int lastRemovableSlotState = getLastRemovableSimSlotState(mContext);
|
||||
int currentRemovableSlotState = removableSlotInfo.getCardStateInfo();
|
||||
Log.i(TAG,
|
||||
"lastRemovableSlotState: " + lastRemovableSlotState + ",currentRemovableSlotState: "
|
||||
+ currentRemovableSlotState);
|
||||
boolean isRemovableSimInserted =
|
||||
lastRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_ABSENT
|
||||
&& currentRemovableSlotState == UiccSlotInfo.CARD_STATE_INFO_PRESENT;
|
||||
@@ -259,7 +261,7 @@ public class SimSlotChangeHandler {
|
||||
}
|
||||
|
||||
List<SubscriptionInfo> subscriptionInfos = getAvailableRemovableSubscription();
|
||||
if (subscriptionInfos == null || subscriptionInfos.get(0) == null) {
|
||||
if (subscriptionInfos.isEmpty()) {
|
||||
Log.e(TAG, "Unable to find the removable subscriptionInfo. Do nothing.");
|
||||
return;
|
||||
}
|
||||
@@ -275,6 +277,7 @@ public class SimSlotChangeHandler {
|
||||
private void setRemovableSimSlotState(Context context, int state) {
|
||||
final SharedPreferences prefs = context.getSharedPreferences(EUICC_PREFS, MODE_PRIVATE);
|
||||
prefs.edit().putInt(KEY_REMOVABLE_SLOT_STATE, state).apply();
|
||||
Log.d(TAG, "setRemovableSimSlotState: " + state);
|
||||
}
|
||||
|
||||
private int getSuwRemovableSlotAction(Context context) {
|
||||
@@ -332,13 +335,14 @@ public class SimSlotChangeHandler {
|
||||
}
|
||||
|
||||
protected List<SubscriptionInfo> getAvailableRemovableSubscription() {
|
||||
List<SubscriptionInfo> subList = new ArrayList<>();
|
||||
for (SubscriptionInfo info : SubscriptionUtil.getAvailableSubscriptions(mContext)) {
|
||||
if (!info.isEmbedded()) {
|
||||
subList.add(info);
|
||||
}
|
||||
}
|
||||
return subList;
|
||||
List<SubscriptionInfo> removableSubscriptions =
|
||||
SubscriptionUtil.getAvailableSubscriptions(mContext);
|
||||
return ImmutableList.copyOf(
|
||||
removableSubscriptions.stream()
|
||||
// ToDo: This condition is for psim only. If device supports removable
|
||||
// esim, it needs an new condition.
|
||||
.filter(sub -> !sub.isEmbedded())
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
private void startChooseSimActivity(boolean psimInserted) {
|
||||
|
Reference in New Issue
Block a user