/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.dialer.searchfragment.remote; import android.content.Context; import android.content.CursorLoader; import android.database.Cursor; import android.net.Uri; import android.os.Build.VERSION; import android.os.Build.VERSION_CODES; import android.provider.ContactsContract; import android.provider.ContactsContract.CommonDataKinds.Phone; import android.support.annotation.VisibleForTesting; import android.text.TextUtils; import com.android.dialer.searchfragment.common.Projections; import com.android.dialer.searchfragment.remote.RemoteDirectoriesCursorLoader.Directory; import java.util.List; /** * Cursor loader to load extended contacts on device. * *
This loader performs several database queries in serial and merges the resulting cursors
* together into {@link RemoteContactsCursor}. If there are no results, the loader will return a
* null cursor.
*/
public final class RemoteContactsCursorLoader extends CursorLoader {
private static final Uri ENTERPRISE_CONTENT_FILTER_URI =
Uri.withAppendedPath(Phone.CONTENT_URI, "filter_enterprise");
private static final String IGNORE_NUMBER_TOO_LONG_CLAUSE = "length(" + Phone.NUMBER + ") < 1000";
private static final String MAX_RESULTS = "20";
private final String query;
private final List