am c0b41cd2: am cadeba01: Merge "Add code to show a message when a conference merge fails." into lmp-mr1-dev
* commit 'c0b41cd25450f7b705d562dfb704bb680696afe7':
Add code to show a message when a conference merge fails.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 23f44e3..f7cb850 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -968,7 +968,7 @@
<!-- In-call screen: message displayed in an error dialog -->
<string name="incall_error_supp_service_transfer">Can\'t transfer.</string>
<!-- In-call screen: message displayed in an error dialog -->
- <string name="incall_error_supp_service_conference">Can\'t conference.</string>
+ <string name="incall_error_supp_service_conference">Unable to conference calls.</string>
<!-- In-call screen: message displayed in an error dialog -->
<string name="incall_error_supp_service_reject">Can\'t reject call.</string>
<!-- In-call screen: message displayed in an error dialog -->
@@ -1066,7 +1066,9 @@
</string-array>
<!-- Title for the dialog used to display CDMA DisplayInfo -->
- <string name="network_message">Network message</string>
+ <string name="network_info_message">Network message</string>
+ <!-- Title for the dialog used to display a network error message to the user -->
+ <string name="network_error_message">Error message</string>
<!-- OTA-specific strings -->
<!-- Title shown on OTA screen -->
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
diff --git a/src/com/android/phone/CallStateMonitor.java b/src/com/android/phone/CallStateMonitor.java
index eda45b9..9b8a653 100644
--- a/src/com/android/phone/CallStateMonitor.java
+++ b/src/com/android/phone/CallStateMonitor.java
@@ -56,6 +56,13 @@
public static final int PHONE_RINGBACK_TONE = 11;
public static final int PHONE_RESEND_MUTE = 12;
public static final int PHONE_ON_DIAL_CHARS = 13;
+ public static final int PHONE_SUPP_SERVICE_FAILED = 14;
+ // Events generated internally.
+ // We should store all the possible event type values in one place to make sure that
+ // they don't step on each others' toes.
+ public static final int INTERNAL_PHONE_MWI_CHANGED = 21;
+ public static final int INTERNAL_SHOW_MESSAGE_NOTIFICATION_DONE = 22;
+ public static final int INTERNAL_UPDATE_IN_CALL_NOTIFICATION = 23;
// Other events from call manager
public static final int EVENT_OTA_PROVISION_CHANGE = 20;
@@ -89,6 +96,7 @@
callManager.registerForSignalInfo(this, PHONE_STATE_SIGNALINFO, null);
callManager.registerForInCallVoicePrivacyOn(this, PHONE_ENHANCED_VP_ON, null);
callManager.registerForInCallVoicePrivacyOff(this, PHONE_ENHANCED_VP_OFF, null);
+ callManager.registerForSuppServiceFailed(this, PHONE_SUPP_SERVICE_FAILED, null);
//callManager.registerForRingbackTone(this, PHONE_RINGBACK_TONE, null);
//callManager.registerForResendIncallMute(this, PHONE_RESEND_MUTE, null);
//callManager.registerForPostDialCharacter(this, PHONE_ON_DIAL_CHARS, null);
@@ -136,6 +144,7 @@
callManager.unregisterForInCallVoicePrivacyOn(this);
callManager.unregisterForInCallVoicePrivacyOff(this);
//callManager.unregisterForPostDialCharacter(this);
+ callManager.unregisterForSuppServiceFailed(this);
registerForNotifications();
}
diff --git a/src/com/android/phone/CdmaDisplayInfo.java b/src/com/android/phone/CdmaDisplayInfo.java
deleted file mode 100644
index 1a88333..0000000
--- a/src/com/android/phone/CdmaDisplayInfo.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.phone;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.os.SystemProperties;
-import android.util.Log;
-import android.view.WindowManager;
-
-/**
- * Helper class for displaying the DisplayInfo sent by CDMA network.
- */
-public class CdmaDisplayInfo {
- private static final String LOG_TAG = "CdmaDisplayInfo";
- private static final boolean DBG = (SystemProperties.getInt("ro.debuggable", 0) == 1);
-
- /** CDMA DisplayInfo dialog */
- private static AlertDialog sDisplayInfoDialog = null;
-
- /**
- * Handle the DisplayInfo record and display the alert dialog with
- * the network message.
- *
- * @param context context to get strings.
- * @param infoMsg Text message from Network.
- */
- public static void displayInfoRecord(Context context, String infoMsg) {
-
- if (DBG) log("displayInfoRecord: infoMsg=" + infoMsg);
-
- if (sDisplayInfoDialog != null) {
- sDisplayInfoDialog.dismiss();
- }
-
- // displaying system alert dialog on the screen instead of
- // using another activity to display the message. This
- // places the message at the forefront of the UI.
- sDisplayInfoDialog = new AlertDialog.Builder(context)
- .setIcon(android.R.drawable.ic_dialog_info)
- .setTitle(context.getText(R.string.network_message))
- .setMessage(infoMsg)
- .setCancelable(true)
- .create();
-
- sDisplayInfoDialog.getWindow().setType(
- WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
- sDisplayInfoDialog.getWindow().addFlags(
- WindowManager.LayoutParams.FLAG_DIM_BEHIND);
-
- sDisplayInfoDialog.show();
- PhoneGlobals.getInstance().wakeUpScreen();
-
- }
-
- /**
- * Dismiss the DisplayInfo record
- */
- public static void dismissDisplayInfoRecord() {
-
- if (DBG) log("Dissmissing Display Info Record...");
-
- if (sDisplayInfoDialog != null) {
- sDisplayInfoDialog.dismiss();
- sDisplayInfoDialog = null;
- }
- }
-
- private static void log(String msg) {
- Log.d(LOG_TAG, "[CdmaDisplayInfo] " + msg);
- }
-}
diff --git a/src/com/android/phone/PhoneDisplayMessage.java b/src/com/android/phone/PhoneDisplayMessage.java
new file mode 100644
index 0000000..2b86a61
--- /dev/null
+++ b/src/com/android/phone/PhoneDisplayMessage.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.phone;
+
+import android.app.AlertDialog;
+import android.content.Context;
+import android.os.SystemProperties;
+import android.util.Log;
+import android.view.WindowManager;
+
+/**
+ * Helper class for displaying the a string triggered by a lower level Phone request
+ */
+public class PhoneDisplayMessage {
+ private static final String LOG_TAG = "PhoneDisplayMessage";
+ private static final boolean DBG = (SystemProperties.getInt("ro.debuggable", 0) == 1);
+
+ /** Display message dialog */
+ private static AlertDialog sDisplayMessageDialog = null;
+
+ /**
+ * Display the alert dialog with the network message.
+ *
+ * @param context context to get strings.
+ * @param infoMsg Text message from Network.
+ */
+ public static void displayNetworkMessage(Context context, String infoMsg) {
+ if (DBG) log("displayInfoRecord: infoMsg=" + infoMsg);
+
+ String title = (String)context.getText(R.string.network_info_message);
+ displayMessage(context, title, infoMsg);
+ }
+
+ /**
+ * Display the alert dialog with the error message.
+ *
+ * @param context context to get strings.
+ * @param errorMsg Error message describing the network triggered error
+ */
+ public static void displayErrorMessage(Context context, String errorMsg) {
+ if (DBG) log("displayErrorMessage: errorMsg=" + errorMsg);
+
+ String title = (String)context.getText(R.string.network_error_message);
+ displayMessage(context, title, errorMsg);
+ }
+
+ public static void displayMessage(Context context, String title, String msg) {
+ if (DBG) log("displayMessage: msg=" + msg);
+
+ if (sDisplayMessageDialog != null) {
+ sDisplayMessageDialog.dismiss();
+ }
+
+ // displaying system alert dialog on the screen instead of
+ // using another activity to display the message. This
+ // places the message at the forefront of the UI.
+ sDisplayMessageDialog = new AlertDialog.Builder(context)
+ .setIcon(android.R.drawable.ic_dialog_info)
+ .setTitle(title)
+ .setMessage(msg)
+ .setCancelable(true)
+ .create();
+
+ sDisplayMessageDialog.getWindow().setType(
+ WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
+ sDisplayMessageDialog.getWindow().addFlags(
+ WindowManager.LayoutParams.FLAG_DIM_BEHIND);
+
+ sDisplayMessageDialog.show();
+ PhoneGlobals.getInstance().wakeUpScreen();
+ }
+
+ /**
+ * Dismiss the DisplayInfo record
+ */
+ public static void dismissMessage() {
+ if (DBG) log("Dissmissing Display Info Record...");
+
+ if (sDisplayMessageDialog != null) {
+ sDisplayMessageDialog.dismiss();
+ sDisplayMessageDialog = null;
+ }
+ }
+
+ private static void log(String msg) {
+ Log.d(LOG_TAG, "[PhoneDisplayMessage] " + msg);
+ }
+}