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

Commit 00731ab2 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Merge "Fix bug that notifyDisplayInfoChanged is notified on wrong...

Merge "Merge "Fix bug that notifyDisplayInfoChanged is notified on wrong record" into rvc-dev am: ebb1992c am: 86ac1a3e am: c07354fc" into rvc-qpr-dev-plus-aosp am: 8efc9cd2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11812870

Change-Id: I72ecb0d9d6ceac66d847dc9374067e3d126f31a0
parents 5d84cf9b 8efc9cd2
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -1607,7 +1607,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                for (Record r : mRecords) {
                    if (r.matchPhoneStateListenerEvent(
                            PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED)
                            && idMatch(r.subId, subId, phoneId)) {
                            && idMatchWithoutDefaultPhoneCheck(r.subId, subId)) {
                        try {
                            r.callback.onDisplayInfoChanged(telephonyDisplayInfo);
                        } catch (RemoteException ex) {
@@ -2732,6 +2732,24 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        Rlog.e(TAG, s);
    }

    /**
     * If the registrant specified a subId, then we should only notify it if subIds match.
     * If the registrant registered with DEFAULT subId, we should notify only when the related subId
     * is default subId (which could be INVALID if there's no default subId).
     *
     * This should be the correct way to check record ID match. in idMatch the record's phoneId is
     * speculated based on subId passed by the registrant so it's not a good reference.
     * But to avoid triggering potential regression only replace idMatch with it when an issue with
     * idMatch is reported. Eventually this should replace all instances of idMatch.
     */
    private boolean idMatchWithoutDefaultPhoneCheck(int subIdInRecord, int subIdToNotify) {
        if (subIdInRecord == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
            return (subIdToNotify == mDefaultSubId);
        } else {
            return (subIdInRecord == subIdToNotify);
        }
    }

    boolean idMatch(int rSubId, int subId, int phoneId) {

        if(subId < 0) {