Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 36255b7ff1980fae2d6a073faf1b952204d8584c 1 parent e6b5478
Santos Cordon authored The Android Automerger committed
View
6 src/com/android/phone/CallController.java
@@ -504,6 +504,12 @@ private CallStatusCode placeCallInternal(Intent intent) {
// 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
View
28 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 @@ public void clearDigits() {
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);
+ }
}
/**
View
29 src/com/android/phone/InCallScreen.java
@@ -585,8 +585,10 @@ protected void onResume() {
} 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 @@ private void updateScreen() {
// 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);
View
9 src/com/android/phone/InCallUiState.java
@@ -145,6 +145,14 @@ private InCallUiState(Context context) {
*/
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 clearProviderInfo() {
public void dumpState() {
log("dumpState():");
log(" - showDialpad: " + showDialpad);
+ log(" - dialpadContextText: " + dialpadContextText);
if (hasPendingCallStatusCode()) {
log(" - status indication is pending!");
log(" - pending call status code = " + mPendingCallStatusCode);
Please sign in to comment.
Something went wrong with that request. Please try again.