diff options
16 files changed, 79 insertions, 108 deletions
diff --git a/apex/appsearch/framework/api/current.txt b/apex/appsearch/framework/api/current.txt index 168c7c2f13cd..5ded446ff81a 100644 --- a/apex/appsearch/framework/api/current.txt +++ b/apex/appsearch/framework/api/current.txt @@ -207,7 +207,6 @@ package android.app.appsearch { public static final class GetByUriRequest.Builder { ctor public GetByUriRequest.Builder(); - method @NonNull public android.app.appsearch.GetByUriRequest.Builder addProjection(@NonNull String, @NonNull java.lang.String...); method @NonNull public android.app.appsearch.GetByUriRequest.Builder addProjection(@NonNull String, @NonNull java.util.Collection<java.lang.String>); method @NonNull public android.app.appsearch.GetByUriRequest.Builder addUris(@NonNull java.lang.String...); method @NonNull public android.app.appsearch.GetByUriRequest.Builder addUris(@NonNull java.util.Collection<java.lang.String>); @@ -323,7 +322,6 @@ package android.app.appsearch { method @NonNull public android.app.appsearch.SearchSpec.Builder addFilterPackageNames(@NonNull java.util.Collection<java.lang.String>); method @NonNull public android.app.appsearch.SearchSpec.Builder addFilterSchemas(@NonNull java.lang.String...); method @NonNull public android.app.appsearch.SearchSpec.Builder addFilterSchemas(@NonNull java.util.Collection<java.lang.String>); - method @NonNull public android.app.appsearch.SearchSpec.Builder addProjection(@NonNull String, @NonNull java.lang.String...); method @NonNull public android.app.appsearch.SearchSpec.Builder addProjection(@NonNull String, @NonNull java.util.Collection<java.lang.String>); method @NonNull public android.app.appsearch.SearchSpec build(); method @NonNull public android.app.appsearch.SearchSpec.Builder setMaxSnippetSize(@IntRange(from=0, to=android.app.appsearch.SearchSpec.MAX_SNIPPET_SIZE_LIMIT) int); @@ -338,7 +336,8 @@ package android.app.appsearch { public final class SetSchemaRequest { method @NonNull public java.util.Map<java.lang.String,android.app.appsearch.AppSearchSchema.Migrator> getMigrators(); method @NonNull public java.util.Set<android.app.appsearch.AppSearchSchema> getSchemas(); - method @NonNull public java.util.Set<java.lang.String> getSchemasNotVisibleToSystemUi(); + method @NonNull public java.util.Set<java.lang.String> getSchemasNotDisplayedBySystem(); + method @Deprecated @NonNull public java.util.Set<java.lang.String> getSchemasNotVisibleToSystemUi(); method @NonNull public java.util.Map<java.lang.String,java.util.Set<android.app.appsearch.PackageIdentifier>> getSchemasVisibleToPackages(); method public boolean isForceOverride(); } @@ -350,8 +349,9 @@ package android.app.appsearch { method @NonNull public android.app.appsearch.SetSchemaRequest build(); method @NonNull public android.app.appsearch.SetSchemaRequest.Builder setForceOverride(boolean); method @NonNull public android.app.appsearch.SetSchemaRequest.Builder setMigrator(@NonNull String, @NonNull android.app.appsearch.AppSearchSchema.Migrator); + method @NonNull public android.app.appsearch.SetSchemaRequest.Builder setSchemaTypeDisplayedBySystem(@NonNull String, boolean); method @NonNull public android.app.appsearch.SetSchemaRequest.Builder setSchemaTypeVisibilityForPackage(@NonNull String, boolean, @NonNull android.app.appsearch.PackageIdentifier); - method @NonNull public android.app.appsearch.SetSchemaRequest.Builder setSchemaTypeVisibilityForSystemUi(@NonNull String, boolean); + method @Deprecated @NonNull public android.app.appsearch.SetSchemaRequest.Builder setSchemaTypeVisibilityForSystemUi(@NonNull String, boolean); } public class SetSchemaResponse { diff --git a/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java b/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java index 6a5975ef7ff7..da446bf1e7c6 100644 --- a/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java +++ b/apex/appsearch/framework/java/android/app/appsearch/AppSearchManager.java @@ -317,7 +317,7 @@ public class AppSearchManager { getPackageName(), DEFAULT_DATABASE_NAME, schemaBundles, - new ArrayList<>(request.getSchemasNotVisibleToSystemUi()), + new ArrayList<>(request.getSchemasNotDisplayedBySystem()), /*schemasPackageAccessible=*/ Collections.emptyMap(), request.isForceOverride(), mContext.getUserId(), diff --git a/apex/appsearch/framework/java/android/app/appsearch/AppSearchSession.java b/apex/appsearch/framework/java/android/app/appsearch/AppSearchSession.java index 24cc60e5eef5..f379739a3778 100644 --- a/apex/appsearch/framework/java/android/app/appsearch/AppSearchSession.java +++ b/apex/appsearch/framework/java/android/app/appsearch/AppSearchSession.java @@ -146,7 +146,7 @@ public final class AppSearchSession implements Closeable { mPackageName, mDatabaseName, schemaBundles, - new ArrayList<>(request.getSchemasNotVisibleToSystemUi()), + new ArrayList<>(request.getSchemasNotDisplayedBySystem()), schemasPackageAccessibleBundles, request.isForceOverride(), mUserId, diff --git a/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java b/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java index 8dd9dc1be312..fb63e16aa6a8 100644 --- a/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java +++ b/apex/appsearch/framework/java/android/app/appsearch/GlobalSearchSession.java @@ -96,7 +96,7 @@ public class GlobalSearchSession implements Closeable { * SetSchemaRequest.Builder#setSchemaTypeVisibilityForPackage} when building a schema. * * <p>Document access can also be granted to system UIs by specifying {@link - * SetSchemaRequest.Builder#setSchemaTypeVisibilityForSystemUi} when building a schema. + * SetSchemaRequest.Builder#setSchemaTypeDisplayedBySystem} when building a schema. * * <p>See {@link AppSearchSession#search} for a detailed explanation on forming a query string. * diff --git a/apex/appsearch/framework/java/android/app/appsearch/IAppSearchManager.aidl b/apex/appsearch/framework/java/android/app/appsearch/IAppSearchManager.aidl index 68ae23f9a9db..ba27762c7dfb 100644 --- a/apex/appsearch/framework/java/android/app/appsearch/IAppSearchManager.aidl +++ b/apex/appsearch/framework/java/android/app/appsearch/IAppSearchManager.aidl @@ -33,7 +33,7 @@ interface IAppSearchManager { * @param packageName The name of the package that owns this schema. * @param databaseName The name of the database where this schema lives. * @param schemaBundles List of {@link AppSearchSchema} bundles. - * @param schemasNotPlatformSurfaceable Schema types that should not be surfaced on platform + * @param schemasNotDisplayedBySystem Schema types that should not be surfaced on platform * surfaces. * @param schemasPackageAccessibleBundles Schema types that are visible to the specified * packages. The value List contains PackageIdentifier Bundles. @@ -47,7 +47,7 @@ interface IAppSearchManager { in String packageName, in String databaseName, in List<Bundle> schemaBundles, - in List<String> schemasNotPlatformSurfaceable, + in List<String> schemasNotDisplayedBySystem, in Map<String, List<Bundle>> schemasPackageAccessibleBundles, boolean forceOverride, in int userId, diff --git a/apex/appsearch/framework/java/external/android/app/appsearch/GetByUriRequest.java b/apex/appsearch/framework/java/external/android/app/appsearch/GetByUriRequest.java index c927e3412cbc..17266f82b603 100644 --- a/apex/appsearch/framework/java/external/android/app/appsearch/GetByUriRequest.java +++ b/apex/appsearch/framework/java/external/android/app/appsearch/GetByUriRequest.java @@ -166,29 +166,7 @@ public final class GetByUriRequest { * all results, excepting any types that have their own, specific property paths set. * * @throws IllegalStateException if the builder has already been used. - * <p>{@see SearchSpec.Builder#addProjection(String, String...)} - */ - @NonNull - public Builder addProjection(@NonNull String schemaType, @NonNull String... propertyPaths) { - Preconditions.checkNotNull(propertyPaths); - return addProjection(schemaType, Arrays.asList(propertyPaths)); - } - - /** - * Adds property paths for the specified type to be used for projection. If property paths - * are added for a type, then only the properties referred to will be retrieved for results - * of that type. If a property path that is specified isn't present in a result, it will be - * ignored for that result. Property paths cannot be null. - * - * <p>If no property paths are added for a particular type, then all properties of results - * of that type will be retrieved. - * - * <p>If property path is added for the {@link - * GetByUriRequest#PROJECTION_SCHEMA_TYPE_WILDCARD}, then those property paths will apply to - * all results, excepting any types that have their own, specific property paths set. - * - * @throws IllegalStateException if the builder has already been used. - * <p>{@see SearchSpec.Builder#addProjection(String, String...)} + * @see SearchSpec.Builder#addProjection */ @NonNull public Builder addProjection( diff --git a/apex/appsearch/framework/java/external/android/app/appsearch/SearchResult.java b/apex/appsearch/framework/java/external/android/app/appsearch/SearchResult.java index d792f450bc05..f34034b1c5c0 100644 --- a/apex/appsearch/framework/java/external/android/app/appsearch/SearchResult.java +++ b/apex/appsearch/framework/java/external/android/app/appsearch/SearchResult.java @@ -202,14 +202,6 @@ public final class SearchResult { */ public static final String PROPERTY_PATH_FIELD = "propertyPath"; - /** - * The index of matching value in its property. A property may have multiple values. This - * index indicates which value is the match. - * - * @hide - */ - public static final String VALUES_INDEX_FIELD = "valuesIndex"; - /** @hide */ public static final String EXACT_MATCH_POSITION_LOWER_FIELD = "exactMatchPositionLower"; @@ -232,8 +224,7 @@ public final class SearchResult { mBundle = Preconditions.checkNotNull(bundle); Preconditions.checkNotNull(document); mPropertyPath = Preconditions.checkNotNull(bundle.getString(PROPERTY_PATH_FIELD)); - mFullText = - getPropertyValues(document, mPropertyPath, mBundle.getInt(VALUES_INDEX_FIELD)); + mFullText = getPropertyValues(document, mPropertyPath); } /** @@ -326,8 +317,7 @@ public final class SearchResult { } /** Extracts the matching string from the document. */ - private static String getPropertyValues( - GenericDocument document, String propertyName, int valueIndex) { + private static String getPropertyValues(GenericDocument document, String propertyName) { // In IcingLib snippeting is available for only 3 data types i.e String, double and // long, so we need to check which of these three are requested. // TODO (tytytyww): getPropertyStringArray takes property name, handle for property @@ -337,7 +327,9 @@ public final class SearchResult { if (values == null) { throw new IllegalStateException("No content found for requested property path!"); } - return values[valueIndex]; + + // TODO(b/175146044): Return the proper match based on the index in the propertyName. + return values[0]; } } diff --git a/apex/appsearch/framework/java/external/android/app/appsearch/SearchSpec.java b/apex/appsearch/framework/java/external/android/app/appsearch/SearchSpec.java index f72f8e1bbc5d..7888c8d78cd8 100644 --- a/apex/appsearch/framework/java/external/android/app/appsearch/SearchSpec.java +++ b/apex/appsearch/framework/java/external/android/app/appsearch/SearchSpec.java @@ -535,28 +535,6 @@ public final class SearchSpec { */ @NonNull public SearchSpec.Builder addProjection( - @NonNull String schema, @NonNull String... propertyPaths) { - Preconditions.checkNotNull(propertyPaths); - return addProjection(schema, Arrays.asList(propertyPaths)); - } - - /** - * Adds property paths for the specified type to be used for projection. If property paths - * are added for a type, then only the properties referred to will be retrieved for results - * of that type. If a property path that is specified isn't present in a result, it will be - * ignored for that result. Property paths cannot be null. - * - * <p>If no property paths are added for a particular type, then all properties of results - * of that type will be retrieved. - * - * <p>If property path is added for the {@link SearchSpec#PROJECTION_SCHEMA_TYPE_WILDCARD}, - * then those property paths will apply to all results, excepting any types that have their - * own, specific property paths set. - * - * <p>{@see SearchSpec.Builder#addProjection(String, String...)} - */ - @NonNull - public SearchSpec.Builder addProjection( @NonNull String schema, @NonNull Collection<String> propertyPaths) { Preconditions.checkState(!mBuilt, "Builder has already been used"); Preconditions.checkNotNull(schema); diff --git a/apex/appsearch/framework/java/external/android/app/appsearch/SetSchemaRequest.java b/apex/appsearch/framework/java/external/android/app/appsearch/SetSchemaRequest.java index 426a903981b3..c05406358995 100644 --- a/apex/appsearch/framework/java/external/android/app/appsearch/SetSchemaRequest.java +++ b/apex/appsearch/framework/java/external/android/app/appsearch/SetSchemaRequest.java @@ -71,19 +71,19 @@ import java.util.Set; */ public final class SetSchemaRequest { private final Set<AppSearchSchema> mSchemas; - private final Set<String> mSchemasNotVisibleToSystemUi; + private final Set<String> mSchemasNotDisplayedBySystem; private final Map<String, Set<PackageIdentifier>> mSchemasVisibleToPackages; private final Map<String, AppSearchSchema.Migrator> mMigrators; private final boolean mForceOverride; SetSchemaRequest( @NonNull Set<AppSearchSchema> schemas, - @NonNull Set<String> schemasNotVisibleToSystemUi, + @NonNull Set<String> schemasNotDisplayedBySystem, @NonNull Map<String, Set<PackageIdentifier>> schemasVisibleToPackages, @NonNull Map<String, AppSearchSchema.Migrator> migrators, boolean forceOverride) { mSchemas = Preconditions.checkNotNull(schemas); - mSchemasNotVisibleToSystemUi = Preconditions.checkNotNull(schemasNotVisibleToSystemUi); + mSchemasNotDisplayedBySystem = Preconditions.checkNotNull(schemasNotDisplayedBySystem); mSchemasVisibleToPackages = Preconditions.checkNotNull(schemasVisibleToPackages); mMigrators = Preconditions.checkNotNull(migrators); mForceOverride = forceOverride; @@ -96,12 +96,22 @@ public final class SetSchemaRequest { } /** + * TODO(b/181887768): This method exists only for dogfooder transition and must be removed. + * @deprecated This method exists only for dogfooder transition and must be removed. + */ + @Deprecated + @NonNull + public Set<String> getSchemasNotVisibleToSystemUi() { + return getSchemasNotDisplayedBySystem(); + } + + /** * Returns all the schema types that are opted out of being displayed and visible on any system * UI surface. */ @NonNull - public Set<String> getSchemasNotVisibleToSystemUi() { - return Collections.unmodifiableSet(mSchemasNotVisibleToSystemUi); + public Set<String> getSchemasNotDisplayedBySystem() { + return Collections.unmodifiableSet(mSchemasNotDisplayedBySystem); } /** @@ -151,7 +161,7 @@ public final class SetSchemaRequest { */ public static final class Builder { private final Set<AppSearchSchema> mSchemas = new ArraySet<>(); - private final Set<String> mSchemasNotVisibleToSystemUi = new ArraySet<>(); + private final Set<String> mSchemasNotDisplayedBySystem = new ArraySet<>(); private final Map<String, Set<PackageIdentifier>> mSchemasVisibleToPackages = new ArrayMap<>(); private final Map<String, AppSearchSchema.Migrator> mMigrators = new ArrayMap<>(); @@ -163,6 +173,8 @@ public final class SetSchemaRequest { * * <p>An {@link AppSearchSchema} object represents one type of structured data. * + * <p>Any documents of these types will be displayed on system UI surfaces by default. + * * @throws IllegalStateException if the builder has already been used. */ @NonNull @@ -187,30 +199,43 @@ public final class SetSchemaRequest { } /** + * TODO(b/181887768): This method exists only for dogfooder transition and must be removed. + * @deprecated This method exists only for dogfooder transition and must be removed. + */ + @Deprecated + @NonNull + public Builder setSchemaTypeVisibilityForSystemUi( + @NonNull String schemaType, boolean displayed) { + return setSchemaTypeDisplayedBySystem(schemaType, displayed); + } + + /** * Sets whether or not documents from the provided {@code schemaType} will be displayed and * visible on any system UI surface. * * <p>This setting applies to the provided {@code schemaType} only, and does not persist * across {@link AppSearchSession#setSchema} calls. * - * <p>By default, documents are displayed and visible on system UI surfaces. + * <p>The default behavior, if this method is not called, is to allow types to be displayed + * on system UI surfaces. * - * @param schemaType The schema type to set visibility on. - * @param visible Whether the {@code schemaType} will be visible or not. + * @param schemaType The name of an {@link AppSearchSchema} within the same {@link + * SetSchemaRequest}, which will be configured. + * @param displayed Whether documents of this type will be displayed on system UI surfaces. * @throws IllegalStateException if the builder has already been used. */ - // Merged list available from getSchemasNotVisibleToSystemUi + // Merged list available from getSchemasNotDisplayedBySystem @SuppressLint("MissingGetterMatchingBuilder") @NonNull - public Builder setSchemaTypeVisibilityForSystemUi( - @NonNull String schemaType, boolean visible) { + public Builder setSchemaTypeDisplayedBySystem( + @NonNull String schemaType, boolean displayed) { Preconditions.checkNotNull(schemaType); Preconditions.checkState(!mBuilt, "Builder has already been used"); - if (visible) { - mSchemasNotVisibleToSystemUi.remove(schemaType); + if (displayed) { + mSchemasNotDisplayedBySystem.remove(schemaType); } else { - mSchemasNotVisibleToSystemUi.add(schemaType); + mSchemasNotDisplayedBySystem.add(schemaType); } return this; } @@ -315,9 +340,10 @@ public final class SetSchemaRequest { Preconditions.checkState(!mBuilt, "Builder has already been used"); mBuilt = true; - // Verify that any schema types with visibility settings refer to a real schema. + // Verify that any schema types with display or visibility settings refer to a real + // schema. // Create a copy because we're going to remove from the set for verification purposes. - Set<String> referencedSchemas = new ArraySet<>(mSchemasNotVisibleToSystemUi); + Set<String> referencedSchemas = new ArraySet<>(mSchemasNotDisplayedBySystem); referencedSchemas.addAll(mSchemasVisibleToPackages.keySet()); for (AppSearchSchema schema : mSchemas) { @@ -332,7 +358,7 @@ public final class SetSchemaRequest { return new SetSchemaRequest( mSchemas, - mSchemasNotVisibleToSystemUi, + mSchemasNotDisplayedBySystem, mSchemasVisibleToPackages, mMigrators, mForceOverride); diff --git a/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java b/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java index 68c906948f12..27c9ccb2cca6 100644 --- a/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java +++ b/apex/appsearch/service/java/com/android/server/appsearch/AppSearchManagerService.java @@ -89,7 +89,7 @@ public class AppSearchManagerService extends SystemService { @NonNull String packageName, @NonNull String databaseName, @NonNull List<Bundle> schemaBundles, - @NonNull List<String> schemasNotPlatformSurfaceable, + @NonNull List<String> schemasNotDisplayedBySystem, @NonNull Map<String, List<Bundle>> schemasPackageAccessibleBundles, boolean forceOverride, @UserIdInt int userId, @@ -124,7 +124,7 @@ public class AppSearchManagerService extends SystemService { packageName, databaseName, schemas, - schemasNotPlatformSurfaceable, + schemasNotDisplayedBySystem, schemasPackageAccessible, forceOverride); invokeCallbackOnResult( diff --git a/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java b/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java index f422ebc2db7b..e9852aa1cd41 100644 --- a/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java +++ b/apex/appsearch/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java @@ -113,8 +113,6 @@ public class SearchResultToProtoConverter { Bundle bundle = new Bundle(); bundle.putString(SearchResult.MatchInfo.PROPERTY_PATH_FIELD, propertyPath); bundle.putInt( - SearchResult.MatchInfo.VALUES_INDEX_FIELD, snippetMatchProto.getValuesIndex()); - bundle.putInt( SearchResult.MatchInfo.EXACT_MATCH_POSITION_LOWER_FIELD, snippetMatchProto.getExactMatchPosition()); bundle.putInt( diff --git a/apex/appsearch/synced_jetpack_changeid.txt b/apex/appsearch/synced_jetpack_changeid.txt index 2c9477a5d76b..41c70f072262 100644 --- a/apex/appsearch/synced_jetpack_changeid.txt +++ b/apex/appsearch/synced_jetpack_changeid.txt @@ -1 +1 @@ -I593dfd22279739e5f578e07d36a55cf02ee942c5 +I42b89416968565ceb6483b400894f5b49524208c diff --git a/apex/appsearch/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java b/apex/appsearch/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java index d912c08e7d5f..440050faaa7d 100644 --- a/apex/appsearch/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java +++ b/apex/appsearch/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java @@ -34,8 +34,8 @@ public interface GlobalSearchSessionShim extends Closeable { * SetSchemaRequest.Builder#setDocumentClassVisibilityForPackage} when building a schema. * * <p>Document access can also be granted to system UIs by specifying {@link - * SetSchemaRequest.Builder#setSchemaTypeVisibilityForSystemUi}, or {@link - * SetSchemaRequest.Builder#setDocumentClassVisibilityForSystemUi} when building a schema. + * SetSchemaRequest.Builder#setSchemaTypeDisplayedBySystem}, or {@link + * SetSchemaRequest.Builder#setDocumentClassDisplayedBySystem} when building a schema. * * <p>See {@link AppSearchSessionShim#search} for a detailed explanation on forming a query * string. diff --git a/core/tests/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java b/core/tests/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java index 0fe44630f308..9e8837386128 100644 --- a/core/tests/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java +++ b/core/tests/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java @@ -21,6 +21,8 @@ import static com.google.common.truth.Truth.assertThat; import android.os.Bundle; +import com.google.common.collect.ImmutableList; + import org.junit.Test; import java.util.List; @@ -67,9 +69,9 @@ public class SearchSpecTest { SearchSpec searchSpec = new SearchSpec.Builder() .setTermMatch(SearchSpec.TERM_MATCH_PREFIX) - .addProjection("TypeA", "field1", "field2.subfield2") - .addProjection("TypeB", "field7") - .addProjection("TypeC") + .addProjection("TypeA", ImmutableList.of("field1", "field2.subfield2")) + .addProjection("TypeB", ImmutableList.of("field7")) + .addProjection("TypeC", ImmutableList.of()) .build(); Map<String, List<String>> typePropertyPathMap = searchSpec.getProjections(); diff --git a/core/tests/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java b/core/tests/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java index bf6b07f71839..677f4bd9e46d 100644 --- a/core/tests/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java +++ b/core/tests/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java @@ -42,13 +42,13 @@ public class SetSchemaRequestTest { } @Test - public void testInvalidSchemaReferences_fromSystemUiVisibility() { + public void testInvalidSchemaReferences_fromDisplayedBySystem() { IllegalArgumentException expected = expectThrows( IllegalArgumentException.class, () -> new SetSchemaRequest.Builder() - .setSchemaTypeVisibilityForSystemUi("InvalidSchema", false) + .setSchemaTypeDisplayedBySystem("InvalidSchema", false) .build()); assertThat(expected).hasMessageThat().contains("referenced, but were not added"); } @@ -71,30 +71,30 @@ public class SetSchemaRequestTest { } @Test - public void testSchemaTypeVisibilityForSystemUi_visible() { + public void testSetSchemaTypeDisplayedBySystem_displayed() { AppSearchSchema schema = new AppSearchSchema.Builder("Schema").build(); - // By default, the schema is visible. + // By default, the schema is displayed. SetSchemaRequest request = new SetSchemaRequest.Builder().addSchemas(schema).build(); - assertThat(request.getSchemasNotVisibleToSystemUi()).isEmpty(); + assertThat(request.getSchemasNotDisplayedBySystem()).isEmpty(); request = new SetSchemaRequest.Builder() .addSchemas(schema) - .setSchemaTypeVisibilityForSystemUi("Schema", true) + .setSchemaTypeDisplayedBySystem("Schema", true) .build(); - assertThat(request.getSchemasNotVisibleToSystemUi()).isEmpty(); + assertThat(request.getSchemasNotDisplayedBySystem()).isEmpty(); } @Test - public void testSchemaTypeVisibilityForSystemUi_notVisible() { + public void testSetSchemaTypeDisplayedBySystem_notDisplayed() { AppSearchSchema schema = new AppSearchSchema.Builder("Schema").build(); SetSchemaRequest request = new SetSchemaRequest.Builder() .addSchemas(schema) - .setSchemaTypeVisibilityForSystemUi("Schema", false) + .setSchemaTypeDisplayedBySystem("Schema", false) .build(); - assertThat(request.getSchemasNotVisibleToSystemUi()).containsExactly("Schema"); + assertThat(request.getSchemasNotDisplayedBySystem()).containsExactly("Schema"); } @Test diff --git a/services/tests/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java b/services/tests/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java index 97daea3011ea..0b1c120d8a1e 100644 --- a/services/tests/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java +++ b/services/tests/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java @@ -67,7 +67,6 @@ public class SnippetTest { .setPropertyName(propertyKeyString) .addSnippetMatches( SnippetMatchProto.newBuilder() - .setValuesIndex(0) .setExactMatchPosition(29) .setExactMatchBytes(3) .setWindowPosition(26) @@ -174,7 +173,6 @@ public class SnippetTest { .setPropertyName("sender.name") .addSnippetMatches( SnippetMatchProto.newBuilder() - .setValuesIndex(0) .setExactMatchPosition(0) .setExactMatchBytes(4) .setWindowPosition(0) @@ -186,7 +184,6 @@ public class SnippetTest { .setPropertyName("sender.email") .addSnippetMatches( SnippetMatchProto.newBuilder() - .setValuesIndex(0) .setExactMatchPosition(0) .setExactMatchBytes(20) .setWindowPosition(0) |