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 package com.android.server.appsearch.appsindexer; 17 18 import android.annotation.NonNull; 19 import android.app.appsearch.GlobalSearchSession; 20 import android.app.appsearch.SearchResults; 21 import android.app.appsearch.SearchSpec; 22 23 import java.io.Closeable; 24 25 /** 26 * A synchronous wrapper around {@link GlobalSearchSession}. This allows us to call globalSearch 27 * synchronously. 28 * 29 * @see GlobalSearchSession 30 */ 31 public interface SyncGlobalSearchSession extends Closeable { 32 /** 33 * Returns a synchronous version of {@link SearchResults}. 34 * 35 * <p>While the underlying method is not asynchronous, this method allows for convenience while 36 * synchronously searching globally. 37 * 38 * @see GlobalSearchSession#search 39 */ 40 @NonNull search(@onNull String query, @NonNull SearchSpec searchSpec)41 SyncSearchResults search(@NonNull String query, @NonNull SearchSpec searchSpec); 42 43 /** 44 * Closes the global session. 45 * 46 * @see GlobalSearchSession#close 47 */ 48 @Override close()49 void close(); 50 } 51