diff options
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)}. |