1 /* 2 * Copyright (C) 2024 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.appsindexer; 18 19 import android.app.appsearch.AppSearchSession; 20 21 import java.util.concurrent.TimeUnit; 22 23 /** 24 * An interface which exposes config flags to Apps Indexer. 25 * 26 * <p>Implementations of this interface must be thread-safe. 27 * 28 * @hide 29 */ 30 public interface AppsIndexerConfig { 31 boolean DEFAULT_APPS_INDEXER_ENABLED = true; 32 33 long DEFAULT_APPS_UPDATE_INTERVAL_MILLIS = TimeUnit.DAYS.toMillis(30); // 30 days. 34 35 /** The default maximum number of app functions per package that the app indexer will index. */ 36 int DEFAULT_MAX_APP_FUNCTIONS_PER_PACKAGE = 250; 37 38 /** 39 * The default maximum number of app function schemas per package that the app indexer will 40 * index. 41 */ 42 int DEFAULT_MAX_ALLOWED_APP_FUNCTION_SCHEMAS_PER_PACKAGE = 20; 43 44 /** 45 * The default max allowed size of an app function document. 46 * 47 * <p>More conservative than one enforced by {@link AppSearchSession#put} to prevent app 48 * developers from indexing additional properties in app function documents using this indexer. 49 */ 50 int DEFAULT_MAX_ALLOWED_APP_FUNCTION_DOC_SIZE_IN_BYTES = 4 * 1024; // 4KiB 51 52 /** 53 * The default minimum time required to wait before attempting a firstRun sync after a previous 54 * firstRun sync. 55 */ 56 long DEFAULT_MIN_TIME_BETWEEN_FIRST_SYNCS_MILLIS = TimeUnit.HOURS.toMillis(4); 57 58 /** Returns whether Apps Indexer is enabled. */ isAppsIndexerEnabled()59 boolean isAppsIndexerEnabled(); 60 61 /* Returns the minimum internal in millis for two consecutive scheduled updates. */ getAppsMaintenanceUpdateIntervalMillis()62 long getAppsMaintenanceUpdateIntervalMillis(); 63 64 /** Returns the max number of app functions the app indexer will index per package. */ getMaxAppFunctionsPerPackage()65 int getMaxAppFunctionsPerPackage(); 66 67 /** Returns the max number of app function schemas the app indexer will index per package. */ getMaxAllowedAppFunctionSchemasPerPackage()68 int getMaxAllowedAppFunctionSchemasPerPackage(); 69 70 /** 71 * Returns the minimum time required to wait before attempting a firstRun sync after a previous 72 * firstRun sync in milliseconds. 73 */ getMinTimeBetweenFirstSyncsMillis()74 long getMinTimeBetweenFirstSyncsMillis(); 75 } 76