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

Commit 5af91fbe authored by Nathan's avatar Nathan
Browse files

Fixups for Barring Info

-Ensure that phoneId is valid before doing fixup for null
 barring info (shouldn't happen, but it's validated elsewhere).
-Move write of mBarringInfo into the synchronized block.
-Dedupe BarringInfo to ensure that registrants aren't spammed
 due to screen off/on.

Bug: 242633342
Test: atest TelephonyRegistryTest#testBarringInfoChanged
Change-Id: I1f83709beb44d65bb36d49dcf71bce5ae382c2d1
parent 8314a3e5
Loading
Loading
Loading
Loading
+28 −22
Original line number Diff line number Diff line
@@ -2572,14 +2572,21 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (!checkNotifyPermission("notifyBarringInfo()")) {
            return;
        }
        if (barringInfo == null) {
            log("Received null BarringInfo for subId=" + subId + ", phoneId=" + phoneId);
            mBarringInfo.set(phoneId, new BarringInfo());
        if (!validatePhoneId(phoneId)) {
            loge("Received invalid phoneId for BarringInfo = " + phoneId);
            return;
        }

        synchronized (mRecords) {
            if (validatePhoneId(phoneId)) {
            if (barringInfo == null) {
                loge("Received null BarringInfo for subId=" + subId + ", phoneId=" + phoneId);
                mBarringInfo.set(phoneId, new BarringInfo());
                return;
            }
            if (barringInfo.equals(mBarringInfo.get(phoneId))) {
                if (VDBG) log("Ignoring duplicate barring info.");
                return;
            }
            mBarringInfo.set(phoneId, barringInfo);
            // Barring info is non-null
            BarringInfo biNoLocation = barringInfo.createLocationInfoSanitizedCopy();
@@ -2601,7 +2608,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    }
                }
            }
            }
            handleRemoveListLocked();
        }
    }