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

Commit 71c7fa3b authored by Umashankar Godachi's avatar Umashankar Godachi Committed by takeshi tanigawa
Browse files

MSIM:Fix sim state change intent broadcasted for both slots.

In SubscriptionInfoUpdater while handling the sim loaded
event, sim state change intent is wrongly getting broadcasted
for both slots. This will have potential issue in case of SIM
PIN lock.

Fix: Broadcast the sim state change intent only for the sim
which is in LOADED state.

Test: Manual - Checked that SIM PIN lock screen dismissed only
when user enters the correct PIN for all SIM.

Bug: 62520405
Change-Id: I7ef7dfc749d0f73c684e3a77113821687496cc78
parent 940538ef
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -356,6 +356,7 @@ public class SubscriptionInfoUpdater extends Handler {
        // The SIM should be loaded at this state, but it is possible in cases such as SIM being
        // removed or a refresh RESET that the IccRecords could be null. The right behavior is to
        // not broadcast the SIM loaded.
        int loadedSlotId = slotId;
        IccRecords records = mPhone[slotId].getIccCard().getIccRecords();
        if (records == null) {  // Possibly a race condition.
            logd("handleSimLoaded: IccRecords null");
@@ -440,16 +441,16 @@ public class SubscriptionInfoUpdater extends Handler {
                    editor.putInt(CURR_SUBID + slotId, subId);
                    editor.apply();
                }
            }
        }

        // Update set of enabled carrier apps now that the privilege rules may have changed.
        CarrierAppUtils.disableCarrierAppsUntilPrivileged(mContext.getOpPackageName(),
                mPackageManager, TelephonyManager.getDefault(),
                mContext.getContentResolver(), mCurrentlyActiveUserId);

                broadcastSimStateChanged(slotId, IccCardConstants.INTENT_VALUE_ICC_LOADED, null);
                updateCarrierServices(slotId, IccCardConstants.INTENT_VALUE_ICC_LOADED);
            }
        }
        broadcastSimStateChanged(loadedSlotId, IccCardConstants.INTENT_VALUE_ICC_LOADED, null);
        updateCarrierServices(loadedSlotId, IccCardConstants.INTENT_VALUE_ICC_LOADED);
    }

    private void updateCarrierServices(int slotId, String simState) {