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

Commit aeefddb0 authored by Tyler Gunn's avatar Tyler Gunn Committed by Automerger Merge Worker
Browse files

Merge "Fix potential exceptions in CallDiagnosticService and missing locks."...

Merge "Fix potential exceptions in CallDiagnosticService and missing locks." into sc-dev am: 4fab561f am: bc0014b0

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

Change-Id: I718666b0159f007d557cb9dd0409f5785d5d95a3
parents b8521c3f bc0014b0
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -294,6 +294,10 @@ public abstract class CallDiagnosticService extends Service {
        CallDiagnostics callDiagnostics;
        synchronized (mLock) {
            callDiagnostics = mDiagnosticCallByTelecomCallId.get(telecomCallId);
            if (callDiagnostics == null) {
                // Possible to get a call update after a call is removed.
                return;
            }
            mCallByTelecomCallId.put(telecomCallId, newCallDetails);
        }
        getExecutor().execute(() -> callDiagnostics.handleCallUpdated(newCallDetails));
@@ -306,12 +310,12 @@ public abstract class CallDiagnosticService extends Service {
    private void handleCallRemoved(@NonNull String telecomCallId) {
        Log.i(this, "handleCallRemoved: callId=%s - removed", telecomCallId);

        CallDiagnostics callDiagnostics;
        synchronized (mLock) {
            if (mCallByTelecomCallId.containsKey(telecomCallId)) {
                mCallByTelecomCallId.remove(telecomCallId);
            }

        CallDiagnostics callDiagnostics;
        synchronized (mLock) {
            if (mDiagnosticCallByTelecomCallId.containsKey(telecomCallId)) {
                callDiagnostics = mDiagnosticCallByTelecomCallId.remove(telecomCallId);
            } else {
@@ -353,7 +357,10 @@ public abstract class CallDiagnosticService extends Service {
    private void handleCallDisconnected(@NonNull String callId,
            @NonNull DisconnectCause disconnectCause) {
        Log.i(this, "handleCallDisconnected: call=%s; cause=%s", callId, disconnectCause);
        CallDiagnostics callDiagnostics = mDiagnosticCallByTelecomCallId.get(callId);
        CallDiagnostics callDiagnostics;
        synchronized (mLock) {
            callDiagnostics = mDiagnosticCallByTelecomCallId.get(callId);
        }
        CharSequence message;
        if (disconnectCause.getImsReasonInfo() != null) {
            message = callDiagnostics.onCallDisconnected(disconnectCause.getImsReasonInfo());
@@ -391,7 +398,9 @@ public abstract class CallDiagnosticService extends Service {
            @NonNull CallQuality callQuality) {
        Log.i(this, "handleCallQualityChanged; call=%s, cq=%s", callId, callQuality);
        CallDiagnostics callDiagnostics;
        synchronized(mLock) {
            callDiagnostics = mDiagnosticCallByTelecomCallId.get(callId);
        }
        if (callDiagnostics != null) {
            callDiagnostics.onCallQualityReceived(callQuality);
        }