IMS: Notify about change of TTY mode of other call participants
Display message when TTY mode of other party changed
during VoLTE phone call
Bug: 18247323
Change-Id: Ia8ea3a277b06582a7d11a3c7a21b477350804ca9
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 5b60f8a..3669544 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -46,6 +46,7 @@
import android.os.Vibrator;
import android.provider.CallLog.Calls;
import android.provider.Settings;
+import android.telecom.TelecomManager;
import android.telephony.DisconnectCause;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneStateListener;
@@ -255,6 +256,11 @@
onSuppServiceFailed((AsyncResult) msg.obj);
break;
+ case CallStateMonitor.PHONE_TTY_MODE_RECEIVED:
+ if (DBG) log("Received PHONE_TTY_MODE_RECEIVED event");
+ onTtyModeReceived((AsyncResult) msg.obj);
+ break;
+
default:
// super.handleMessage(msg);
}
@@ -979,6 +985,42 @@
}
/**
+ * Displays a notification when the phone receives a notice that TTY mode
+ * has changed on remote end.
+ */
+ private void onTtyModeReceived(AsyncResult r) {
+ if (DBG) log("TtyModeReceived: displaying notification message");
+
+ int resId = 0;
+ switch (((Integer)r.result).intValue()) {
+ case TelecomManager.TTY_MODE_FULL:
+ resId = com.android.internal.R.string.peerTtyModeFull;
+ break;
+ case TelecomManager.TTY_MODE_HCO:
+ resId = com.android.internal.R.string.peerTtyModeHco;
+ break;
+ case TelecomManager.TTY_MODE_VCO:
+ resId = com.android.internal.R.string.peerTtyModeVco;
+ break;
+ case TelecomManager.TTY_MODE_OFF:
+ resId = com.android.internal.R.string.peerTtyModeOff;
+ break;
+ default:
+ Log.e(LOG_TAG, "Unsupported TTY mode: " + r.result);
+ break;
+ }
+ if (resId != 0) {
+ PhoneDisplayMessage.displayNetworkMessage(mApplication,
+ mApplication.getResources().getString(resId));
+
+ // 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 e150c68..16a6f1f 100644
--- a/src/com/android/phone/CallStateMonitor.java
+++ b/src/com/android/phone/CallStateMonitor.java
@@ -57,6 +57,7 @@
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;
+ public static final int PHONE_TTY_MODE_RECEIVED = 15;
// 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.
@@ -99,6 +100,7 @@
//callManager.registerForRingbackTone(this, PHONE_RINGBACK_TONE, null);
//callManager.registerForResendIncallMute(this, PHONE_RESEND_MUTE, null);
//callManager.registerForPostDialCharacter(this, PHONE_ON_DIAL_CHARS, null);
+ callManager.registerForTtyModeReceived(this, PHONE_TTY_MODE_RECEIVED, null);
}
public void addListener(Handler handler) {
@@ -144,6 +146,7 @@
callManager.unregisterForInCallVoicePrivacyOff(this);
//callManager.unregisterForPostDialCharacter(this);
callManager.unregisterForSuppServiceFailed(this);
+ callManager.unregisterForTtyModeReceived(this);
registerForNotifications();
}