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

Commit 957359d0 authored by Hemant Gupta's avatar Hemant Gupta
Browse files

PBAP: Sort vCardListing results when order is alphabetic

Usecase:
Send Get request from PBAP client for vCardListing with search
attribute as "number" and order is "alphabetic".

Issue:
vCardListing returned from Pbap Server doesn't follow alphabetic
order.

Root Cause:
Set of values fetched for the given number(Search Value) are ordered
by Contact_ID in the cursor query.

Fix:
Sort the entries alphabetically before writing vCardListing response
if order is set to alphabetic from Pbap client.

Test: After sending alphabetical search, verified that the received vcard
listing was in alphabetical order.

Bug: 37412583
Change-Id: Iff3d1f4aac998ef85b5cef862fd427cb8a57bdb4
parent 444e340b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

import javax.obex.ApplicationParameter;
import javax.obex.HeaderSet;
@@ -838,6 +839,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
            // query the number, to get the names
            ArrayList<String> names =
                    mVcardManager.getContactNamesByNumber(appParamValue.searchValue);
            if (mOrderBy == ORDER_BY_ALPHABETICAL) Collections.sort(names);
            for (int i = 0; i < names.size(); i++) {
                compareValue = names.get(i).trim();
                if (D) {