summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alexander Dorokhine <adorokhine@google.com> 2020-12-15 20:47:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-12-15 20:47:01 +0000
commitc51d98c112ac0dbe0ebd12f4fb497c7c253533bd (patch)
tree4d5fe300cf344dfb12452aa02c901b4414af5aa4
parent2d1c83c610623c7222e358ad800e1b39452db71b (diff)
parent7749895904a09108f62fbb3561c2257e8a0dec01 (diff)
Merge changes I3a17ec73,Ie460dbbb
* changes: Unhide AppSearchManager APIs. Unhide GlobalSearchSession API.
-rw-r--r--apex/appsearch/framework/api/current.txt14
-rw-r--r--apex/appsearch/framework/api/system-current.txt8
-rw-r--r--apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java10
-rw-r--r--apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java2
-rw-r--r--core/api/current.txt1
-rw-r--r--core/java/android/content/Context.java1
6 files changed, 32 insertions, 4 deletions
diff --git a/apex/appsearch/framework/api/current.txt b/apex/appsearch/framework/api/current.txt
index 8713499984a6..ae9e7ff8de2f 100644
--- a/apex/appsearch/framework/api/current.txt
+++ b/apex/appsearch/framework/api/current.txt
@@ -7,6 +7,20 @@ package android.app.appsearch {
method public boolean isSuccess();
}
+ public class AppSearchManager {
+ method public void createSearchSession(@NonNull android.app.appsearch.AppSearchManager.SearchContext, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.appsearch.AppSearchResult<android.app.appsearch.AppSearchSession>>);
+ }
+
+ public static final class AppSearchManager.SearchContext {
+ method @NonNull public String getDatabaseName();
+ }
+
+ public static final class AppSearchManager.SearchContext.Builder {
+ ctor public AppSearchManager.SearchContext.Builder();
+ method @NonNull public android.app.appsearch.AppSearchManager.SearchContext build();
+ method @NonNull public android.app.appsearch.AppSearchManager.SearchContext.Builder setDatabaseName(@NonNull String);
+ }
+
public final class AppSearchResult<ValueType> {
method @Nullable public String getErrorMessage();
method public int getResultCode();
diff --git a/apex/appsearch/framework/api/system-current.txt b/apex/appsearch/framework/api/system-current.txt
index 4a6194e2915d..73a4a196b90a 100644
--- a/apex/appsearch/framework/api/system-current.txt
+++ b/apex/appsearch/framework/api/system-current.txt
@@ -1,9 +1,17 @@
// Signature format: 2.0
package android.app.appsearch {
+ public class AppSearchManager {
+ method public void createGlobalSearchSession(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.appsearch.AppSearchResult<android.app.appsearch.GlobalSearchSession>>);
+ }
+
public class AppSearchManagerFrameworkInitializer {
method public static void initialize();
}
+ public class GlobalSearchSession {
+ method @NonNull public android.app.appsearch.SearchResults query(@NonNull String, @NonNull android.app.appsearch.SearchSpec, @NonNull java.util.concurrent.Executor);
+ }
+
}
diff --git a/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java b/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java
index 442ca7b8639b..c82119d14670 100644
--- a/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java
+++ b/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java
@@ -17,6 +17,7 @@ package android.app.appsearch;
import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
+import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.content.Context;
import android.os.Bundle;
@@ -39,8 +40,6 @@ import java.util.function.Consumer;
*
* <p>Apps can index structured text documents with AppSearch, which can then be retrieved through
* the query API.
- *
- * @hide
*/
// TODO(b/148046169): This class header needs a detailed example/tutorial.
@SystemService(Context.APP_SEARCH_SERVICE)
@@ -92,7 +91,8 @@ public class AppSearchManager {
*
* <p>Database name cannot contain {@code '/'}.
*
- * <p>If not specified, defaults to {@link #DEFAULT_DATABASE_NAME}.
+ * <p>If not specified, defaults to the empty string.
+ *
* @param databaseName The name of the database.
* @throws IllegalArgumentException if the databaseName contains {@code '/'}.
*/
@@ -150,7 +150,9 @@ public class AppSearchManager {
* @param callback The {@link AppSearchResult}&lt;{@link GlobalSearchSession}&gt; of
* performing this operation. Or a {@link AppSearchResult} with failure
* reason code and error information.
+ * @hide
*/
+ @SystemApi
public void createGlobalSearchSession(
@NonNull @CallbackExecutor Executor executor,
@NonNull Consumer<AppSearchResult<GlobalSearchSession>> callback) {
@@ -300,6 +302,7 @@ public class AppSearchManager {
* @throws RuntimeException If an error occurred during the execution.
*
* @deprecated use {@link AppSearchSession#getByUri} instead.
+ * @hide
*/
public AppSearchBatchResult<String, GenericDocument> getByUri(
@NonNull GetByUriRequest request) {
@@ -443,6 +446,7 @@ public class AppSearchManager {
* @throws RuntimeException If an error occurred during the execution.
*
* @deprecated use {@link AppSearchSession#removeByUri} instead.
+ * @hide
*/
public AppSearchBatchResult<String, Void> removeByUri(@NonNull RemoveByUriRequest request) {
List<String> uris = new ArrayList<>(request.getUris());
diff --git a/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java b/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java
index 07938b704f11..1c56a9b643e7 100644
--- a/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java
+++ b/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java
@@ -19,6 +19,7 @@ package android.app.appsearch;
import android.annotation.CallbackExecutor;
import android.annotation.NonNull;
+import android.annotation.SystemApi;
import android.os.RemoteException;
import java.util.Objects;
@@ -31,6 +32,7 @@ import java.util.function.Consumer;
* <p>Apps can retrieve indexed documents through the query API.
* @hide
*/
+@SystemApi
public class GlobalSearchSession {
private final IAppSearchManager mService;
diff --git a/core/api/current.txt b/core/api/current.txt
index f303a56bdc28..e6585916521a 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -10246,6 +10246,7 @@ package android.content {
field public static final String ALARM_SERVICE = "alarm";
field public static final String APPWIDGET_SERVICE = "appwidget";
field public static final String APP_OPS_SERVICE = "appops";
+ field public static final String APP_SEARCH_SERVICE = "app_search";
field public static final String AUDIO_SERVICE = "audio";
field public static final String BATTERY_SERVICE = "batterymanager";
field public static final int BIND_ABOVE_CLIENT = 8; // 0x8
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index f3e1a87ea271..58e88869e52e 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -5225,7 +5225,6 @@ public abstract class Context {
* indexing and querying app data managed by the system.
*
* @see #getSystemService(String)
- * @hide
*/
public static final String APP_SEARCH_SERVICE = "app_search";