From e40a3ca111b4152440a9059ae1e71ae757b79c1c Mon Sep 17 00:00:00 2001 From: Zoey Chen Date: Thu, 15 Dec 2022 11:02:31 +0000 Subject: [PATCH] [Settings] 1. Provision status checking of eSIM 2. Show SIM if isOpportunistic is false Bug: 262679983 Bug: 257120311 Test: manual Change-Id: I67acd7d6e261d67271438f78ce1a87e90362e0b6 --- .../network/MobileNetworkRepository.java | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/network/MobileNetworkRepository.java b/src/com/android/settings/network/MobileNetworkRepository.java index 42f15c824b1..0c150afaf53 100644 --- a/src/com/android/settings/network/MobileNetworkRepository.java +++ b/src/com/android/settings/network/MobileNetworkRepository.java @@ -15,6 +15,7 @@ */ package com.android.settings.network; +import static android.telephony.SubscriptionManager.PROFILE_CLASS_PROVISIONING; import static android.telephony.UiccSlotInfo.CARD_STATE_INFO_PRESENT; import static com.android.internal.telephony.TelephonyIntents.ACTION_DEFAULT_VOICE_SUBSCRIPTION_CHANGED; @@ -265,7 +266,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions mPortIndex = portInfo.getPortIndex(); } else if (DEBUG) { Log.d(TAG, "Can not get port index and physicalSlotIndex for subId " - + mSubId); + + mSubId); } }); if (mPhysicalSlotIndex != SubscriptionManager.INVALID_SIM_SLOT_INDEX) { @@ -324,7 +325,12 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions SubscriptionInfoEntity subInfoEntity = convertToSubscriptionInfoEntity(context, info); if (subInfoEntity != null) { - mSubscriptionInfoMap.put(info.getSubscriptionId(), info); + int subId = info.getSubscriptionId(); + mSubscriptionInfoMap.put(subId, info); + if (DEBUG) { + Log.d(TAG, "convert subId " + subId + "to SubscriptionInfoEntity: " + + subInfoEntity); + } mMobileNetworkDatabase.insertSubsInfo(subInfoEntity); mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_SUB_INFO); @@ -401,13 +407,21 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions } public void insertUiccInfo() { - mMobileNetworkDatabase.insertUiccInfo(convertToUiccInfoEntity()); + UiccInfoEntity uiccInfoEntity = convertToUiccInfoEntity(); + if (DEBUG) { + Log.d(TAG, "uiccInfoEntity = " + uiccInfoEntity); + } + mMobileNetworkDatabase.insertUiccInfo(uiccInfoEntity); mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_UICC_INFO); } public void insertMobileNetworkInfo(Context context) { - mMobileNetworkDatabase.insertMobileNetworkInfo(convertToMobileNetworkInfoEntity(context)); + MobileNetworkInfoEntity mobileNetworkInfoEntity = convertToMobileNetworkInfoEntity(context); + if (DEBUG) { + Log.d(TAG, "mobileNetworkInfoEntity = " + mobileNetworkInfoEntity); + } + mMobileNetworkDatabase.insertMobileNetworkInfo(mobileNetworkInfoEntity); mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_MOBILE_NETWORK_DB_INSERT_MOBILE_NETWORK_INFO); } @@ -449,7 +463,8 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions @Override public void onSubscriptionsChanged() { - insertAvailableSubInfoToEntity(mSubscriptionManager.getAvailableSubscriptionInfoList()); + insertAvailableSubInfoToEntity( + SubscriptionUtil.getSelectableSubscriptionInfoList(mContext)); } private void insertAvailableSubInfoToEntity(List availableInfoList) { @@ -470,8 +485,14 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions for (SubscriptionInfo subInfo : infoArray) { mSubscriptionInfoMap.remove(subInfo.getSubscriptionId()); if (DEBUG) { - Log.d(TAG, - "insert sudInfo " + subInfo.getSubscriptionId() + " to subInfoEntity"); + Log.d(TAG, "insert subInfo to subInfoEntity, subInfo = " + subInfo); + } + if (subInfo.isEmbedded() + && subInfo.getProfileClass() == PROFILE_CLASS_PROVISIONING) { + if (DEBUG) { + Log.d(TAG, "Do not insert the provision eSIM"); + } + continue; } insertSubInfo(mContext, subInfo); }