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

Commit 02ce7868 authored by Jordan Liu's avatar Jordan Liu
Browse files

Do not notify SS change with invalid subId

If a service state change is reported as a subscription is becoming
invalid (i.e. no longer connected to a phone), the current behavior can
sometimes notify this change to all PhoneStateListeners regardless of
which subId they registered to listen on (namely this happens when the
subscription was attached to the default phone).

This change removes that behavior so that no listeners are notified if
the subscription is invalid.

Test: manually verified on DSDS that when
  1. erasing eSIM when it is default and
  2. removing pSIM when it is default,
  the service state triangle for the other SIM is unaffected
Bug: 133140128
Change-Id: I906147b2d13be0bc26f8d31ec361fcd016c2cda0
parent b7da5f09
Loading
Loading
Loading
Loading
+8 −2
Original line number Original line Diff line number Diff line
@@ -1027,7 +1027,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                log(str);
                log(str);
            }
            }
            mLocalLog.log(str);
            mLocalLog.log(str);
            if (validatePhoneId(phoneId)) {
            // for service state updates, don't notify clients when subId is invalid. This prevents
            // us from sending incorrect notifications like b/133140128
            // In the future, we can remove this logic for every notification here and add a
            // callback so listeners know when their PhoneStateListener's subId becomes invalid, but
            // for now we use the simplest fix.
            if (validatePhoneId(phoneId) && SubscriptionManager.isValidSubscriptionId(subId)) {
                mServiceState[phoneId] = state;
                mServiceState[phoneId] = state;


                for (Record r : mRecords) {
                for (Record r : mRecords) {
@@ -1059,7 +1064,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    }
                    }
                }
                }
            } else {
            } else {
                log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId);
                log("notifyServiceStateForSubscriber: INVALID phoneId=" + phoneId
                        + " or subId=" + subId);
            }
            }
            handleRemoveListLocked();
            handleRemoveListLocked();
        }
        }