Use FLAG_REFRAIN_PHONE_NUMBER_FORMATTING to prevent discard
of "+", "p", "w" etc in phone numbers.

Change-Id: Ic69d60e5831e59a497c523aa62c753922edf06f6
diff --git a/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java b/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java
index c5449fa..1db8723 100755
--- a/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java
+++ b/src/com/android/bluetooth/pbap/BluetoothPbapCallLogComposer.java
@@ -185,7 +185,11 @@
     }
 
     private String createOneCallLogEntryInternal() {
-        final VCardBuilder builder = new VCardBuilder(VCardConfig.VCARD_TYPE_V21_GENERIC_UTF8);
+        // We should not allow vCard composer to re-format phone numbers, since
+        // some characters are (inappropriately) removed and devices do not work fine.
+        final int vcardType = VCardConfig.VCARD_TYPE_V21_GENERIC_UTF8 |
+                VCardConfig.FLAG_REFRAIN_PHONE_NUMBER_FORMATTING;
+        final VCardBuilder builder = new VCardBuilder(vcardType);
         String name = mCursor.getString(CALLER_NAME_COLUMN_INDEX);
         if (TextUtils.isEmpty(name)) {
             name = mCursor.getString(NUMBER_COLUMN_INDEX);
@@ -213,7 +217,8 @@
             String phoneNumber, boolean vcardVer21) {
         final int vcardType = (vcardVer21 ?
                 VCardConfig.VCARD_TYPE_V21_GENERIC_UTF8 :
-                    VCardConfig.VCARD_TYPE_V30_GENERIC_UTF8);
+                    VCardConfig.VCARD_TYPE_V30_GENERIC_UTF8) |
+                VCardConfig.FLAG_REFRAIN_PHONE_NUMBER_FORMATTING;
         final VCardBuilder builder = new VCardBuilder(vcardType);
         boolean needCharset = false;
         if (!(VCardUtils.containsOnlyPrintableAscii(phoneName))) {
diff --git a/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java b/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java
index de8a3fd..cd704a4 100644
--- a/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java
+++ b/src/com/android/bluetooth/pbap/BluetoothPbapVcardManager.java
@@ -433,6 +433,7 @@
                     vcardType = VCardConfig.VCARD_TYPE_V30_GENERIC_UTF8;
                 }
                 vcardType |= VCardConfig.FLAG_REFRAIN_IMAGE_EXPORT;
+                vcardType |= VCardConfig.FLAG_REFRAIN_PHONE_NUMBER_FORMATTING;
 
                 composer = new VCardComposer(mContext, vcardType, true);
                 composer.addHandler(new HandlerForStringBuffer(op, ownerVCard));