diff options
author | Yorke Lee <yorkelee@google.com> | 2015-06-18 14:23:34 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-06-18 14:23:34 -0700 |
commit | f3a65b2e9bcbf162aa8a715709028b2deeb2ca09 (patch) | |
tree | e0a87299e80166880ba32251e2771022730a14aa /InCallUI | |
parent | 0c75d39e185d917f58a679f6ccca65484560dc30 (diff) |
Fix for InCallUI finishing too quickly to display error dialog
Increase the delay before disconnecting the call for
DisconnectCause.ERROR, so that the user has time to acknowledge
the error.
To avoid regressing on b/20956721, keep track of any calls
that are pending a disconnect. If the user has explicitly dismissed
the error dialog, disconnect the call immediately to avoid blocking
the UI any further.
Bug: 21436856
Change-Id: I339cdbf1ba99fda5b1f5c8c31f722c97b64f487f
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallList.java | 22 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 1 |
2 files changed, 22 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java index 5d38e2477..c0014bdfe 100644 --- a/InCallUI/src/com/android/incallui/CallList.java +++ b/InCallUI/src/com/android/incallui/CallList.java @@ -28,6 +28,7 @@ import com.google.common.collect.Maps; import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; @@ -60,6 +61,8 @@ public class CallList { new ConcurrentHashMap<Listener, Boolean>(8, 0.9f, 1)); private final HashMap<String, List<CallUpdateListener>> mCallUpdateListenerMap = Maps .newHashMap(); + private final Set<Call> mPendingDisconnectCalls = Collections.newSetFromMap( + new ConcurrentHashMap<Call, Boolean>(8, 0.9f, 1)); /** * Static singleton accessor method. @@ -391,6 +394,19 @@ public class CallList { } /** + * Called when the user has dismissed an error dialog. This indicates acknowledgement of + * the disconnect cause, and that any pending disconnects should immediately occur. + */ + public void onErrorDialogDismissed() { + final Iterator<Call> iterator = mPendingDisconnectCalls.iterator(); + while (iterator.hasNext()) { + Call call = iterator.next(); + iterator.remove(); + finishDisconnectedCall(call); + } + } + + /** * Processes an update for a single call. * * @param call The call to update. @@ -438,6 +454,7 @@ public class CallList { // Set up a timer to destroy the call after X seconds. final Message msg = mHandler.obtainMessage(EVENT_DISCONNECTED_TIMEOUT, call); mHandler.sendMessageDelayed(msg, getDelayForDisconnect(call)); + mPendingDisconnectCalls.add(call); mCallById.put(call.getId(), call); mCallByTelecommCall.put(call.getTelecommCall(), call); @@ -467,9 +484,9 @@ public class CallList { delay = DISCONNECTED_CALL_SHORT_TIMEOUT_MS; break; case DisconnectCause.REMOTE: + case DisconnectCause.ERROR: delay = DISCONNECTED_CALL_MEDIUM_TIMEOUT_MS; break; - case DisconnectCause.ERROR: case DisconnectCause.REJECTED: case DisconnectCause.MISSED: case DisconnectCause.CANCELED: @@ -505,6 +522,9 @@ public class CallList { * Sets up a call for deletion and notifies listeners of change. */ private void finishDisconnectedCall(Call call) { + if (mPendingDisconnectCalls.contains(call)) { + mPendingDisconnectCalls.remove(call); + } call.setState(Call.State.IDLE); updateCallInMap(call); notifyGenericListeners(); diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 01ddac4ec..ab7dd1b8b 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -861,6 +861,7 @@ public class InCallActivity extends Activity implements FragmentDisplayManager { private void onDialogDismissed() { mDialog = null; + CallList.getInstance().onErrorDialogDismissed(); InCallPresenter.getInstance().onDismissDialog(); } } |