User cannot reject a waiting call after a switch call fails
Incoming call is set to ANSWERED state if user attempts to answer,
but ANSWERED state is not reset if answer fails due to fail of switch
request.
If switch call fails, reset all ANSWERED calls back to RINGING so that
the user can attempt the operation again.
Test: Manual - Verify that incoming call can be rejected after switch
call is failed.
Bug: 143918738
Change-Id: I8f9cc677ee769f1ea261ede6595850df7de91cb9
diff --git a/src/com/android/server/telecom/Call.java b/src/com/android/server/telecom/Call.java
index e48cc84..91466b5 100644
--- a/src/com/android/server/telecom/Call.java
+++ b/src/com/android/server/telecom/Call.java
@@ -138,6 +138,7 @@
boolean onCanceledViaNewOutgoingCallBroadcast(Call call, long disconnectionTimeout);
void onHoldToneRequested(Call call);
void onCallHoldFailed(Call call);
+ void onCallSwitchFailed(Call call);
void onConnectionEvent(Call call, String event, Bundle extras);
void onExternalCallChanged(Call call, boolean isExternalCall);
void onRttInitiationFailure(Call call, int reason);
@@ -214,6 +215,8 @@
@Override
public void onCallHoldFailed(Call call) {}
@Override
+ public void onCallSwitchFailed(Call call) {}
+ @Override
public void onConnectionEvent(Call call, String event, Bundle extras) {}
@Override
public void onExternalCallChanged(Call call, boolean isExternalCall) {}
@@ -3198,6 +3201,10 @@
for (Listener l : mListeners) {
l.onCallHoldFailed(this);
}
+ } else if (Connection.EVENT_CALL_SWITCH_FAILED.equals(event)) {
+ for (Listener l : mListeners) {
+ l.onCallSwitchFailed(this);
+ }
} else {
for (Listener l : mListeners) {
l.onConnectionEvent(this, event, extras);
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index 935790c..cf922a6 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -1026,12 +1026,22 @@
@Override
public void onCallHoldFailed(Call call) {
- // Normally, we don't care whether a call hold has failed. However, if a call was held in
- // order to answer an incoming call, that incoming call needs to be brought out of the
- // ANSWERED state so that the user can try the operation again.
+ markAllAnsweredCallAsRinging(call, "hold");
+ }
+
+ @Override
+ public void onCallSwitchFailed(Call call) {
+ markAllAnsweredCallAsRinging(call, "switch");
+ }
+
+ private void markAllAnsweredCallAsRinging(Call call, String actionName) {
+ // Normally, we don't care whether a call hold or switch has failed.
+ // However, if a call was held or switched in order to answer an incoming call, that
+ // incoming call needs to be brought out of the ANSWERED state so that the user can
+ // try the operation again.
for (Call call1 : mCalls) {
if (call1 != call && call1.getState() == CallState.ANSWERED) {
- setCallState(call1, CallState.RINGING, "hold failed on other call");
+ setCallState(call1, CallState.RINGING, actionName + " failed on other call");
}
}
}