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

Commit 17693343 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" into rvc-dev am: 23a334da

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

Change-Id: I18725075e49c849ae9a16717ecbc6f619f97d375
parents 0422e77e 23a334da
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;
            }