Loading services/core/java/com/android/server/TelephonyRegistry.java +37 −1 Original line number Diff line number Diff line Loading @@ -2691,7 +2691,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { for (Record r : mRecords) { if (r.matchTelephonyCallbackEvent( TelephonyCallback.EVENT_RADIO_POWER_STATE_CHANGED) && idMatch(r, subId, phoneId)) { && idMatchRelaxed(r, subId, phoneId)) { try { r.callback.onRadioPowerStateChanged(state); } catch (RemoteException ex) { Loading Loading @@ -4089,6 +4089,42 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } /** * Match the sub id or phone id of the event to the record with relaxed rules * * We follow the rules below: * 1) If sub id of the event is invalid, phone id should be used. * 2) If record's phoneId is also invalid then allow phone 0 notifications * 3) The event on default sub should be notified to the records * which register the default sub id. * 4) Sub id should be exactly matched for all other cases. * TODO: b/337878785 for longterm fix */ boolean idMatchRelaxed(Record r, int subId, int phoneId) { if (subId < 0) { // Invalid case, we need compare phoneId. // If the record does not have a valid phone Id send phone 0 notifications. // A record's phoneId can get invalid if there is no SIM or modem was restarting // when caller registered. if (r.phoneId == INVALID_SIM_SLOT_INDEX) { return (phoneId == 0); } else { return (r.phoneId == phoneId); } } if (r.subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) { // if the registered record does not have a valid phoneId then use the phone 0 if (r.phoneId == INVALID_SIM_SLOT_INDEX) { return (phoneId == 0); } return (subId == mDefaultSubId); } else { return (r.subId == subId); } } private boolean checkFineLocationAccess(Record r) { return checkFineLocationAccess(r, Build.VERSION_CODES.BASE); } Loading Loading
services/core/java/com/android/server/TelephonyRegistry.java +37 −1 Original line number Diff line number Diff line Loading @@ -2691,7 +2691,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { for (Record r : mRecords) { if (r.matchTelephonyCallbackEvent( TelephonyCallback.EVENT_RADIO_POWER_STATE_CHANGED) && idMatch(r, subId, phoneId)) { && idMatchRelaxed(r, subId, phoneId)) { try { r.callback.onRadioPowerStateChanged(state); } catch (RemoteException ex) { Loading Loading @@ -4089,6 +4089,42 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub { } } /** * Match the sub id or phone id of the event to the record with relaxed rules * * We follow the rules below: * 1) If sub id of the event is invalid, phone id should be used. * 2) If record's phoneId is also invalid then allow phone 0 notifications * 3) The event on default sub should be notified to the records * which register the default sub id. * 4) Sub id should be exactly matched for all other cases. * TODO: b/337878785 for longterm fix */ boolean idMatchRelaxed(Record r, int subId, int phoneId) { if (subId < 0) { // Invalid case, we need compare phoneId. // If the record does not have a valid phone Id send phone 0 notifications. // A record's phoneId can get invalid if there is no SIM or modem was restarting // when caller registered. if (r.phoneId == INVALID_SIM_SLOT_INDEX) { return (phoneId == 0); } else { return (r.phoneId == phoneId); } } if (r.subId == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) { // if the registered record does not have a valid phoneId then use the phone 0 if (r.phoneId == INVALID_SIM_SLOT_INDEX) { return (phoneId == 0); } return (subId == mDefaultSubId); } else { return (r.subId == subId); } } private boolean checkFineLocationAccess(Record r) { return checkFineLocationAccess(r, Build.VERSION_CODES.BASE); } Loading