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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -256,6 +264,32 @@ public abstract class CallDiagnosticService extends Service {
|
||||
diagnosticCall.onReceiveDeviceToDeviceMessage(message, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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(
|
||||
|
||||
Reference in New Issue
Block a user