Merge "Fix race condition when TelephonyRegistry handles multi-SIM config change" am: 19e53cfdc8
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2107190 Change-Id: I53d63a247cb99e020ff6f6555aa026dd538a149b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
4ce464c70b
@ -2808,6 +2808,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
throw new IllegalArgumentException("Invalid slot index: " + phoneId);
|
||||
}
|
||||
|
||||
// In case this is triggered from the caller who has handled multiple SIM config change
|
||||
// firstly, we need to update the status (mNumPhone and mCarrierPrivilegeStates) firstly.
|
||||
// This is almost a no-op if there is no multiple SIM config change in advance.
|
||||
onMultiSimConfigChanged();
|
||||
|
||||
synchronized (mRecords) {
|
||||
Record r = add(
|
||||
callback.asBinder(), Binder.getCallingUid(), Binder.getCallingPid(), false);
|
||||
@ -2868,6 +2873,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
+ ", <packages=" + pii(privilegedPackageNames)
|
||||
+ ", uids=" + Arrays.toString(privilegedUids) + ">");
|
||||
}
|
||||
|
||||
// In case this is triggered from the caller who has handled multiple SIM config change
|
||||
// firstly, we need to update the status (mNumPhone and mCarrierPrivilegeStates) firstly.
|
||||
// This is almost a no-op if there is no multiple SIM config change in advance.
|
||||
onMultiSimConfigChanged();
|
||||
|
||||
synchronized (mRecords) {
|
||||
mCarrierPrivilegeStates.set(
|
||||
phoneId, new Pair<>(privilegedPackageNames, privilegedUids));
|
||||
@ -2900,6 +2911,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
+ ", package=" + pii(packageName) + ", uid=" + uid);
|
||||
}
|
||||
|
||||
// In case this is triggered from the caller who has handled multiple SIM config change
|
||||
// firstly, we need to update the status (mNumPhone and mCarrierServiceStates) firstly.
|
||||
// This is almost a no-op if there is no multiple SIM config change in advance.
|
||||
onMultiSimConfigChanged();
|
||||
|
||||
synchronized (mRecords) {
|
||||
mCarrierServiceStates.set(
|
||||
phoneId, new Pair<>(packageName, uid));
|
||||
@ -3364,7 +3380,8 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
|
||||
private boolean validatePhoneId(int phoneId) {
|
||||
boolean valid = (phoneId >= 0) && (phoneId < mNumPhones);
|
||||
// Call getActiveModemCount to get the latest value instead of depending on mNumPhone
|
||||
boolean valid = (phoneId >= 0) && (phoneId < getTelephonyManager().getActiveModemCount());
|
||||
if (VDBG) log("validatePhoneId: " + valid);
|
||||
return valid;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user