Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49f5cec0 authored by Xiaodong Xu's avatar Xiaodong Xu Committed by Johan Redestig
Browse files

Bluetooth: Add vCard version support for call history.

Under current implementation, PSE only deliver call history
under format VCard2.1 to PCE, this is not correct according to
PBAP specification, which says "The PSE shall support both
vCard2.1 and vCard3.0 versions and deliver the Entries to the
PCE under the format version that is requested by the PCE."
This fix is to make implementation following such PBAP
specificaiton.

Change-Id: Id0146d0887bad3bd066109ecd3be674b3106bced
parent a8a094ee
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ public class BluetoothPbapCallLogComposer {
        }
    }

    public boolean createOneEntry() {
    public boolean createOneEntry(boolean vcardVer21) {
        if (mCursor == null || mCursor.isAfterLast()) {
            mErrorReason = FAILURE_REASON_NOT_INITIALIZED;
            return false;
@@ -160,7 +160,7 @@ public class BluetoothPbapCallLogComposer {

        final String vcard;
        try {
            vcard = createOneCallLogEntryInternal();
            vcard = createOneCallLogEntryInternal(vcardVer21);
        } catch (OutOfMemoryError error) {
            Log.e(TAG, "OutOfMemoryError occured. Ignore the entry");
            System.gc();
@@ -184,10 +184,9 @@ public class BluetoothPbapCallLogComposer {
        return true;
    }

    private String createOneCallLogEntryInternal() {
        // 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 |
    private String createOneCallLogEntryInternal(boolean vcardVer21) {
        final int vcardType = (vcardVer21 ? VCardConfig.VCARD_TYPE_V21_GENERIC :
                VCardConfig.VCARD_TYPE_V30_GENERIC) |
                VCardConfig.FLAG_REFRAIN_PHONE_NUMBER_FORMATTING;
        final VCardBuilder builder = new VCardBuilder(vcardType);
        String name = mCursor.getString(CALLER_NAME_COLUMN_INDEX);
+1 −1
Original line number Diff line number Diff line
@@ -473,7 +473,7 @@ public class BluetoothPbapVcardManager {
                        BluetoothPbapObexServer.sIsAborted = false;
                        break;
                    }
                    if (!composer.createOneEntry()) {
                    if (!composer.createOneEntry(vcardType21)) {
                        Log.e(TAG, "Failed to read a contact. Error reason: "
                                + composer.getErrorReason());
                        return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;