Fixed bug in CallsManager calling back would not complete
CallsManager was not handling the case where an account handle was being
passed into it. Added and refactored.
Bug: 16460877
Change-Id: Ic9715eda24443e6bd6a1991e8badc9c56af88f30
diff --git a/src/com/android/telecomm/CallsManager.java b/src/com/android/telecomm/CallsManager.java
index e41f331..dd126df 100644
--- a/src/com/android/telecomm/CallsManager.java
+++ b/src/com/android/telecomm/CallsManager.java
@@ -311,20 +311,30 @@
call.addListener(this);
addCall(call);
- if (TelephonyUtil.shouldProcessAsEmergency(TelecommApp.getInstance(), call.getHandle())) {
+ // This block of code will attempt to pre-determine a phone account
+ final boolean emergencyCall = TelephonyUtil.shouldProcessAsEmergency(
+ TelecommApp.getInstance(), call.getHandle());
+ if (emergencyCall) {
// Emergency -- CreateConnectionProcessor will choose accounts automatically
call.setPhoneAccount(null);
- call.startCreateConnection();
- } else if (accountHandle == null) {
+ } else if (accountHandle != null) {
+ call.setPhoneAccount(accountHandle);
+ } else {
+ // No preset account, check if default exists
PhoneAccountHandle defaultAccountHandle = TelecommApp.getInstance()
.getPhoneAccountRegistrar().getDefaultOutgoingPhoneAccount();
if (defaultAccountHandle != null) {
call.setPhoneAccount(defaultAccountHandle);
- call.startCreateConnection();
- } else {
- call.setState(CallState.PRE_DIAL_WAIT);
}
}
+
+ if (call.getPhoneAccount() != null || emergencyCall) {
+ // If the account is selected, proceed to place the outgoing call
+ call.startCreateConnection();
+ } else {
+ // This is the state where the user is expected to select an account
+ call.setState(CallState.PRE_DIAL_WAIT);
+ }
}
/**