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

Commit 820ce795 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "HFP: use Bundle to query call log and phonebook" am: 1f4ac1b9

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Bluetooth/+/1408031

Change-Id: I51641f2fde9c7f8dba4f18616918938697419882
parents cbe44769 1f4ac1b9
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -425,21 +425,29 @@ public class AtPhonebook {
        }

        if (ancillaryPhonebook) {
            pbr.cursor = mContentResolver.query(Calls.CONTENT_URI, CALLS_PROJECTION, where, null,
                    Calls.DEFAULT_SORT_ORDER + " LIMIT " + MAX_PHONEBOOK_SIZE);
            Bundle queryArgs = new Bundle();
            queryArgs.putString(ContentResolver.QUERY_ARG_SQL_SELECTION, where);
            queryArgs.putString(ContentResolver.QUERY_ARG_SQL_SORT_ORDER, Calls.DEFAULT_SORT_ORDER);
            queryArgs.putInt(ContentResolver.QUERY_ARG_LIMIT, MAX_PHONEBOOK_SIZE);
            pbr.cursor = mContentResolver.query(Calls.CONTENT_URI, CALLS_PROJECTION,
                    queryArgs, null);

            if (pbr.cursor == null) {
                return false;
            }

            pbr.numberColumn = pbr.cursor.getColumnIndexOrThrow(Calls.NUMBER);
            pbr.numberPresentationColumn =
                    pbr.cursor.getColumnIndexOrThrow(Calls.NUMBER_PRESENTATION);
            pbr.typeColumn = -1;
            pbr.nameColumn = -1;
        } else {
            Bundle queryArgs = new Bundle();
            queryArgs.putString(ContentResolver.QUERY_ARG_SQL_SELECTION, where);
            queryArgs.putInt(ContentResolver.QUERY_ARG_LIMIT, MAX_PHONEBOOK_SIZE);
            final Uri phoneContentUri = DevicePolicyUtils.getEnterprisePhoneUri(mContext);
            pbr.cursor = mContentResolver.query(phoneContentUri, PHONES_PROJECTION, where, null,
                    Phone.NUMBER + " LIMIT " + MAX_PHONEBOOK_SIZE);
            pbr.cursor = mContentResolver.query(phoneContentUri, PHONES_PROJECTION,
                    queryArgs, null);

            if (pbr.cursor == null) {
                return false;
            }