Add code to show a message when a conference merge fails.
Right now the plumbing only exists for VoLTE conference calls
and GSM/CDMA calls behave as they did before. While making
this change, it made a lot of sense to rename CdmaDisplayInfo
to PhoneDisplayMessage.
Bug: 18080792
Change-Id: If8c8cf9a234371bdb2798c9d1e80d56b3aaf84f8
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index f22913c..bc13010 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -65,8 +65,8 @@
(PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
private static final boolean VDBG = (PhoneGlobals.DBG_LEVEL >= 2);
- // Time to display the DisplayInfo Record sent by CDMA network
- private static final int DISPLAYINFO_NOTIFICATION_TIME = 2000; // msec
+ // Time to display the message from the underlying phone layers.
+ private static final int SHOW_MESSAGE_NOTIFICATION_TIME = 3000; // msec
private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SPEECH)
@@ -86,12 +86,6 @@
// object used to synchronize access to mCallerInfoQueryState
private Object mCallerInfoQueryStateGuard = new Object();
- // Events generated internally:
- private static final int PHONE_MWI_CHANGED = 21;
- private static final int DISPLAYINFO_NOTIFICATION_DONE = 24;
- private static final int UPDATE_IN_CALL_NOTIFICATION = 27;
-
-
private PhoneGlobals mApplication;
private CallManager mCM;
private BluetoothHeadset mBluetoothHeadset;
@@ -197,7 +191,7 @@
onUnknownConnectionAppeared((AsyncResult) msg.obj);
break;
- case PHONE_MWI_CHANGED:
+ case CallStateMonitor.INTERNAL_PHONE_MWI_CHANGED:
onMwiChanged(mApplication.phone.getMessageWaitingIndicator());
break;
@@ -211,9 +205,9 @@
onSignalInfo((AsyncResult) msg.obj);
break;
- case DISPLAYINFO_NOTIFICATION_DONE:
+ case CallStateMonitor.INTERNAL_SHOW_MESSAGE_NOTIFICATION_DONE:
if (DBG) log("Received Display Info notification done event ...");
- CdmaDisplayInfo.dismissDisplayInfoRecord();
+ PhoneDisplayMessage.dismissMessage();
break;
case CallStateMonitor.EVENT_OTA_PROVISION_CHANGE:
@@ -239,6 +233,11 @@
}
break;
+ case CallStateMonitor.PHONE_SUPP_SERVICE_FAILED:
+ if (DBG) log("PHONE_SUPP_SERVICE_FAILED...");
+ onSuppServiceFailed((AsyncResult) msg.obj);
+ break;
+
default:
// super.handleMessage(msg);
}
@@ -485,7 +484,8 @@
}
int autoretrySetting = 0;
- if ((c != null) && (c.getCall().getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)) {
+ if ((c != null) &&
+ (c.getCall().getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)) {
autoretrySetting = android.provider.Settings.Global.getInt(mApplication.
getContentResolver(),android.provider.Settings.Global.CALL_AUTO_RETRY, 0);
}
@@ -493,7 +493,8 @@
// Stop any signalInfo tone being played when a call gets ended
stopSignalInfoTone();
- if ((c != null) && (c.getCall().getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)) {
+ if ((c != null) &&
+ (c.getCall().getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)) {
// Resetting the CdmaPhoneCallState members
mApplication.cdmaPhoneCallState.resetCdmaPhoneCallState();
}
@@ -632,7 +633,7 @@
* failed NotificationMgr.updateMwi() call.
*/
/* package */ void sendMwiChangedDelayed(long delayMillis) {
- Message message = Message.obtain(this, PHONE_MWI_CHANGED);
+ Message message = Message.obtain(this, CallStateMonitor.INTERNAL_PHONE_MWI_CHANGED);
sendMessageDelayed(message, delayMillis);
}
@@ -916,15 +917,37 @@
if (displayInfoRec != null) {
String displayInfo = displayInfoRec.alpha;
if (DBG) log("onDisplayInfo: displayInfo=" + displayInfo);
- CdmaDisplayInfo.displayInfoRecord(mApplication, displayInfo);
+ PhoneDisplayMessage.displayNetworkMessage(mApplication, displayInfo);
- // start a 2 second timer
- sendEmptyMessageDelayed(DISPLAYINFO_NOTIFICATION_DONE,
- DISPLAYINFO_NOTIFICATION_TIME);
+ // start a timer that kills the dialog
+ sendEmptyMessageDelayed(CallStateMonitor.INTERNAL_SHOW_MESSAGE_NOTIFICATION_DONE,
+ SHOW_MESSAGE_NOTIFICATION_TIME);
}
}
/**
+ * Displays a notification when the phone receives a notice that a supplemental
+ * service has failed.
+ * TODO: This is a NOOP if it isn't for conferences right now.
+ */
+ private void onSuppServiceFailed(AsyncResult r) {
+ if (r.result != Phone.SuppService.CONFERENCE) {
+ if (DBG) log("onSuppServiceFailed: not a merge failure event");
+ return;
+ }
+
+ if (DBG) log("onSuppServiceFailed: displaying merge failure message");
+
+ String mergeFailedString = mApplication.getResources().getString(
+ R.string.incall_error_supp_service_conference);
+ PhoneDisplayMessage.displayErrorMessage(mApplication, mergeFailedString);
+
+ // start a timer that kills the dialog
+ sendEmptyMessageDelayed(CallStateMonitor.INTERNAL_SHOW_MESSAGE_NOTIFICATION_DONE,
+ SHOW_MESSAGE_NOTIFICATION_TIME);
+ }
+
+ /**
* Helper class to play SignalInfo tones using the ToneGenerator.
*
* To use, just instantiate a new SignalInfoTonePlayer