summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Bing <c_cbing@codeaurora.org>2014-05-20 10:57:45 +0800
committeremancebo <emancebo@cyngn.com>2014-09-04 15:20:00 -0700
commitab081ce6d29f6ea11e91ecb3a5e7d8750f7481c0 (patch)
tree60ab2296a40acee77ba48a093592b54f5922063d
parentf7e4b58ba1bbb810818c90e8ba9d0aba086bd42d (diff)
downloadandroid_packages_apps_InCallUI-ab081ce6d29f6ea11e91ecb3a5e7d8750f7481c0.tar.gz
android_packages_apps_InCallUI-ab081ce6d29f6ea11e91ecb3a5e7d8750f7481c0.tar.bz2
android_packages_apps_InCallUI-ab081ce6d29f6ea11e91ecb3a5e7d8750f7481c0.zip
InCallUI: Fix the repeated appending for the input number from HID.
In DTMFKeyListener,the input numbers would be appended twice by its parent and itself. Solution: Don't append the input numbers in DTMFKeyListener. Change-Id: Ie3f6049a5d4bd7aa541438ce519d86a89e520f63 CRs-Fixed: 656603
-rw-r--r--src/com/android/incallui/DialpadFragment.java37
1 files changed, 23 insertions, 14 deletions
diff --git a/src/com/android/incallui/DialpadFragment.java b/src/com/android/incallui/DialpadFragment.java
index 236b38c9..84f03e90 100644
--- a/src/com/android/incallui/DialpadFragment.java
+++ b/src/com/android/incallui/DialpadFragment.java
@@ -19,6 +19,7 @@ package com.android.incallui;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
+import android.telephony.PhoneNumberUtils;
import android.text.Editable;
import android.text.method.DialerKeyListener;
import android.util.AttributeSet;
@@ -182,21 +183,29 @@ public class DialpadFragment extends BaseFragment<DialpadPresenter, DialpadPrese
// find the character
char c = (char) lookup(event, content);
-
- // if not a long press, and parent onKeyDown accepts the input
- if (event.getRepeatCount() == 0 && super.onKeyDown(view, content, keyCode, event)) {
-
- boolean keyOK = ok(getAcceptedChars(), c);
-
- // if the character is a valid dtmf code, start playing the tone and send the
- // code.
- if (keyOK) {
- Log.d(this, "DTMFKeyListener reading '" + c + "' from input.");
- getPresenter().processDtmf(c);
- } else {
- Log.d(this, "DTMFKeyListener rejecting '" + c + "' from input.");
+ if (mDtmfDialerField != null) {
+ String str = mDtmfDialerField.getText().toString();
+ // if not a long press, and parent onKeyDown accepts the input
+ if (event.getRepeatCount() == 0 && super.onKeyDown(view, content, keyCode, event)) {
+
+ boolean keyOK = ok(getAcceptedChars(), c);
+
+ // if the character is a valid dtmf code, start playing the tone and send the
+ // code.
+ if (keyOK) {
+ Log.d(this, "DTMFKeyListener reading '" + c + "' from input.");
+ if (PhoneNumberUtils.is12Key(c)) {
+ Log.d(this, "updating display and sending dtmf tone for '" + c + "'");
+ CallCommandClient.getInstance().playDtmfTone(c, false);
+ } else {
+ Log.d(this, "ignoring dtmf request for '" + c + "'");
+ }
+ } else {
+ mDtmfDialerField.setText(str);
+ Log.d(this, "DTMFKeyListener rejecting '" + c + "' from input.");
+ }
+ return true;
}
- return true;
}
return false;
}