Adding contextual "Voice Mail" text to in-call dialpad.
Adds contextual "Voice Mail" text as the hint in the DMTF dialpad
editText.
bug: b/7110391
Change-Id: I85241dc7fa6768f68867fdb1237540233b8be01b
diff --git a/src/com/android/phone/CallController.java b/src/com/android/phone/CallController.java
index 942f75f..1f810f9 100644
--- a/src/com/android/phone/CallController.java
+++ b/src/com/android/phone/CallController.java
@@ -504,6 +504,12 @@
// first gets connected.)
inCallUiState.showDialpad = voicemailUriSpecified;
+ // For voicemails, we add context text to let the user know they
+ // are dialing their voicemail.
+ // TODO: This is only set here and becomes problematic when swapping calls
+ inCallUiState.dialpadContextText = voicemailUriSpecified ?
+ phone.getVoiceMailAlphaTag() : "";
+
// Also, in case a previous call was already active (i.e. if
// we just did "Add call"), clear out the "history" of DTMF
// digits you typed, to make sure it doesn't persist from the
diff --git a/src/com/android/phone/DTMFTwelveKeyDialer.java b/src/com/android/phone/DTMFTwelveKeyDialer.java
index 6b41a10..c47b366 100644
--- a/src/com/android/phone/DTMFTwelveKeyDialer.java
+++ b/src/com/android/phone/DTMFTwelveKeyDialer.java
@@ -23,7 +23,9 @@
import android.provider.Settings;
import android.telephony.PhoneNumberUtils;
import android.text.Editable;
+import android.text.SpannableString;
import android.text.method.DialerKeyListener;
+import android.text.style.RelativeSizeSpan;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -825,6 +827,32 @@
if (mDialpadDigits != null) {
mDialpadDigits.setText("");
}
+
+ setDialpadContext("");
+ }
+
+ /**
+ * Set the context text (hint) to show in the dialpad Digits EditText.
+ *
+ * This is currently only used for displaying a value for "Voice Mail"
+ * calls since they default to the dialpad and we want to give users better
+ * context when they dial voicemail.
+ *
+ * TODO: Is there value in extending this functionality for all contacts
+ * and not just Voice Mail calls?
+ * TODO: This should include setting the digits as well as the context
+ * once we start saving the digits properly...and properly in this case
+ * ideally means moving some of processDtmf() out of this class.
+ */
+ public void setDialpadContext(String contextValue) {
+ if (mDialpadDigits != null) {
+ if (contextValue == null) {
+ contextValue = "";
+ }
+ final SpannableString hint = new SpannableString(contextValue);
+ hint.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), 0);
+ mDialpadDigits.setHint(hint);
+ }
}
/**
diff --git a/src/com/android/phone/InCallScreen.java b/src/com/android/phone/InCallScreen.java
index 9f8ec31..008efd8 100755
--- a/src/com/android/phone/InCallScreen.java
+++ b/src/com/android/phone/InCallScreen.java
@@ -585,8 +585,10 @@
} else {
closeDialpadInternal(false); // no "closing" animation
}
- //
- // TODO: also need to load inCallUiState.dialpadDigits into the dialpad
+
+ // Reset the dialpad context
+ // TODO: Dialpad digits should be set here as well (once they are saved)
+ mDialer.setDialpadContext(inCallUiState.dialpadContextText);
// If there's a "Respond via SMS" popup still around since the
// last time we were the foreground activity, make sure it's not
@@ -2401,20 +2403,31 @@
// If an incoming call is ringing, make sure the dialpad is
// closed. (We do this to make sure we're not covering up the
// "incoming call" UI.)
- if (mCM.getState() == Phone.State.RINGING && mDialer.isOpened()) {
- Log.i(LOG_TAG, "During RINGING state we force hiding dialpad.");
- closeDialpadInternal(false); // don't do the "closing" animation
+ if (mCM.getState() == Phone.State.RINGING) {
+ if (mDialer.isOpened()) {
+ Log.i(LOG_TAG, "During RINGING state we force hiding dialpad.");
+ closeDialpadInternal(false); // don't do the "closing" animation
+ }
- // Also, clear out the "history" of DTMF digits you may have typed
- // into the previous call (so you don't see the previous call's
- // digits if you answer this call and then bring up the dialpad.)
+ // At this point, we are guranteed that the dialer is closed.
+ // This means that it is safe to clear out the "history" of DTMF digits
+ // you may have typed into the previous call (so you don't see the
+ // previous call's digits if you answer this call and then bring up the
+ // dialpad.)
//
// TODO: it would be more precise to do this when you *answer* the
// incoming call, rather than as soon as it starts ringing, but
// the InCallScreen doesn't keep enough state right now to notice
// that specific transition in onPhoneStateChanged().
+ // TODO: This clears out the dialpad context as well so when a second
+ // call comes in while a voicemail call is happening, the voicemail
+ // dialpad will no longer have the "Voice Mail" context. It's a small
+ // case so not terribly bad, but we need to maintain a better
+ // call-to-callstate mapping before we can fix this.
mDialer.clearDigits();
}
+
+
// Now that we're sure DTMF dialpad is in an appropriate state, reflect
// the dialpad state into CallCard
updateCallCardVisibilityPerDialerState(false);
diff --git a/src/com/android/phone/InCallUiState.java b/src/com/android/phone/InCallUiState.java
index 72e87de..cfaed99 100644
--- a/src/com/android/phone/InCallUiState.java
+++ b/src/com/android/phone/InCallUiState.java
@@ -145,6 +145,14 @@
*/
String dialpadDigits;
+ /**
+ * The contact/dialed number information shown in the DTMF digits text
+ * when the user has not yet typed any digits.
+ *
+ * Currently only used for displaying "Voice Mail" since voicemail calls
+ * start directly in the dialpad view.
+ */
+ String dialpadContextText;
//
// (3) Error / diagnostic indications
@@ -419,6 +427,7 @@
public void dumpState() {
log("dumpState():");
log(" - showDialpad: " + showDialpad);
+ log(" - dialpadContextText: " + dialpadContextText);
if (hasPendingCallStatusCode()) {
log(" - status indication is pending!");
log(" - pending call status code = " + mPendingCallStatusCode);