1 /* 2 * Copyright (C) 2022 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.appsearch.contactsindexer; 18 19 import java.util.concurrent.TimeUnit; 20 21 /** 22 * An interface which exposes config flags to Contacts Indexer. 23 * 24 * <p>Implementations of this interface must be thread-safe. 25 * 26 * @hide 27 */ 28 public interface ContactsIndexerConfig { 29 boolean DEFAULT_CONTACTS_INDEXER_ENABLED = true; 30 int DEFAULT_CONTACTS_FIRST_RUN_INDEXING_LIMIT = 1000; 31 long DEFAULT_CONTACTS_FULL_UPDATE_INTERVAL_MILLIS = TimeUnit.DAYS.toMillis(30); // 30 days. 32 int DEFAULT_CONTACTS_FULL_UPDATE_INDEXING_LIMIT = 10_000; 33 int DEFAULT_CONTACTS_DELTA_UPDATE_INDEXING_LIMIT = 1000; 34 boolean DEFAULT_CONTACTS_INDEX_FIRST_MIDDLE_AND_LAST_NAMES = false; 35 boolean DEFAULT_CONTACTS_KEEP_UPDATING_ON_ERROR = true; 36 37 /** Returns whether Contacts Indexer is enabled. */ isContactsIndexerEnabled()38 boolean isContactsIndexerEnabled(); 39 40 /** 41 * Returns the maximum number of CP2 contacts indexed during first run. 42 * 43 * <p>This value will limit the amount of processing performed when the device upgrades from 44 * Android S to T with Contacts Indexer enabled. 45 */ getContactsFirstRunIndexingLimit()46 int getContactsFirstRunIndexingLimit(); 47 48 /** 49 * Returns the minimum internal in millis for two consecutive full update. This is only checked 50 * once after reach boot. 51 */ getContactsFullUpdateIntervalMillis()52 long getContactsFullUpdateIntervalMillis(); 53 54 /** 55 * Returns the maximum number of CP2 contacts indexed during a full update. 56 * 57 * <p>The value will be used as a LIMIT for querying CP2 during full update. 58 */ getContactsFullUpdateLimit()59 int getContactsFullUpdateLimit(); 60 61 /** 62 * Returns the maximum number of CP2 contacts indexed during a delta update. 63 * 64 * <p>The value will be used as a LIMIT for querying CP2 during the delta update. 65 */ getContactsDeltaUpdateLimit()66 int getContactsDeltaUpdateLimit(); 67 68 /** 69 * Returns whether the first, middle and last names of a contact should be indexed in addition 70 * to the full name. 71 */ shouldIndexFirstMiddleAndLastNames()72 boolean shouldIndexFirstMiddleAndLastNames(); 73 74 /** Returns whether full and delta updates should continue on error. */ shouldKeepUpdatingOnError()75 boolean shouldKeepUpdatingOnError(); 76 } 77