diff options
author | Tyler Gunn <tgunn@google.com> | 2021-03-09 15:06:30 -0800 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2021-03-10 19:02:38 -0800 |
commit | bc9ecbcfbe17c62d35f1a35243aee3a3efb4cb56 (patch) | |
tree | 88c2bd116183f33cc91bd4a9f6c2bb4b38ad15b6 /telecomm/java/android/telecom/CallDiagnosticService.java | |
parent | 4e9240747944659c4c9b704db15966771e9d35f8 (diff) |
Propagate Telephony disconnect cause to Telecom.
Propagate telephony disconnect causes and imsreasoninfo to Telecom for
propagation to CAllDiagnosticService.
Plumb through disconnect message override in CallDiagnosticService.
Test: Added new CTS test coverage for these APIs.
Test: Manual test with telecom test app; verify the disconnect message is
overridden.
Bug: 163085177
Change-Id: I0c6938f2d0a46d535ae201364193ef58e07ec488
Diffstat (limited to 'telecomm/java/android/telecom/CallDiagnosticService.java')
-rw-r--r-- | telecomm/java/android/telecom/CallDiagnosticService.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/CallDiagnosticService.java b/telecomm/java/android/telecom/CallDiagnosticService.java index 201c5db74e16..a5f77290e2b4 100644 --- a/telecomm/java/android/telecom/CallDiagnosticService.java +++ b/telecomm/java/android/telecom/CallDiagnosticService.java @@ -24,6 +24,8 @@ import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.os.RemoteException; +import android.telephony.Annotation; +import android.telephony.ims.ImsReasonInfo; import android.util.ArrayMap; import com.android.internal.telecom.ICallDiagnosticService; @@ -96,6 +98,12 @@ public abstract class CallDiagnosticService extends Service { throws RemoteException { handleBluetoothCallQualityReport(qualityReport); } + + @Override + public void notifyCallDisconnected(@NonNull String callId, + @NonNull DisconnectCause disconnectCause) throws RemoteException { + handleCallDisconnected(callId, disconnectCause); + } } /** @@ -257,6 +265,32 @@ public abstract class CallDiagnosticService extends Service { } /** + * Handles a request from the Telecom framework to get a disconnect message from the + * {@link CallDiagnosticService}. + * @param callId The ID of the call. + * @param disconnectCause The telecom disconnect cause. + */ + private void handleCallDisconnected(@NonNull String callId, + @NonNull DisconnectCause disconnectCause) { + Log.i(this, "handleCallDisconnected: call=%s; cause=%s", callId, disconnectCause); + DiagnosticCall diagnosticCall = mDiagnosticCallByTelecomCallId.get(callId); + CharSequence message; + if (disconnectCause.getImsReasonInfo() != null) { + message = diagnosticCall.onCallDisconnected(disconnectCause.getImsReasonInfo()); + } else { + message = diagnosticCall.onCallDisconnected( + disconnectCause.getTelephonyDisconnectCause(), + disconnectCause.getTelephonyPreciseDisconnectCause()); + } + try { + mAdapter.overrideDisconnectMessage(callId, message); + } catch (RemoteException e) { + Log.w(this, "handleCallDisconnected: call=%s; cause=%s; %s", + callId, disconnectCause, e); + } + } + + /** * Handles an incoming bluetooth call quality report from Telecom. Notifies via * {@link CallDiagnosticService#onBluetoothCallQualityReportReceived( * BluetoothCallQualityReport)}. |