Merge "Add a regression test on WebView" into rvc-dev
diff --git a/apps/CameraITS/tests/scene3/scene3.pdf b/apps/CameraITS/tests/scene3/scene3.pdf
index 4c787b1..0db93f8 100644
--- a/apps/CameraITS/tests/scene3/scene3.pdf
+++ b/apps/CameraITS/tests/scene3/scene3.pdf
Binary files differ
diff --git a/hostsidetests/adb/Android.mk b/hostsidetests/adb/Android.mk
new file mode 100644
index 0000000..292bc18
--- /dev/null
+++ b/hostsidetests/adb/Android.mk
@@ -0,0 +1,12 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_COMPATIBILITY_SUITE := cts vts10 general-tests
+LOCAL_CTS_TEST_PACKAGE := android.host.adb
+LOCAL_MODULE := CtsAdbHostTestCases
+LOCAL_MODULE_CLASS := JAVA_LIBRARIES
+LOCAL_MODULE_TAGS := optional
+LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
+LOCAL_JAVA_RESOURCE_FILES := $(HOST_OUT_EXECUTABLES)/check_ms_os_desc
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/adb/AndroidTest.xml b/hostsidetests/adb/AndroidTest.xml
new file mode 100755
index 0000000..46fcc98
--- /dev/null
+++ b/hostsidetests/adb/AndroidTest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration description="Config for the CTS adb host tests">
+ <option name="test-suite-tag" value="cts" />
+ <option name="config-descriptor:metadata" key="component" value="bionic" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsAdbHostTestCases.jar" />
+ </test>
+</configuration>
diff --git a/hostsidetests/adb/OWNERS b/hostsidetests/adb/OWNERS
new file mode 100644
index 0000000..7529cb9
--- /dev/null
+++ b/hostsidetests/adb/OWNERS
@@ -0,0 +1 @@
+include platform/system/core:/janitors/OWNERS
diff --git a/hostsidetests/adb/src/android/adb/cts/AdbHostTest.java b/hostsidetests/adb/src/android/adb/cts/AdbHostTest.java
new file mode 100644
index 0000000..f388cc3
--- /dev/null
+++ b/hostsidetests/adb/src/android/adb/cts/AdbHostTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.adb.cts;
+
+import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IDeviceTest;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class AdbHostTest extends DeviceTestCase implements IDeviceTest {
+ // TODO: there are too many copies of this in CTS!
+ public static File copyResourceToTempFile(String resName) throws IOException {
+ InputStream is = AdbHostTest.class.getResourceAsStream(resName);
+ File tf = File.createTempFile("AdbHostTest", ".tmp");
+ FileOutputStream os = new FileOutputStream(tf);
+ byte[] buf = new byte[8192];
+ int length;
+ while ((length = is.read(buf)) != -1) {
+ os.write(buf, 0, length);
+ }
+ os.flush();
+ os.close();
+ tf.deleteOnExit();
+ return tf;
+ }
+
+ public void testHasMsOsDescriptors() throws Exception {
+ File check_ms_os_desc = copyResourceToTempFile("/check_ms_os_desc");
+ check_ms_os_desc.setExecutable(true);
+
+ // ANDROID_SERIAL is already set correctly in our environment.
+ ProcessBuilder pb = new ProcessBuilder(check_ms_os_desc.getAbsolutePath());
+ pb.redirectOutput(ProcessBuilder.Redirect.PIPE);
+ pb.redirectErrorStream(true);
+ Process p = pb.start();
+ int result = p.waitFor();
+ BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+ String line;
+ StringBuilder output = new StringBuilder();
+ while ((line = br.readLine()) != null) {
+ output.append(line + "\n");
+ }
+ assertTrue("check_ms_os_desc failed:\n" + output, result == 0);
+ }
+}
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgrade.apk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgrade.apk
index 543f310..3360f07 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgrade.apk
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgrade.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgrade.apk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgrade.apk
index c801897..0996efe 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgrade.apk
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgrade.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/src/com/android/cts/storagestatsapp/StorageStatsTest.java b/hostsidetests/appsecurity/test-apps/StorageStatsApp/src/com/android/cts/storagestatsapp/StorageStatsTest.java
index b1d07e2..1e57012 100644
--- a/hostsidetests/appsecurity/test-apps/StorageStatsApp/src/com/android/cts/storagestatsapp/StorageStatsTest.java
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/src/com/android/cts/storagestatsapp/StorageStatsTest.java
@@ -50,6 +50,7 @@
import android.os.Environment;
import android.os.UserHandle;
import android.os.storage.StorageManager;
+import android.provider.MediaStore;
import android.support.test.uiautomator.UiDevice;
import android.test.InstrumentationTestCase;
import android.util.Log;
@@ -196,6 +197,8 @@
// Rename to ensure that stats are updated
video.renameTo(new File(dir, System.nanoTime() + ".PnG"));
+ MediaStore.waitForIdle(getContext().getContentResolver());
+
final ExternalStorageStats afterRename = stats.queryExternalStatsForUser(UUID_DEFAULT, user);
assertMostlyEquals(17 * MB_IN_BYTES, afterRename.getTotalBytes() - before.getTotalBytes());
diff --git a/hostsidetests/graphics/gpuprofiling/app/Android.bp b/hostsidetests/graphics/gpuprofiling/app/Android.bp
index 134e0cc..6c05ece 100644
--- a/hostsidetests/graphics/gpuprofiling/app/Android.bp
+++ b/hostsidetests/graphics/gpuprofiling/app/Android.bp
@@ -17,6 +17,7 @@
srcs: [
"android_graphics_cts_GpuProfilingData.cpp",
],
+ test_suites: ["cts"],
compile_multilib: "both",
multilib: {
lib32: {
diff --git a/hostsidetests/securitybulletin/AndroidTest.xml b/hostsidetests/securitybulletin/AndroidTest.xml
index 42b22c9..1276523 100644
--- a/hostsidetests/securitybulletin/AndroidTest.xml
+++ b/hostsidetests/securitybulletin/AndroidTest.xml
@@ -188,7 +188,6 @@
<!--__________________-->
<!-- Bulletin 2018-11 -->
<!-- Please add tests solely from this bulletin below to avoid merge conflict -->
- <option name="push" value="CVE-2018-9536->/data/local/tmp/CVE-2018-9536" />
<option name="push" value="CVE-2018-9539->/data/local/tmp/CVE-2018-9539" />
<!--__________________-->
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9536/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9536/Android.bp
deleted file mode 100644
index 16f9474..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9536/Android.bp
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2020 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-cc_test {
- name: "CVE-2018-9536",
- defaults: ["cts_hostsidetests_securitybulletin_defaults"],
- srcs: ["poc.cpp"],
- include_dirs: [
- "external/aac/libFDK/include",
- "external/aac/libSYS/include",
- "cts/hostsidetests/securitybulletin/securityPatch/includes",
- ],
- shared_libs: [
- "libbluetooth"
- ],
-}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9536/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9536/poc.cpp
deleted file mode 100644
index 47d20e6..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9536/poc.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <dirent.h>
-#include <dlfcn.h>
-#include <signal.h>
-#include <string>
-#include <common.h>
-#include <FDK_bitbuffer.h>
-#define MAX_PATH_LENGTH 1035
-
-int main() {
- FILE *fp;
- char path[MAX_PATH_LENGTH];
- void *libHandle;
- static int (*real_FDK_getBitCnt)(HANDLE_FDK_BITBUF) = NULL;
- fp = popen("find / -name libbluetooth.so 2>/dev/null ", "r");
- if (fp == NULL) {
- return EXIT_SUCCESS;
- }
- while (fgets(path, sizeof(path) - 1, fp) != NULL) {
- path[strlen(path) - 1] = '\0'; /* remove \n */
-
- libHandle = dlopen(path, RTLD_LAZY);
- if (libHandle) {
- real_FDK_getBitCnt = (int (*)(
- HANDLE_FDK_BITBUF))dlsym(libHandle, "FDK_getBitCnt");
- dlclose(libHandle);
- if (real_FDK_getBitCnt) {
- pclose(fp);
- /* The symbol of function is present, it means there is no fix patch */
- return EXIT_VULNERABLE;
- }
- }
- }
- pclose(fp);
- return EXIT_SUCCESS;
-}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
index c4ae6b5..03a49b7 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
@@ -46,15 +46,6 @@
* existing test methods
******************************************************************************/
- /**
- * b/112662184
- * Vulnerability Behaviour: EXIT_VULNERABLE (113)
- **/
- @SecurityTest(minPatchLevel = "2018-11")
- @Test
- public void testPocCVE_2018_9536() throws Exception {
- AdbUtils.runPocAssertExitStatusNotVulnerable("CVE-2018-9536", getDevice(), 60);
- }
/******************************************************************************
* To prevent merge conflicts, add tests for Q below this comment, before any
diff --git a/hostsidetests/stagedinstall/Android.bp b/hostsidetests/stagedinstall/Android.bp
index 96ab887..75ea48e 100644
--- a/hostsidetests/stagedinstall/Android.bp
+++ b/hostsidetests/stagedinstall/Android.bp
@@ -62,6 +62,8 @@
":StagedInstallTestAppSamePackageNameAsApex",
":StagedInstallTestApexV2_SdkTargetP",
":StagedInstallTestCorruptedApex_b146895998",
+ ":StagedInstallTestApexV2_NoApkSignature",
+ ":StagedInstallTestApexV2_UnsignedPayload",
],
static_libs: [
"androidx.test.runner",
@@ -448,3 +450,43 @@
filename: "corrupted_b146895998.apex",
installable: false,
}
+
+prebuilt_apex {
+ name: "StagedInstallTestApexV2_NoApkSignature",
+ arch: {
+ arm: {
+ src: "testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_apk_container.apex",
+ },
+ arm64: {
+ src: "testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_apk_container.apex",
+ },
+ x86: {
+ src: "testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_apk_container.apex",
+ },
+ x86_64: {
+ src: "testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_apk_container.apex",
+ },
+ },
+ filename: "com.android.apex.cts.shim.v2_unsigned_apk_container.apex",
+ installable: false,
+}
+
+prebuilt_apex {
+ name: "StagedInstallTestApexV2_UnsignedPayload",
+ arch: {
+ arm: {
+ src: "testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_payload.apex",
+ },
+ arm64: {
+ src: "testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_payload.apex",
+ },
+ x86: {
+ src: "testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_payload.apex",
+ },
+ x86_64: {
+ src: "testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_payload.apex",
+ },
+ },
+ filename: "com.android.apex.cts.shim.v2_unsigned_payload.apex",
+ installable: false,
+}
diff --git a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
index c5c3a09..4f5b06c 100644
--- a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
@@ -147,6 +147,13 @@
/*isApex*/true, "com.android.apex.cts.shim.v2_sdk_target_p.apex");
private static final TestApp CorruptedApex_b146895998 = new TestApp(
"StagedInstallTestCorruptedApex_b146895998", "", 1, true, "corrupted_b146895998.apex");
+ private static final TestApp Apex2NoApkSignature = new TestApp(
+ "StagedInstallTestApexV2_NoApkSignature", SHIM_PACKAGE_NAME, 1,
+ /*isApex*/true, "com.android.apex.cts.shim.v2_unsigned_apk_container.apex");
+ private static final TestApp Apex2UnsignedPayload = new TestApp(
+ "StagedInstallTestApexV2_UnsignedPayload", SHIM_PACKAGE_NAME, 1,
+ /*isApex*/true, "com.android.apex.cts.shim.v2_unsigned_payload.apex");
+
@Before
public void adoptShellPermissions() {
InstrumentationRegistry
@@ -1070,6 +1077,27 @@
assertThat(sessionInfo).isStagedSessionFailed();
}
+ /**
+ * Should fail to pass apk signature check
+ */
+ @Test
+ public void testApexWithUnsignedApkFailsVerification() throws Exception {
+ assertThat(stageSingleApk(Apex2NoApkSignature).getErrorMessage())
+ .contains("INSTALL_PARSE_FAILED_NO_CERTIFICATES");
+ }
+
+ /**
+ * Should fail to verify apex with unsigned payload
+ */
+ @Test
+ public void testApexWithUnsignedPayloadFailsVerification() throws Exception {
+ int sessionId = stageSingleApk(Apex2UnsignedPayload).assertSuccessful().getSessionId();
+ PackageInstaller.SessionInfo sessionInfo = waitForBroadcast(sessionId);
+ assertThat(sessionInfo).isStagedSessionFailed();
+ assertThat(sessionInfo.getStagedSessionErrorMessage())
+ .contains("AVB footer verification failed");
+ }
+
private static long getInstalledVersion(String packageName) {
Context context = InstrumentationRegistry.getInstrumentation().getContext();
PackageManager pm = context.getPackageManager();
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
index 5054be4..91e83b2 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
@@ -537,6 +537,22 @@
runPhase("testCorruptedApexFailsVerification_b146895998");
}
+ /**
+ * Should fail to pass apk signature check
+ */
+ @Test
+ public void testApexWithUnsignedApkFailsVerification() throws Exception {
+ runPhase("testApexWithUnsignedApkFailsVerification");
+ }
+
+ /**
+ * Should fail to verify apex with unsigned payload
+ */
+ @Test
+ public void testApexWithUnsignedPayloadFailsVerification() throws Exception {
+ runPhase("testApexWithUnsignedPayloadFailsVerification");
+ }
+
private boolean isUpdatingApexSupported() throws Exception {
final String updatable = getDevice().getProperty("ro.apex.updatable");
return updatable != null && updatable.equals("true");
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v1.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v1.apex
index 0a77a65..093770b 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v1.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v1.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2.apex
index 30f0e61..b45c93a 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_file.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_file.apex
index cdbd503..2c7fb51 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_file.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_file.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_folder.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_folder.apex
index b4a2d37..4829ab7 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_folder.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_additional_folder.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p.apex
new file mode 100644
index 0000000..8f18159
--- /dev/null
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_certificate.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_certificate.apex
index 5970eb9..15c9ebf 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_certificate.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_certificate.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_package_name.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_package_name.apex
index 8300cd7..027cc9f 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_package_name.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_different_package_name.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_no_hashtree.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_no_hashtree.apex
index 99c1d2e..88f4355 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_no_hashtree.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_no_hashtree.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_sdk_target_p.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_sdk_target_p.apex
index 7c147ad..4b4bc9c 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_sdk_target_p.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_sdk_target_p.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob.apex
index 3b0e8c3..db36942 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot.apex
index 45480c1..94726c8 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
index e8bf987..59f3c88 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_apk_container.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_apk_container.apex
new file mode 100644
index 0000000..1187674
--- /dev/null
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_apk_container.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_payload.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_payload.apex
new file mode 100644
index 0000000..f6f8719
--- /dev/null
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_unsigned_payload.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_post_install_hook.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_post_install_hook.apex
index 8b20f9d..d04bf00a 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_post_install_hook.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_post_install_hook.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_pre_install_hook.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
index 454002d..9b418a0 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_wrong_sha.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_wrong_sha.apex
index 8e64b73..cee12d8 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_wrong_sha.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v2_wrong_sha.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3.apex
index acf3be2..73320d5 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob.apex
index b7a2d02..0358430 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob_rot.apex b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob_rot.apex
index 07e3977..4b467f7 100644
--- a/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob_rot.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/arm/com.android.apex.cts.shim.v3_signed_bob_rot.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v1.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v1.apex
index 0a6ec9b..085c1a9 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v1.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v1.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2.apex
index c9555a4..9ead68e 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_file.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_file.apex
index c6f6730..2c7fb51 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_file.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_file.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_folder.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_folder.apex
index cb40709..4829ab7 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_folder.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_additional_folder.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p.apex
new file mode 100644
index 0000000..8f18159
--- /dev/null
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_apk_in_apex_sdk_target_p.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_certificate.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_certificate.apex
index 061f00d..15c9ebf 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_certificate.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_certificate.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_package_name.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_package_name.apex
index 89d687d..75efea3 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_package_name.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_different_package_name.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_no_hashtree.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_no_hashtree.apex
index c505cab..61e6bff 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_no_hashtree.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_no_hashtree.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_sdk_target_p.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_sdk_target_p.apex
index 961021f..4e28d6a 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_sdk_target_p.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_sdk_target_p.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob.apex
index 482d3d8..a084b94 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot.apex
index c461d9f..b8badc5 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
index cfdc9f0..0cced96 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_apk_container.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_apk_container.apex
new file mode 100644
index 0000000..5962142
--- /dev/null
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_apk_container.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_payload.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_payload.apex
new file mode 100644
index 0000000..17f4d68
--- /dev/null
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_unsigned_payload.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_post_install_hook.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_post_install_hook.apex
index 9f22e23..d04bf00a 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_post_install_hook.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_post_install_hook.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_pre_install_hook.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
index 6300caf..9b418a0 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_wrong_sha.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_wrong_sha.apex
index 02dec8a..cee12d8 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_wrong_sha.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v2_wrong_sha.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3.apex
index 030e57d..03f1ecb 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob.apex
index 3957085..3113f25 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob_rot.apex b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob_rot.apex
index 017096e..8c911bb 100644
--- a/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob_rot.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/x86/com.android.apex.cts.shim.v3_signed_bob_rot.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/arm/CtsShimTargetPSdk.apk b/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/arm/CtsShimTargetPSdk.apk
index 065528c..5cd12d2 100644
--- a/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/arm/CtsShimTargetPSdk.apk
+++ b/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/arm/CtsShimTargetPSdk.apk
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/x86/CtsShimTargetPSdk.apk b/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/x86/CtsShimTargetPSdk.apk
index 065528c..5cd12d2 100644
--- a/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/x86/CtsShimTargetPSdk.apk
+++ b/hostsidetests/stagedinstall/testdata/apk/CtsShimTargetPSdk/x86/CtsShimTargetPSdk.apk
Binary files differ
diff --git a/hostsidetests/statsd/src/android/cts/statsd/validation/ProcStatsValidationTests.java b/hostsidetests/statsd/src/android/cts/statsd/validation/ProcStatsValidationTests.java
index 1f564ca..bd14fa4 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/validation/ProcStatsValidationTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/validation/ProcStatsValidationTests.java
@@ -238,7 +238,7 @@
assertThat(statsdData).isNotEmpty();
assertThat(
statsdData.get(0).getProcStatsPkgProc().getProcStatsSection()
- .getPackageStatsList()
+ .getProcessStatsList()
).isNotEmpty();
// We pull directly from ProcessStatsService, so not necessary to compare every field.
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedDisplayTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedDisplayTest.java
index 721028a..0fd37c2 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedDisplayTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedDisplayTest.java
@@ -257,7 +257,7 @@
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mActivityView = new ActivityView(this);
+ mActivityView = new ActivityView(this, null, 0, false, true);
setContentView(mActivityView);
}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java
index e11c60e..862b7b8 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java
@@ -16,7 +16,7 @@
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC;
-import static android.view.Display.FLAG_PRIVATE;
+import static android.view.Display.DEFAULT_DISPLAY;
import android.app.Activity;
import android.content.Context;
@@ -29,7 +29,6 @@
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.Window;
-import android.view.WindowManager;
import com.android.compatibility.common.util.TestUtils;
@@ -37,7 +36,7 @@
* Utilities needed when interacting with the display
*/
public class DisplayUtils {
- private static final int DISPLAY_ADDED_TIMOUT_MS = 5000;
+ private static final int DISPLAY_ADDED_TIMEOUT_MS = 5000;
public static int getStatusBarHeight(Activity activity) {
final Rect rect = new Rect();
@@ -76,7 +75,11 @@
}
/**
- * Creates a virtual display and waits until it's in display list.
+ * Creates a virtual display having same size with default display and waits until it's
+ * in display list. The density of the virtual display is based on
+ * {@link DisplayMetrics#xdpi} so that the threshold of gesture detection is same as
+ * the default display's.
+ *
* @param context
* @param isPrivate if this display is a private display.
* @return virtual display.
@@ -110,17 +113,15 @@
Context.DISPLAY_SERVICE);
displayManager.registerDisplayListener(listener, null);
- final WindowManager windowManager = (WindowManager) context.getSystemService(
- Context.WINDOW_SERVICE);
final DisplayMetrics metrics = new DisplayMetrics();
- windowManager.getDefaultDisplay().getRealMetrics(metrics);
+ displayManager.getDisplay(DEFAULT_DISPLAY).getRealMetrics(metrics);
final Display display = createDisplay(context, metrics.widthPixels,
- metrics.heightPixels, metrics.densityDpi, isPrivate);
+ metrics.heightPixels, (int) metrics.xdpi, isPrivate);
try {
TestUtils.waitOn(waitObject,
() -> displayManager.getDisplay(display.getDisplayId()) != null,
- DISPLAY_ADDED_TIMOUT_MS,
+ DISPLAY_ADDED_TIMEOUT_MS,
String.format("wait for virtual display %d adding", display.getDisplayId()));
} finally {
displayManager.unregisterDisplayListener(listener);
diff --git a/tests/app/AppExitTest/AndroidTest.xml b/tests/app/AppExitTest/AndroidTest.xml
index a16f5d1..b1e86e1 100644
--- a/tests/app/AppExitTest/AndroidTest.xml
+++ b/tests/app/AppExitTest/AndroidTest.xml
@@ -19,7 +19,6 @@
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
<option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="force-install-mode" value="FULL"/>
<option name="cleanup-apks" value="true" />
diff --git a/tests/app/src/android/app/cts/NotificationManagerTest.java b/tests/app/src/android/app/cts/NotificationManagerTest.java
index d8b9e2a..322069b 100644
--- a/tests/app/src/android/app/cts/NotificationManagerTest.java
+++ b/tests/app/src/android/app/cts/NotificationManagerTest.java
@@ -125,6 +125,7 @@
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -744,6 +745,7 @@
ShortcutManager scManager =
(ShortcutManager) mContext.getSystemService(Context.SHORTCUT_SERVICE);
scManager.removeAllDynamicShortcuts();
+ scManager.removeLongLivedShortcuts(Collections.singletonList(SHARE_SHORTCUT_ID));
}
/**
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
index 9bbc779..65df6fb 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
@@ -214,7 +214,8 @@
public static final MockImeSessionRule sMockImeSessionRule = new MockImeSessionRule(
InstrumentationRegistry.getTargetContext(),
InstrumentationRegistry.getInstrumentation().getUiAutomation(),
- new ImeSettings.Builder().setInlineSuggestionsEnabled(true));
+ new ImeSettings.Builder().setInlineSuggestionsEnabled(true)
+ .setInlineSuggestionViewContentDesc(InlineUiBot.SUGGESTION_STRIP_DESC));
protected static final RequiredFeatureRule sRequiredFeatureRule =
new RequiredFeatureRule(PackageManager.FEATURE_AUTOFILL);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedTimeouts.java b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedTimeouts.java
index 7bfdfc8..2eef6e3 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedTimeouts.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedTimeouts.java
@@ -23,7 +23,7 @@
*/
final class AugmentedTimeouts {
- private static final long ONE_TIMEOUT_TO_RULE_THEN_ALL_MS = 1_000;
+ private static final long ONE_TIMEOUT_TO_RULE_THEN_ALL_MS = 1_500;
private static final long ONE_NAPTIME_TO_RULE_THEN_ALL_MS = 3_000;
/**
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java
index 13f7ce8..1d1803a 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineUiBot.java
@@ -33,11 +33,9 @@
public final class InlineUiBot extends UiBot {
private static final String TAG = "AutoFillInlineCtsUiBot";
- //TODO: Change magic constant
- private static final String RESOURCE_ID_SUGGESTION_STRIP = "message";
+ public static final String SUGGESTION_STRIP_DESC = "MockIme Inline Suggestion View";
- private static final BySelector SUGGESTION_STRIP_SELECTOR =
- By.res("android", RESOURCE_ID_SUGGESTION_STRIP);
+ private static final BySelector SUGGESTION_STRIP_SELECTOR = By.desc(SUGGESTION_STRIP_DESC);
public InlineUiBot() {
this(UI_TIMEOUT);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
index 9b113d5..05f1b09 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
@@ -27,8 +27,6 @@
import android.view.View;
import android.view.WindowManager;
-import androidx.test.filters.FlakyTest;
-
import org.junit.Test;
/**
@@ -40,7 +38,6 @@
@Presubmit
public class WindowContextTests extends WindowContextTestBase {
@Test
- @FlakyTest(bugId = 150251036)
@AppModeFull
public void testWindowContextConfigChanges() {
final WindowManagerState.DisplayContent display = createManagedVirtualDisplaySession()
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java
index c1863f9..917f7b3 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java
@@ -50,6 +50,8 @@
private static final String HARD_KEYBOARD_CONFIGURATION_BEHAVIOR_ALLOWED =
"HardKeyboardConfigurationBehaviorAllowed";
private static final String INLINE_SUGGESTIONS_ENABLED = "InlineSuggestionsEnabled";
+ private static final String INLINE_SUGGESTION_VIEW_CONTENT_DESC =
+ "InlineSuggestionViewContentDesc";
@NonNull
private final PersistableBundle mBundle;
@@ -120,6 +122,11 @@
return mBundle.getBoolean(INLINE_SUGGESTIONS_ENABLED);
}
+ @Nullable
+ public String getInlineSuggestionViewContentDesc(@Nullable String defaultValue) {
+ return mBundle.getString(INLINE_SUGGESTION_VIEW_CONTENT_DESC, defaultValue);
+ }
+
static Bundle serializeToBundle(@NonNull String eventCallbackActionName,
@Nullable Builder builder) {
final Bundle result = new Bundle();
@@ -261,5 +268,17 @@
mBundle.putBoolean(INLINE_SUGGESTIONS_ENABLED, enabled);
return this;
}
+
+ /**
+ * Controls whether inline suggestions are enabled for {@link MockIme}. If enabled, a
+ * suggestion strip will be rendered at the top of the keyboard.
+ *
+ * @param contentDesc content description to be set to the inline suggestion View.
+ */
+ public Builder setInlineSuggestionViewContentDesc(@NonNull String contentDesc) {
+ mBundle.putString(INLINE_SUGGESTION_VIEW_CONTENT_DESC, contentDesc);
+ return this;
+ }
+
}
}
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
index 279206e..585895c 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
@@ -421,6 +421,10 @@
private final View.OnLayoutChangeListener mLayoutListener;
private final LinearLayout mLayout;
+
+ @Nullable
+ private final LinearLayout mSuggestionView;
+
private boolean mDrawsBehindNavBar = false;
KeyboardLayoutView(MockIme mockIme, @NonNull ImeSettings imeSettings,
@@ -444,14 +448,19 @@
final LayoutParams scrollViewParams = new LayoutParams(MATCH_PARENT, 100);
scrollView.setLayoutParams(scrollViewParams);
- sSuggestionView = new LinearLayout(getContext());
- sSuggestionView.setBackgroundColor(0xFFEEEEEE);
- //TODO: Change magic id
- sSuggestionView.setId(0x0102000b);
- scrollView.addView(sSuggestionView,
- new LayoutParams(MATCH_PARENT, MATCH_PARENT));
+ final LinearLayout suggestionView = new LinearLayout(getContext());
+ suggestionView.setBackgroundColor(0xFFEEEEEE);
+ final String suggestionViewContentDesc =
+ mSettings.getInlineSuggestionViewContentDesc(null /* default */);
+ if (suggestionViewContentDesc != null) {
+ suggestionView.setContentDescription(suggestionViewContentDesc);
+ }
+ scrollView.addView(suggestionView, new LayoutParams(MATCH_PARENT, MATCH_PARENT));
+ mSuggestionView = suggestionView;
mLayout.addView(scrollView);
+ } else {
+ mSuggestionView = null;
}
{
@@ -558,6 +567,24 @@
super.onDetachedFromWindow();
removeOnLayoutChangeListener(mLayoutListener);
}
+
+ @MainThread
+ private void updateInlineSuggestions(
+ @NonNull PendingInlineSuggestions pendingInlineSuggestions) {
+ Log.d(TAG, "updateInlineSuggestions() called: " + pendingInlineSuggestions.mTotalCount);
+ if (mSuggestionView == null || !pendingInlineSuggestions.mValid.get()) {
+ return;
+ }
+ mSuggestionView.removeAllViews();
+ for (int i = 0; i < pendingInlineSuggestions.mTotalCount; i++) {
+ View view = pendingInlineSuggestions.mViews[i];
+ Size size = pendingInlineSuggestions.mViewSizes[i];
+ if (view == null || size == null) {
+ continue;
+ }
+ mSuggestionView.addView(view, size.getWidth(), size.getHeight());
+ }
+ }
}
KeyboardLayoutView mView;
@@ -677,7 +704,6 @@
return new ImeState(hasInputBinding, hasDummyInputConnectionConnection);
}
- private static LinearLayout sSuggestionView;
private PendingInlineSuggestions mPendingInlineSuggestions;
private static final class PendingInlineSuggestions {
@@ -700,77 +726,61 @@
@MainThread
@Override
public InlineSuggestionsRequest onCreateInlineSuggestionsRequest(Bundle uiExtras) {
- Log.d(TAG, "onCreateInlineSuggestionsRequest() called");
- final ArrayList<InlinePresentationSpec> presentationSpecs = new ArrayList<>();
- presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100),
- new Size(400, 100)).build());
- presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100),
- new Size(400, 100)).build());
+ return getTracer().onCreateInlineSuggestionsRequest(() -> {
+ final ArrayList<InlinePresentationSpec> presentationSpecs = new ArrayList<>();
+ presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100),
+ new Size(400, 100)).build());
+ presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, 100),
+ new Size(400, 100)).build());
- return new InlineSuggestionsRequest.Builder(presentationSpecs)
- .setMaxSuggestionCount(6)
- .build();
+ return new InlineSuggestionsRequest.Builder(presentationSpecs)
+ .setMaxSuggestionCount(6)
+ .build();
+ });
}
@MainThread
@Override
- public boolean onInlineSuggestionsResponse(InlineSuggestionsResponse response) {
- Log.d(TAG,
- "onInlineSuggestionsResponse() called: " + response.getInlineSuggestions().size());
- final PendingInlineSuggestions pendingInlineSuggestions =
- new PendingInlineSuggestions(response);
- if (mPendingInlineSuggestions != null) {
- mPendingInlineSuggestions.mValid.set(false);
- }
- mPendingInlineSuggestions = pendingInlineSuggestions;
- if (pendingInlineSuggestions.mTotalCount == 0) {
- updateInlineSuggestions(pendingInlineSuggestions);
- return true;
- }
-
- for (int i = 0; i < pendingInlineSuggestions.mTotalCount; i++) {
- final int index = i;
- InlineSuggestion inlineSuggestion =
- pendingInlineSuggestions.mResponse.getInlineSuggestions().get(index);
- Size size = inlineSuggestion.getInfo().getInlinePresentationSpec().getMaxSize();
- inlineSuggestion.inflate(
- this,
- size,
- AsyncTask.THREAD_POOL_EXECUTOR,
- suggestionView -> {
- Log.d(TAG, "new inline suggestion view ready");
- if (suggestionView != null) {
- pendingInlineSuggestions.mViews[index] = suggestionView;
- pendingInlineSuggestions.mViewSizes[index] = size;
- }
- if (pendingInlineSuggestions.mInflatedViewCount.incrementAndGet()
- == pendingInlineSuggestions.mTotalCount
- && pendingInlineSuggestions.mValid.get()) {
- Log.d(TAG, "ready to display all suggestions");
- getMainExecutor().execute(
- () -> updateInlineSuggestions(pendingInlineSuggestions));
- }
- });
- }
- return true;
- }
-
- @MainThread
- private void updateInlineSuggestions(PendingInlineSuggestions pendingInlineSuggestions) {
- Log.d(TAG, "updateInlineSuggestions() called: " + pendingInlineSuggestions.mTotalCount);
- if (sSuggestionView == null || !pendingInlineSuggestions.mValid.get()) {
- return;
- }
- sSuggestionView.removeAllViews();
- for (int i = 0; i < pendingInlineSuggestions.mTotalCount; i++) {
- View view = pendingInlineSuggestions.mViews[i];
- Size size = pendingInlineSuggestions.mViewSizes[i];
- if (view == null || size == null) {
- continue;
+ public boolean onInlineSuggestionsResponse(@NonNull InlineSuggestionsResponse response) {
+ return getTracer().onInlineSuggestionsResponse(response, () -> {
+ final PendingInlineSuggestions pendingInlineSuggestions =
+ new PendingInlineSuggestions(response);
+ if (mPendingInlineSuggestions != null) {
+ mPendingInlineSuggestions.mValid.set(false);
}
- sSuggestionView.addView(view, size.getWidth(), size.getHeight());
- }
+ mPendingInlineSuggestions = pendingInlineSuggestions;
+ if (pendingInlineSuggestions.mTotalCount == 0) {
+ mView.updateInlineSuggestions(pendingInlineSuggestions);
+ return true;
+ }
+
+ for (int i = 0; i < pendingInlineSuggestions.mTotalCount; i++) {
+ final int index = i;
+ InlineSuggestion inlineSuggestion =
+ pendingInlineSuggestions.mResponse.getInlineSuggestions().get(index);
+ Size size = inlineSuggestion.getInfo().getInlinePresentationSpec().getMaxSize();
+ inlineSuggestion.inflate(
+ this,
+ size,
+ AsyncTask.THREAD_POOL_EXECUTOR,
+ suggestionView -> {
+ Log.d(TAG, "new inline suggestion view ready");
+ if (suggestionView != null) {
+ pendingInlineSuggestions.mViews[index] = suggestionView;
+ pendingInlineSuggestions.mViewSizes[index] = size;
+ }
+ if (pendingInlineSuggestions.mInflatedViewCount.incrementAndGet()
+ == pendingInlineSuggestions.mTotalCount
+ && pendingInlineSuggestions.mValid.get()) {
+ Log.d(TAG, "ready to display all suggestions");
+ getMainExecutor().execute(() ->
+ mView.updateInlineSuggestions(pendingInlineSuggestions));
+ }
+ });
+ }
+ return true;
+ });
}
/**
@@ -864,45 +874,44 @@
return result;
}
- public void onCreate(@NonNull Runnable runnable) {
+ void onCreate(@NonNull Runnable runnable) {
recordEventInternal("onCreate", runnable);
}
- public void onConfigureWindow(Window win, boolean isFullscreen,
- boolean isCandidatesOnly, @NonNull Runnable runnable) {
+ void onConfigureWindow(Window win, boolean isFullscreen, boolean isCandidatesOnly,
+ @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putBoolean("isFullscreen", isFullscreen);
arguments.putBoolean("isCandidatesOnly", isCandidatesOnly);
recordEventInternal("onConfigureWindow", runnable, arguments);
}
- public boolean onEvaluateFullscreenMode(@NonNull BooleanSupplier supplier) {
+ boolean onEvaluateFullscreenMode(@NonNull BooleanSupplier supplier) {
return recordEventInternal("onEvaluateFullscreenMode", supplier::getAsBoolean);
}
- public boolean onEvaluateInputViewShown(@NonNull BooleanSupplier supplier) {
+ boolean onEvaluateInputViewShown(@NonNull BooleanSupplier supplier) {
return recordEventInternal("onEvaluateInputViewShown", supplier::getAsBoolean);
}
- public View onCreateInputView(@NonNull Supplier<View> supplier) {
+ View onCreateInputView(@NonNull Supplier<View> supplier) {
return recordEventInternal("onCreateInputView", supplier);
}
- public void onStartInput(EditorInfo editorInfo, boolean restarting,
- @NonNull Runnable runnable) {
+ void onStartInput(EditorInfo editorInfo, boolean restarting, @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putParcelable("editorInfo", editorInfo);
arguments.putBoolean("restarting", restarting);
recordEventInternal("onStartInput", runnable, arguments);
}
- public void onWindowVisibilityChanged(@NonNull Runnable runnable, int visibility) {
+ void onWindowVisibilityChanged(@NonNull Runnable runnable, int visibility) {
final Bundle arguments = new Bundle();
arguments.putInt("visible", visibility);
recordEventInternal("onWindowVisibilityChanged", runnable, arguments);
}
- public void onStartInputView(EditorInfo editorInfo, boolean restarting,
+ void onStartInputView(EditorInfo editorInfo, boolean restarting,
@NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putParcelable("editorInfo", editorInfo);
@@ -910,31 +919,31 @@
recordEventInternal("onStartInputView", runnable, arguments);
}
- public void onFinishInputView(boolean finishingInput, @NonNull Runnable runnable) {
+ void onFinishInputView(boolean finishingInput, @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putBoolean("finishingInput", finishingInput);
recordEventInternal("onFinishInputView", runnable, arguments);
}
- public void onFinishInput(@NonNull Runnable runnable) {
+ void onFinishInput(@NonNull Runnable runnable) {
recordEventInternal("onFinishInput", runnable);
}
- public boolean onKeyDown(int keyCode, KeyEvent event, @NonNull BooleanSupplier supplier) {
+ boolean onKeyDown(int keyCode, KeyEvent event, @NonNull BooleanSupplier supplier) {
final Bundle arguments = new Bundle();
arguments.putInt("keyCode", keyCode);
arguments.putParcelable("event", event);
return recordEventInternal("onKeyDown", supplier::getAsBoolean, arguments);
}
- public void onUpdateCursorAnchorInfo(CursorAnchorInfo cursorAnchorInfo,
+ void onUpdateCursorAnchorInfo(CursorAnchorInfo cursorAnchorInfo,
@NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putParcelable("cursorAnchorInfo", cursorAnchorInfo);
recordEventInternal("onUpdateCursorAnchorInfo", runnable, arguments);
}
- public boolean onShowInputRequested(int flags, boolean configChange,
+ boolean onShowInputRequested(int flags, boolean configChange,
@NonNull BooleanSupplier supplier) {
final Bundle arguments = new Bundle();
arguments.putInt("flags", flags);
@@ -942,66 +951,76 @@
return recordEventInternal("onShowInputRequested", supplier::getAsBoolean, arguments);
}
- public void onDestroy(@NonNull Runnable runnable) {
+ void onDestroy(@NonNull Runnable runnable) {
recordEventInternal("onDestroy", runnable);
}
- public void attachToken(IBinder token, @NonNull Runnable runnable) {
+ void attachToken(IBinder token, @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putBinder("token", token);
recordEventInternal("attachToken", runnable, arguments);
}
- public void bindInput(InputBinding binding, @NonNull Runnable runnable) {
+ void bindInput(InputBinding binding, @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putParcelable("binding", binding);
recordEventInternal("bindInput", runnable, arguments);
}
- public void unbindInput(@NonNull Runnable runnable) {
+ void unbindInput(@NonNull Runnable runnable) {
recordEventInternal("unbindInput", runnable);
}
- public void showSoftInput(int flags, ResultReceiver resultReceiver,
- @NonNull Runnable runnable) {
+ void showSoftInput(int flags, ResultReceiver resultReceiver, @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putInt("flags", flags);
arguments.putParcelable("resultReceiver", resultReceiver);
recordEventInternal("showSoftInput", runnable, arguments);
}
- public void hideSoftInput(int flags, ResultReceiver resultReceiver,
- @NonNull Runnable runnable) {
+ void hideSoftInput(int flags, ResultReceiver resultReceiver, @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putInt("flags", flags);
arguments.putParcelable("resultReceiver", resultReceiver);
recordEventInternal("hideSoftInput", runnable, arguments);
}
- public AbstractInputMethodImpl onCreateInputMethodInterface(
+ AbstractInputMethodImpl onCreateInputMethodInterface(
@NonNull Supplier<AbstractInputMethodImpl> supplier) {
return recordEventInternal("onCreateInputMethodInterface", supplier);
}
- public void onReceiveCommand(
- @NonNull ImeCommand command, @NonNull Runnable runnable) {
+ void onReceiveCommand(@NonNull ImeCommand command, @NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
arguments.putBundle("command", command.toBundle());
recordEventInternal("onReceiveCommand", runnable, arguments);
}
- public void onHandleCommand(
+ void onHandleCommand(
@NonNull ImeCommand command, @NonNull Supplier<Object> resultSupplier) {
final Bundle arguments = new Bundle();
arguments.putBundle("command", command.toBundle());
recordEventInternal("onHandleCommand", resultSupplier, arguments);
}
- public void onInputViewLayoutChanged(@NonNull ImeLayoutInfo imeLayoutInfo,
+ void onInputViewLayoutChanged(@NonNull ImeLayoutInfo imeLayoutInfo,
@NonNull Runnable runnable) {
final Bundle arguments = new Bundle();
imeLayoutInfo.writeToBundle(arguments);
recordEventInternal("onInputViewLayoutChanged", runnable, arguments);
}
+
+ InlineSuggestionsRequest onCreateInlineSuggestionsRequest(
+ @NonNull Supplier<InlineSuggestionsRequest> supplier) {
+ return recordEventInternal("onCreateInlineSuggestionsRequest", supplier);
+ }
+
+ boolean onInlineSuggestionsResponse(@NonNull InlineSuggestionsResponse response,
+ @NonNull BooleanSupplier supplier) {
+ final Bundle arguments = new Bundle();
+ arguments.putParcelable("response", response);
+ return recordEventInternal("onInlineSuggestionsResponse", supplier::getAsBoolean,
+ arguments);
+ }
}
}
diff --git a/tests/sensor/src/android/hardware/cts/SensorTest.java b/tests/sensor/src/android/hardware/cts/SensorTest.java
index 49e3c27..bde6e0e 100644
--- a/tests/sensor/src/android/hardware/cts/SensorTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorTest.java
@@ -731,9 +731,11 @@
}
if (mFlushWhileIdle) {
SensorCtsHelper.makeMyPackageIdle();
+ sensorManager.assertFlushFail();
+ } else {
+ CountDownLatch flushLatch = sensorManager.requestFlush();
+ listener.waitForFlushComplete(flushLatch, true);
}
- CountDownLatch flushLatch = sensorManager.requestFlush();
- listener.waitForFlushComplete(flushLatch, true);
} finally {
sensorManager.unregisterListener();
if (mFlushWhileIdle) {
diff --git a/tests/sensor/src/android/hardware/cts/helpers/TestSensorManager.java b/tests/sensor/src/android/hardware/cts/helpers/TestSensorManager.java
index 7c69649..aba6d49 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/TestSensorManager.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/TestSensorManager.java
@@ -156,6 +156,20 @@
}
/**
+ * Call {@link SensorManager#flush(SensorEventListener)} and asserts that it fails.
+ */
+ public void assertFlushFail() {
+ if (mTestSensorEventListener == null) {
+ Log.w(LOG_TAG, "No listener registered, returning.");
+ return;
+ }
+ Assert.assertFalse(
+ SensorCtsHelper.formatAssertionMessage(
+ "Flush succeeded unexpectedly", mEnvironment),
+ mSensorManager.flush(mTestSensorEventListener));
+ }
+
+ /**
* Call {@link SensorManager#flush(SensorEventListener)}. This method will perform a no-op if
* the sensor is not registered.
*
diff --git a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
index 687e316..867f8a3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
@@ -2598,6 +2598,17 @@
}
@Test(expected = FileNotFoundException.class)
+ public void testUriWithoutScheme() throws IOException {
+ Uri uri = new Uri.Builder()
+ .authority("authority")
+ .appendPath("missing")
+ .appendPath("scheme")
+ .build();
+ ImageDecoder.Source src = ImageDecoder.createSource(getContentResolver(), uri);
+ ImageDecoder.decodeDrawable(src);
+ }
+
+ @Test(expected = FileNotFoundException.class)
public void testBadCallable() throws IOException {
ImageDecoder.Source src = ImageDecoder.createSource(() -> null);
ImageDecoder.decodeDrawable(src);
diff --git a/tests/tests/media/src/android/media/cts/AudioManagerTest.java b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
index 6268466..e4d4f62 100644
--- a/tests/tests/media/src/android/media/cts/AudioManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
@@ -1538,7 +1538,7 @@
mAudioManager.adjustSuggestedStreamVolume(AudioManager.ADJUST_RAISE, 66747, 0);
}
- @CddTest(requirement="5.4.4/C-4-1")
+ @CddTest(requirement="5.4.1/C-1-4")
public void testGetMicrophones() throws Exception {
if (!mContext.getPackageManager().hasSystemFeature(
PackageManager.FEATURE_MICROPHONE)) {
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordTest.java b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
index 5cc58ce..69e13aa 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
@@ -963,7 +963,7 @@
Log.i(TAG, "******");
}
- @CddTest(requirement="5.4.4/C-4-1")
+ @CddTest(requirement="5.4.1/C-1-4")
@Test
public void testGetActiveMicrophones() throws Exception {
if (!hasMicrophone()) {
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index b059301..44e724f 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -629,7 +629,7 @@
mMediaRecorder.setMaxFileSize(MAX_FILE_SIZE * 10);
}
- @CddTest(requirement="5.4.4/C-4-1")
+ @CddTest(requirement="5.4.1/C-1-4")
public void testGetActiveMicrophones() throws Exception {
if (!hasMicrophone() || !hasAac()) {
MediaUtils.skipTest("no audio codecs or microphone");
diff --git a/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt b/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt
index 45ea4b8..6093731 100644
--- a/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt
+++ b/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt
@@ -26,7 +26,7 @@
import android.net.Uri
import android.platform.test.annotations.AppModeFull
import android.provider.DeviceConfig
-import android.provider.Settings.*
+import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS
import android.support.test.uiautomator.By
import android.support.test.uiautomator.BySelector
import android.support.test.uiautomator.UiObject2
@@ -34,7 +34,8 @@
import android.view.accessibility.AccessibilityNodeInfo
import android.widget.Switch
import com.android.compatibility.common.util.SystemUtil
-import com.android.compatibility.common.util.SystemUtil.*
+import com.android.compatibility.common.util.SystemUtil.runShellCommand
+import com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity
import com.android.compatibility.common.util.ThrowingSupplier
import com.android.compatibility.common.util.UiAutomatorUtils
import com.android.compatibility.common.util.UiDumpUtils
@@ -68,6 +69,7 @@
eventually {
assertPermission(PERMISSION_GRANTED)
}
+ goBack()
goHome()
Thread.sleep(5)
@@ -79,7 +81,7 @@
assertPermission(PERMISSION_DENIED)
}
runShellCommand("cmd statusbar expand-notifications")
- waitFindObject(By.text("App permissions automatically removed"))
+ waitFindObject(By.textContains("unused app"))
.click()
waitFindObject(By.text(APK_PACKAGE_NAME))
waitFindObject(By.text("Calendar permission removed"))
diff --git a/tests/tests/role/Android.bp b/tests/tests/role/Android.bp
index ac70a58..bb35032 100644
--- a/tests/tests/role/Android.bp
+++ b/tests/tests/role/Android.bp
@@ -18,6 +18,7 @@
srcs: [
"src/**/*.java",
+ "src/**/*.kt",
],
static_libs: [
diff --git a/tests/tests/role/src/android/app/role/cts/RoleControllerManagerTest.kt b/tests/tests/role/src/android/app/role/cts/RoleControllerManagerTest.kt
new file mode 100644
index 0000000..8d7353b
--- /dev/null
+++ b/tests/tests/role/src/android/app/role/cts/RoleControllerManagerTest.kt
@@ -0,0 +1,155 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app.role.cts
+
+import android.app.Instrumentation
+
+import android.app.role.RoleControllerManager
+import android.app.role.RoleManager
+import android.content.Context
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.os.Process
+import android.provider.Settings
+import androidx.test.InstrumentationRegistry
+import androidx.test.runner.AndroidJUnit4
+import com.android.compatibility.common.util.SystemUtil.runShellCommand
+import com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity
+import com.google.common.truth.Truth.assertThat
+import org.junit.After
+import org.junit.Assert.assertEquals
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+import java.util.concurrent.CompletableFuture
+import java.util.concurrent.TimeUnit
+import java.util.function.Consumer
+
+/**
+ * Tests [RoleControllerManager].
+ */
+@RunWith(AndroidJUnit4::class)
+class RoleControllerManagerTest {
+ private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
+ private val context: Context = instrumentation.context
+ private val packageManager: PackageManager = context.packageManager
+ private val roleControllerManager: RoleControllerManager =
+ context.getSystemService(RoleControllerManager::class.java)!!
+
+ @Before
+ fun installApp() {
+ installPackage(APP_APK_PATH)
+ }
+
+ @After
+ fun uninstallApp() {
+ uninstallPackage(APP_PACKAGE_NAME)
+ }
+
+ @Test
+ fun appIsVisibleForRole() {
+ assertAppIsVisibleForRole(APP_PACKAGE_NAME, ROLE_NAME, true)
+ }
+
+ @Test
+ fun settingsIsNotVisibleForHomeRole() {
+ // Settings should never show as a possible home app even if qualified.
+ val settingsPackageName = packageManager.resolveActivity(
+ Intent(Settings.ACTION_SETTINGS), PackageManager.MATCH_DEFAULT_ONLY
+ or PackageManager.MATCH_DIRECT_BOOT_AWARE or PackageManager.MATCH_DIRECT_BOOT_UNAWARE
+ )!!.activityInfo.packageName
+ assertAppIsVisibleForRole(settingsPackageName, RoleManager.ROLE_HOME, false)
+ }
+
+ @Test
+ fun appIsNotVisibleForInvalidRole() {
+ assertAppIsVisibleForRole(APP_PACKAGE_NAME, "invalid", false)
+ }
+
+ @Test
+ fun invalidAppIsNotVisibleForRole() {
+ assertAppIsVisibleForRole("invalid", ROLE_NAME, false)
+ }
+
+ private fun assertAppIsVisibleForRole(
+ packageName: String,
+ roleName: String,
+ expectedIsVisible: Boolean
+ ) {
+ val future = CompletableFuture<Boolean>()
+ runWithShellPermissionIdentity {
+ roleControllerManager.isApplicationVisibleForRole(
+ roleName, packageName, context.mainExecutor, Consumer { future.complete(it) }
+ )
+ }
+ val isVisible = future.get(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
+ assertThat(isVisible).isEqualTo(expectedIsVisible)
+ }
+
+ @Test
+ fun roleIsVisible() {
+ assertRoleIsVisible(ROLE_NAME, true)
+ }
+
+ @Test
+ fun systemGalleryRoleIsNotVisible() {
+ // The system gallery role should always be hidden.
+ assertRoleIsVisible(SYSTEM_GALLERY_ROLE_NAME, false)
+ }
+
+ @Test
+ fun invalidRoleIsNotVisible() {
+ assertRoleIsVisible("invalid", false)
+ }
+
+ private fun assertRoleIsVisible(roleName: String, expectedIsVisible: Boolean) {
+ val future = CompletableFuture<Boolean>()
+ runWithShellPermissionIdentity {
+ roleControllerManager.isRoleVisible(
+ roleName, context.mainExecutor, Consumer {
+ future.complete(it)
+ }
+ )
+ }
+ val isVisible = future.get(TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)
+ assertThat(isVisible).isEqualTo(expectedIsVisible)
+ }
+
+ private fun installPackage(apkPath: String) {
+ assertEquals(
+ "Success",
+ runShellCommand("pm install -r --user ${Process.myUserHandle().identifier} $apkPath")
+ .trim()
+ )
+ }
+
+ private fun uninstallPackage(packageName: String) {
+ assertEquals(
+ "Success",
+ runShellCommand("pm uninstall --user ${Process.myUserHandle().identifier} $packageName")
+ .trim()
+ )
+ }
+
+ companion object {
+ private const val ROLE_NAME = RoleManager.ROLE_BROWSER
+ private const val APP_APK_PATH = "/data/local/tmp/cts/role/CtsRoleTestApp.apk"
+ private const val APP_PACKAGE_NAME = "android.app.role.cts.app"
+ private const val SYSTEM_GALLERY_ROLE_NAME = "android.app.role.SYSTEM_GALLERY"
+ private const val TIMEOUT_MILLIS = 15 * 1000L
+ }
+}
diff --git a/tests/tests/security/res/raw/bug_110435401.mid b/tests/tests/security/res/raw/bug_110435401.mid
new file mode 100644
index 0000000..184ab1f
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_110435401.mid
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_26366256.midi b/tests/tests/security/res/raw/bug_26366256.midi
new file mode 100644
index 0000000..5114d92
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_26366256.midi
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_68664359.mid b/tests/tests/security/res/raw/bug_68664359.mid
new file mode 100644
index 0000000..f816d82
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_68664359.mid
@@ -0,0 +1 @@
+DK:@~kkkkk
\ No newline at end of file
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 61b9d47..74b0b81 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -307,6 +307,12 @@
}
@Test
+ @SecurityTest(minPatchLevel = "2016-04")
+ public void testStagefright_bug_26366256() throws Exception {
+ doStagefrightTest(R.raw.bug_26366256);
+ }
+
+ @Test
@SecurityTest(minPatchLevel = "2017-02")
public void testStagefright_cve_2016_2429_b_27211885() throws Exception {
doStagefrightTest(R.raw.cve_2016_2429_b_27211885,
@@ -1116,6 +1122,18 @@
}
@Test
+ @SecurityTest(minPatchLevel = "2018-11")
+ public void testStagefright_bug_68664359() throws Exception {
+ doStagefrightTest(R.raw.bug_68664359, 60000);
+ }
+
+ @Test
+ @SecurityTest(minPatchLevel = "2018-11")
+ public void testStagefright_bug_110435401() throws Exception {
+ doStagefrightTest(R.raw.bug_110435401, 60000);
+ }
+
+ @Test
@SecurityTest(minPatchLevel = "2017-03")
public void testStagefright_cve_2017_0474() throws Exception {
doStagefrightTest(R.raw.cve_2017_0474, 120000);
diff --git a/tests/tests/telecom/src/android/telecom/cts/TelecomAvailabilityTest.java b/tests/tests/telecom/src/android/telecom/cts/TelecomAvailabilityTest.java
index 8163520..d218da9c 100644
--- a/tests/tests/telecom/src/android/telecom/cts/TelecomAvailabilityTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/TelecomAvailabilityTest.java
@@ -118,6 +118,26 @@
}
/**
+ * Tests that TelecomManager always creates resolvable/actionable emergency dialer intent.
+ */
+ public void testCreateLaunchEmergencyDialerIntent() {
+ if (!shouldTestTelecom(mContext)) {
+ return;
+ }
+ final TelecomManager telecomManager = mContext.getSystemService(TelecomManager.class);
+
+ final Intent intentWithoutNumber = telecomManager.createLaunchEmergencyDialerIntent(null);
+ assertNotNull(intentWithoutNumber);
+ assertEquals(1, mPackageManager.queryIntentActivities(intentWithoutNumber,
+ PackageManager.MATCH_DEFAULT_ONLY).size());
+
+ final Intent intentWithNumber = telecomManager.createLaunchEmergencyDialerIntent("12345");
+ assertNotNull(intentWithNumber);
+ assertEquals(1, mPackageManager.queryIntentActivities(intentWithNumber,
+ PackageManager.MATCH_DEFAULT_ONLY).size());
+ }
+
+ /**
* @return The {@link PackageInfo} of the only app named {@code PACKAGE_NAME}.
*/
private static PackageInfo findOnlyTelecomPackageInfo(PackageManager packageManager) {
diff --git a/tests/tests/tv/src/android/media/tv/tuner/cts/TunerFilterTest.java b/tests/tests/tv/src/android/media/tv/tuner/cts/TunerFilterTest.java
new file mode 100644
index 0000000..7a32e70
--- /dev/null
+++ b/tests/tests/tv/src/android/media/tv/tuner/cts/TunerFilterTest.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.media.tv.tuner.cts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
+import android.media.tv.tuner.Tuner;
+import android.media.tv.tuner.filter.AvSettings;
+import android.media.tv.tuner.filter.DownloadSettings;
+import android.media.tv.tuner.filter.Filter;
+import android.media.tv.tuner.filter.PesSettings;
+import android.media.tv.tuner.filter.RecordSettings;
+import android.media.tv.tuner.filter.SectionSettingsWithSectionBits;
+import android.media.tv.tuner.filter.SectionSettingsWithTableInfo;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class TunerFilterTest {
+ private static final String TAG = "MediaTunerFilterTest";
+
+ private Context mContext;
+ private Tuner mTuner;
+
+ @Before
+ public void setUp() throws Exception {
+ mContext = InstrumentationRegistry.getTargetContext();
+ InstrumentationRegistry
+ .getInstrumentation().getUiAutomation().adoptShellPermissionIdentity();
+ if (!hasTuner()) return;
+ mTuner = new Tuner(mContext, null, 100);
+ }
+
+ @After
+ public void tearDown() {
+ if (mTuner != null) {
+ mTuner.close();
+ mTuner = null;
+ }
+ }
+
+ @Test
+ public void testAvSettings() throws Exception {
+ if (!hasTuner()) return;
+ AvSettings settings =
+ AvSettings
+ .builder(Filter.TYPE_TS, true)
+ .setPassthrough(false)
+ .build();
+
+ assertFalse(settings.isPassthrough());
+ }
+
+ @Test
+ public void testDownloadSettings() throws Exception {
+ if (!hasTuner()) return;
+ DownloadSettings settings =
+ DownloadSettings
+ .builder(Filter.TYPE_MMTP)
+ .setDownloadId(2)
+ .build();
+
+ assertEquals(2, settings.getDownloadId());
+ }
+
+ @Test
+ public void testPesSettings() throws Exception {
+ if (!hasTuner()) return;
+ PesSettings settings =
+ PesSettings
+ .builder(Filter.TYPE_TS)
+ .setStreamId(2)
+ .setRaw(true)
+ .build();
+
+ assertEquals(2, settings.getStreamId());
+ assertTrue(settings.isRaw());
+ }
+
+ @Test
+ public void testRecordSettings() throws Exception {
+ if (!hasTuner()) return;
+ RecordSettings settings =
+ RecordSettings
+ .builder(Filter.TYPE_TS)
+ .setTsIndexMask(
+ RecordSettings.TS_INDEX_FIRST_PACKET
+ | RecordSettings.TS_INDEX_PRIVATE_DATA)
+ .setScIndexType(RecordSettings.INDEX_TYPE_SC)
+ .setScIndexMask(RecordSettings.SC_INDEX_I_FRAME)
+ .build();
+
+ assertEquals(
+ RecordSettings.TS_INDEX_FIRST_PACKET | RecordSettings.TS_INDEX_PRIVATE_DATA,
+ settings.getTsIndexMask());
+ assertEquals(RecordSettings.INDEX_TYPE_SC, settings.getScIndexType());
+ assertEquals(RecordSettings.SC_INDEX_I_FRAME, settings.getScIndexMask());
+ }
+
+ @Test
+ public void testSectionSettingsWithSectionBits() throws Exception {
+ if (!hasTuner()) return;
+ SectionSettingsWithSectionBits settings =
+ SectionSettingsWithSectionBits
+ .builder(Filter.TYPE_TS)
+ .setCrcEnabled(true)
+ .setRepeat(false)
+ .setRaw(false)
+ .setFilter(new byte[] {2, 3, 4})
+ .setMask(new byte[] {7, 6, 5, 4})
+ .setMode(new byte[] {22, 55, 33})
+ .build();
+
+ assertTrue(settings.isCrcEnabled());
+ assertFalse(settings.isRepeat());
+ assertFalse(settings.isRaw());
+ Assert.assertArrayEquals(new byte[] {2, 3, 4}, settings.getFilterBytes());
+ Assert.assertArrayEquals(new byte[] {7, 6, 5, 4}, settings.getMask());
+ Assert.assertArrayEquals(new byte[] {22, 55, 33}, settings.getMode());
+ }
+
+ @Test
+ public void testSectionSettingsWithTableInfo() throws Exception {
+ if (!hasTuner()) return;
+ SectionSettingsWithTableInfo settings =
+ SectionSettingsWithTableInfo
+ .builder(Filter.TYPE_TS)
+ .setTableId(11)
+ .setVersion(2)
+ .setCrcEnabled(false)
+ .setRepeat(true)
+ .setRaw(true)
+ .build();
+
+ assertEquals(11, settings.getTableId());
+ assertEquals(2, settings.getVersion());
+ assertFalse(settings.isCrcEnabled());
+ assertTrue(settings.isRepeat());
+ assertTrue(settings.isRaw());
+ }
+
+ private boolean hasTuner() {
+ return mContext.getPackageManager().hasSystemFeature("android.hardware.tv.tuner");
+ }
+}