Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ca3255c authored by Zoey Chen's avatar Zoey Chen
Browse files

[Settings] Fix crash and UI error when turn ON/OFF SIM

1. Should update the UI when turn off SIM
2. Fix ConcurrentModificationException

Bug: 259487637
Test: manual
Change-Id: If30a6b6323ac0237c92dc210bf3953ce86a199ae
parent 9d0a16aa
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -264,8 +264,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions
                        mIsActive = portInfo.isActive();
                        mPortIndex = portInfo.getPortIndex();
                    } else if (DEBUG) {
                        Log.d(TAG,
                                "Can not get port index and physicalSlotIndex for subId "
                        Log.d(TAG, "Can not get port index and physicalSlotIndex for subId "
                                        + mSubId);
                    }
                });
@@ -297,8 +296,7 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions
        setActiveSubInfoList(mActiveSubInfoEntityList);
    }

    private void setActiveSubInfoList(
            List<SubscriptionInfoEntity> activeSubInfoEntityList) {
    private void setActiveSubInfoList(List<SubscriptionInfoEntity> activeSubInfoEntityList) {
        if (DEBUG) {
            Log.d(TAG,
                    "onActiveSubInfoChanged, activeSubInfoEntityList = " + activeSubInfoEntityList);
@@ -460,11 +458,16 @@ public class MobileNetworkRepository extends SubscriptionManager.OnSubscriptions
            if (DEBUG) {
                Log.d(TAG, "availableSudInfoList from framework is empty, remove all subs");
            }
            for (SubscriptionInfoEntity info : mAvailableSubInfoEntityList) {

            SubscriptionInfoEntity[] availableInfoArray = mAvailableSubInfoEntityList.toArray(
                    new SubscriptionInfoEntity[0]);
            for (SubscriptionInfoEntity info : availableInfoArray) {
                deleteAllInfoBySubId(info.subId);
            }

        } else if (availableInfoList != null) {
            for (SubscriptionInfo subInfo : availableInfoList) {
            SubscriptionInfo[] infoArray = availableInfoList.toArray(new SubscriptionInfo[0]);
            for (SubscriptionInfo subInfo : infoArray) {
                mSubscriptionInfoMap.remove(subInfo.getSubscriptionId());
                if (DEBUG) {
                    Log.d(TAG,
+4 −4
Original line number Diff line number Diff line
@@ -464,10 +464,6 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme

    @Override
    public void onAvailableSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) {
    }

    @Override
    public void onActiveSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) {
        if (DataServiceUtils.shouldUpdateEntityList(mSubInfoEntityList, subInfoEntityList)) {

            // Check the current subId is existed or not, if so, finish it.
@@ -499,6 +495,10 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme
        }
    }

    @Override
    public void onActiveSubInfoChanged(List<SubscriptionInfoEntity> subInfoEntityList) {
    }

    @Override
    public void onAllUiccInfoChanged(List<UiccInfoEntity> uiccInfoEntityList) {
    }