Fix crash when making an outgoing call
Fix the Log.wtf exception that occurs because mPendingOutgoingCallIds
does not contain the expected callId
Change-Id: I5cf6b08a2bffd883b89791d3cca9d5fc6b2175f6
diff --git a/src/com/android/telecomm/CallServiceWrapper.java b/src/com/android/telecomm/CallServiceWrapper.java
index c4d033c..807f427 100644
--- a/src/com/android/telecomm/CallServiceWrapper.java
+++ b/src/com/android/telecomm/CallServiceWrapper.java
@@ -91,8 +91,10 @@
@Override public void onSuccess() {
if (isServiceValid("isCompatibleWith")) {
try {
+ mAdapter.addPendingOutgoingCallId(callInfo.getId());
mServiceInterface.isCompatibleWith(callInfo);
} catch (RemoteException e) {
+ mAdapter.removePendingOutgoingCallId(callInfo.getId());
Log.e(CallServiceWrapper.this, e, "Failed checking isCompatibleWith.");
}
}
@@ -119,7 +121,6 @@
if (isServiceValid("call")) {
try {
mServiceInterface.call(callInfo);
- mAdapter.addPendingOutgoingCallId(callId);
} catch (RemoteException e) {
Log.e(CallServiceWrapper.this, e, "Failed to place call %s", callId);
}
@@ -225,6 +226,15 @@
mAdapter.removePendingIncomingCallId(callId);
}
+ /**
+ * Cancels the outgoing call for the specified call ID.
+ *
+ * @param callId The ID of the call.
+ */
+ void cancelOutgoingCall(String callId) {
+ mAdapter.removePendingOutgoingCallId(callId);
+ }
+
/** {@inheritDoc} */
@Override protected void setServiceInterface(IBinder binder) {
mServiceInterface = ICallService.Stub.asInterface(binder);