Show one SIM only for EAP-SIM when dual SIMs have the same carrier ID

- Because the wifiConfiguration save the carrier ID only for EAP-SIM authentication

- If multiple SIMs have the same carrier ID, the Wi-Fi framework will use the default data SIM for EAP-SIM authentication

- To avoid user confusion, show one SIM only when dual SIMs have the same carrier ID

Bug: 233765468
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=WifiConfigController2Test

Change-Id: I56f956d20053d314f082ba185d661d8e0a0ef3cb
This commit is contained in:
Weng Su
2022-08-03 02:29:08 +08:00
parent a0d8b1fbc6
commit 66922f4870
2 changed files with 68 additions and 11 deletions

View File

@@ -42,6 +42,7 @@ import android.text.InputType;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.ArrayMap;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
@@ -1495,13 +1496,20 @@ public class WifiConfigController2 implements TextWatcher,
}
// Shows display name of each active subscription.
final ArrayList<CharSequence> displayNames = new ArrayList<>();
ArrayMap<Integer, CharSequence> displayNames = new ArrayMap<>();
int defaultDataSubscriptionId = SubscriptionManager.getDefaultDataSubscriptionId();
for (SubscriptionInfo activeSubInfo : mActiveSubscriptionInfos) {
displayNames.add(
// If multiple SIMs have the same carrier id, only the first or default data SIM is
// displayed.
if (displayNames.containsKey(activeSubInfo.getCarrierId())
&& defaultDataSubscriptionId != activeSubInfo.getSubscriptionId()) {
continue;
}
displayNames.put(activeSubInfo.getCarrierId(),
SubscriptionUtil.getUniqueSubscriptionDisplayName(activeSubInfo, mContext));
}
mEapSimSpinner.setAdapter(
getSpinnerAdapter(displayNames.toArray(new String[displayNames.size()])));
getSpinnerAdapter(displayNames.values().toArray(new String[displayNames.size()])));
mEapSimSpinner.setSelection(0 /* position */);
if (displayNames.size() == 1) {
mEapSimSpinner.setEnabled(false);