Merge "Implement virtual-device-only known failures in LibcoreTest."
diff --git a/hostsidetests/apex/src/android/apex/cts/ApexTest.java b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
index fb81760..89936e1 100644
--- a/hostsidetests/apex/src/android/apex/cts/ApexTest.java
+++ b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
@@ -24,8 +24,13 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.Arrays;
+
@RunWith(DeviceJUnit4ClassRunner.class)
public class ApexTest extends BaseHostJUnit4Test {
+ private boolean isApexUpdatable() throws Exception {
+ return Boolean.parseBoolean(getDevice().getProperty("ro.apex.updatable"));
+ }
/**
* Ensures that the built-in APEXes are all with flattened APEXes
@@ -51,7 +56,7 @@
"No APEX found",
(numFlattenedApexes + numNonFlattenedApexes) != 0);
- if (Boolean.parseBoolean(getDevice().getProperty("ro.apex.updatable"))) {
+ if (isApexUpdatable()) {
Assert.assertTrue(numFlattenedApexes +
" flattened APEX(es) found on a device supporting updatable APEX",
numFlattenedApexes == 0);
@@ -79,4 +84,50 @@
CTS_SHIM_APEX_NAME + ".apex\" | wc -l");
return result.getExitCode() == 0 ? Integer.parseInt(result.getStdout().trim()) : 0;
}
+
+ /**
+ * Ensures that pre-apexd processes (e.g. vold) and post-apexd processes (e.g. init) are using
+ * different mount namespaces (in case of ro.apexd.updatable is true), or not.
+ */
+ @Test
+ public void testMountNamespaces() throws Exception {
+ final int rootMountIdOfInit = getMountEntry("1", "/").mountId;
+ final int rootMountIdOfVold = getMountEntry("$(pidof vold)", "/").mountId;
+ if (isApexUpdatable()) {
+ Assert.assertNotEquals("device supports updatable APEX, but is not using multiple mount namespaces",
+ rootMountIdOfInit, rootMountIdOfVold);
+ } else {
+ Assert.assertEquals("device supports updatable APEX, but is using multiple mount namespaces",
+ rootMountIdOfInit, rootMountIdOfVold);
+ }
+ }
+
+ private static class MountEntry {
+ public final int mountId;
+ public final String mountPoint;
+
+ public MountEntry(String mountInfoLine) {
+ String[] tokens = mountInfoLine.split(" ");
+ if (tokens.length < 5) {
+ throw new RuntimeException(mountInfoLine + " doesn't seem to be from mountinfo");
+ }
+ mountId = Integer.parseInt(tokens[0]);
+ mountPoint = tokens[4];
+ }
+ }
+
+ private String[] readMountInfo(String pidExpression) throws Exception {
+ CommandResult result = getDevice().executeShellV2Command(
+ "cat /proc/" + pidExpression + "/mountinfo");
+ if (result.getExitCode() != 0) {
+ throw new RuntimeException("failed to read mountinfo for " + pidExpression);
+ }
+ return result.getStdout().trim().split("\n");
+ }
+
+ private MountEntry getMountEntry(String pidExpression, String mountPoint) throws Exception {
+ return Arrays.asList(readMountInfo(pidExpression)).stream()
+ .map(MountEntry::new)
+ .filter(entry -> mountPoint.equals(entry.mountPoint)).findAny().get();
+ }
}
diff --git a/hostsidetests/appsecurity/test-apps/AuthBoundKeyApp/Android.bp b/hostsidetests/appsecurity/test-apps/AuthBoundKeyApp/Android.bp
new file mode 100644
index 0000000..7355721
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AuthBoundKeyApp/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2019 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.
+
+android_test_helper_app {
+ name: "AuthBoundKeyApp",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["android-support-test"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsUsePermissionDiffCert
+ certificate: ":cts-testkey1",
+}
diff --git a/hostsidetests/appsecurity/test-apps/AuthBoundKeyApp/Android.mk b/hostsidetests/appsecurity/test-apps/AuthBoundKeyApp/Android.mk
deleted file mode 100644
index 1918b61..0000000
--- a/hostsidetests/appsecurity/test-apps/AuthBoundKeyApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2019 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_PACKAGE_NAME := AuthBoundKeyApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsUsePermissionDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.bp b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.bp
new file mode 100644
index 0000000..c8f4973
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2016 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.
+//
+
+android_test_helper_app {
+ name: "CtsEncryptionApp",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ static_libs: [
+ "androidx.test.rules",
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ ],
+ libs: ["android.test.base.stubs"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ certificate: ":cts-testkey1",
+}
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
deleted file mode 100644
index 44aa242..0000000
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (C) 2016 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsEncryptionApp
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.bp b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.bp
index e214221..0dfc5c7 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.bp
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
+android_test_helper_app {
name: "CtsExternalStorageApp",
defaults: ["cts_support_defaults"],
sdk_version: "current",
diff --git a/hostsidetests/appsecurity/test-apps/StorageApp/Android.bp b/hostsidetests/appsecurity/test-apps/StorageApp/Android.bp
index 2d916f2..9d1a5bd 100644
--- a/hostsidetests/appsecurity/test-apps/StorageApp/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/StorageApp/Android.bp
@@ -8,3 +8,37 @@
"ub-uiautomator",
],
}
+
+android_test_helper_app {
+ name: "CtsStorageAppA",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ static_libs: [
+ "androidx.test.rules",
+ ],
+ libs: ["android.test.base.stubs"],
+ srcs: ["src/**/*.java"],
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "AndroidManifestA.xml",
+}
+
+android_test_helper_app {
+ name: "CtsStorageAppB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ static_libs: [
+ "androidx.test.rules",
+ ],
+ libs: ["android.test.base.stubs"],
+ srcs: ["src/**/*.java"],
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "AndroidManifestB.xml",
+}
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageApp/AndroidManifestA.xml
similarity index 100%
rename from hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml
rename to hostsidetests/appsecurity/test-apps/StorageApp/AndroidManifestA.xml
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageApp/AndroidManifestB.xml
similarity index 100%
rename from hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml
rename to hostsidetests/appsecurity/test-apps/StorageApp/AndroidManifestB.xml
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk b/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
deleted file mode 100644
index f2b7117..0000000
--- a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../StorageApp/src/)
-
-LOCAL_PACKAGE_NAME := CtsStorageAppA
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk b/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
deleted file mode 100644
index 76bfce6..0000000
--- a/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2017 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../StorageApp/src/)
-
-LOCAL_PACKAGE_NAME := CtsStorageAppB
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.bp b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.bp
new file mode 100644
index 0000000..660ab53
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.bp
@@ -0,0 +1,46 @@
+// Copyright (C) 2012 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.
+
+android_test_helper_app {
+ name: "CtsWriteExternalStorageApp",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ static_libs: [
+ "CtsWriteExternalStorageWriteGiftLib",
+ "androidx.test.rules",
+ "compatibility-device-util-axt",
+ ],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ srcs: ["src/**/*.java"],
+ exclude_srcs: ["src/com/android/cts/writeexternalstorageapp/WriteGiftTest.java"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+java_library {
+ name: "CtsWriteExternalStorageWriteGiftLib",
+ srcs: ["src/com/android/cts/writeexternalstorageapp/WriteGiftTest.java"],
+ static_libs: ["CtsExternalStorageTestLib"],
+ libs: [
+ "android.test.base.stubs",
+ "android.test.runner.stubs",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
deleted file mode 100644
index 9adb60b..0000000
--- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2012 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- ../ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsWriteExternalStorageApp
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
index 1041638..1e44976 100644
--- a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
@@ -99,7 +99,7 @@
int veryJankyDelta = countFramesAbove(statsAfter, 60) - countFramesAbove(statsBefore, 60);
// The 1st frame could be >40ms, but nothing after that should be
- assertTrue(veryJankyDelta <= 1);
+ assertTrue(veryJankyDelta <= 2);
}
public void testDaveyDrawFrame() throws Exception {
diff --git a/libs/vogar-expect/README b/libs/vogar-expect/README
index eee6f83..d8f8051 100644
--- a/libs/vogar-expect/README
+++ b/libs/vogar-expect/README
@@ -1 +1,3 @@
Selected classes taken from http://code.google.com/p/vogar/
+
+The classes were later repackaged from vogar.** to vogar.expect.**
diff --git a/libs/vogar-expect/src/vogar/Expectation.java b/libs/vogar-expect/src/vogar/expect/Expectation.java
similarity index 99%
rename from libs/vogar-expect/src/vogar/Expectation.java
rename to libs/vogar-expect/src/vogar/expect/Expectation.java
index ddbc233..8ccd0bd 100644
--- a/libs/vogar-expect/src/vogar/Expectation.java
+++ b/libs/vogar-expect/src/vogar/expect/Expectation.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar;
+package vogar.expect;
import java.util.LinkedHashSet;
import java.util.Set;
diff --git a/libs/vogar-expect/src/vogar/ExpectationStore.java b/libs/vogar-expect/src/vogar/expect/ExpectationStore.java
similarity index 99%
rename from libs/vogar-expect/src/vogar/ExpectationStore.java
rename to libs/vogar-expect/src/vogar/expect/ExpectationStore.java
index c6c7f86..6807f17 100644
--- a/libs/vogar-expect/src/vogar/ExpectationStore.java
+++ b/libs/vogar-expect/src/vogar/expect/ExpectationStore.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar;
+package vogar.expect;
import com.android.json.stream.JsonReader;
import com.google.common.base.Joiner;
@@ -32,7 +32,7 @@
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
-import vogar.util.Log;
+import vogar.expect.util.Log;
/**
* A database of expected outcomes. Entries in this database come in two forms.
diff --git a/libs/vogar-expect/src/vogar/ModeId.java b/libs/vogar-expect/src/vogar/expect/ModeId.java
similarity index 97%
rename from libs/vogar-expect/src/vogar/ModeId.java
rename to libs/vogar-expect/src/vogar/expect/ModeId.java
index 3b24cc1..0ebf60c 100644
--- a/libs/vogar-expect/src/vogar/ModeId.java
+++ b/libs/vogar-expect/src/vogar/expect/ModeId.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar;
+package vogar.expect;
public enum ModeId {
DEVICE, JVM, ACTIVITY, SIM, HOST;
diff --git a/libs/vogar-expect/src/vogar/Outcome.java b/libs/vogar-expect/src/vogar/expect/Outcome.java
similarity index 98%
rename from libs/vogar-expect/src/vogar/Outcome.java
rename to libs/vogar-expect/src/vogar/expect/Outcome.java
index 3d7c68f..cbe2abe 100644
--- a/libs/vogar-expect/src/vogar/Outcome.java
+++ b/libs/vogar-expect/src/vogar/expect/Outcome.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar;
+package vogar.expect;
import com.google.common.collect.Lists;
import java.io.PrintWriter;
@@ -22,7 +22,7 @@
import java.util.Arrays;
import java.util.Date;
import java.util.List;
-import vogar.util.Strings;
+import vogar.expect.util.Strings;
/**
* An outcome of an action. Some actions may have multiple outcomes. For
diff --git a/libs/vogar-expect/src/vogar/Result.java b/libs/vogar-expect/src/vogar/expect/Result.java
similarity index 97%
rename from libs/vogar-expect/src/vogar/Result.java
rename to libs/vogar-expect/src/vogar/expect/Result.java
index 45c88ce..b94c0a0 100644
--- a/libs/vogar-expect/src/vogar/Result.java
+++ b/libs/vogar-expect/src/vogar/expect/Result.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar;
+package vogar.expect;
/**
* The result of a test or benchmark execution.
diff --git a/libs/vogar-expect/src/vogar/ResultValue.java b/libs/vogar-expect/src/vogar/expect/ResultValue.java
similarity index 96%
rename from libs/vogar-expect/src/vogar/ResultValue.java
rename to libs/vogar-expect/src/vogar/expect/ResultValue.java
index 2e450f4..46716d8 100644
--- a/libs/vogar-expect/src/vogar/ResultValue.java
+++ b/libs/vogar-expect/src/vogar/expect/ResultValue.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar;
+package vogar.expect;
/**
* Represents an evaluation of the goodness of a result.
diff --git a/libs/vogar-expect/src/vogar/util/Log.java b/libs/vogar-expect/src/vogar/expect/util/Log.java
similarity index 98%
rename from libs/vogar-expect/src/vogar/util/Log.java
rename to libs/vogar-expect/src/vogar/expect/util/Log.java
index 99c0807..9aa016f 100644
--- a/libs/vogar-expect/src/vogar/util/Log.java
+++ b/libs/vogar-expect/src/vogar/expect/util/Log.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar.util;
+package vogar.expect.util;
import java.util.List;
diff --git a/libs/vogar-expect/src/vogar/util/LogOutput.java b/libs/vogar-expect/src/vogar/expect/util/LogOutput.java
similarity index 97%
rename from libs/vogar-expect/src/vogar/util/LogOutput.java
rename to libs/vogar-expect/src/vogar/expect/util/LogOutput.java
index 8123a81..7e60d07 100644
--- a/libs/vogar-expect/src/vogar/util/LogOutput.java
+++ b/libs/vogar-expect/src/vogar/expect/util/LogOutput.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package vogar.util;
+package vogar.expect.util;
import java.util.List;
diff --git a/libs/vogar-expect/src/vogar/util/Strings.java b/libs/vogar-expect/src/vogar/expect/util/Strings.java
similarity index 99%
rename from libs/vogar-expect/src/vogar/util/Strings.java
rename to libs/vogar-expect/src/vogar/expect/util/Strings.java
index f92edd8..208cbda 100644
--- a/libs/vogar-expect/src/vogar/util/Strings.java
+++ b/libs/vogar-expect/src/vogar/expect/util/Strings.java
@@ -15,7 +15,7 @@
*/
-package vogar.util;
+package vogar.expect.util;
//import com.google.common.collect.Lists;
import java.io.BufferedReader;
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java b/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java
index f409dbd..4419b4b 100644
--- a/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java
@@ -27,10 +27,10 @@
import org.junit.runner.manipulation.Filter;
import org.junit.runners.ParentRunner;
import org.junit.runners.Suite;
-import vogar.Expectation;
-import vogar.ExpectationStore;
-import vogar.ModeId;
-import vogar.Result;
+import vogar.expect.Expectation;
+import vogar.expect.ExpectationStore;
+import vogar.expect.ModeId;
+import vogar.expect.Result;
/**
* Filter out tests/classes that are not requested or which are expected to fail.
diff --git a/tests/core/runner/src/com/android/cts/core/runner/ExpectationBasedFilter.java b/tests/core/runner/src/com/android/cts/core/runner/ExpectationBasedFilter.java
index f409dbd..4419b4b 100644
--- a/tests/core/runner/src/com/android/cts/core/runner/ExpectationBasedFilter.java
+++ b/tests/core/runner/src/com/android/cts/core/runner/ExpectationBasedFilter.java
@@ -27,10 +27,10 @@
import org.junit.runner.manipulation.Filter;
import org.junit.runners.ParentRunner;
import org.junit.runners.Suite;
-import vogar.Expectation;
-import vogar.ExpectationStore;
-import vogar.ModeId;
-import vogar.Result;
+import vogar.expect.Expectation;
+import vogar.expect.ExpectationStore;
+import vogar.expect.ModeId;
+import vogar.expect.Result;
/**
* Filter out tests/classes that are not requested or which are expected to fail.
diff --git a/tests/jdwp/runner/host-side/Android.bp b/tests/jdwp/runner/host-side/Android.bp
index e421ce0..597ae6f 100644
--- a/tests/jdwp/runner/host-side/Android.bp
+++ b/tests/jdwp/runner/host-side/Android.bp
@@ -35,5 +35,6 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
}
diff --git a/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/DalvikTest.java b/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/DalvikTest.java
index 61e1988..4546535 100644
--- a/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/DalvikTest.java
+++ b/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/DalvikTest.java
@@ -61,8 +61,8 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import vogar.ExpectationStore;
-import vogar.ModeId;
+import vogar.expect.ExpectationStore;
+import vogar.expect.ModeId;
/**
* A wrapper to run tests against Dalvik.
diff --git a/tests/libcore/luni/Android.bp b/tests/libcore/luni/Android.bp
index 6ce733f..1a4416b 100644
--- a/tests/libcore/luni/Android.bp
+++ b/tests/libcore/luni/Android.bp
@@ -53,6 +53,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
java_resources: [
":libcore-expectations-knownfailures",
diff --git a/tests/libcore/ojluni/Android.bp b/tests/libcore/ojluni/Android.bp
index 83fe2aa..6232e47 100644
--- a/tests/libcore/ojluni/Android.bp
+++ b/tests/libcore/ojluni/Android.bp
@@ -33,6 +33,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
java_resources: [":libcore-expectations-knownfailures"],
}
diff --git a/tests/libcore/okhttp/Android.bp b/tests/libcore/okhttp/Android.bp
index 5052019..511e28a 100644
--- a/tests/libcore/okhttp/Android.bp
+++ b/tests/libcore/okhttp/Android.bp
@@ -34,8 +34,9 @@
// Tag this module as a cts test artifact
test_suites: [
"cts",
- "vts",
"general-tests",
+ "mts",
+ "vts",
],
java_resources: [":libcore-expectations-knownfailures"],
}
diff --git a/tests/libcore/runner/Android.bp b/tests/libcore/runner/Android.bp
index 2b8c525..3edbe3f 100644
--- a/tests/libcore/runner/Android.bp
+++ b/tests/libcore/runner/Android.bp
@@ -28,5 +28,6 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
}
diff --git a/tests/mocking/extended/AndroidTest.xml b/tests/mocking/extended/AndroidTest.xml
index 5fcd077..3b655ba 100644
--- a/tests/mocking/extended/AndroidTest.xml
+++ b/tests/mocking/extended/AndroidTest.xml
@@ -26,6 +26,8 @@
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.extended.mocking.cts" />
<option name="runtime-hint" value="120s" />
+ <!-- test-timeout unit is ms, value = 10 min -->
+ <option name="test-timeout" value="600000" />
</test>
<!-- Controller that will skip the module if a native bridge situation is detected -->
diff --git a/tests/mocking/inline/AndroidTest.xml b/tests/mocking/inline/AndroidTest.xml
index f7b51fb..b580e05 100644
--- a/tests/mocking/inline/AndroidTest.xml
+++ b/tests/mocking/inline/AndroidTest.xml
@@ -26,6 +26,8 @@
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.inline.mocking.cts" />
<option name="runtime-hint" value="120s" />
+ <!-- test-timeout unit is ms, value = 10 min -->
+ <option name="test-timeout" value="600000" />
</test>
<!-- Controller that will skip the module if a native bridge situation is detected -->
diff --git a/tests/signature/api-check/shared-libs-api/Android.mk b/tests/signature/api-check/shared-libs-api/Android.mk
index d4d36fb..d921e6b 100644
--- a/tests/signature/api-check/shared-libs-api/Android.mk
+++ b/tests/signature/api-check/shared-libs-api/Android.mk
@@ -20,8 +20,8 @@
$(foreach ver,$(call int_range_list,28,$(PLATFORM_SDK_VERSION)),\
$(foreach api_level,public system,\
- $(foreach lib,$(filter-out android,$(filter-out %removed,\
- $(basename $(notdir $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/$(ver)/$(api_level)/api/*.txt))))),\
+ $(foreach lib,$(filter-out android,$(filter-out %removed,$(filter-out incompatibilities,\
+ $(basename $(notdir $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/$(ver)/$(api_level)/api/*.txt)))))),\
$(eval all_shared_libs_modules += $(lib)-$(ver)-$(api_level).txt))))
all_shared_libs_files := $(addprefix $(COMPATIBILITY_TESTCASES_OUT_cts)/,$(all_shared_libs_modules))
diff --git a/tests/signature/api/Android.mk b/tests/signature/api/Android.mk
index 96afc10..6e7f13c 100644
--- a/tests/signature/api/Android.mk
+++ b/tests/signature/api/Android.mk
@@ -38,6 +38,6 @@
$(foreach ver,$(call int_range_list,28,$(PLATFORM_SDK_VERSION)),\
$(foreach api_level,public system,\
- $(foreach lib,$(filter-out android,$(filter-out %removed,\
- $(basename $(notdir $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/$(ver)/$(api_level)/api/*.txt))))),\
+ $(foreach lib,$(filter-out android,$(filter-out %removed,$(filter-out incompatibilities,\
+ $(basename $(notdir $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/$(ver)/$(api_level)/api/*.txt)))))),\
$(eval $(call copy_api_txt_file,$(lib)-$(ver)-$(api_level).txt,prebuilts/sdk/$(ver)/$(api_level)/api/$(lib).txt)))))
diff --git a/tests/tests/icu/Android.bp b/tests/tests/icu/Android.bp
index 69f358f..178b909 100644
--- a/tests/tests/icu/Android.bp
+++ b/tests/tests/icu/Android.bp
@@ -25,6 +25,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
platform_apis: true,
}
diff --git a/tests/tests/media/Android.bp b/tests/tests/media/Android.bp
index 9989b6b..f2be353 100644
--- a/tests/tests/media/Android.bp
+++ b/tests/tests/media/Android.bp
@@ -74,6 +74,7 @@
"vts",
"general-tests",
"cts_instant",
+ "mts",
],
host_required: ["cts-dynamic-config"],
}
diff --git a/tests/tests/mediastress/Android.bp b/tests/tests/mediastress/Android.bp
index 491fff3..e0878b6 100644
--- a/tests/tests/mediastress/Android.bp
+++ b/tests/tests/mediastress/Android.bp
@@ -20,6 +20,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
// Include both the 32 and 64 bit versions
compile_multilib: "both",
diff --git a/tests/tests/net/jni/NativeMultinetworkJni.cpp b/tests/tests/net/jni/NativeMultinetworkJni.cpp
index a6b5e90..5bd3013 100644
--- a/tests/tests/net/jni/NativeMultinetworkJni.cpp
+++ b/tests/tests/net/jni/NativeMultinetworkJni.cpp
@@ -455,13 +455,17 @@
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo));
// For reference see:
- // https://tools.ietf.org/html/draft-tsvwg-quic-protocol-01#section-6.1
- uint8_t quic_packet[] = {
- 0x0c, // public flags: 64bit conn ID, 8bit sequence number
+ // https://tools.ietf.org/html/draft-tsvwg-quic-protocol#section-6.1
+ uint8_t quic_packet[1200] = {
+ 0x0d, // public flags:
+ // - version present (0x01),
+ // - 64bit connection ID (0x0c),
+ // - 1 byte packet number (0x00)
0, 0, 0, 0, 0, 0, 0, 0, // 64bit connection ID
- 0x01, // sequence number
+ 0xaa, 0xda, 0xca, 0xaa, // reserved-space version number
+ 1, // 1 byte packet number
0x00, // private flags
- 0x07, // type: regular frame type "PING"
+ 0x07, // PING frame (cuz why not)
};
arc4random_buf(quic_packet + 1, 8); // random connection ID
@@ -489,7 +493,7 @@
i + 1, MAX_RETRIES, rcvd, errnum);
}
}
- if (rcvd < sent) {
+ if (rcvd < 9) {
ALOGD("QUIC UDP %s: sent=%zd but rcvd=%zd, errno=%d", kPort, sent, rcvd, errnum);
if (rcvd <= 0) {
ALOGD("Does this network block UDP port %s?", kPort);
@@ -505,8 +509,7 @@
return -EPROTO;
}
- // TODO: log, and compare to the IP address encoded in the
- // response, since this should be a public reset packet.
+ // TODO: Replace this quick 'n' dirty test with proper QUIC-capable code.
close(fd);
return 0;
diff --git a/tests/tests/neuralnetworks/Android.mk b/tests/tests/neuralnetworks/Android.mk
index 1799cec..50cb0f1 100644
--- a/tests/tests/neuralnetworks/Android.mk
+++ b/tests/tests/neuralnetworks/Android.mk
@@ -14,44 +14,6 @@
nnapi_cts_dir := $(call my-dir)
-# Build the static library which is friendly to multi-threaded compilation.
-# The sources are located at frameworks/ml/nn/runtime/test
-LOCAL_PATH:= frameworks/ml/nn/runtime/test/
-include $(CLEAR_VARS)
-LOCAL_MODULE := CtsNNAPITests_static
-LOCAL_SRC_FILES := \
- $(call all-cpp-files-under,generated/tests) \
- $(call all-cpp-files-under,fuzzing/operation_signatures) \
- fuzzing/OperationManager.cpp \
- fuzzing/RandomGraphGenerator.cpp \
- fuzzing/RandomGraphGeneratorUtils.cpp \
- fuzzing/RandomVariable.cpp \
- fuzzing/TestRandomGraph.cpp \
- TestGenerated.cpp \
- TestMemory.cpp \
- TestTrivialModel.cpp \
- TestUnknownDimensions.cpp \
- TestValidateModel.cpp \
- TestValidateOperations.cpp \
- TestValidation.cpp \
- TestWrapper.cpp \
- TestNeuralNetworksWrapper.cpp
-
-LOCAL_C_INCLUDES := frameworks/ml/nn/runtime/include/
-LOCAL_C_INCLUDES += frameworks/ml/nn/runtime/test/
-LOCAL_C_INCLUDES += frameworks/ml/nn/runtime/
-LOCAL_C_INCLUDES += frameworks/ml/nn/common/include
-LOCAL_C_INCLUDES += frameworks/ml/nn/tools/test_generator/include
-
-LOCAL_CFLAGS := -Werror -Wall -DNNTEST_ONLY_PUBLIC_API -DNNTEST_CTS
-
-LOCAL_SHARED_LIBRARIES := libandroid liblog libneuralnetworks
-LOCAL_STATIC_LIBRARIES := libgtest_ndk_c++ libgmock_ndk
-LOCAL_SDK_VERSION := current
-LOCAL_NDK_STL_VARIANT := c++_static
-include $(BUILD_STATIC_LIBRARY)
-
-
# Build the actual CTS module with the static lib above.
# This is necessary for the build system to pickup the AndroidTest.xml.
LOCAL_PATH:= $(nnapi_cts_dir)
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index d06f3fc..8f2a947 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -41,7 +41,8 @@
src/android/os/cts/IEmptyService.aidl \
src/android/os/cts/ISeccompIsolatedService.aidl \
src/android/os/cts/ISecondary.aidl \
- src/android/os/cts/ISharedMemoryService.aidl
+ src/android/os/cts/ISharedMemoryService.aidl \
+ src/android/os/cts/IParcelExceptionService.aidl \
LOCAL_PACKAGE_NAME := CtsOsTestCases
diff --git a/tests/tests/os/AndroidManifest.xml b/tests/tests/os/AndroidManifest.xml
index ef4893e..ffeac0a 100644
--- a/tests/tests/os/AndroidManifest.xml
+++ b/tests/tests/os/AndroidManifest.xml
@@ -80,6 +80,10 @@
android:name="android.os.cts.SharedMemoryService"
android:process=":sharedmem"
android:exported="false" />
+ <service
+ android:name="android.os.cts.ParcelExceptionService"
+ android:process=":remote"
+ android:exported="true" />
<service android:name="android.os.cts.LocalService">
<intent-filter>
diff --git a/libs/vogar-expect/src/vogar/ResultValue.java b/tests/tests/os/src/android/os/cts/ExceptionalParcelable.aidl
similarity index 74%
copy from libs/vogar-expect/src/vogar/ResultValue.java
copy to tests/tests/os/src/android/os/cts/ExceptionalParcelable.aidl
index 2e450f4..7d09693 100644
--- a/libs/vogar-expect/src/vogar/ResultValue.java
+++ b/tests/tests/os/src/android/os/cts/ExceptionalParcelable.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2019 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.
@@ -14,13 +14,6 @@
* limitations under the License.
*/
-package vogar;
+package android.os.cts;
-/**
- * Represents an evaluation of the goodness of a result.
- */
-public enum ResultValue {
- OK,
- IGNORE,
- FAIL
-}
+parcelable ExceptionalParcelable;
\ No newline at end of file
diff --git a/tests/tests/os/src/android/os/cts/ExceptionalParcelable.java b/tests/tests/os/src/android/os/cts/ExceptionalParcelable.java
new file mode 100644
index 0000000..333cf57
--- /dev/null
+++ b/tests/tests/os/src/android/os/cts/ExceptionalParcelable.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2019 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.os.cts;
+
+import android.os.IBinder;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+
+public class ExceptionalParcelable implements Parcelable {
+ private final IBinder mBinder;
+
+ ExceptionalParcelable(IBinder binder) {
+ mBinder = binder;
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * Write a binder to the Parcel and then throw an exception
+ */
+ public void writeToParcel(Parcel out, int flags) {
+ // Write a binder for the exception to overwrite
+ out.writeStrongBinder(mBinder);
+
+ // Throw an exception
+ throw new IllegalArgumentException("A truly exceptional message");
+ }
+
+ public static final Creator<ExceptionalParcelable> CREATOR =
+ new Creator<ExceptionalParcelable>() {
+ @Override
+ public ExceptionalParcelable createFromParcel(Parcel source) {
+ return new ExceptionalParcelable(source.readStrongBinder());
+ }
+
+ @Override
+ public ExceptionalParcelable[] newArray(int size) {
+ return new ExceptionalParcelable[size];
+ }
+ };
+}
diff --git a/libs/vogar-expect/src/vogar/ResultValue.java b/tests/tests/os/src/android/os/cts/IParcelExceptionService.aidl
similarity index 67%
copy from libs/vogar-expect/src/vogar/ResultValue.java
copy to tests/tests/os/src/android/os/cts/IParcelExceptionService.aidl
index 2e450f4..ce7af6d 100644
--- a/libs/vogar-expect/src/vogar/ResultValue.java
+++ b/tests/tests/os/src/android/os/cts/IParcelExceptionService.aidl
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Android Open Source Project
+ * Copyright (C) 2019 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.
@@ -14,13 +14,10 @@
* limitations under the License.
*/
-package vogar;
+package android.os.cts;
+import android.os.cts.ExceptionalParcelable;
-/**
- * Represents an evaluation of the goodness of a result.
- */
-public enum ResultValue {
- OK,
- IGNORE,
- FAIL
+interface IParcelExceptionService {
+//parcelable android.os.cts.ExceptionalParcelable;
+ ExceptionalParcelable writeBinderThrowException();
}
diff --git a/tests/tests/os/src/android/os/cts/ParcelExceptionService.java b/tests/tests/os/src/android/os/cts/ParcelExceptionService.java
new file mode 100644
index 0000000..d8387e3
--- /dev/null
+++ b/tests/tests/os/src/android/os/cts/ParcelExceptionService.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 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.os.cts;
+
+import android.app.Service;
+import android.content.Intent;
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.RemoteException;
+
+public class ParcelExceptionService extends Service {
+ @Override
+ public IBinder onBind(Intent intent) {
+ return new ParcelExceptionServiceImpl();
+ }
+
+ private static class ParcelExceptionServiceImpl extends IParcelExceptionService.Stub {
+ private final IBinder mBinder = new Binder();
+
+
+ @Override
+ public ExceptionalParcelable writeBinderThrowException() throws RemoteException {
+ return new ExceptionalParcelable(mBinder);
+ }
+ }
+}
diff --git a/tests/tests/os/src/android/os/cts/ParcelTest.java b/tests/tests/os/src/android/os/cts/ParcelTest.java
index 3715850..77d325c 100644
--- a/tests/tests/os/src/android/os/cts/ParcelTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelTest.java
@@ -24,7 +24,14 @@
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
import android.content.pm.Signature;
import android.os.BadParcelableException;
import android.os.Binder;
@@ -39,6 +46,8 @@
import android.util.SparseArray;
import android.util.SparseBooleanArray;
+import com.google.common.util.concurrent.AbstractFuture;
+
public class ParcelTest extends AndroidTestCase {
public void testObtain() {
@@ -3308,4 +3317,55 @@
// good
}
}
+
+ public static class ParcelExceptionConnection extends AbstractFuture<IParcelExceptionService>
+ implements ServiceConnection {
+ @Override
+ public void onServiceConnected(ComponentName name, IBinder service) {
+ set(IParcelExceptionService.Stub.asInterface(service));
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName name) {
+ }
+
+ @Override
+ public IParcelExceptionService get() throws InterruptedException, ExecutionException {
+ try {
+ return get(5, TimeUnit.SECONDS);
+ } catch (TimeoutException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
+ public void testExceptionOverwritesObject() throws Exception {
+ final Intent intent = new Intent();
+ intent.setComponent(new ComponentName(
+ "android.os.cts", "android.os.cts.ParcelExceptionService"));
+
+ final ParcelExceptionConnection connection = new ParcelExceptionConnection();
+
+ mContext.startService(intent);
+ assertTrue(mContext.bindService(intent, connection,
+ Context.BIND_ABOVE_CLIENT | Context.BIND_EXTERNAL_SERVICE));
+
+
+ Parcel data = Parcel.obtain();
+ Parcel reply = Parcel.obtain();
+ data.writeInterfaceToken("android.os.cts.IParcelExceptionService");
+ IParcelExceptionService service = connection.get();
+ try {
+ assertTrue("Transaction failed", service.asBinder().transact(
+ IParcelExceptionService.Stub.TRANSACTION_writeBinderThrowException, data, reply,
+ 0));
+ } catch (Exception e) {
+ fail("Exception caught from transaction: " + e);
+ }
+ reply.setDataPosition(0);
+ assertTrue("Exception should have occurred on service-side",
+ reply.readExceptionCode() != 0);
+ assertNull("Binder should have been overwritten by the exception",
+ reply.readStrongBinder());
+ }
}
diff --git a/tests/tests/security/res/raw/bug_73552574_avc.mp4 b/tests/tests/security/res/raw/bug_73552574_avc.mp4
new file mode 100644
index 0000000..1cca70c
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_73552574_avc.mp4
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_73552574_framelen.mp4 b/tests/tests/security/res/raw/bug_73552574_framelen.mp4
new file mode 100644
index 0000000..36728cc
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_73552574_framelen.mp4
@@ -0,0 +1,93 @@
+48
+4
+28
+208
+0
+10
+39
+386
+8
+70
+6
+32
+31
+4
+8
+24
+10
+22
+12
+108
+9
+229
+38
+12
+10
+166
+39
+250
+43
+8
+70
+6
+29
+12
+4
+8
+33
+12
+0
+10
+156
+10
+39
+94
+10
+39
+386
+8
+70
+6
+10
+31
+4
+8
+24
+10
+22
+12
+70
+9
+420
+0
+8
+36
+6
+12
+20
+31
+102
+229
+38
+12
+10
+156
+10
+39
+197
+251
+38
+12
+10
+156
+10
+180
+10
+39
+386
+8
+70
+6
+32
+31
+6441
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index e9a3982..9e00421 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -803,6 +803,12 @@
before any existing test methods
***********************************************************/
+ @SecurityTest(minPatchLevel = "2018-06")
+ public void testBug_73552574() throws Exception {
+ int[] frameSizes = getFrameSizes(R.raw.bug_73552574_framelen);
+ doStagefrightTestRawBlob(R.raw.bug_73552574_avc, "video/avc", 320, 240, frameSizes);
+ }
+
@SecurityTest(minPatchLevel = "2018-02")
public void testStagefright_bug_68342866() throws Exception {
Thread server = new Thread() {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
index 4610d7c..14c0bb3 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
@@ -42,6 +42,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.os.Looper;
import android.os.PersistableBundle;
@@ -63,6 +64,7 @@
private static final String CARRIER_NAME_OVERRIDE = "carrier_a";
private CarrierConfigManager mConfigManager;
private TelephonyManager mTelephonyManager;
+ private PackageManager mPackageManager;
private static final int TOLERANCE = 2000;
private final Object mLock = new Object();
@@ -72,6 +74,7 @@
getContext().getSystemService(Context.TELEPHONY_SERVICE);
mConfigManager = (CarrierConfigManager)
getContext().getSystemService(Context.CARRIER_CONFIG_SERVICE);
+ mPackageManager = getContext().getPackageManager();
}
@After
@@ -141,6 +144,9 @@
@SecurityTest
@Test
public void testRevokePermission() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ return;
+ }
PersistableBundle config;
try {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/PhoneNumberUtilsTest.java b/tests/tests/telephony/current/src/android/telephony/cts/PhoneNumberUtilsTest.java
index d9a989f..daf078b 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/PhoneNumberUtilsTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/PhoneNumberUtilsTest.java
@@ -40,13 +40,30 @@
import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
public class PhoneNumberUtilsTest {
+ private static final int MIN_MATCH = 7;
+
// mPhoneNumber ~ "+17005550020", length == 7.
private byte[] mPhoneNumber = { (byte) 0x91, (byte) 0x71, (byte) 0x00, (byte) 0x55,
(byte) 0x05, (byte) 0x20, (byte) 0xF0 };
+ private int mOldMinMatch;
+
+ @Before
+ public void setUp() throws Exception {
+ mOldMinMatch = PhoneNumberUtils.getMinMatchForTest();
+ PhoneNumberUtils.setMinMatchForTest(MIN_MATCH);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ PhoneNumberUtils.setMinMatchForTest(mOldMinMatch);
+ }
+
@Test
public void testExtractMethods() {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
index e06a499..3283bc9 100755
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
@@ -135,6 +135,9 @@
@Test
public void testDivideMessage() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ return;
+ }
ArrayList<String> dividedMessages = divideMessage(LONG_TEXT);
assertNotNull(dividedMessages);
if (TelephonyUtils.isSkt(mTelephonyManager)) {
@@ -150,6 +153,9 @@
@Test
public void testDivideUnicodeMessage() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ return;
+ }
ArrayList<String> dividedMessages = divideMessage(LONG_TEXT_WITH_32BIT_CHARS);
assertNotNull(dividedMessages);
assertTrue(isComplete(dividedMessages, 3, LONG_TEXT_WITH_32BIT_CHARS));
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index 70e0acc..ec9ec07 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -894,6 +894,10 @@
*/
@Test
public void testGetUiccCardsInfo() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
+ return;
+ }
// Requires READ_PRIVILEGED_PHONE_STATE or carrier privileges
List<UiccCardInfo> infos =
ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/LockedMessageTest.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/LockedMessageTest.java
new file mode 100644
index 0000000..f3d04cb
--- /dev/null
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/LockedMessageTest.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2019 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.telephonyprovider.cts;
+
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.Telephony;
+
+import androidx.test.filters.SmallTest;
+
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@SmallTest
+public class LockedMessageTest {
+ private static final String MMS_SUBJECT_ONE = "MMS Subject CTS One";
+ private static final String SMS_SUBJECT_TWO = "SMS Subject CTS One";
+ private static final String TEST_SMS_BODY = "TEST_SMS_BODY";
+ private static final String TEST_ADDRESS = "+19998880001";
+ private static final int TEST_THREAD_ID = 101;
+
+ private ContentResolver mContentResolver;
+
+ @BeforeClass
+ public static void ensureDefaultSmsApp() {
+ DefaultSmsAppHelper.ensureDefaultSmsApp();
+ }
+
+ @AfterClass
+ public static void cleanup() {
+ ContentResolver contentResolver = getInstrumentation().getContext().getContentResolver();
+ contentResolver.delete(Telephony.Mms.CONTENT_URI, null, null);
+ contentResolver.delete(Telephony.Sms.CONTENT_URI, null, null);
+ }
+
+ @Before
+ public void setupTestEnvironment() {
+ cleanup();
+ mContentResolver = getInstrumentation().getContext().getContentResolver();
+ }
+
+ /**
+ * The purpose of this test is to check at least one locked message found in the union of MMS
+ * and SMS messages.
+ */
+ @Test
+ @Ignore
+ public void testLockedMessage_atMostOneLockedMessage() {
+ Uri mmsUri = insertMmsWithLockedMessage();
+ String mmsId = mmsUri.getLastPathSegment();
+
+ Uri smsUri = insertSmsWithLockedMessage();
+ String smsId = smsUri.getLastPathSegment();
+
+ Cursor cursor = mContentResolver.query(Telephony.MmsSms.CONTENT_LOCKED_URI, null, null,
+ null);
+ assertThat(cursor.getCount()).isEqualTo(1);
+ assertThat(cursor.moveToFirst()).isEqualTo(true);
+ assertThat(cursor.getColumnCount()).isEqualTo(1);
+ assertThat(cursor.getColumnNames()).isEqualTo(new String[]{Telephony.BaseMmsColumns._ID});
+ assertThat(cursor.getInt(cursor.getColumnIndex(Telephony.BaseMmsColumns._ID)))
+ .isNotEqualTo(Integer.parseInt(mmsId));
+ assertThat(cursor.getInt(cursor.getColumnIndex(Telephony.BaseMmsColumns._ID)))
+ .isEqualTo(Integer.parseInt(smsId));
+ }
+
+ /**
+ * The purpose of this test is to check there is no locked message found in the union of MMS and
+ * SMS messages.
+ */
+ @Test
+ public void testLockedMessage_getNoLockedMessage() {
+ Uri mmsUri = insertIntoMmsTable(MMS_SUBJECT_ONE, Telephony.Sms.MESSAGE_TYPE_SENT);
+ assertThat(mmsUri).isNotNull();
+ Cursor mmsCursor = mContentResolver.query(mmsUri, null, null, null);
+ assertThat(mmsCursor.getCount()).isEqualTo(1);
+
+ Uri smsUri = insertIntoSmsTable(SMS_SUBJECT_TWO);
+ assertThat(smsUri).isNotNull();
+ Cursor smCursor = mContentResolver.query(smsUri, null, null, null);
+ assertThat(smCursor.getCount()).isEqualTo(1);
+
+ Cursor cursor = mContentResolver.query(Telephony.MmsSms.CONTENT_LOCKED_URI, null, null,
+ null);
+ assertThat(cursor.getCount()).isEqualTo(0);
+ }
+
+ private Uri insertMmsWithLockedMessage() {
+ Uri mmsUri = insertIntoMmsTable(MMS_SUBJECT_ONE, Telephony.Sms.MESSAGE_TYPE_SENT);
+ assertThat(mmsUri).isNotNull();
+
+ Cursor cursor = mContentResolver.query(mmsUri, null, null, null);
+
+ assertThat(cursor.getCount()).isEqualTo(1);
+
+ final ContentValues updateValues = new ContentValues();
+ updateValues.put(Telephony.Mms.LOCKED, 1);
+
+ int cursorUpdate = mContentResolver.update(mmsUri, updateValues, null, null);
+ assertThat(cursorUpdate).isEqualTo(1);
+
+ Cursor cursorAfterReadUpdate = mContentResolver.query(mmsUri, null, null, null);
+
+ assertThat(cursorAfterReadUpdate.getCount()).isEqualTo(1);
+ assertThat(cursorAfterReadUpdate.moveToFirst()).isEqualTo(true);
+ assertThat(
+ cursorAfterReadUpdate.getInt(
+ cursorAfterReadUpdate.getColumnIndex(Telephony.Mms.LOCKED)))
+ .isEqualTo(
+ 1);
+ return mmsUri;
+ }
+
+ private Uri insertSmsWithLockedMessage() {
+ Uri smsUri = insertIntoSmsTable(SMS_SUBJECT_TWO);
+ assertThat(smsUri).isNotNull();
+
+ Cursor cursor = mContentResolver.query(smsUri, null, null, null);
+
+ assertThat(cursor.getCount()).isEqualTo(1);
+
+ final ContentValues updateValues = new ContentValues();
+ updateValues.put(Telephony.Sms.LOCKED, 1);
+
+ int cursorUpdate = mContentResolver.update(smsUri, updateValues, null, null);
+ assertThat(cursorUpdate).isEqualTo(1);
+
+ Cursor cursorAfterReadUpdate = mContentResolver.query(smsUri, null, null, null);
+
+ assertThat(cursorAfterReadUpdate.getCount()).isEqualTo(1);
+ assertThat(cursorAfterReadUpdate.moveToFirst()).isEqualTo(true);
+ assertThat(
+ cursorAfterReadUpdate.getInt(
+ cursorAfterReadUpdate.getColumnIndex(Telephony.Sms.LOCKED)))
+ .isEqualTo(
+ 1);
+ return smsUri;
+ }
+
+ private Uri insertIntoMmsTable(String subject, int messageType) {
+ final ContentValues mmsValues = new ContentValues();
+ mmsValues.put(Telephony.Mms.TEXT_ONLY, 1);
+ mmsValues.put(Telephony.Mms.MESSAGE_TYPE, messageType);
+ mmsValues.put(Telephony.Mms.SUBJECT, subject);
+ mmsValues.put(Telephony.Mms.THREAD_ID, TEST_THREAD_ID);
+ final Uri mmsUri = mContentResolver.insert(Telephony.Mms.CONTENT_URI, mmsValues);
+ return mmsUri;
+ }
+
+ private Uri insertIntoSmsTable(String subject) {
+ final ContentValues smsValues = new ContentValues();
+ smsValues.put(Telephony.Sms.SUBJECT, subject);
+ smsValues.put(Telephony.Sms.ADDRESS, TEST_ADDRESS);
+ smsValues.put(Telephony.Sms.BODY, TEST_SMS_BODY);
+ smsValues.put(Telephony.Sms.THREAD_ID, TEST_THREAD_ID);
+ final Uri smsUri = mContentResolver.insert(Telephony.Sms.CONTENT_URI, smsValues);
+ return smsUri;
+ }
+
+}
diff --git a/tools/cts-dynamic-config/Android.mk b/tools/cts-dynamic-config/Android.mk
index da8e11f..dc53d6b 100644
--- a/tools/cts-dynamic-config/Android.mk
+++ b/tools/cts-dynamic-config/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_CLASS := FAKE
LOCAL_IS_HOST_MODULE := true
-LOCAL_COMPATIBILITY_SUITE := cts general-tests vts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests vts mts
# my_test_config_file := DynamicConfig.xml
# TODO (sbasi): Update to use BUILD_HOST_TEST_CONFIG when it's primary install
diff --git a/tools/cts-media-preparer-app/Android.bp b/tools/cts-media-preparer-app/Android.bp
index 37b7e2e..400dac7 100644
--- a/tools/cts-media-preparer-app/Android.bp
+++ b/tools/cts-media-preparer-app/Android.bp
@@ -31,6 +31,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
sdk_version: "test_current",
}
diff --git a/tools/utils/CollectAllTests.java b/tools/utils/CollectAllTests.java
index 1c6fa99..2582149 100644
--- a/tools/utils/CollectAllTests.java
+++ b/tools/utils/CollectAllTests.java
@@ -22,8 +22,8 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import vogar.Expectation;
-import vogar.ExpectationStore;
+import vogar.expect.Expectation;
+import vogar.expect.ExpectationStore;
import java.io.BufferedReader;
import java.io.File;
diff --git a/tools/utils/DescriptionGenerator.java b/tools/utils/DescriptionGenerator.java
index 1e2542f..ada9b4d 100644
--- a/tools/utils/DescriptionGenerator.java
+++ b/tools/utils/DescriptionGenerator.java
@@ -38,8 +38,8 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import vogar.ExpectationStore;
-import vogar.Expectation;
+import vogar.expect.ExpectationStore;
+import vogar.expect.Expectation;
import com.sun.javadoc.AnnotationDesc;
import com.sun.javadoc.AnnotationTypeDoc;
diff --git a/tools/utils/VogarUtils.java b/tools/utils/VogarUtils.java
index 8657aa6..d760d7d 100644
--- a/tools/utils/VogarUtils.java
+++ b/tools/utils/VogarUtils.java
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-import vogar.Expectation;
-import vogar.ExpectationStore;
-import vogar.ModeId;
-import vogar.Result;
+import vogar.expect.Expectation;
+import vogar.expect.ExpectationStore;
+import vogar.expect.ModeId;
+import vogar.expect.Result;
import com.android.tradefed.util.AbiUtils;