diff options
author | Tyler Gunn <tgunn@google.com> | 2021-03-15 18:28:08 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-03-15 18:28:08 +0000 |
commit | deb61608ce763f15f163226a476c33a31252ce4c (patch) | |
tree | d7ba3aaf1654f3d1c9a47f517c73a9db24314472 /telecomm/java/android/telecom/CallDiagnosticService.java | |
parent | 2cd2ed4c7b57ad4e350b71e5c2e333aabc455b44 (diff) | |
parent | bc9ecbcfbe17c62d35f1a35243aee3a3efb4cb56 (diff) |
Merge "Propagate Telephony disconnect cause to Telecom." into sc-dev
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 809f2bc1bb7d..5fb6b3381360 100644 --- a/telecomm/java/android/telecom/CallDiagnosticService.java +++ b/telecomm/java/android/telecom/CallDiagnosticService.java @@ -27,6 +27,8 @@ import android.os.Handler; import android.os.HandlerExecutor; 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; @@ -105,6 +107,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); + } } /** @@ -329,6 +337,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)}. |