Update Framework from Jetpack.

Included changes:
* 509ebe: Rename getSchemasNotVisibleToSystemUi to setSchemaTypeDisplayedBySystem
* a532fe: Resolve merge conflicts from upstream sync.

Bug: 179143575
Bug: 175146044
Bug: 179160886
Bug: 175255572
Bug: 181887768
Test: Presubmit

Change-Id: I977baf47f6188e4c182a5cf96af4873d0e5284e0
diff --git a/framework/api/current.txt b/framework/api/current.txt
index 168c7c2..5ded446 100644
--- a/framework/api/current.txt
+++ b/framework/api/current.txt
@@ -207,7 +207,6 @@
 
   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 @@
     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 @@
   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 @@
     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/framework/java/android/app/appsearch/AppSearchManager.java b/framework/java/android/app/appsearch/AppSearchManager.java
index 6a5975e..da446bf 100644
--- a/framework/java/android/app/appsearch/AppSearchManager.java
+++ b/framework/java/android/app/appsearch/AppSearchManager.java
@@ -317,7 +317,7 @@
                     getPackageName(),
                     DEFAULT_DATABASE_NAME,
                     schemaBundles,
-                    new ArrayList<>(request.getSchemasNotVisibleToSystemUi()),
+                    new ArrayList<>(request.getSchemasNotDisplayedBySystem()),
                     /*schemasPackageAccessible=*/ Collections.emptyMap(),
                     request.isForceOverride(),
                     mContext.getUserId(),
diff --git a/framework/java/android/app/appsearch/AppSearchSession.java b/framework/java/android/app/appsearch/AppSearchSession.java
index 24cc60e..f379739 100644
--- a/framework/java/android/app/appsearch/AppSearchSession.java
+++ b/framework/java/android/app/appsearch/AppSearchSession.java
@@ -146,7 +146,7 @@
                     mPackageName,
                     mDatabaseName,
                     schemaBundles,
-                    new ArrayList<>(request.getSchemasNotVisibleToSystemUi()),
+                    new ArrayList<>(request.getSchemasNotDisplayedBySystem()),
                     schemasPackageAccessibleBundles,
                     request.isForceOverride(),
                     mUserId,
diff --git a/framework/java/android/app/appsearch/GlobalSearchSession.java b/framework/java/android/app/appsearch/GlobalSearchSession.java
index 8dd9dc1..fb63e16 100644
--- a/framework/java/android/app/appsearch/GlobalSearchSession.java
+++ b/framework/java/android/app/appsearch/GlobalSearchSession.java
@@ -96,7 +96,7 @@
      * 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/framework/java/android/app/appsearch/IAppSearchManager.aidl b/framework/java/android/app/appsearch/IAppSearchManager.aidl
index 68ae23f..ba27762 100644
--- a/framework/java/android/app/appsearch/IAppSearchManager.aidl
+++ b/framework/java/android/app/appsearch/IAppSearchManager.aidl
@@ -33,7 +33,7 @@
      * @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 @@
         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/framework/java/external/android/app/appsearch/GetByUriRequest.java b/framework/java/external/android/app/appsearch/GetByUriRequest.java
index c927e34..17266f8 100644
--- a/framework/java/external/android/app/appsearch/GetByUriRequest.java
+++ b/framework/java/external/android/app/appsearch/GetByUriRequest.java
@@ -166,29 +166,7 @@
          * 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/framework/java/external/android/app/appsearch/SearchResult.java b/framework/java/external/android/app/appsearch/SearchResult.java
index d792f45..f34034b 100644
--- a/framework/java/external/android/app/appsearch/SearchResult.java
+++ b/framework/java/external/android/app/appsearch/SearchResult.java
@@ -202,14 +202,6 @@
          */
         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 @@
             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 @@
         }
 
         /** 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 @@
             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/framework/java/external/android/app/appsearch/SearchSpec.java b/framework/java/external/android/app/appsearch/SearchSpec.java
index f72f8e1..7888c8d 100644
--- a/framework/java/external/android/app/appsearch/SearchSpec.java
+++ b/framework/java/external/android/app/appsearch/SearchSpec.java
@@ -535,28 +535,6 @@
          */
         @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/framework/java/external/android/app/appsearch/SetSchemaRequest.java b/framework/java/external/android/app/appsearch/SetSchemaRequest.java
