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_KEEP_UPDATING_ON_ERROR = true; 35 36 /** Returns whether Contacts Indexer is enabled. */ isContactsIndexerEnabled()37 boolean isContactsIndexerEnabled(); 38 39 /** 40 * Returns the maximum number of CP2 contacts indexed during first run. 41 * 42 * <p>This value will limit the amount of processing performed when the device upgrades from 43 * Android S to T with Contacts Indexer enabled. 44 */ getContactsFirstRunIndexingLimit()45 int getContactsFirstRunIndexingLimit(); 46 47 /** 48 * Returns the minimum internal in millis for two consecutive full update. This is only checked 49 * once after reach boot. 50 */ getContactsFullUpdateIntervalMillis()51 long getContactsFullUpdateIntervalMillis(); 52 53 /** 54 * Returns the maximum number of CP2 contacts indexed during a full update. 55 * 56 * <p>The value will be used as a LIMIT for querying CP2 during full update. 57 */ getContactsFullUpdateLimit()58 int getContactsFullUpdateLimit(); 59 60 /** 61 * Returns the maximum number of CP2 contacts indexed during a delta update. 62 * 63 * <p>The value will be used as a LIMIT for querying CP2 during the delta update. 64 */ getContactsDeltaUpdateLimit()65 int getContactsDeltaUpdateLimit(); 66 67 /** Returns whether full and delta updates should continue on error. */ shouldKeepUpdatingOnError()68 boolean shouldKeepUpdatingOnError(); 69 } 70