diff options
| author | Joseph Pirozzo <pirozzoj@google.com> | 2017-03-28 10:23:55 -0700 |
|---|---|---|
| committer | Joseph Pirozzo <pirozzoj@google.com> | 2017-03-30 15:53:07 +0000 |
| commit | 1746becf87f6d5fd8cede5e4becb55e68e2ebf22 (patch) | |
| tree | 7fd8e292fa407c8a5a6d888f373eb5f661d773bc | |
| parent | 3e19d11d5ba6b48a370d4471049dae708750dee7 (diff) | |
| download | platform_frameworks_opt_vcard-oreo-dev.tar.gz platform_frameworks_opt_vcard-oreo-dev.tar.bz2 platform_frameworks_opt_vcard-oreo-dev.zip | |
The Vcard Framework was capable of exporting * and # keys but not
importing them. Updated the import code to accept any of the standard
12 dialable keys through use of the PhoneNumberUtils.is12Key.
Bug: 35882694
Test: runtest -x frameworks/opt/vcard/
Change-Id: Ia16d457f102c78aed6bba81159c430d3319e60d9
(cherry picked from commit f4d2a98d3088641e86fed2ca26ca368b289a9aec)
| -rw-r--r-- | java/com/android/vcard/VCardEntry.java | 2 | ||||
| -rw-r--r-- | tests/res/raw/v21_complicated.vcf | 3 | ||||
| -rw-r--r-- | tests/res/raw/v30_complicated.vcf | 1 | ||||
| -rw-r--r-- | tests/src/com/android/vcard/tests/VCardImporterTests.java | 4 |
4 files changed, 8 insertions, 2 deletions
diff --git a/java/com/android/vcard/VCardEntry.java b/java/com/android/vcard/VCardEntry.java index 44a71d8..97b1bfc 100644 --- a/java/com/android/vcard/VCardEntry.java +++ b/java/com/android/vcard/VCardEntry.java @@ -1789,7 +1789,7 @@ public class VCardEntry { } else if (ch == 'w' || ch == 'W') { builder.append(PhoneNumberUtils.WAIT); hasPauseOrWait = true; - } else if (('0' <= ch && ch <= '9') || (i == 0 && ch == '+')) { + } else if (PhoneNumberUtils.is12Key(ch) || (i == 0 && ch == '+')) { builder.append(ch); } } diff --git a/tests/res/raw/v21_complicated.vcf b/tests/res/raw/v21_complicated.vcf index de34e16..b40ebea 100644 --- a/tests/res/raw/v21_complicated.vcf +++ b/tests/res/raw/v21_complicated.vcf @@ -8,6 +8,7 @@ X-CLASS:PUBLIC TITLE:Shrimp Man
TEL;WORK;VOICE:(111) 555-1212
TEL;HOME;VOICE:(404) 555-1212
+TEL;FAX:(404) 555-1212P*#55
TEL;CELL:0311111111
TEL;VIDEO:0322222222
TEL;VOICE:0333333333
@@ -103,4 +104,4 @@ BDAY:19800101 GEO:35.6563854,139.6994233
URL:http://www.example.com/
REV:20080424T195243Z
-END:VCARD
\ No newline at end of file +END:VCARD
diff --git a/tests/res/raw/v30_complicated.vcf b/tests/res/raw/v30_complicated.vcf index 4a8698e..0443a6f 100644 --- a/tests/res/raw/v30_complicated.vcf +++ b/tests/res/raw/v30_complicated.vcf @@ -8,6 +8,7 @@ X-CLASS:PUBLIC TITLE:Shrimp Man
TEL;WORK;VOICE:(111) 555-1212
TEL;HOME;VOICE:(404) 555-1212
+TEL;FAX:(404) 555-1212P*#55
TEL;CELL:0311111111
TEL;VIDEO:0322222222
TEL;VOICE:0333333333
diff --git a/tests/src/com/android/vcard/tests/VCardImporterTests.java b/tests/src/com/android/vcard/tests/VCardImporterTests.java index 134014f..7b4e669 100644 --- a/tests/src/com/android/vcard/tests/VCardImporterTests.java +++ b/tests/src/com/android/vcard/tests/VCardImporterTests.java @@ -573,6 +573,7 @@ public class VCardImporterTests extends VCardTestsBase { .addExpectedNodeWithOrder("X-CLASS", "PUBLIC") .addExpectedNodeWithOrder("TEL", "(111) 555-1212", new TypeSet("WORK", "VOICE")) .addExpectedNodeWithOrder("TEL", "(404) 555-1212", new TypeSet("HOME", "VOICE")) + .addExpectedNodeWithOrder("TEL", "(404) 555-1212P*#55", new TypeSet("FAX")) .addExpectedNodeWithOrder("TEL", "0311111111", new TypeSet("CELL")) .addExpectedNodeWithOrder("TEL", "0322222222", new TypeSet("VIDEO")) .addExpectedNodeWithOrder("TEL", "0333333333", new TypeSet("VOICE")) @@ -645,6 +646,9 @@ public class VCardImporterTests extends VCardTestsBase { .put(Phone.TYPE, Phone.TYPE_HOME) .put(Phone.NUMBER, "404-555-1212"); elem.addExpected(Phone.CONTENT_ITEM_TYPE) + .put(Phone.TYPE, Phone.TYPE_FAX_HOME) + .put(Phone.NUMBER, "4045551212,*#55"); + elem.addExpected(Phone.CONTENT_ITEM_TYPE) .put(Phone.TYPE, Phone.TYPE_MOBILE) .put(Phone.NUMBER, "031-111-1111"); elem.addExpected(Phone.CONTENT_ITEM_TYPE) |
