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

Commit 3e7c7ca8 authored by richard chou's avatar richard chou Committed by Richard Chou
Browse files

Reset SIM state if the subscription/slot is no longer active.

Reset the cached SIM state if the subscription and associated slot is not active.

Bug: 77702165
Bug: 75499020
Test: Nova team An-Cheng verified it manually.
Change-Id: Ic5adfbe637d29bd7e12e277e9d89d4ad56350adf
parent 08d79be6
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1850,6 +1850,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
        final TelephonyManager tele = TelephonyManager.from(mContext);
        ArrayList<Integer> changedSubscriptionIds = new ArrayList<>();
        HashSet<Integer> activeSubIds = new HashSet<>();
        HashSet<Integer> activeSlotIds = new HashSet<>();

        for (SubscriptionInfo info : activeSubscriptionInfos) {
            int subId = info.getSubscriptionId();
@@ -1878,11 +1879,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
            }

            activeSubIds.add(subId);
            activeSlotIds.add(slotId);
        }

        for (SimData data : mSimDatas.values()) {
            if (!activeSubIds.contains(data.subId) && data.simState != State.ABSENT) {
            if (!activeSubIds.contains(data.subId)
                && !activeSlotIds.contains(data.slotId)
                && data.simState != State.ABSENT) {
                // for the inactive subscriptions, reset state to ABSENT
                if (DEBUG_SIM_STATES) Log.d(TAG, "reset state to ABSENT for subId:" + data.subId);
                data.simState = State.ABSENT;
                changedSubscriptionIds.add(data.subId);
            }