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

Commit 5d6650dd authored by Grace Jia's avatar Grace Jia Committed by Android (Google) Code Review
Browse files

Merge "Synchronize onMultiSimConfigChanged with callback registrations." into tm-dev

parents 4684f7f9 869dc9cb
Loading
Loading
Loading
Loading
+101 −97
Original line number Diff line number Diff line
@@ -651,6 +651,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
    }

    private void onMultiSimConfigChanged() {
        synchronized (mRecords) {
            int oldNumPhones = mNumPhones;
            mNumPhones = getTelephonyManager().getActiveModemCount();
            if (oldNumPhones == mNumPhones) return;
@@ -747,6 +748,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                mCarrierPrivilegeStates.add(i, new Pair<>(Collections.emptyList(), new int[0]));
            }
        }
    }

    private void cutListToSize(List list, int size) {
        if (list == null) return;
@@ -2802,11 +2804,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                            + " callback=" + callback
                            + " callback.asBinder=" + callback.asBinder());
        }

        synchronized (mRecords) {
            if (!validatePhoneId(phoneId)) {
                throw new IllegalArgumentException("Invalid slot index: " + phoneId);
            }

        synchronized (mRecords) {
            Record r = add(
                    callback.asBinder(), Binder.getCallingUid(), Binder.getCallingPid(), false);

@@ -2851,7 +2853,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (!checkNotifyPermission("notifyCarrierPrivilegesChanged")) {
            return;
        }
        if (!validatePhoneId(phoneId)) return;
        if (VDBG) {
            log(
                    "notifyCarrierPrivilegesChanged: phoneId=" + phoneId
@@ -2859,6 +2860,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                            + ", uids=" + Arrays.toString(privilegedUids) + ">");
        }
        synchronized (mRecords) {
            if (!validatePhoneId(phoneId)) {
                throw new IllegalArgumentException("Invalid slot index: " + phoneId);
            }
            mCarrierPrivilegeStates.set(
                    phoneId, new Pair<>(privilegedPackageNames, privilegedUids));
            for (Record r : mRecords) {