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

Commit 0a1c6d1b authored by Tyler Gunn's avatar Tyler Gunn
Browse files

Propagate call quality reports from Telephony to CallDiagnosticService.

Complete plumbing for call quality reports to get to the CDS.

Test: Manual network testing.
Test: Modify CTS tests to cover these cases.
Bug: 163085177
Change-Id: I2bb68d29c4ad11cc8738c26cd69404fde4348843
parent 45abbc30
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.IBinder;
import android.os.RemoteException;

import android.telephony.CallQuality;
import android.util.ArrayMap;

import com.android.internal.telecom.ICallDiagnosticService;
@@ -111,6 +113,12 @@ public abstract class CallDiagnosticService extends Service {
                @NonNull DisconnectCause disconnectCause) throws RemoteException {
            handleCallDisconnected(callId, disconnectCause);
        }

        @Override
        public void callQualityChanged(String callId, CallQuality callQuality)
                throws RemoteException {
            handleCallQualityChanged(callId, callQuality);
        }
    }

    /**
@@ -374,6 +382,21 @@ public abstract class CallDiagnosticService extends Service {
        getExecutor().execute(() -> onBluetoothCallQualityReportReceived(qualityReport));
    }

    /**
     * Handles a change reported by Telecom to the call quality for a call.
     * @param callId the call ID the change applies to.
     * @param callQuality The new call quality.
     */
    private void handleCallQualityChanged(@NonNull String callId,
            @NonNull CallQuality callQuality) {
        Log.i(this, "handleCallQualityChanged; call=%s, cq=%s", callId, callQuality);
        CallDiagnostics callDiagnostics;
        callDiagnostics = mDiagnosticCallByTelecomCallId.get(callId);
        if (callDiagnostics != null) {
            callDiagnostics.onCallQualityReceived(callQuality);
        }
    }

    /**
     * Handles a request from a {@link CallDiagnostics} to send a device to device message (received
     * via {@link CallDiagnostics#sendDeviceToDeviceMessage(int, int)}.
+18 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;
import android.telephony.CallQuality;
import android.telephony.ims.ImsStreamMediaProfile;
import android.util.ArraySet;
import android.view.Surface;
@@ -978,6 +979,23 @@ public abstract class Connection extends Conferenceable {
    public static final String EXTRA_DEVICE_TO_DEVICE_MESSAGE_VALUE =
            "android.telecom.extra.DEVICE_TO_DEVICE_MESSAGE_VALUE";

    /**
     * Connection event used to communicate a {@link android.telephony.CallQuality} report from
     * telephony to Telecom for relaying to
     * {@link DiagnosticCall#onCallQualityReceived(CallQuality)}.
     * @hide
     */
    public static final String EVENT_CALL_QUALITY_REPORT =
            "android.telecom.event.CALL_QUALITY_REPORT";

    /**
     * Extra sent with {@link #EVENT_CALL_QUALITY_REPORT} containing the
     * {@link android.telephony.CallQuality} data.
     * @hide
     */
    public static final String EXTRA_CALL_QUALITY_REPORT =
            "android.telecom.extra.CALL_QUALITY_REPORT";

    // Flag controlling whether PII is emitted into the logs
    private static final boolean PII_DEBUG = Log.isLoggable(android.util.Log.DEBUG);

+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.telecom.BluetoothCallQualityReport;
import android.telecom.CallAudioState;
import android.telecom.DisconnectCause;
import android.telecom.ParcelableCall;
import android.telephony.CallQuality;
import com.android.internal.telecom.ICallDiagnosticServiceAdapter;

/**
@@ -34,6 +35,7 @@ oneway interface ICallDiagnosticService {
    void updateCallAudioState(in CallAudioState callAudioState);
    void removeDiagnosticCall(in String callId);
    void receiveDeviceToDeviceMessage(in String callId, int message, int value);
    void callQualityChanged(in String callId, in CallQuality callQuality);
    void receiveBluetoothCallQualityReport(in BluetoothCallQualityReport qualityReport);
    void notifyCallDisconnected(in String callId, in DisconnectCause disconnectCause);
}