summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorDaisuke Miyakawa <dmiyakawa@google.com>2011-11-28 11:33:57 -0800
committerDaisuke Miyakawa <dmiyakawa@google.com>2011-11-28 11:38:57 -0800
commit449d710428682b3f44ba20ce290564cd9352ca0a (patch)
tree890a062efa3c0d967292efc5a7fe6584ae81ff0f /java
parent5fffd2ba2d7fc22271251251f89043ab345acd74 (diff)
downloadplatform_frameworks_opt_vcard-jb-release.tar.gz
platform_frameworks_opt_vcard-jb-release.tar.bz2
platform_frameworks_opt_vcard-jb-release.zip
vCard's "VOICE" type is the default type used in the format, while OTHER is the default type on Android. Our exporter treats Android's OTHER type as vCard's "VOICE", while our importer accepts the default type "VOICE" as Android's CUSTOM type with "VOICE" label, which confuses users: when they transfer phone numbers with OTHER type those numbers become "VOICE" on receiver sides. Bug: 5600504 Change-Id: Id30d2ca9b67b81798565224b881a734e8ee76516
Diffstat (limited to 'java')
-rw-r--r--java/com/android/vcard/VCardUtils.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/java/com/android/vcard/VCardUtils.java b/java/com/android/vcard/VCardUtils.java
index 575dfbd..a486d5d 100644
--- a/java/com/android/vcard/VCardUtils.java
+++ b/java/com/android/vcard/VCardUtils.java
@@ -153,6 +153,8 @@ public class VCardUtils {
Phone.TYPE_TTY_TDD);
sKnownPhoneTypeMap_StoI.put(VCardConstants.PARAM_PHONE_EXTRA_TYPE_ASSISTANT,
Phone.TYPE_ASSISTANT);
+ // OTHER (default in Android) should correspond to VOICE (default in vCard).
+ sKnownPhoneTypeMap_StoI.put(VCardConstants.PARAM_TYPE_VOICE, Phone.TYPE_OTHER);
sPhoneTypesUnknownToContactsSet = new HashSet<String>();
sPhoneTypesUnknownToContactsSet.add(VCardConstants.PARAM_TYPE_MODEM);
@@ -223,7 +225,13 @@ public class VCardUtils {
final Integer tmp = sKnownPhoneTypeMap_StoI.get(labelCandidate.toUpperCase());
if (tmp != null) {
final int typeCandidate = tmp;
- // TYPE_PAGER is prefered when the number contains @ surronded by
+ // 1. If a type isn't specified yet, we'll choose the new type candidate.
+ // 2. If the current type is default one (OTHER) or custom one, we'll
+ // prefer more specific types specified in the vCard. Note that OTHER and
+ // the other different types may appear simultaneously here, since vCard
+ // allow to have VOICE and HOME/WORK in one line.
+ // e.g. "TEL;WORK;VOICE:1" -> WORK + OTHER -> Type should be WORK
+ // 3. TYPE_PAGER is prefered when the number contains @ surronded by
// a pager number and a domain name.
// e.g.
// o 1111@domain.com
@@ -233,7 +241,8 @@ public class VCardUtils {
if ((typeCandidate == Phone.TYPE_PAGER
&& 0 < indexOfAt && indexOfAt < number.length() - 1)
|| type < 0
- || type == Phone.TYPE_CUSTOM) {
+ || type == Phone.TYPE_CUSTOM
+ || type == Phone.TYPE_OTHER) {
type = tmp;
}
} else if (type < 0) {