summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jaikumar Ganesh <jaikumar@google.com> 2011-08-15 17:33:21 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-08-15 17:33:21 -0700
commit0f2da17a9523fc40bceb5209cabd044df648e98e (patch)
tree7be4623981733fc34998681be47ddc5d8c7b5179
parenta3fed51f2e9fee5b3be9355885dcfeec75cf2e21 (diff)
parent4eb45cc98bdcee575cc21f5ad5754cde57197a81 (diff)
Merge "Add utility functions for pause and tonewait pause."
-rw-r--r--telephony/java/android/telephony/PhoneNumberUtils.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java
index c1713a58002a..51922da2b4f7 100644
--- a/telephony/java/android/telephony/PhoneNumberUtils.java
+++ b/telephony/java/android/telephony/PhoneNumberUtils.java
@@ -122,6 +122,17 @@ public class PhoneNumberUtils
return c == PAUSE || c == WAIT;
}
+ private static boolean
+ isPause (char c){
+ return c == 'p'||c == 'P';
+ }
+
+ private static boolean
+ isToneWait (char c){
+ return c == 'w'||c == 'W';
+ }
+
+
/** Returns true if ch is not dialable or alpha char */
private static boolean isSeparator(char ch) {
return !isDialable(ch) && !(('a' <= ch && ch <= 'z') || ('A' <= ch && ch <= 'Z'));
@@ -278,6 +289,32 @@ public class PhoneNumberUtils
return ret.toString();
}
+ /**
+ * Converts pause and tonewait pause characters
+ * to Android representation.
+ * RFC 3601 says pause is 'p' and tonewait is 'w'.
+ * @hide
+ */
+ public static String convertPreDial(String phoneNumber) {
+ if (phoneNumber == null) {
+ return null;
+ }
+ int len = phoneNumber.length();
+ StringBuilder ret = new StringBuilder(len);
+
+ for (int i = 0; i < len; i++) {
+ char c = phoneNumber.charAt(i);
+
+ if (isPause(c)) {
+ c = PAUSE;
+ } else if (isToneWait(c)) {
+ c = WAIT;
+ }
+ ret.append(c);
+ }
+ return ret.toString();
+ }
+
/** or -1 if both are negative */
static private int
minPositive (int a, int b) {