Adding redialing support in CDMA
Add new REDIALING state when CallNotifier identifies the current call
as a redial attempt.
bug:10824223
Change-Id: I906a3add0bc7b9d6309434fc9e19bf12d5ccb748
diff --git a/common/src/com/android/services/telephony/common/Call.java b/common/src/com/android/services/telephony/common/Call.java
index f5cc904..4a74114 100644
--- a/common/src/com/android/services/telephony/common/Call.java
+++ b/common/src/com/android/services/telephony/common/Call.java
@@ -47,10 +47,11 @@
public static final int INCOMING = 3; /* A normal incoming phone call */
public static final int CALL_WAITING = 4; /* Incoming call while another is active */
public static final int DIALING = 5; /* An outgoing call during dial phase */
- public static final int ONHOLD = 6; /* An active phone call placed on hold */
- public static final int DISCONNECTING = 7; /* A call is being ended. */
- public static final int DISCONNECTED = 8; /* State after a call disconnects */
- public static final int CONFERENCED = 9; /* Call part of a conference call */
+ public static final int REDIALING = 6; /* Subsequent dialing attempt after a failure */
+ public static final int ONHOLD = 7; /* An active phone call placed on hold */
+ public static final int DISCONNECTING = 8; /* A call is being ended. */
+ public static final int DISCONNECTED = 9; /* State after a call disconnects */
+ public static final int CONFERENCED = 10; /* Call part of a conference call */
public static boolean isConnected(int state) {
switch(state) {
@@ -58,6 +59,7 @@
case INCOMING:
case CALL_WAITING:
case DIALING:
+ case REDIALING:
case ONHOLD:
case CONFERENCED:
return true;
@@ -65,11 +67,17 @@
}
return false;
}
+
+ public static boolean isDialing(int state) {
+ return state == DIALING || state == REDIALING;
+ }
}
/**
* Defines a set of capabilities that a call can have as a bit mask.
* TODO: Should some of these be capabilities of the Phone instead of the call?
+ * TODO: This is starting to be a mix of capabilities and call properties. Capabilities
+ * and properties should be separated.
*/
public static class Capabilities {
public static final int HOLD = 0x00000001; /* has ability to hold the call */
@@ -139,6 +147,7 @@
.put(Call.State.ACTIVE, "ACTIVE")
.put(Call.State.CALL_WAITING, "CALL_WAITING")
.put(Call.State.DIALING, "DIALING")
+ .put(Call.State.REDIALING, "REDIALING")
.put(Call.State.IDLE, "IDLE")
.put(Call.State.INCOMING, "INCOMING")
.put(Call.State.ONHOLD, "ONHOLD")
diff --git a/src/com/android/phone/CallModeler.java b/src/com/android/phone/CallModeler.java
index 02f0809..cfb5b65 100644
--- a/src/com/android/phone/CallModeler.java
+++ b/src/com/android/phone/CallModeler.java
@@ -223,6 +223,7 @@
state == Call.State.CALL_WAITING ||
state == Call.State.CONFERENCED ||
state == Call.State.DIALING ||
+ state == Call.State.REDIALING ||
state == Call.State.INCOMING ||
state == Call.State.ONHOLD ||
state == Call.State.DISCONNECTING) {
@@ -241,8 +242,7 @@
HashMap<Connection, Call> map) {
for (Call call : map.values()) {
final int state = call.getState();
- if (state == Call.State.ACTIVE ||
- state == Call.State.DIALING) {
+ if (state == Call.State.ACTIVE || Call.State.isDialing(state)) {
return true;
}
}
@@ -475,7 +475,7 @@
// for the call, if available, and set it.
final RawGatewayInfo info = mCallGatewayManager.getGatewayInfo(connection);
- if (newState == Call.State.DIALING) {
+ if (Call.State.isDialing(newState)) {
if (!info.isEmpty()) {
call.setGatewayNumber(info.getFormattedGatewayNumber());
call.setGatewayPackage(info.packageName);
@@ -690,13 +690,15 @@
private int translateStateFromTelephony(Connection connection, boolean isForConference) {
+ com.android.internal.telephony.Call.State connState = connection.getState();
+
// For the "fake" outgoing CDMA call, we need to always treat it as an outgoing call.
if (mCdmaOutgoingConnection == connection) {
- return State.DIALING;
+ connState = com.android.internal.telephony.Call.State.DIALING;
}
int retval = State.IDLE;
- switch (connection.getState()) {
+ switch (connState) {
case ACTIVE:
retval = State.ACTIVE;
break;
@@ -705,7 +707,11 @@
break;
case DIALING:
case ALERTING:
- retval = State.DIALING;
+ if (PhoneGlobals.getInstance().notifier.getIsCdmaRedialCall()) {
+ retval = State.REDIALING;
+ } else {
+ retval = State.DIALING;
+ }
break;
case WAITING:
retval = State.CALL_WAITING;
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 9655371..bf0897b 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -1097,8 +1097,11 @@
if (autoretrySetting == InCallScreen.AUTO_RETRY_ON) {
// TODO: (Moto): The contact reference data may need to be stored and use
// here when redialing a call. For now, pass in NULL as the URI parameter.
- PhoneUtils.placeCall(mApplication, phone, number, null, false);
- mIsCdmaRedialCall = true;
+ final int status =
+ PhoneUtils.placeCall(mApplication, phone, number, null, false);
+ if (status != PhoneUtils.CALL_STATUS_FAILED) {
+ mIsCdmaRedialCall = true;
+ }
} else {
mIsCdmaRedialCall = false;
}