summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorAnders Kristensen <andersk@google.com>2014-03-28 17:30:10 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-03-28 17:30:11 +0000
commita3170fa2e80cd35d1677930d667d518d5d258c7a (patch)
tree3e0a16fddc09f50c855b16ca082a458d0defeecc /InCallUI
parent3ce49172bf45607990d1e791e99fcd5670c6b217 (diff)
parent479c50f6d4fac0fa44210c9bad4346f64dba3f1e (diff)
Merge "Remove duplicate call disconnect codes."
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java43
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java5
-rw-r--r--InCallUI/src/com/android/incallui/CallList.java11
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java18
4 files changed, 43 insertions, 34 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 0d26b82cc..9b452cd98 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -22,6 +22,7 @@ import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.telephony.DisconnectCause;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -233,7 +234,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
}
@Override
- public void setCallState(int state, Call.DisconnectCause cause, boolean bluetoothOn,
+ public void setCallState(int state, int cause, boolean bluetoothOn,
String gatewayLabel, String gatewayNumber) {
String callStateLabel = null;
@@ -241,7 +242,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
callStateLabel = getCallStateLabelFromState(state, cause);
Log.v(this, "setCallState " + callStateLabel);
- Log.v(this, "DisconnectCause " + cause);
+ Log.v(this, "DisconnectCause " + DisconnectCause.toString(cause));
Log.v(this, "bluetooth on " + bluetoothOn);
Log.v(this, "gateway " + gatewayLabel + gatewayNumber);
@@ -360,7 +361,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
* Gets the call state label based on the state of the call and
* cause of disconnect
*/
- private String getCallStateLabelFromState(int state, Call.DisconnectCause cause) {
+ private String getCallStateLabelFromState(int state, int cause) {
final Context context = getView().getContext();
String callStateLabel = null; // Label to display as part of the call banner
@@ -401,8 +402,10 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
/**
* Maps the disconnect cause to a resource string.
+ *
+ * @param cause disconnect cause as defined in {@link DisconnectCause}
*/
- private String getCallFailedString(Call.DisconnectCause cause) {
+ private String getCallFailedString(int cause) {
int resID = R.string.card_title_call_ended;
// TODO: The card *title* should probably be "Call ended" in all
@@ -410,61 +413,61 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
// probably also display the specific failure reason somewhere...
switch (cause) {
- case BUSY:
+ case DisconnectCause.BUSY:
resID = R.string.callFailed_userBusy;
break;
- case CONGESTION:
+ case DisconnectCause.CONGESTION:
resID = R.string.callFailed_congestion;
break;
- case TIMED_OUT:
+ case DisconnectCause.TIMED_OUT:
resID = R.string.callFailed_timedOut;
break;
- case SERVER_UNREACHABLE:
+ case DisconnectCause.SERVER_UNREACHABLE:
resID = R.string.callFailed_server_unreachable;
break;
- case NUMBER_UNREACHABLE:
+ case DisconnectCause.NUMBER_UNREACHABLE:
resID = R.string.callFailed_number_unreachable;
break;
- case INVALID_CREDENTIALS:
+ case DisconnectCause.INVALID_CREDENTIALS:
resID = R.string.callFailed_invalid_credentials;
break;
- case SERVER_ERROR:
+ case DisconnectCause.SERVER_ERROR:
resID = R.string.callFailed_server_error;
break;
- case OUT_OF_NETWORK:
+ case DisconnectCause.OUT_OF_NETWORK:
resID = R.string.callFailed_out_of_network;
break;
- case LOST_SIGNAL:
- case CDMA_DROP:
+ case DisconnectCause.LOST_SIGNAL:
+ case DisconnectCause.CDMA_DROP:
resID = R.string.callFailed_noSignal;
break;
- case LIMIT_EXCEEDED:
+ case DisconnectCause.LIMIT_EXCEEDED:
resID = R.string.callFailed_limitExceeded;
break;
- case POWER_OFF:
+ case DisconnectCause.POWER_OFF:
resID = R.string.callFailed_powerOff;
break;
- case ICC_ERROR:
+ case DisconnectCause.ICC_ERROR:
resID = R.string.callFailed_simError;
break;
- case OUT_OF_SERVICE:
+ case DisconnectCause.OUT_OF_SERVICE:
resID = R.string.callFailed_outOfService;
break;
- case INVALID_NUMBER:
- case UNOBTAINABLE_NUMBER:
+ case DisconnectCause.INVALID_NUMBER:
+ case DisconnectCause.UNOBTAINABLE_NUMBER:
resID = R.string.callFailed_unobtainable_number;
break;
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 949d71891..4e9fe9659 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -21,6 +21,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.graphics.Bitmap;
+import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.text.format.DateUtils;
@@ -191,7 +192,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
ui.setCallState(mPrimary.getState(), mPrimary.getDisconnectCause(), bluetoothOn,
getGatewayLabel(), getGatewayNumber());
} else {
- ui.setCallState(Call.State.IDLE, Call.DisconnectCause.UNKNOWN, false, null, null);
+ ui.setCallState(Call.State.IDLE, DisconnectCause.NOT_VALID, false, null, null);
}
}
@@ -462,7 +463,7 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
void setSecondary(boolean show, String name, boolean nameIsNumber, String label,
Drawable photo, boolean isConference, boolean isGeneric);
void setSecondaryImage(Drawable image);
- void setCallState(int state, Call.DisconnectCause cause, boolean bluetoothOn,
+ void setCallState(int state, int cause, boolean bluetoothOn,
String gatewayLabel, String gatewayNumber);
void setPrimaryCallElapsedTime(boolean show, String duration);
void setPrimaryName(String name, boolean nameIsNumber);
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java
index ba123b0c1..4c43db7bb 100644
--- a/InCallUI/src/com/android/incallui/CallList.java
+++ b/InCallUI/src/com/android/incallui/CallList.java
@@ -23,6 +23,7 @@ import com.google.common.base.Preconditions;
import android.os.Handler;
import android.os.Message;
+import android.telephony.DisconnectCause;
import com.android.services.telephony.common.Call;
@@ -373,17 +374,17 @@ public class CallList {
Preconditions.checkState(call.getState() == Call.State.DISCONNECTED);
- final Call.DisconnectCause cause = call.getDisconnectCause();
+ final int cause = call.getDisconnectCause();
final int delay;
switch (cause) {
- case LOCAL:
+ case DisconnectCause.LOCAL:
delay = DISCONNECTED_CALL_SHORT_TIMEOUT_MS;
break;
- case NORMAL:
+ case DisconnectCause.NORMAL:
delay = DISCONNECTED_CALL_MEDIUM_TIMEOUT_MS;
break;
- case INCOMING_REJECTED:
- case INCOMING_MISSED:
+ case DisconnectCause.INCOMING_REJECTED:
+ case DisconnectCause.INCOMING_MISSED:
// no delay for missed/rejected incoming calls
delay = 0;
break;
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java
index 08a8f12d0..aa4a715ad 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -27,6 +27,7 @@ import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
+import android.telephony.DisconnectCause;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
@@ -432,7 +433,10 @@ public class InCallActivity extends Activity {
return super.dispatchPopulateAccessibilityEvent(event);
}
- public void maybeShowErrorDialogOnDisconnect(Call.DisconnectCause cause) {
+ /**
+ * @param cause disconnect cause as defined in {@link DisconnectCause}
+ */
+ public void maybeShowErrorDialogOnDisconnect(int cause) {
Log.d(this, "maybeShowErrorDialogOnDisconnect");
if (!isFinishing()) {
@@ -478,18 +482,18 @@ public class InCallActivity extends Activity {
mDialog.show();
}
- private int getResIdForDisconnectCause(Call.DisconnectCause cause) {
+ private int getResIdForDisconnectCause(int cause) {
int resId = INVALID_RES_ID;
- if (cause == Call.DisconnectCause.CALL_BARRED) {
+ if (cause == DisconnectCause.CALL_BARRED) {
resId = R.string.callFailed_cb_enabled;
- } else if (cause == Call.DisconnectCause.FDN_BLOCKED) {
+ } else if (cause == DisconnectCause.FDN_BLOCKED) {
resId = R.string.callFailed_fdn_only;
- } else if (cause == Call.DisconnectCause.CS_RESTRICTED) {
+ } else if (cause == DisconnectCause.CS_RESTRICTED) {
resId = R.string.callFailed_dsac_restricted;
- } else if (cause == Call.DisconnectCause.CS_RESTRICTED_EMERGENCY) {
+ } else if (cause == DisconnectCause.CS_RESTRICTED_EMERGENCY) {
resId = R.string.callFailed_dsac_restricted_emergency;
- } else if (cause == Call.DisconnectCause.CS_RESTRICTED_NORMAL) {
+ } else if (cause == DisconnectCause.CS_RESTRICTED_NORMAL) {
resId = R.string.callFailed_dsac_restricted_normal;
}