Stop AppSearch CTS tests from using its hidden APIs.
Without this change we would not be able to change/remove those APIs in
future mainline updates.
The one removed testcase was testing a hidden builder API which
is only used in Jetpack on older devices and is not used in framework.
The testcase is moved to a unit test in our mts suite.
Bug: 186717514
Test: AppSearchCtsTests
Change-Id: I068b047be1e5fed4f706060066c436a27f19a1f7
diff --git a/tests/appsearch/Android.bp b/tests/appsearch/Android.bp
index e96ab82..a4e8950 100644
--- a/tests/appsearch/Android.bp
+++ b/tests/appsearch/Android.bp
@@ -19,11 +19,6 @@
android_test {
name: "CtsAppSearchTestCases",
defaults: ["cts_defaults"],
- sdk_version: "module_current",
- libs: [
- "framework-annotations-lib",
- "framework-appsearch.impl",
- ],
static_libs: [
"AppSearchTestUtils",
"androidx.test.ext.junit",
diff --git a/tests/appsearch/aidl/com/android/cts/appsearch/ICommandReceiver.aidl b/tests/appsearch/aidl/com/android/cts/appsearch/ICommandReceiver.aidl
index 655e955..25a202e 100644
--- a/tests/appsearch/aidl/com/android/cts/appsearch/ICommandReceiver.aidl
+++ b/tests/appsearch/aidl/com/android/cts/appsearch/ICommandReceiver.aidl
@@ -15,6 +15,7 @@
*/
package com.android.cts.appsearch;
+import android.os.Bundle;
import java.util.List;
interface ICommandReceiver {
@@ -30,4 +31,4 @@
in String id);
boolean clearData(in String databaseName);
-}
\ No newline at end of file
+}
diff --git a/tests/appsearch/src/com/android/cts/appsearch/external/app/GetSchemaResponseCtsTest.java b/tests/appsearch/src/com/android/cts/appsearch/external/app/GetSchemaResponseCtsTest.java
index c34164e..fc3a21a 100644
--- a/tests/appsearch/src/com/android/cts/appsearch/external/app/GetSchemaResponseCtsTest.java
+++ b/tests/appsearch/src/com/android/cts/appsearch/external/app/GetSchemaResponseCtsTest.java
@@ -18,8 +18,6 @@
import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assert.assertThrows;
-
import android.app.appsearch.AppSearchSchema;
import android.app.appsearch.GetSchemaResponse;
import android.app.appsearch.PackageIdentifier;
@@ -142,52 +140,6 @@
}
@Test
- public void testRebuild_noSupportedException() {
- AppSearchSchema schema1 =
- new AppSearchSchema.Builder("Email1")
- .addProperty(
- new AppSearchSchema.StringPropertyConfig.Builder("subject")
- .setCardinality(
- AppSearchSchema.PropertyConfig.CARDINALITY_OPTIONAL)
- .setIndexingType(
- AppSearchSchema.StringPropertyConfig
- .INDEXING_TYPE_PREFIXES)
- .setTokenizerType(
- AppSearchSchema.StringPropertyConfig
- .TOKENIZER_TYPE_PLAIN)
- .build())
- .build();
-
- GetSchemaResponse.Builder builder =
- new GetSchemaResponse.Builder(/*getVisibilitySettingSupported=*/ false)
- .setVersion(42)
- .addSchema(schema1);
-
- GetSchemaResponse original = builder.build();
- assertThrows(
- UnsupportedOperationException.class,
- () -> original.getSchemaTypesNotDisplayedBySystem());
- assertThrows(
- UnsupportedOperationException.class,
- () -> original.getSchemaTypesVisibleToPackages());
- assertThrows(
- UnsupportedOperationException.class,
- () -> original.getRequiredPermissionsForSchemaTypeVisibility());
-
- // rebuild will throw same exception
- GetSchemaResponse rebuild = builder.setVersion(42).build();
- assertThrows(
- UnsupportedOperationException.class,
- () -> rebuild.getSchemaTypesNotDisplayedBySystem());
- assertThrows(
- UnsupportedOperationException.class,
- () -> rebuild.getSchemaTypesVisibleToPackages());
- assertThrows(
- UnsupportedOperationException.class,
- () -> original.getRequiredPermissionsForSchemaTypeVisibility());
- }
-
- @Test
public void setVisibility() {
byte[] sha256cert1 = new byte[32];
byte[] sha256cert2 = new byte[32];