Merge "Fixups for Barring Info" am: 84e81127b0 am: 04e59a1d10 am: 92c328682a

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

Change-Id: Ia34e8e73f1e96abdf82bfeac7fb06fb2968f6ec6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Nathan Harold
2022-10-20 18:00:43 +00:00
committed by Automerger Merge Worker

View File

@@ -2581,33 +2581,39 @@ 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)) {
mBarringInfo.set(phoneId, barringInfo);
// Barring info is non-null
BarringInfo biNoLocation = barringInfo.createLocationInfoSanitizedCopy();
if (VDBG) log("listen: call onBarringInfoChanged=" + barringInfo);
for (Record r : mRecords) {
if (r.matchTelephonyCallbackEvent(
TelephonyCallback.EVENT_BARRING_INFO_CHANGED)
&& idMatch(r, subId, phoneId)) {
try {
if (DBG_LOC) {
log("notifyBarringInfo: mBarringInfo="
+ barringInfo + " r=" + r);
}
r.callback.onBarringInfoChanged(
checkFineLocationAccess(r, Build.VERSION_CODES.BASE)
? barringInfo : biNoLocation);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
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();
if (VDBG) log("listen: call onBarringInfoChanged=" + barringInfo);
for (Record r : mRecords) {
if (r.matchTelephonyCallbackEvent(
TelephonyCallback.EVENT_BARRING_INFO_CHANGED)
&& idMatch(r, subId, phoneId)) {
try {
if (DBG_LOC) {
log("notifyBarringInfo: mBarringInfo="
+ barringInfo + " r=" + r);
}
r.callback.onBarringInfoChanged(
checkFineLocationAccess(r, Build.VERSION_CODES.BASE)
? barringInfo : biNoLocation);
} catch (RemoteException ex) {
mRemoveList.add(r.binder);
}
}
}