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

Commit 8a380d1b authored by Robert Greenwalt's avatar Robert Greenwalt Committed by Android (Google) Code Review
Browse files

Merge "Don't modify a list while iterating."

parents a7212f55 1d15dd7d
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -233,6 +233,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (!checkNotifyPermission("notifyCallState()")) {
            return;
        }
        ArrayList<IBinder> removeList = new ArrayList<IBinder>();
        synchronized (mRecords) {
            mCallState = state;
            mCallIncomingNumber = incomingNumber;
@@ -241,10 +242,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    try {
                        r.callback.onCallStateChanged(state, incomingNumber);
                    } catch (RemoteException ex) {
                        remove(r.binder);
                        removeList.add(r.binder);
                    }
                }
            }
            for (IBinder b : removeList) remove(b);
        }
        broadcastCallStateChanged(state, incomingNumber);
    }
@@ -268,6 +270,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (!checkNotifyPermission("notifySignalStrength()")) {
            return;
        }
        ArrayList<IBinder> removeList = new ArrayList<IBinder>();
        synchronized (mRecords) {
            mSignalStrength = signalStrength;
            for (Record r : mRecords) {
@@ -280,10 +283,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                        r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
                                : gsmSignalStrength));
                    } catch (RemoteException ex) {
                        remove(r.binder);
                        removeList.add(r.binder);
                    }
                }
            }
            for (IBinder b : removeList) remove(b);
        }
        broadcastSignalStrengthChanged(signalStrength);
    }
@@ -292,6 +296,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (!checkNotifyPermission("notifyMessageWaitingChanged()")) {
            return;
        }
        ArrayList<IBinder> removeList = new ArrayList<IBinder>();
        synchronized (mRecords) {
            mMessageWaiting = mwi;
            for (Record r : mRecords) {
@@ -299,10 +304,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    try {
                        r.callback.onMessageWaitingIndicatorChanged(mwi);
                    } catch (RemoteException ex) {
                        remove(r.binder);
                        removeList.add(r.binder);
                    }
                }
            }
            for (IBinder b : removeList) remove(b);
        }
    }

@@ -310,6 +316,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (!checkNotifyPermission("notifyCallForwardingChanged()")) {
            return;
        }
        ArrayList<IBinder> removeList = new ArrayList<IBinder>();
        synchronized (mRecords) {
            mCallForwarding = cfi;
            for (Record r : mRecords) {
@@ -317,10 +324,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    try {
                        r.callback.onCallForwardingIndicatorChanged(cfi);
                    } catch (RemoteException ex) {
                        remove(r.binder);
                        removeList.add(r.binder);
                    }
                }
            }
            for (IBinder b : removeList) remove(b);
        }
    }

@@ -328,6 +336,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
        if (!checkNotifyPermission("notifyDataActivity()" )) {
            return;
        }
        ArrayList<IBinder> removeList = new ArrayList<IBinder>();
        synchronized (mRecords) {
            mDataActivity = state;
            for (Record r : mRecords) {
@@ -335,10 +344,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    try {
                        r.callback.onDataActivity(state);
                    } catch (RemoteException ex) {
                        remove(r.binder);
                        removeList.add(r.binder);
                    }
                }
            }
            for (IBinder b : removeList) remove(b);
        }
    }

@@ -376,15 +386,17 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
                modified = true;
            }
            if (modified) {
                ArrayList<IBinder> removeList = new ArrayList<IBinder>();
                for (Record r : mRecords) {
                    if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
                        try {
                            r.callback.onDataConnectionStateChanged(state, networkType);
                        } catch (RemoteException ex) {
                            remove(r.binder);
                            removeList.add(r.binder);
                        }
                    }
                }
                for (IBinder b : removeList) remove(b);
            }
        }
        broadcastDataConnectionStateChanged(state, isDataConnectivityPossible, reason, apn,