Fix system service crash on radio session death. DO NOT MERGE am: 1b16c57b57

Change-Id: I41cd190455210797e2620a49fc1f655103abf95c
This commit is contained in:
Automerger Merge Worker
2019-12-21 00:56:43 +00:00

View File

@@ -233,18 +233,24 @@ class RadioModule {
}
private void fanoutAidlCallbackLocked(AidlCallbackRunnable runnable) {
List<TunerSession> deadSessions = null;
for (TunerSession tunerSession : mAidlTunerSessions) {
try {
runnable.run(tunerSession.mCallback);
} catch (DeadObjectException ex) {
// The other side died without calling close(), so just purge it from our
// records.
// The other side died without calling close(), so just purge it from our records.
Slog.e(TAG, "Removing dead TunerSession");
mAidlTunerSessions.remove(tunerSession);
if (deadSessions == null) {
deadSessions = new ArrayList<>();
}
deadSessions.add(tunerSession);
} catch (RemoteException ex) {
Slog.e(TAG, "Failed to invoke ITunerCallback: ", ex);
}
}
if (deadSessions != null) {
mAidlTunerSessions.removeAll(deadSessions);
}
}
public android.hardware.radio.ICloseHandle addAnnouncementListener(@NonNull int[] enabledTypes,