summaryrefslogtreecommitdiffstats
path: root/core/java/android/pim
diff options
context:
space:
mode:
authorDaisuke Miyakawa <dmiyakawa@google.com>2009-10-12 15:05:21 -0700
committerDaisuke Miyakawa <dmiyakawa@google.com>2009-10-12 15:14:09 -0700
commit7c6770c26ba819bcad3d9522e046f9d1fdf9e222 (patch)
tree192726bd0897268a764ee189b1dc3344da80e411 /core/java/android/pim
parentd48e25d4e3278c5e975db01adb98661ee59923fe (diff)
downloadframeworks_base-7c6770c26ba819bcad3d9522e046f9d1fdf9e222.zip
frameworks_base-7c6770c26ba819bcad3d9522e046f9d1fdf9e222.tar.gz
frameworks_base-7c6770c26ba819bcad3d9522e046f9d1fdf9e222.tar.bz2
Add the flag "FLAG_APPEND_TYPE_PARAM" to VCardConfig, which
enables vCard composer to append "TYPE=" to type param/attribute everytime possible, which should fix the issue 2180800. issue number: 2180800
Diffstat (limited to 'core/java/android/pim')
-rw-r--r--core/java/android/pim/vcard/VCardComposer.java4
-rw-r--r--core/java/android/pim/vcard/VCardConfig.java19
2 files changed, 22 insertions, 1 deletions
diff --git a/core/java/android/pim/vcard/VCardComposer.java b/core/java/android/pim/vcard/VCardComposer.java
index b23fc3d..9cb9c90 100644
--- a/core/java/android/pim/vcard/VCardComposer.java
+++ b/core/java/android/pim/vcard/VCardComposer.java
@@ -288,6 +288,7 @@ public class VCardComposer {
private final boolean mUsesUtf8;
private final boolean mUsesShiftJis;
private final boolean mUsesQPToPrimaryProperties;
+ private final boolean mAppendTypeParamName;
private Cursor mCursor;
private int mIdColumn;
@@ -353,6 +354,7 @@ public class VCardComposer {
mUsesUtf8 = VCardConfig.usesUtf8(vcardType);
mUsesShiftJis = VCardConfig.usesShiftJis(vcardType);
mUsesQPToPrimaryProperties = VCardConfig.usesQPToPrimaryProperties(vcardType);
+ mAppendTypeParamName = VCardConfig.appendTypeParamName(vcardType);
mHandlerList = new ArrayList<OneEntryHandler>();
if (mIsDoCoMo) {
@@ -1756,7 +1758,7 @@ public class VCardComposer {
private void appendTypeAttribute(final StringBuilder builder, final String type) {
// Note: In vCard 3.0, Type strings also can be like this: "TYPE=HOME,PREF"
- if (mIsV30) {
+ if (mIsV30 || mAppendTypeParamName) {
builder.append(Constants.ATTR_TYPE).append(VCARD_ATTR_EQUAL);
}
builder.append(type);
diff --git a/core/java/android/pim/vcard/VCardConfig.java b/core/java/android/pim/vcard/VCardConfig.java
index 665fd4b..03ed329 100644
--- a/core/java/android/pim/vcard/VCardConfig.java
+++ b/core/java/android/pim/vcard/VCardConfig.java
@@ -106,6 +106,21 @@ public class VCardConfig {
*/
public static final int FLAG_USE_QP_TO_PRIMARY_PROPERTIES = 0x10000000;
+ /**
+ * The flag indicating the vCard composer "for 2.1" emits "TYPE=" string every time
+ * possible. The default behavior does not emit it and is valid, while adding "TYPE="
+ * is also valid. In vCrad 3.0, this flag is unnecessary, since "TYPE=" is MUST in
+ * vCard 3.0 specification.
+ *
+ * If you are targeting to some importer which cannot accept type attributes (params)
+ * without "TYPE=" string (which should be rare though), please use this flag.
+ *
+ * XXX: Really rare?
+ *
+ * e.g. int vcardType = (VCARD_TYPE_V21_GENERIC | FLAG_APPEND_TYPE_PARAM);
+ */
+ public static final int FLAG_APPEND_TYPE_PARAM = 0x08000000;
+
//// The followings are VCard types available from importer/exporter. ////
/**
@@ -300,6 +315,10 @@ public class VCardConfig {
((vcardType & FLAG_USE_QP_TO_PRIMARY_PROPERTIES) != 0));
}
+ public static boolean appendTypeParamName(int vcardType) {
+ return (vcardType & FLAG_APPEND_TYPE_PARAM) != 0;
+ }
+
private VCardConfig() {
}
} \ No newline at end of file