Switch setSchema API to be synchronous, based on discussion with API council.
Bug: 145635424
Test: Presubmit
Change-Id: I1419ca809eacea38bb8efd272771c0853d91efec
diff --git a/service/java/com/android/server/appsearch/AppSearchManagerService.java b/service/java/com/android/server/appsearch/AppSearchManagerService.java
index f8e010d..5d6d3f0 100644
--- a/service/java/com/android/server/appsearch/AppSearchManagerService.java
+++ b/service/java/com/android/server/appsearch/AppSearchManagerService.java
@@ -52,7 +52,7 @@
private class Stub extends IAppSearchManager.Stub {
@Override
- public void setSchema(byte[] schemaBytes, boolean force, AndroidFuture callback) {
+ public void setSchema(byte[] schemaBytes, boolean forceOverride, AndroidFuture callback) {
Preconditions.checkNotNull(schemaBytes);
Preconditions.checkNotNull(callback);
int callingUid = Binder.getCallingUidOrThrow();
@@ -61,7 +61,7 @@
try {
SchemaProto schema = SchemaProto.parseFrom(schemaBytes);
AppSearchImpl impl = ImplInstanceManager.getInstance(getContext(), callingUserId);
- impl.setSchema(callingUid, schema, force);
+ impl.setSchema(callingUid, schema, forceOverride);
callback.complete(null);
} catch (Throwable t) {
callback.completeExceptionally(t);
diff --git a/service/java/com/android/server/appsearch/impl/AppSearchImpl.java b/service/java/com/android/server/appsearch/impl/AppSearchImpl.java
index e69fc8a..177c910 100644
--- a/service/java/com/android/server/appsearch/impl/AppSearchImpl.java
+++ b/service/java/com/android/server/appsearch/impl/AppSearchImpl.java
@@ -45,10 +45,10 @@
*
* @param callingUid The uid of the app calling AppSearch.
* @param origSchema The schema to set for this app.
- * @param force Whether to force-apply the schema even if it is incompatible. Documents which do
- * not comply with the new schema will be deleted.
+ * @param forceOverride Whether to force-apply the schema even if it is incompatible. Documents
+ * which do not comply with the new schema will be deleted.
*/
- public void setSchema(int callingUid, @NonNull SchemaProto origSchema, boolean force) {
+ public void setSchema(int callingUid, @NonNull SchemaProto origSchema, boolean forceOverride) {
// Rewrite schema type names to include the calling app's package and uid.
String typePrefix = getTypePrefix(callingUid);
SchemaProto.Builder schemaBuilder = origSchema.toBuilder();