index 426a903..c054063 100644
--- a/framework/java/external/android/app/appsearch/SetSchemaRequest.java
+++ b/framework/java/external/android/app/appsearch/SetSchemaRequest.java
@@ -71,19 +71,19 @@
  */
 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 @@
     }
 
     /**
+     * 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 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 @@
          *
          * <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 @@
         }
 
         /**
+         * 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 @@
             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 @@
 
             return new SetSchemaRequest(
                     mSchemas,
-                    mSchemasNotVisibleToSystemUi,
+                    mSchemasNotDisplayedBySystem,
                     mSchemasVisibleToPackages,
                     mMigrators,
                     mForceOverride);
diff --git a/service/java/com/android/server/appsearch/AppSearchManagerService.java b/service/java/com/android/server/appsearch/AppSearchManagerService.java
index a45fa39..8d6b9ef 100644
--- a/service/java/com/android/server/appsearch/AppSearchManagerService.java
+++ b/service/java/com/android/server/appsearch/AppSearchManagerService.java
@@ -89,7 +89,7 @@
                 @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,
@@ -125,7 +125,7 @@
                         packageName,
                         databaseName,
                         schemas,
-                        schemasNotPlatformSurfaceable,
+                        schemasNotDisplayedBySystem,
                         schemasPackageAccessible,
                         forceOverride);
                 invokeCallbackOnResult(
diff --git a/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java b/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java
index f422ebc..e9852aa 100644
--- a/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java
+++ b/service/java/com/android/server/appsearch/external/localstorage/converter/SearchResultToProtoConverter.java
@@ -113,8 +113,6 @@
         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/synced_jetpack_changeid.txt b/synced_jetpack_changeid.txt
index 2c9477a..41c70f0 100644
--- a/synced_jetpack_changeid.txt
+++ b/synced_jetpack_changeid.txt
@@ -1 +1 @@
-I593dfd22279739e5f578e07d36a55cf02ee942c5
+I42b89416968565ceb6483b400894f5b49524208c
diff --git a/testing/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java b/testing/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java
index 0fe4463..9e88373 100644
--- a/testing/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java
+++ b/testing/coretests/src/android/app/appsearch/external/app/SearchSpecTest.java
@@ -21,6 +21,8 @@
 
 import android.os.Bundle;
 
+import com.google.common.collect.ImmutableList;
+
 import org.junit.Test;
 
 import java.util.List;
@@ -67,9 +69,9 @@
         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/testing/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java b/testing/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java
index bf6b07f..677f4bd 100644
--- a/testing/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java
+++ b/testing/coretests/src/android/app/appsearch/external/app/SetSchemaRequestTest.java
@@ -42,13 +42,13 @@
     }
 
     @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 @@
     }
 
     @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/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java b/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java
index d912c08..440050f 100644
--- a/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java
+++ b/testing/java/com/android/server/appsearch/testing/external/GlobalSearchSessionShim.java
@@ -34,8 +34,8 @@
      * 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/testing/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java b/testing/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java
index 97daea3..0b1c120 100644
--- a/testing/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java
+++ b/testing/servicestests/src/com/android/server/appsearch/external/localstorage/converter/SnippetTest.java
@@ -67,7 +67,6 @@
                                         .setPropertyName(propertyKeyString)
                                         .addSnippetMatches(
                                                 SnippetMatchProto.newBuilder()
-                                                        .setValuesIndex(0)
                                                         .setExactMatchPosition(29)
                                                         .setExactMatchBytes(3)
                                                         .setWindowPosition(26)
@@ -174,7 +173,6 @@
                                         .setPropertyName("sender.name")
                                         .addSnippetMatches(
                                                 SnippetMatchProto.newBuilder()
-                                                        .setValuesIndex(0)
                                                         .setExactMatchPosition(0)
                                                         .setExactMatchBytes(4)
                                                         .setWindowPosition(0)
@@ -186,7 +184,6 @@
                                         .setPropertyName("sender.email")
                                         .addSnippetMatches(
                                                 SnippetMatchProto.newBuilder()
-                                                        .setValuesIndex(0)
                                                         .setExactMatchPosition(0)
                                                         .setExactMatchBytes(20)
                                                         .setWindowPosition(0)