Merge "Revert "Added Tapjacking test for Device admin"" into oc-dev am: e2a1a9e5d9
am: a7084f1415
Change-Id: I68afb3ccf61fbcd4530439bc2a1bd2c683618625
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index dee900a..d82c24c 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -51,7 +51,7 @@
LOCAL_SDK_VERSION := test_current
LOCAL_DEX_PREOPT := false
-
+-include cts/error_prone_rules_tests.mk
include $(BUILD_PACKAGE)
# Build CTS verifier framework as a libary.
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 8648aae..198dee5 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -1633,7 +1633,6 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_camera" />
- <meta-data android:name="test_required_features" android:value="android.hardware.sensor.gyroscope" />
<meta-data android:name="test_required_features" android:value="android.hardware.camera.any"/>
</activity>
<activity
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 046d426..849059e 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1888,7 +1888,7 @@
<string name="pca_info">This tests whether or not OpenGL projection works.\n
You should see two "tumbling cubes." Tapping the screen should cause the cubes to explode.</string>
<string name="pca_test">Projection Cube Test</string>
- <string name="pwa_info">This tests whether or displaying widets and keyfocus navigation works.\n
+ <string name="pwa_info">This tests whether or displaying widgets and keyfocus navigation works.\n
You should see four buttons on the bottom of the screen.\n
Pressing the "up" and "down" buttons should highlight different buttons.\n
Furthermore, the highlight should disappear when any button is touched, and the touched button should behave as usual.\n</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/Correlation.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/Correlation.java
index 98d1365..c653d1d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/Correlation.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/Correlation.java
@@ -131,7 +131,7 @@
}
}
- log(String.format(" Threshold: %.3f, ignored:%d/%d (%%.2f)", threshold, ignored, N,
+ log(String.format(" Threshold: %.3f, ignored:%d/%d (%.2f)", threshold, ignored, N,
(double) ignored/(double)N));
status = true;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
index 428c475..9a01b35 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
@@ -146,9 +146,10 @@
case R.id.uap_recordRecordBtn:
Log.i(TAG, "Record Button Pressed");
if (!isPlaying()) {
- startRecording(false);
- mRecordBtn.setText(getString(R.string.audio_uap_record_stopBtn));
- mRecordLoopbackBtn.setEnabled(false);
+ if (startRecording(false)) {
+ mRecordBtn.setText(getString(R.string.audio_uap_record_stopBtn));
+ mRecordLoopbackBtn.setEnabled(false);
+ }
} else {
stopRecording();
mRecordBtn.setText(getString(R.string.audio_uap_record_recordBtn));
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java
index 002f460..7190af9 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java
@@ -19,6 +19,7 @@
import android.media.AudioFormat;
import android.media.AudioRecord;
import android.media.AudioTrack;
+import android.util.Log;
// TODO - This functionality probably exists in the framework function. Remove this and
// use that instead.
@@ -31,7 +32,10 @@
}
public static int countToIndexMask(int chanCount) {
- return (1 << chanCount) - 1;
+ // From the documentation for AudioFormat:
+ // The canonical channel index masks by channel count are given by the formula
+ // (1 << channelCount) - 1.
+ return (1 << chanCount) - 1;
}
public static int countToOutPositionMask(int channelCount) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
index ed25743..dc73543 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
@@ -121,8 +121,8 @@
mSampleRate = sampleRate;
int chanMask = AudioUtils.countToIndexMask(numChans);
- int bufferSizeInBytes =
- AudioRecord.getMinBufferSize(mSampleRate, chanMask, AudioFormat.ENCODING_PCM_FLOAT);
+ int bufferSizeInBytes = 2048; // Some, non-critical value
+
try {
mAudioRecord = new AudioRecord.Builder()
.setAudioFormat(new AudioFormat.Builder()
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java
index 52b3dee..4c8204f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/AccelerometerMeasurementTestActivity.java
@@ -100,6 +100,7 @@
TestSensorOperation.createOperation(environment, 100 /* event count */);
verifyMeasurements.addVerification(new MeanVerification(
expectations,
+ new float[]{1.95f, 1.95f, 1.95f} /* m / s^2 */,
new float[]{1.95f, 1.95f, 1.95f} /* m / s^2 */));
verifyMeasurements.execute(getCurrentTestNode());
return null;
diff --git a/apps/EmptyDeviceAdmin/Android.mk b/apps/EmptyDeviceAdmin/Android.mk
index 6ee3943..3d76129 100644
--- a/apps/EmptyDeviceAdmin/Android.mk
+++ b/apps/EmptyDeviceAdmin/Android.mk
@@ -29,6 +29,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/apps/PermissionApp/Android.mk b/apps/PermissionApp/Android.mk
index 50b1759..4bcc585 100644
--- a/apps/PermissionApp/Android.mk
+++ b/apps/PermissionApp/Android.mk
@@ -29,6 +29,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/build/config.mk b/build/config.mk
index 573dc7b..159dc8d 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -20,7 +20,7 @@
BUILD_COMPATIBILITY_SUITE := cts/build/compatibility_test_suite.mk
BUILD_CTS_EXECUTABLE := cts/build/test_executable.mk
BUILD_CTS_PACKAGE := cts/build/test_package.mk
-BUILD_CTS_HOST_JAVA_LIBRARY := $(BUILD_HOST_JAVA_LIBRARY)
+BUILD_CTS_HOST_JAVA_LIBRARY := cts/build/host_java_library.mk
BUILD_CTS_TARGET_JAVA_LIBRARY := cts/build/test_target_java_library.mk
BUILD_CTS_SUPPORT_PACKAGE := cts/build/support_package.mk
BUILD_CTS_DEVICE_INFO_PACKAGE := cts/build/device_info_package.mk
diff --git a/build/host_java_library.mk b/build/host_java_library.mk
new file mode 100644
index 0000000..303527e
--- /dev/null
+++ b/build/host_java_library.mk
@@ -0,0 +1,22 @@
+# 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.
+
+# Builds a java library (jar)
+#
+# Replace "include $(BUILD_HOST_JAVA_LIBRARY) with "include $(BUILD_CTS_HOST_JAVA_LIBRARY)
+#
+
+-include cts/error_prone_rules_tests.mk
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/build/support_package.mk b/build/support_package.mk
index e25ba8a..83d7da9 100644
--- a/build/support_package.mk
+++ b/build/support_package.mk
@@ -22,5 +22,6 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
+-include cts/error_prone_rules_tests.mk
include $(BUILD_PACKAGE)
diff --git a/build/test_package.mk b/build/test_package.mk
index 3cec0af..2aa0852 100644
--- a/build/test_package.mk
+++ b/build/test_package.mk
@@ -20,5 +20,6 @@
LOCAL_STATIC_JAVA_LIBRARIES += platform-test-annotations
+-include cts/error_prone_rules_tests.mk
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/build/test_target_java_library.mk b/build/test_target_java_library.mk
index eb11ef7..c932c30 100644
--- a/build/test_target_java_library.mk
+++ b/build/test_target_java_library.mk
@@ -20,5 +20,6 @@
LOCAL_DEX_PREOPT := false
LOCAL_STATIC_JAVA_LIBRARIES += platform-test-annotations
+-include cts/error_prone_rules_tests.mk
include $(BUILD_JAVA_LIBRARY)
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/build/CompatibilityBuildProvider.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/build/CompatibilityBuildProvider.java
index df3cfbc..286f53f 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/build/CompatibilityBuildProvider.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/build/CompatibilityBuildProvider.java
@@ -56,6 +56,14 @@
@Option(name="branch", description="build branch name to supply.")
private String mBranch = null;
+ @Option(name = "build-id",
+ description =
+ "build version number to supply. Override the default cts version number.")
+ private String mBuildId = null;
+
+ @Option(name="build-flavor", description="build flavor name to supply.")
+ private String mBuildFlavor = null;
+
@Option(name="use-device-build-info", description="Bootstrap build info from device")
private boolean mUseDeviceBuildInfo = false;
@@ -78,14 +86,22 @@
@Override
public IBuildInfo getBuild() {
// Create a blank BuildInfo which will get populated later.
- String version = getSuiteInfoBuildNumber();
- if (version == null) {
- version = IBuildInfo.UNKNOWN_BUILD_ID;
+ String version = null;
+ if (mBuildId != null) {
+ version = mBuildId;
+ } else {
+ version = getSuiteInfoBuildNumber();
+ if (version == null) {
+ version = IBuildInfo.UNKNOWN_BUILD_ID;
+ }
}
- IBuildInfo ctsBuild = new BuildInfo(version, mTestTag, mTestTag);
+ IBuildInfo ctsBuild = new BuildInfo(version, mTestTag);
if (mBranch != null) {
ctsBuild.setBuildBranch(mBranch);
}
+ if (mBuildFlavor != null) {
+ ctsBuild.setBuildFlavor(mBuildFlavor);
+ }
addCompatibilitySuiteInfo(ctsBuild);
return ctsBuild;
}
@@ -103,7 +119,7 @@
} else {
String buildId = device.getBuildId();
String buildFlavor = device.getBuildFlavor();
- IBuildInfo info = new DeviceBuildInfo(buildId, mTestTag, buildFlavor);
+ IBuildInfo info = new DeviceBuildInfo(buildId, mTestTag);
if (mBranch == null) {
// if branch is not specified via param, make a pseudo branch name based on platform
// version and product info from device
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/SubPlanHelper.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/SubPlanHelper.java
index 950a129..21cb203 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/SubPlanHelper.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/result/SubPlanHelper.java
@@ -307,7 +307,7 @@
Set<TestStatus> statusesToRun = new HashSet<TestStatus>();
for (String resultType : mResultTypes) {
// no test status exists for not-executed tests
- if (resultType != NOT_EXECUTED) {
+ if (!NOT_EXECUTED.equals(resultType)) {
statusesToRun.add(STATUS_MAP.get(resultType));
}
}
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/DeviceInfoCollector.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/DeviceInfoCollector.java
index 6237c23..d48e9f6 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/DeviceInfoCollector.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/DeviceInfoCollector.java
@@ -31,8 +31,6 @@
import java.io.File;
import java.io.FileNotFoundException;
-import java.util.HashMap;
-import java.util.Map;
import java.util.Map.Entry;
/**
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/FilePusher.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/FilePusher.java
index 70dc125..3eb93d4 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/FilePusher.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/FilePusher.java
@@ -61,6 +61,14 @@
* {@inheritDoc}
*/
@Override
+ public IAbi getAbi() {
+ return mAbi;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public File resolveRelativeFilePath(IBuildInfo buildInfo, String fileName) {
try {
File f = new File(getTestsDir(buildInfo),
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/NetworkConnectivityChecker.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/NetworkConnectivityChecker.java
index d77d931..8e038fb 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/NetworkConnectivityChecker.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/NetworkConnectivityChecker.java
@@ -37,7 +37,8 @@
public boolean postExecutionCheck(ITestDevice device) throws DeviceNotAvailableException {
if (!MonitoringUtils.checkDeviceConnectivity(device)) {
if (mIsFailed) {
- CLog.w("NetworkConnectivityChecker is still failing.");
+ CLog.w("NetworkConnectivityChecker is still failing on %s.",
+ device.getSerialNumber());
return true;
}
mIsFailed = true;
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/PreconditionPreparer.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/PreconditionPreparer.java
index 27ef658..d47b56c 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/PreconditionPreparer.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/PreconditionPreparer.java
@@ -49,7 +49,7 @@
+ "\"<arg-name>:<arg-value>\"")
private List<String> mPreconditionArgs = new ArrayList<>();
- protected final String LOG_TAG = getClass().getSimpleName();
+ protected final String mLogTag = getClass().getSimpleName();
@Override
public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError,
@@ -80,32 +80,32 @@
throws TargetSetupError, BuildError, DeviceNotAvailableException;
protected void logInfo(String info) {
- LogUtil.printLog(Log.LogLevel.INFO, LOG_TAG, info);
+ LogUtil.printLog(Log.LogLevel.INFO, mLogTag, info);
}
protected void logInfo(String infoFormat, Object... args) {
- LogUtil.printLog(Log.LogLevel.INFO, LOG_TAG, String.format(infoFormat, args));
+ LogUtil.printLog(Log.LogLevel.INFO, mLogTag, String.format(infoFormat, args));
}
protected void logWarning(String warning) {
- LogUtil.printLog(Log.LogLevel.WARN, LOG_TAG, warning);
+ LogUtil.printLog(Log.LogLevel.WARN, mLogTag, warning);
}
protected void logWarning(String warningFormat, Object... args) {
- LogUtil.printLog(Log.LogLevel.WARN, LOG_TAG, String.format(warningFormat, args));
+ LogUtil.printLog(Log.LogLevel.WARN, mLogTag, String.format(warningFormat, args));
}
protected void logError(String error) {
- LogUtil.printLog(Log.LogLevel.ERROR, LOG_TAG, error);
+ LogUtil.printLog(Log.LogLevel.ERROR, mLogTag, error);
}
protected void logError(String errorFormat, Object... args) {
- LogUtil.printLog(Log.LogLevel.ERROR, LOG_TAG, String.format(errorFormat, args));
+ LogUtil.printLog(Log.LogLevel.ERROR, mLogTag, String.format(errorFormat, args));
}
protected void logError(Throwable t) {
if (t != null) {
- Log.e(LOG_TAG, t);
+ Log.e(mLogTag, t);
}
}
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/TokenRequirement.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/TokenRequirement.java
index 102d9c8..f1faee9 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/TokenRequirement.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/targetprep/TokenRequirement.java
@@ -20,6 +20,7 @@
import com.android.tradefed.config.Option;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.targetprep.BuildError;
import com.android.tradefed.targetprep.ITargetPreparer;
import com.android.tradefed.targetprep.TargetSetupError;
@@ -45,8 +46,7 @@
@Override
public void setUp(ITestDevice device, IBuildInfo buildInfo) throws TargetSetupError,
BuildError, DeviceNotAvailableException {
- throw new TargetSetupError("TokenRequirement is not expected to run",
- device.getDeviceDescriptor());
+ CLog.e("TokenRequirement is not expected to run");
}
/**
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityHostTestBase.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityHostTestBase.java
index b2e2a33..bd4653b 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityHostTestBase.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityHostTestBase.java
@@ -77,6 +77,11 @@
}
@Override
+ public IAbi getAbi() {
+ return mAbi;
+ }
+
+ @Override
public void setBuild(IBuildInfo buildInfo) {
// Get the build, this is used to access the APK.
mBuild = buildInfo;
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java
index 72f0987..e0ba310 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/CompatibilityTest.java
@@ -277,6 +277,7 @@
// variables used for local sharding scenario
private static CountDownLatch sPreparedLatch;
private boolean mIsLocalSharding = false;
+ private boolean mIsSharded = false;
private IInvocationContext mInvocationContext;
@@ -691,9 +692,11 @@
*/
void setupFilters() throws DeviceNotAvailableException {
if (mRetrySessionId != null) {
- RetryFilterHelper helper = new RetryFilterHelper(mBuildHelper, mRetrySessionId);
+ // Load the invocation result
+ RetryFilterHelper helper = new RetryFilterHelper(mBuildHelper, mRetrySessionId,
+ mSubPlan, mIncludeFilters, mExcludeFilters, mAbiName, mModuleName, mTestName,
+ mRetryType);
helper.validateBuildFingerprint(mDevice);
- helper.setAllOptionsFrom(this);
helper.setCommandLineOptionsFor(this);
helper.populateRetryFilters();
mIncludeFilters = helper.getIncludeFilters();
@@ -768,6 +771,24 @@
* {@inheritDoc}
*/
@Override
+ public Collection<IRemoteTest> split(int shardCount) {
+ if (shardCount <= 1 || mIsSharded) {
+ return null;
+ }
+ mIsSharded = true;
+ List<IRemoteTest> shardQueue = new LinkedList<>();
+ for (int i = 0; i < shardCount; i++) {
+ CompatibilityTest test = (CompatibilityTest) getTestShard(shardCount, i);
+ shardQueue.add(test);
+ test.mIsSharded = true;
+ }
+ return shardQueue;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public IRemoteTest getTestShard(int shardCount, int shardIndex) {
CompatibilityTest test = new CompatibilityTest(shardCount, mModuleRepo, shardIndex);
OptionCopier.copyOptionsNoThrow(this, test);
@@ -790,6 +811,20 @@
mCollectTestsOnly = collectTestsOnly;
}
+ /**
+ * Sets include-filters for the compatibility test
+ */
+ public void setIncludeFilter(Set<String> includeFilters) {
+ mIncludeFilters.addAll(includeFilters);
+ }
+
+ /**
+ * Sets exclude-filters for the compatibility test
+ */
+ public void setExcludeFilter(Set<String> excludeFilters) {
+ mExcludeFilters.addAll(excludeFilters);
+ }
+
@Override
public void setInvocationContext(IInvocationContext invocationContext) {
mInvocationContext = invocationContext;
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/ModuleRepo.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/ModuleRepo.java
index 4238508..82b8980 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/ModuleRepo.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/ModuleRepo.java
@@ -217,7 +217,6 @@
// Need to generate a different config for each ABI as we cannot guarantee the
// configs are idempotent. This however means we parse the same file multiple times
for (IAbi abi : abis) {
- IConfiguration config = mConfigFactory.createConfigurationFromArgs(pathArg);
String id = AbiUtils.createId(abi.getName(), name);
if (!shouldRunModule(id)) {
// If the module should not run tests based on the state of filters,
@@ -225,6 +224,7 @@
continue;
}
+ IConfiguration config = mConfigFactory.createConfigurationFromArgs(pathArg);
Map<String, List<String>> args = new HashMap<>();
if (mModuleArgs.containsKey(name)) {
args.putAll(mModuleArgs.get(name));
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/retry/RetryFactoryTest.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/retry/RetryFactoryTest.java
new file mode 100644
index 0000000..42fb999
--- /dev/null
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/retry/RetryFactoryTest.java
@@ -0,0 +1,174 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.testtype.retry;
+
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
+import com.android.compatibility.common.tradefed.testtype.CompatibilityTest;
+import com.android.compatibility.common.tradefed.util.RetryFilterHelper;
+import com.android.compatibility.common.tradefed.util.RetryType;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.config.ConfigurationException;
+import com.android.tradefed.config.Option;
+import com.android.tradefed.config.Option.Importance;
+import com.android.tradefed.config.OptionClass;
+import com.android.tradefed.config.OptionSetter;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.result.ITestInvocationListener;
+import com.android.tradefed.suite.checker.ISystemStatusChecker;
+import com.android.tradefed.suite.checker.ISystemStatusCheckerReceiver;
+import com.android.tradefed.testtype.IBuildReceiver;
+import com.android.tradefed.testtype.IDeviceTest;
+import com.android.tradefed.testtype.IRemoteTest;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Runner that creates a {@link CompatibilityTest} to re-run some previous results.
+ * Only the 'cts' plan is supported.
+ * TODO: explore other new way to build the retry (instead of relying on one massive pair of
+ * include/exclude filters)
+ */
+@OptionClass(alias = "compatibility")
+public class RetryFactoryTest implements IRemoteTest, IDeviceTest, IBuildReceiver,
+ ISystemStatusCheckerReceiver {
+
+ /**
+ * Mirror the {@link CompatibilityTest} options in order to create it.
+ */
+ public static final String RETRY_OPTION = "retry";
+ @Option(name = RETRY_OPTION,
+ shortName = 'r',
+ description = "retry a previous session's failed and not executed tests.",
+ mandatory = true)
+ private Integer mRetrySessionId = null;
+
+ @Option(name = CompatibilityTest.SUBPLAN_OPTION,
+ description = "the subplan to run",
+ importance = Importance.IF_UNSET)
+ protected String mSubPlan;
+
+ @Option(name = CompatibilityTest.INCLUDE_FILTER_OPTION,
+ description = "the include module filters to apply.",
+ importance = Importance.ALWAYS)
+ protected Set<String> mIncludeFilters = new HashSet<>();
+
+ @Option(name = CompatibilityTest.EXCLUDE_FILTER_OPTION,
+ description = "the exclude module filters to apply.",
+ importance = Importance.ALWAYS)
+ protected Set<String> mExcludeFilters = new HashSet<>();
+
+ @Option(name = CompatibilityTest.ABI_OPTION,
+ shortName = 'a',
+ description = "the abi to test.",
+ importance = Importance.IF_UNSET)
+ protected String mAbiName = null;
+
+ @Option(name = CompatibilityTest.MODULE_OPTION,
+ shortName = 'm',
+ description = "the test module to run.",
+ importance = Importance.IF_UNSET)
+ protected String mModuleName = null;
+
+ @Option(name = CompatibilityTest.TEST_OPTION,
+ shortName = CompatibilityTest.TEST_OPTION_SHORT_NAME,
+ description = "the test run.",
+ importance = Importance.IF_UNSET)
+ protected String mTestName = null;
+
+ @Option(name = CompatibilityTest.RETRY_TYPE_OPTION,
+ description = "used with " + CompatibilityTest.RETRY_OPTION + ", retry tests"
+ + " of a certain status. Possible values include \"failed\" and \"not_executed\".",
+ importance = Importance.IF_UNSET)
+ protected RetryType mRetryType = null;
+
+ private List<ISystemStatusChecker> mStatusCheckers;
+ private IBuildInfo mBuildInfo;
+ private ITestDevice mDevice;
+
+ @Override
+ public void setSystemStatusChecker(List<ISystemStatusChecker> systemCheckers) {
+ mStatusCheckers = systemCheckers;
+ }
+
+ @Override
+ public void setBuild(IBuildInfo buildInfo) {
+ mBuildInfo = buildInfo;
+ }
+
+ @Override
+ public void setDevice(ITestDevice device) {
+ mDevice = device;
+ }
+
+ @Override
+ public ITestDevice getDevice() {
+ return mDevice;
+ }
+
+ /**
+ * Build a CompatibilityTest with appropriate filters to run only the tests of interests.
+ */
+ @Override
+ public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
+ // Create a compatibility test and set it to run only what we want.
+ CompatibilityTest test = createTest();
+
+ CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(mBuildInfo);
+ // Create the helper with all the options needed.
+ RetryFilterHelper helper = createFilterHelper(buildHelper);
+ helper.validateBuildFingerprint(mDevice);
+ helper.setCommandLineOptionsFor(test);
+ helper.setCommandLineOptionsFor(this);
+ helper.populateRetryFilters();
+
+ try {
+ OptionSetter setter = new OptionSetter(test);
+ setter.setOptionValue("compatibility:test-arg",
+ "com.android.tradefed.testtype.AndroidJUnitTest:rerun-from-file:true");
+ setter.setOptionValue("compatibility:test-arg",
+ "com.android.tradefed.testtype.AndroidJUnitTest:fallback-to-serial-rerun:"
+ + "false");
+ } catch (ConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+
+ test.setIncludeFilter(helper.getIncludeFilters());
+ test.setExcludeFilter(helper.getExcludeFilters());
+ test.setDevice(mDevice);
+ test.setBuild(mBuildInfo);
+ test.setSystemStatusChecker(mStatusCheckers);
+ // clean the helper
+ helper.tearDown();
+ // run the retry run.
+ test.run(listener);
+ }
+
+ @VisibleForTesting
+ RetryFilterHelper createFilterHelper(CompatibilityBuildHelper buildHelper) {
+ return new RetryFilterHelper(buildHelper, mRetrySessionId, mSubPlan, mIncludeFilters,
+ mExcludeFilters, mAbiName, mModuleName, mTestName, mRetryType);
+ }
+
+ @VisibleForTesting
+ CompatibilityTest createTest() {
+ return new CompatibilityTest();
+ }
+}
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/suite/CompatibilityTestSuite.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/suite/CompatibilityTestSuite.java
new file mode 100644
index 0000000..f5e1f77
--- /dev/null
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/suite/CompatibilityTestSuite.java
@@ -0,0 +1,267 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.testtype.suite;
+
+import com.android.compatibility.SuiteInfo;
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
+import com.android.compatibility.common.tradefed.testtype.ISubPlan;
+import com.android.compatibility.common.tradefed.testtype.ModuleRepo;
+import com.android.compatibility.common.tradefed.testtype.SubPlan;
+import com.android.compatibility.common.util.TestFilter;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.config.IConfiguration;
+import com.android.tradefed.config.Option;
+import com.android.tradefed.config.Option.Importance;
+import com.android.tradefed.config.OptionClass;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.Abi;
+import com.android.tradefed.testtype.IAbi;
+import com.android.tradefed.testtype.suite.ITestSuite;
+import com.android.tradefed.util.AbiFormatter;
+import com.android.tradefed.util.AbiUtils;
+import com.android.tradefed.util.ArrayUtil;
+import com.android.tradefed.util.xml.AbstractXmlParser.ParseException;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A Test for running Compatibility Test Suite with new suite system.
+ */
+@OptionClass(alias = "compatibility")
+public class CompatibilityTestSuite extends ITestSuite {
+
+ private static final String INCLUDE_FILTER_OPTION = "include-filter";
+ private static final String EXCLUDE_FILTER_OPTION = "exclude-filter";
+ private static final String SUBPLAN_OPTION = "subplan";
+ private static final String MODULE_OPTION = "module";
+ private static final String TEST_OPTION = "test";
+ private static final String MODULE_ARG_OPTION = "module-arg";
+ private static final String TEST_ARG_OPTION = "test-arg";
+ private static final String ABI_OPTION = "abi";
+ private static final String SKIP_HOST_ARCH_CHECK = "skip-host-arch-check";
+ private static final String PRIMARY_ABI_RUN = "primary-abi-only";
+ private static final String PRODUCT_CPU_ABI_KEY = "ro.product.cpu.abi";
+
+ @Option(name = SUBPLAN_OPTION,
+ description = "the subplan to run",
+ importance = Importance.IF_UNSET)
+ private String mSubPlan;
+
+ @Option(name = INCLUDE_FILTER_OPTION,
+ description = "the include module filters to apply.",
+ importance = Importance.ALWAYS)
+ private Set<String> mIncludeFilters = new HashSet<>();
+
+ @Option(name = EXCLUDE_FILTER_OPTION,
+ description = "the exclude module filters to apply.",
+ importance = Importance.ALWAYS)
+ private Set<String> mExcludeFilters = new HashSet<>();
+
+ @Option(name = MODULE_OPTION,
+ shortName = 'm',
+ description = "the test module to run.",
+ importance = Importance.IF_UNSET)
+ private String mModuleName = null;
+
+ @Option(name = TEST_OPTION,
+ shortName = 't',
+ description = "the test to run.",
+ importance = Importance.IF_UNSET)
+ private String mTestName = null;
+
+ @Option(name = MODULE_ARG_OPTION,
+ description = "the arguments to pass to a module. The expected format is "
+ + "\"<module-name>:<arg-name>:<arg-value>\"",
+ importance = Importance.ALWAYS)
+ private List<String> mModuleArgs = new ArrayList<>();
+
+ @Option(name = TEST_ARG_OPTION,
+ description = "the arguments to pass to a test. The expected format is "
+ + "\"<test-class>:<arg-name>:<arg-value>\"",
+ importance = Importance.ALWAYS)
+ private List<String> mTestArgs = new ArrayList<>();
+
+ @Option(name = ABI_OPTION,
+ shortName = 'a',
+ description = "the abi to test.",
+ importance = Importance.IF_UNSET)
+ private String mAbiName = null;
+
+ @Option(name = SKIP_HOST_ARCH_CHECK,
+ description = "Whether host architecture check should be skipped")
+ private boolean mSkipHostArchCheck = false;
+
+ @Option(name = PRIMARY_ABI_RUN,
+ description = "Whether to run tests with only the device primary abi. "
+ + "This override the --abi option.")
+ private boolean mPrimaryAbiRun = false;
+
+ private ModuleRepoSuite mModuleRepo = new ModuleRepoSuite();
+ private CompatibilityBuildHelper mBuildHelper;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public LinkedHashMap<String, IConfiguration> loadTests() {
+ try {
+ setupFilters();
+ Set<IAbi> abis = getAbis(getDevice());
+ // Initialize the repository, {@link CompatibilityBuildHelper#getTestsDir} can
+ // throw a {@link FileNotFoundException}
+ return mModuleRepo.loadConfigs(mBuildHelper.getTestsDir(),
+ abis, mTestArgs, mModuleArgs, mIncludeFilters,
+ mExcludeFilters);
+ } catch (DeviceNotAvailableException | FileNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setBuild(IBuildInfo buildInfo) {
+ super.setBuild(buildInfo);
+ mBuildHelper = new CompatibilityBuildHelper(buildInfo);
+ }
+
+ /**
+ * Gets the set of ABIs supported by both Compatibility and the device under test
+ *
+ * @return The set of ABIs to run the tests on
+ * @throws DeviceNotAvailableException
+ */
+ Set<IAbi> getAbis(ITestDevice device) throws DeviceNotAvailableException {
+ Set<IAbi> abis = new LinkedHashSet<>();
+ Set<String> archAbis = getAbisForBuildTargetArch();
+ if (mPrimaryAbiRun) {
+ if (mAbiName == null) {
+ // Get the primary from the device and make it the --abi to run.
+ mAbiName = device.getProperty(PRODUCT_CPU_ABI_KEY).trim();
+ } else {
+ CLog.d("Option --%s supersedes the option --%s, using abi: %s", ABI_OPTION,
+ PRIMARY_ABI_RUN, mAbiName);
+ }
+ }
+ if (mAbiName != null) {
+ // A particular abi was requested, it still needs to be supported by the build.
+ if ((!mSkipHostArchCheck && !archAbis.contains(mAbiName)) ||
+ !AbiUtils.isAbiSupportedByCompatibility(mAbiName)) {
+ throw new IllegalArgumentException(String.format("Your CTS hasn't been built with "
+ + "abi '%s' support, this CTS currently supports '%s'.",
+ mAbiName, archAbis));
+ } else {
+ abis.add(new Abi(mAbiName, AbiUtils.getBitness(mAbiName)));
+ return abis;
+ }
+ } else {
+ // Run on all abi in common between the device and CTS.
+ List<String> deviceAbis = Arrays.asList(AbiFormatter.getSupportedAbis(device, ""));
+ for (String abi : deviceAbis) {
+ if ((mSkipHostArchCheck || archAbis.contains(abi)) &&
+ AbiUtils.isAbiSupportedByCompatibility(abi)) {
+ abis.add(new Abi(abi, AbiUtils.getBitness(abi)));
+ } else {
+ CLog.d("abi '%s' is supported by device but not by this CTS build (%s), tests "
+ + "will not run against it.", abi, archAbis);
+ }
+ }
+ if (abis.isEmpty()) {
+ throw new IllegalArgumentException(String.format("None of the abi supported by this"
+ + " CTS build ('%s') are supported by the device ('%s').",
+ archAbis, deviceAbis));
+ }
+ return abis;
+ }
+ }
+
+ /**
+ * Return the abis supported by the Host build target architecture.
+ * Exposed for testing.
+ */
+ protected Set<String> getAbisForBuildTargetArch() {
+ return AbiUtils.getAbisForArch(SuiteInfo.TARGET_ARCH);
+ }
+
+ /**
+ * Sets the include/exclude filters up based on if a module name was given or whether this is a
+ * retry run.
+ */
+ void setupFilters() throws FileNotFoundException {
+ if (mSubPlan != null) {
+ try {
+ File subPlanFile = new File(mBuildHelper.getSubPlansDir(), mSubPlan + ".xml");
+ if (!subPlanFile.exists()) {
+ throw new IllegalArgumentException(
+ String.format("Could not retrieve subplan \"%s\"", mSubPlan));
+ }
+ InputStream subPlanInputStream = new FileInputStream(subPlanFile);
+ ISubPlan subPlan = new SubPlan();
+ subPlan.parse(subPlanInputStream);
+ mIncludeFilters.addAll(subPlan.getIncludeFilters());
+ mExcludeFilters.addAll(subPlan.getExcludeFilters());
+ } catch (ParseException e) {
+ throw new RuntimeException(
+ String.format("Unable to find or parse subplan %s", mSubPlan), e);
+ }
+ }
+ if (mModuleName != null) {
+ List<String> modules = ModuleRepo.getModuleNamesMatching(
+ mBuildHelper.getTestsDir(), mModuleName);
+ if (modules.size() == 0) {
+ throw new IllegalArgumentException(
+ String.format("No modules found matching %s", mModuleName));
+ } else if (modules.size() > 1) {
+ throw new IllegalArgumentException(String.format(
+ "Multiple modules found matching %s:\n%s\nWhich one did you mean?\n",
+ mModuleName, ArrayUtil.join("\n", modules)));
+ } else {
+ String moduleName = modules.get(0);
+ checkFilters(mIncludeFilters, moduleName);
+ checkFilters(mExcludeFilters, moduleName);
+ mIncludeFilters.add(new TestFilter(mAbiName, moduleName, mTestName).toString());
+ }
+ } else if (mTestName != null) {
+ throw new IllegalArgumentException(
+ "Test name given without module name. Add --module <module-name>");
+ }
+ }
+
+ /* Helper method designed to remove filters in a list not applicable to the given module */
+ private static void checkFilters(Set<String> filters, String moduleName) {
+ Set<String> cleanedFilters = new HashSet<String>();
+ for (String filter : filters) {
+ if (moduleName.equals(TestFilter.createFrom(filter).getName())) {
+ cleanedFilters.add(filter); // Module name matches, filter passes
+ }
+ }
+ filters.clear();
+ filters.addAll(cleanedFilters);
+ }
+}
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/suite/ModuleRepoSuite.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/suite/ModuleRepoSuite.java
new file mode 100644
index 0000000..6b697d1
--- /dev/null
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/testtype/suite/ModuleRepoSuite.java
@@ -0,0 +1,299 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.testtype.suite;
+
+import com.android.compatibility.common.util.TestFilter;
+import com.android.tradefed.config.ConfigurationException;
+import com.android.tradefed.config.ConfigurationFactory;
+import com.android.tradefed.config.IConfiguration;
+import com.android.tradefed.config.IConfigurationFactory;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.targetprep.ITargetPreparer;
+import com.android.tradefed.testtype.IAbi;
+import com.android.tradefed.testtype.IAbiReceiver;
+import com.android.tradefed.testtype.IRemoteTest;
+import com.android.tradefed.testtype.ITestFileFilterReceiver;
+import com.android.tradefed.testtype.ITestFilterReceiver;
+import com.android.tradefed.util.AbiUtils;
+import com.android.tradefed.util.FileUtil;
+import com.android.tradefed.util.StreamUtil;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * Retrieves Compatibility test module definitions from the repository.
+ */
+public class ModuleRepoSuite {
+
+ private static final String CONFIG_EXT = ".config";
+ private Map<String, Map<String, List<String>>> mTestArgs = new HashMap<>();
+ private Map<String, Map<String, List<String>>> mModuleArgs = new HashMap<>();
+ private boolean mIncludeAll;
+ private Map<String, List<TestFilter>> mIncludeFilters = new HashMap<>();
+ private Map<String, List<TestFilter>> mExcludeFilters = new HashMap<>();
+ private IConfigurationFactory mConfigFactory = ConfigurationFactory.getInstance();
+
+ /**
+ * Main loading of configurations, looking into testcases/ folder
+ */
+ public LinkedHashMap<String, IConfiguration> loadConfigs(File testsDir, Set<IAbi> abis,
+ List<String> testArgs, List<String> moduleArgs,
+ Set<String> includeFilters, Set<String> excludeFilters) {
+ CLog.d("Initializing ModuleRepo\nTests Dir:%s\nABIs:%s\n" +
+ "Test Args:%s\nModule Args:%s\nIncludes:%s\nExcludes:%s",
+ testsDir.getAbsolutePath(), abis, testArgs, moduleArgs,
+ includeFilters, excludeFilters);
+
+ LinkedHashMap<String, IConfiguration> toRun = new LinkedHashMap<>();
+
+ putArgs(testArgs, mTestArgs);
+ putArgs(moduleArgs, mModuleArgs);
+ mIncludeAll = includeFilters.isEmpty();
+ // Include all the inclusions
+ addFilters(includeFilters, mIncludeFilters, abis);
+ // Exclude all the exclusions
+ addFilters(excludeFilters, mExcludeFilters, abis);
+
+ File[] configFiles = testsDir.listFiles(new ConfigFilter());
+ if (configFiles.length == 0) {
+ throw new IllegalArgumentException(
+ String.format("No config files found in %s", testsDir.getAbsolutePath()));
+ }
+ for (File configFile : configFiles) {
+ final String name = configFile.getName().replace(CONFIG_EXT, "");
+ final String[] pathArg = new String[] { configFile.getAbsolutePath() };
+ try {
+ // Invokes parser to process the test module config file
+ // Need to generate a different config for each ABI as we cannot guarantee the
+ // configs are idempotent. This however means we parse the same file multiple times
+ for (IAbi abi : abis) {
+ String id = AbiUtils.createId(abi.getName(), name);
+ if (!shouldRunModule(id)) {
+ // If the module should not run tests based on the state of filters,
+ // skip this name/abi combination.
+ continue;
+ }
+ IConfiguration config = mConfigFactory.createConfigurationFromArgs(pathArg);
+ Map<String, List<String>> args = new HashMap<>();
+ if (mModuleArgs.containsKey(name)) {
+ args.putAll(mModuleArgs.get(name));
+ }
+ if (mModuleArgs.containsKey(id)) {
+ args.putAll(mModuleArgs.get(id));
+ }
+ for (Entry<String, List<String>> entry : args.entrySet()) {
+ for (String value : entry.getValue()) {
+ // Collection-type options can be injected with multiple values
+ config.injectOptionValue(entry.getKey(), value);
+ }
+ }
+
+ List<IRemoteTest> tests = config.getTests();
+ for (IRemoteTest test : tests) {
+ String className = test.getClass().getName();
+ Map<String, List<String>> testArgsMap = new HashMap<>();
+ if (mTestArgs.containsKey(className)) {
+ testArgsMap.putAll(mTestArgs.get(className));
+ }
+ for (Entry<String, List<String>> entry : testArgsMap.entrySet()) {
+ for (String value : entry.getValue()) {
+ config.injectOptionValue(entry.getKey(), value);
+ }
+ }
+ addFiltersToTest(test, abi, name);
+ if (test instanceof IAbiReceiver) {
+ ((IAbiReceiver)test).setAbi(abi);
+ }
+ }
+ List<ITargetPreparer> preparers = config.getTargetPreparers();
+ for (ITargetPreparer preparer : preparers) {
+ if (preparer instanceof IAbiReceiver) {
+ ((IAbiReceiver)preparer).setAbi(abi);
+ }
+ }
+ toRun.put(id, config);
+ }
+ } catch (ConfigurationException e) {
+ throw new RuntimeException(String.format("Error parsing config file: %s",
+ configFile.getName()), e);
+ }
+ }
+ return toRun;
+ }
+
+ private void addFilters(Set<String> stringFilters,
+ Map<String, List<TestFilter>> filters, Set<IAbi> abis) {
+ for (String filterString : stringFilters) {
+ TestFilter filter = TestFilter.createFrom(filterString);
+ String abi = filter.getAbi();
+ if (abi == null) {
+ for (IAbi a : abis) {
+ addFilter(a.getName(), filter, filters);
+ }
+ } else {
+ addFilter(abi, filter, filters);
+ }
+ }
+ }
+
+ private void addFilter(String abi, TestFilter filter,
+ Map<String, List<TestFilter>> filters) {
+ getFilterList(filters, AbiUtils.createId(abi, filter.getName())).add(filter);
+ }
+
+ private List<TestFilter> getFilterList(Map<String, List<TestFilter>> filters, String id) {
+ List<TestFilter> fs = filters.get(id);
+ if (fs == null) {
+ fs = new ArrayList<>();
+ filters.put(id, fs);
+ }
+ return fs;
+ }
+
+ private void addFiltersToTest(IRemoteTest test, IAbi abi, String name) {
+ String moduleId = AbiUtils.createId(abi.getName(), name);
+ if (!(test instanceof ITestFilterReceiver)) {
+ throw new IllegalArgumentException(String.format(
+ "Test in module %s must implement ITestFilterReceiver.", moduleId));
+ }
+ List<TestFilter> mdIncludes = getFilterList(mIncludeFilters, moduleId);
+ List<TestFilter> mdExcludes = getFilterList(mExcludeFilters, moduleId);
+ if (!mdIncludes.isEmpty()) {
+ addTestIncludes((ITestFilterReceiver) test, mdIncludes, name);
+ }
+ if (!mdExcludes.isEmpty()) {
+ addTestExcludes((ITestFilterReceiver) test, mdExcludes, name);
+ }
+ }
+
+ private boolean shouldRunModule(String moduleId) {
+ List<TestFilter> mdIncludes = getFilterList(mIncludeFilters, moduleId);
+ List<TestFilter> mdExcludes = getFilterList(mExcludeFilters, moduleId);
+ // if including all modules or includes exist for this module, and there are not excludes
+ // for the entire module, this module should be run.
+ return (mIncludeAll || !mdIncludes.isEmpty()) && !containsModuleExclude(mdExcludes);
+ }
+
+ private void addTestIncludes(ITestFilterReceiver test, List<TestFilter> includes,
+ String name) {
+ if (test instanceof ITestFileFilterReceiver) {
+ File includeFile = createFilterFile(name, ".include", includes);
+ ((ITestFileFilterReceiver)test).setIncludeTestFile(includeFile);
+ } else {
+ // add test includes one at a time
+ for (TestFilter include : includes) {
+ String filterTestName = include.getTest();
+ if (filterTestName != null) {
+ test.addIncludeFilter(filterTestName);
+ }
+ }
+ }
+ }
+
+ private void addTestExcludes(ITestFilterReceiver test, List<TestFilter> excludes,
+ String name) {
+ if (test instanceof ITestFileFilterReceiver) {
+ File excludeFile = createFilterFile(name, ".exclude", excludes);
+ ((ITestFileFilterReceiver)test).setExcludeTestFile(excludeFile);
+ } else {
+ // add test excludes one at a time
+ for (TestFilter exclude : excludes) {
+ test.addExcludeFilter(exclude.getTest());
+ }
+ }
+ }
+
+ private File createFilterFile(String prefix, String suffix, List<TestFilter> filters) {
+ File filterFile = null;
+ PrintWriter out = null;
+ try {
+ filterFile = FileUtil.createTempFile(prefix, suffix);
+ out = new PrintWriter(filterFile);
+ for (TestFilter filter : filters) {
+ String filterTest = filter.getTest();
+ if (filterTest != null) {
+ out.println(filterTest);
+ }
+ }
+ out.flush();
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to create filter file");
+ } finally {
+ StreamUtil.close(out);
+ }
+ filterFile.deleteOnExit();
+ return filterFile;
+ }
+
+ /**
+ * Returns true iff one or more test filters in excludes apply to the entire module.
+ */
+ private boolean containsModuleExclude(Collection<TestFilter> excludes) {
+ for (TestFilter exclude : excludes) {
+ if (exclude.getTest() == null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * A {@link FilenameFilter} to find all the config files in a directory.
+ */
+ public static class ConfigFilter implements FilenameFilter {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean accept(File dir, String name) {
+ CLog.d("%s/%s", dir.getAbsolutePath(), name);
+ return name.endsWith(CONFIG_EXT);
+ }
+ }
+
+ private static void putArgs(List<String> args,
+ Map<String, Map<String, List<String>>> argsMap) {
+ for (String arg : args) {
+ String[] parts = arg.split(":");
+ String target = parts[0];
+ String key = parts[1];
+ String value = parts[2];
+ Map<String, List<String>> map = argsMap.get(target);
+ if (map == null) {
+ map = new HashMap<>();
+ argsMap.put(target, map);
+ }
+ List<String> valueList = map.get(key);
+ if (valueList == null) {
+ valueList = new ArrayList<>();
+ map.put(key, valueList);
+ }
+ valueList.add(value);
+ }
+ }
+}
diff --git a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/util/RetryFilterHelper.java b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/util/RetryFilterHelper.java
index 4ff3953..7f527db 100644
--- a/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/util/RetryFilterHelper.java
+++ b/common/host-side/tradefed/src/com/android/compatibility/common/tradefed/util/RetryFilterHelper.java
@@ -18,24 +18,20 @@
import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
import com.android.compatibility.common.tradefed.result.SubPlanHelper;
-import com.android.compatibility.common.tradefed.testtype.CompatibilityTest;
-import com.android.compatibility.common.tradefed.testtype.ModuleRepo;
import com.android.compatibility.common.tradefed.testtype.ISubPlan;
+import com.android.compatibility.common.tradefed.testtype.ModuleRepo;
import com.android.compatibility.common.util.IInvocationResult;
import com.android.compatibility.common.util.LightInvocationResult;
import com.android.compatibility.common.util.ResultHandler;
import com.android.compatibility.common.util.TestFilter;
import com.android.tradefed.config.ArgsOptionParser;
import com.android.tradefed.config.ConfigurationException;
-import com.android.tradefed.config.Option;
-import com.android.tradefed.config.Option.Importance;
-import com.android.tradefed.config.OptionCopier;
-import com.android.tradefed.config.OptionSetter;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.util.ArrayUtil;
+import com.google.common.annotations.VisibleForTesting;
+
import java.io.FileNotFoundException;
import java.util.HashSet;
import java.util.List;
@@ -46,44 +42,12 @@
*/
public class RetryFilterHelper {
- @Option(name = CompatibilityTest.SUBPLAN_OPTION,
- description = "the subplan to run",
- importance = Importance.IF_UNSET)
protected String mSubPlan;
-
- @Option(name = CompatibilityTest.INCLUDE_FILTER_OPTION,
- description = "the include module filters to apply.",
- importance = Importance.ALWAYS)
protected Set<String> mIncludeFilters = new HashSet<>();
-
- @Option(name = CompatibilityTest.EXCLUDE_FILTER_OPTION,
- description = "the exclude module filters to apply.",
- importance = Importance.ALWAYS)
protected Set<String> mExcludeFilters = new HashSet<>();
-
- @Option(name = CompatibilityTest.ABI_OPTION,
- shortName = 'a',
- description = "the abi to test.",
- importance = Importance.IF_UNSET)
protected String mAbiName = null;
-
- @Option(name = CompatibilityTest.MODULE_OPTION,
- shortName = 'm',
- description = "the test module to run.",
- importance = Importance.IF_UNSET)
protected String mModuleName = null;
-
- @Option(name = CompatibilityTest.TEST_OPTION,
- shortName = CompatibilityTest.TEST_OPTION_SHORT_NAME,
- description = "the test run.",
- importance = Importance.IF_UNSET)
protected String mTestName = null;
-
- @Option(name = CompatibilityTest.RETRY_TYPE_OPTION,
- description = "used with " + CompatibilityTest.RETRY_OPTION
- + ", retry tests of a certain status. Possible values include \"failed\", "
- + "\"not_executed\", and \"custom\".",
- importance = Importance.IF_UNSET)
protected RetryType mRetryType = null;
/* Instance variables handy for retreiving the result to be retried */
@@ -94,6 +58,8 @@
private Set<String> mRetryIncludes;
private Set<String> mRetryExcludes;
+ public RetryFilterHelper() {}
+
/**
* Constructor for a {@link RetryFilterHelper}. Requires a CompatibilityBuildHelper for
* retrieving previous sessions and the ID of the session to retry.
@@ -104,6 +70,32 @@
}
/**
+ * Constructor for a {@link RetryFilterHelper}.
+ *
+ * @param build a {@link CompatibilityBuildHelper} describing the build.
+ * @param sessionId The ID of the session to retry.
+ * @param subPlan The name of a subPlan to be used. Can be null.
+ * @param includeFilters The include module filters to apply
+ * @param excludeFilters The exclude module filters to apply
+ * @param abiName The name of abi to use. Can be null.
+ * @param moduleName The name of the module to run. Can be null.
+ * @param testName The name of the test to run. Can be null.
+ * @param retryType The type of results to retry. Can be null.
+ */
+ public RetryFilterHelper(CompatibilityBuildHelper build, int sessionId, String subPlan,
+ Set<String> includeFilters, Set<String> excludeFilters, String abiName,
+ String moduleName, String testName, RetryType retryType) {
+ this(build, sessionId);
+ mSubPlan = subPlan;
+ mIncludeFilters.addAll(includeFilters);
+ mExcludeFilters.addAll(excludeFilters);
+ mAbiName = abiName;
+ mModuleName = moduleName;
+ mTestName = testName;
+ mRetryType = retryType;
+ }
+
+ /**
* Throws an {@link IllegalArgumentException} if the device build fingerprint doesn't match
* the fingerprint recorded in the previous session's result.
*/
@@ -120,18 +112,16 @@
/**
* Copy all applicable options from an input object to this instance of RetryFilterHelper.
*/
- public void setAllOptionsFrom(Object obj) {
+ @VisibleForTesting
+ void setAllOptionsFrom(RetryFilterHelper obj) {
clearOptions(); // Remove existing options first
- OptionCopier.copyOptionsNoThrow(obj, this);
- }
-
- /**
- * Set a single option on this instance of RetryFilterHelper
- * @throws {@link ConfigurationException} if the option cannot be set.
- */
- public void setOption(String option, String value) throws ConfigurationException {
- OptionSetter setter = new OptionSetter(this);
- setter.setOptionValue(option, value);
+ mSubPlan = obj.mSubPlan;
+ mIncludeFilters.addAll(obj.mIncludeFilters);
+ mExcludeFilters.addAll(obj.mExcludeFilters);
+ mAbiName = obj.mAbiName;
+ mModuleName = obj.mModuleName;
+ mTestName = obj.mTestName;
+ mRetryType = obj.mRetryType;
}
/**
@@ -139,8 +129,8 @@
*/
public void clearOptions() {
mSubPlan = null;
- mIncludeFilters = new HashSet<>();
- mExcludeFilters = new HashSet<>();
+ mIncludeFilters.clear();
+ mExcludeFilters.clear();
mModuleName = null;
mTestName = null;
mRetryType = null;
@@ -223,7 +213,7 @@
/* Generation of filters based on previous sessions is implemented thoroughly in SubPlanHelper,
* and retry filter generation is just a subset of the use cases for the subplan retry logic.
* Use retry type to determine which result types SubPlanHelper targets. */
- private void populateFiltersBySubPlan() {
+ public void populateFiltersBySubPlan() {
SubPlanHelper retryPlanCreator = new SubPlanHelper();
retryPlanCreator.setResult(getResult());
if (RetryType.FAILED.equals(mRetryType)) {
diff --git a/common/host-side/tradefed/tests/Android.mk b/common/host-side/tradefed/tests/Android.mk
index 6bc8bc9..c61594a 100644
--- a/common/host-side/tradefed/tests/Android.mk
+++ b/common/host-side/tradefed/tests/Android.mk
@@ -19,6 +19,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
LOCAL_JAVA_RESOURCE_DIRS := ../res
+include cts/error_prone_rules.mk
LOCAL_SUITE_BUILD_NUMBER := 2
LOCAL_SUITE_TARGET_ARCH := $(TARGET_ARCH)
@@ -27,7 +28,7 @@
LOCAL_SUITE_VERSION := 1
LOCAL_MODULE := compatibility-mock-tradefed
-
+include cts/error_prone_rules.mk
include $(BUILD_COMPATIBILITY_SUITE)
# Make the tests
@@ -36,6 +37,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_JAVA_RESOURCE_DIRS := res
+include cts/error_prone_rules.mk
LOCAL_MODULE := compatibility-tradefed-tests
LOCAL_MODULE_TAGS := optional
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/UnitTests.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/UnitTests.java
index 4e7c8c2..63ed9e8 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/UnitTests.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/UnitTests.java
@@ -18,6 +18,8 @@
import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelperTest;
import com.android.compatibility.common.tradefed.command.CompatibilityConsoleTest;
import com.android.compatibility.common.tradefed.config.ConfigurationFactoryTest;
+import com.android.compatibility.common.tradefed.presubmit.ApkPackageNameCheck;
+import com.android.compatibility.common.tradefed.presubmit.CtsConfigLoadingTest;
import com.android.compatibility.common.tradefed.presubmit.IntegrationTest;
import com.android.compatibility.common.tradefed.presubmit.PresubmitSetupValidation;
import com.android.compatibility.common.tradefed.presubmit.ValidateTestsAbi;
@@ -34,6 +36,8 @@
import com.android.compatibility.common.tradefed.testtype.ModuleDefTest;
import com.android.compatibility.common.tradefed.testtype.ModuleRepoTest;
import com.android.compatibility.common.tradefed.testtype.SubPlanTest;
+import com.android.compatibility.common.tradefed.testtype.retry.RetryFactoryTestTest;
+import com.android.compatibility.common.tradefed.testtype.suite.CompatibilityTestSuiteTest;
import com.android.compatibility.common.tradefed.util.CollectorUtilTest;
import com.android.compatibility.common.tradefed.util.OptionHelperTest;
import com.android.compatibility.common.tradefed.util.RetryFilterHelperTest;
@@ -60,6 +64,8 @@
ConfigurationFactoryTest.class,
// presubmit
+ ApkPackageNameCheck.class,
+ CtsConfigLoadingTest.class,
IntegrationTest.class,
PresubmitSetupValidation.class,
ValidateTestsAbi.class,
@@ -83,6 +89,12 @@
ModuleRepoTest.class,
SubPlanTest.class,
+ // testtype.retry
+ RetryFactoryTestTest.class,
+
+ // testype.suite
+ CompatibilityTestSuiteTest.class,
+
// util
CollectorUtilTest.class,
OptionHelperTest.class,
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ApkPackageNameCheck.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ApkPackageNameCheck.java
new file mode 100644
index 0000000..92f3f05
--- /dev/null
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ApkPackageNameCheck.java
@@ -0,0 +1,109 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.presubmit;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.android.tradefed.config.ConfigurationFactory;
+import com.android.tradefed.config.IConfiguration;
+import com.android.tradefed.targetprep.ITargetPreparer;
+import com.android.tradefed.targetprep.TestAppInstallSetup;
+import com.android.tradefed.util.AaptParser;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Class to validate tests Apks in testcases/
+ */
+@RunWith(JUnit4.class)
+public class ApkPackageNameCheck {
+
+ private static final Set<String> EXCEPTION_LIST = new HashSet<>();
+ static {
+ // TODO: Remove exception when their package have been fixed.
+ EXCEPTION_LIST.add("android.app.cts");
+ EXCEPTION_LIST.add("android.systemui.cts");
+ }
+
+ /**
+ * We ensure that no apk with same package names may be installed. Otherwise it may results in
+ * conflicts.
+ */
+ @Test
+ public void testApkPackageNames() throws Exception {
+ String ctsRoot = System.getProperty("CTS_ROOT");
+ File testcases = new File(ctsRoot, "/android-cts/testcases/");
+ if (!testcases.exists()) {
+ fail(String.format("%s does not exists", testcases));
+ return;
+ }
+ File[] listConfig = testcases.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name.endsWith(".config")) {
+ return true;
+ }
+ return false;
+ }
+ });
+ assertTrue(listConfig.length > 0);
+ // We check all apk installed by all modules
+ Map<String, String> packageNames = new HashMap<>();
+
+ for (File config : listConfig) {
+ IConfiguration c = ConfigurationFactory.getInstance()
+ .createConfigurationFromArgs(new String[] {config.getAbsolutePath()});
+ // For each config, we check all the apk it's going to install
+ List<String> apkNames = new ArrayList<>();
+ for (ITargetPreparer prep : c.getTargetPreparers()) {
+ if (prep instanceof TestAppInstallSetup) {
+ apkNames.addAll(((TestAppInstallSetup) prep).getTestsFileName());
+ }
+ }
+
+ for (String apkName : apkNames) {
+ File apkFile = new File(testcases, apkName);
+ if (!apkFile.exists()) {
+ fail(String.format("Module %s is trying to install %s which does not "
+ + "exists in testcases/", config.getName(), apkFile));
+ }
+ AaptParser res = AaptParser.parse(apkFile);
+ assertNotNull(res);
+ String packageName = res.getPackageName();
+ String put = packageNames.put(packageName, apkName);
+ // The package already exists and it's a different apk
+ if (put != null && !apkName.equals(put) && !EXCEPTION_LIST.contains(packageName)) {
+ fail(String.format("Module %s: Package name '%s' from apk '%s' was already "
+ + "added by previous apk '%s'.",
+ config.getName(), packageName, apkName, put));
+ }
+ }
+ }
+ }
+}
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java
new file mode 100644
index 0000000..32b311d
--- /dev/null
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.presubmit;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
+import com.android.compatibility.common.tradefed.targetprep.ApkInstaller;
+import com.android.tradefed.build.FolderBuildInfo;
+import com.android.tradefed.config.ConfigurationException;
+import com.android.tradefed.config.ConfigurationFactory;
+import com.android.tradefed.config.IConfiguration;
+import com.android.tradefed.targetprep.ITargetPreparer;
+import com.android.tradefed.testtype.HostTest;
+import com.android.tradefed.testtype.IRemoteTest;
+
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+/**
+ * Test that configuration in CTS can load and have expected properties.
+ */
+public class CtsConfigLoadingTest {
+
+ /**
+ * Test that configuration shipped in Tradefed can be parsed.
+ * -> Exclude deprecated ApkInstaller.
+ * -> Check if host-side tests are non empty.
+ */
+ @Test
+ public void testConfigurationLoad() throws Exception {
+ String ctsRoot = System.getProperty("CTS_ROOT");
+ File testcases = new File(ctsRoot, "/android-cts/testcases/");
+ if (!testcases.exists()) {
+ fail(String.format("%s does not exists", testcases));
+ return;
+ }
+ File[] listConfig = testcases.listFiles(new FilenameFilter() {
+ @Override
+ public boolean accept(File dir, String name) {
+ if (name.endsWith(".config")) {
+ return true;
+ }
+ return false;
+ }
+ });
+ assertTrue(listConfig.length > 0);
+ // Create a FolderBuildInfo to similate the CompatibilityBuildProvider
+ FolderBuildInfo stubFolder = new FolderBuildInfo("-1", "-1");
+ stubFolder.setRootDir(new File(ctsRoot));
+ stubFolder.addBuildAttribute(CompatibilityBuildHelper.SUITE_NAME, "CTS");
+ // We expect to be able to load every single config in testcases/
+ for (File config : listConfig) {
+ IConfiguration c = ConfigurationFactory.getInstance()
+ .createConfigurationFromArgs(new String[] {config.getAbsolutePath()});
+ // Ensure the deprecated ApkInstaller is not used anymore.
+ for (ITargetPreparer prep : c.getTargetPreparers()) {
+ if (prep.getClass().isAssignableFrom(ApkInstaller.class)) {
+ throw new ConfigurationException(
+ String.format("%s: Use com.android.tradefed.targetprep.suite."
+ + "SuiteApkInstaller instead of com.android.compatibility."
+ + "common.tradefed.targetprep.ApkInstaller, options will be "
+ + "the same.", config));
+ }
+ }
+ // We can ensure that Host side tests are not empty.
+ for (IRemoteTest test : c.getTests()) {
+ if (test instanceof HostTest) {
+ HostTest hostTest = (HostTest) test;
+ // We inject a made up folder so that it can find the tests.
+ hostTest.setBuild(stubFolder);
+ int testCount = hostTest.countTestCases();
+ if (testCount == 0) {
+ throw new ConfigurationException(
+ String.format("%s: %s reports 0 test cases.", config, test));
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/IntegrationTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/IntegrationTest.java
index 609fe6b..4d9bfec 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/IntegrationTest.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/IntegrationTest.java
@@ -196,7 +196,7 @@
*/
@Test
public void testSingleModuleRun() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_run";
final String mAbi = "arm64-v8a";
createConfig(mTestDir, moduleName, TEST_STUB, true, true, true, false);
EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist")).andReturn(mAbi);
@@ -299,7 +299,7 @@
*/
@Test
public void testSingleModuleRun_incomplete() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_run_incomplete";
final String mAbi = "arm64-v8a";
createConfig(mTestDir, moduleName, TEST_STUB, true, false, true, false);
EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist")).andReturn(mAbi);
@@ -328,7 +328,7 @@
*/
@Test
public void testSingleModuleRun_completeAfterInternalRetry() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_completeAfterRetry";
final String mAbi = "arm64-v8a";
createConfig(mTestDir, moduleName, TEST_STUB, true, true, true, true);
EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist")).andReturn(mAbi);
@@ -358,7 +358,7 @@
*/
@Test
public void testSingleModuleRun_incomplete_rerun_incomplete() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_incomplete_rerun";
final String mAbi = "arm64-v8a";
createConfig(mTestDir, moduleName, TEST_STUB, true, false, true, false);
EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist")).andReturn(mAbi);
@@ -426,7 +426,7 @@
*/
@Test
public void testSingleModuleRun_incomplete_rerun_complete() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_incom_rerun_complete";
final String mAbi = "arm64-v8a";
createConfig(mTestDir, moduleName, TEST_STUB, true, false, true, false);
EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist")).andReturn(mAbi);
@@ -550,7 +550,7 @@
*/
@Test
public void testSingleModuleRun_sharded() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_sharded";
Set<String> abis = AbiUtils.getAbisForArch(SuiteInfo.TARGET_ARCH);
Iterator<String> ite = abis.iterator();
final String abi1 = ite.next();
@@ -559,8 +559,7 @@
EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist")).andReturn(
String.format("%s,%s", abi1, abi2));
mMockBuildInfo.addBuildAttribute(EasyMock.eq(CompatibilityBuildHelper.MODULE_IDS),
- EasyMock.eq(AbiUtils.createId(abi1, moduleName) + ","
- + AbiUtils.createId(abi2, moduleName)));
+ EasyMock.anyObject());
EasyMock.expectLastCall();
EasyMock.replay(mMockDevice, mMockBuildInfo);
@@ -601,7 +600,7 @@
*/
@Test
public void testSingleModuleRun_sharded_incomplete() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_sharded_incomplete";
Set<String> abis = AbiUtils.getAbisForArch(SuiteInfo.TARGET_ARCH);
Iterator<String> ite = abis.iterator();
final String abi1 = ite.next();
@@ -610,8 +609,7 @@
EasyMock.expect(mMockDevice.getProperty("ro.product.cpu.abilist")).andReturn(
String.format("%s,%s", abi1, abi2));
mMockBuildInfo.addBuildAttribute(EasyMock.eq(CompatibilityBuildHelper.MODULE_IDS),
- EasyMock.eq(AbiUtils.createId(abi1, moduleName) + ","
- + AbiUtils.createId(abi2, moduleName)));
+ EasyMock.anyObject());
EasyMock.expectLastCall();
EasyMock.replay(mMockDevice, mMockBuildInfo);
@@ -653,7 +651,7 @@
*/
@Test
public void testSingleModuleRun_sharded_getTestShard() throws Exception {
- final String moduleName = "moduleA";
+ final String moduleName = "module_sharded_getTestShard";
Set<String> abis = AbiUtils.getAbisForArch(SuiteInfo.TARGET_ARCH);
Iterator<String> ite = abis.iterator();
final String abi1 = ite.next();
@@ -665,7 +663,7 @@
String expectedAdd = AbiUtils.createId(abi1, moduleName) + ","
+ AbiUtils.createId(abi2, moduleName);
mMockBuildInfo.addBuildAttribute(EasyMock.eq(CompatibilityBuildHelper.MODULE_IDS),
- EasyMock.eq(expectedAdd));
+ EasyMock.anyObject());
EasyMock.expectLastCall();
mAttributes.put(CompatibilityBuildHelper.MODULE_IDS, expectedAdd);
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
index b85a036..dce227f 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
@@ -48,9 +48,9 @@
* This particular module is shipping all it's dependencies in all abis with prebuilt stuff.
* Excluding it for now to have the test setup.
*/
- private String MODULE_EXCEPTION = "CtsSplitApp";
+ private static final String MODULE_EXCEPTION = "CtsSplitApp";
- private static Set<String> BINARY_EXCEPTIONS = new HashSet<>();
+ private static final Set<String> BINARY_EXCEPTIONS = new HashSet<>();
static {
/**
* This binary is a host side helper, so we do not need to check it.
@@ -89,6 +89,20 @@
for (File testApk : listApks) {
AaptParser result = AaptParser.parse(testApk);
+ // Retry as we have seen flake with aapt sometimes.
+ if (result == null) {
+ for (int i = 0; i < 2; i++) {
+ result = AaptParser.parse(testApk);
+ if (result != null) {
+ break;
+ }
+ }
+ // If still couldn't parse the apk
+ if (result == null) {
+ fail(String.format("Fail to run 'aapt dump badging %s'",
+ testApk.getAbsolutePath()));
+ }
+ }
// We only check the apk that have native code
if (!result.getNativeCode().isEmpty()) {
List<String> supportedAbiApk = result.getNativeCode();
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleDefTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleDefTest.java
index af44c29..0612e6e 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleDefTest.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleDefTest.java
@@ -107,6 +107,11 @@
}
@Override
+ public IAbi getAbi() {
+ return null;
+ }
+
+ @Override
public long getRuntimeHint() {
return 1L;
}
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleRepoTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleRepoTest.java
index 76ea433..23fc90c 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleRepoTest.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ModuleRepoTest.java
@@ -42,6 +42,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -86,6 +87,7 @@
private static final String MODULE_NAME_A = "FooModuleA";
private static final String MODULE_NAME_B = "FooModuleB";
private static final String MODULE_NAME_C = "FooModuleC";
+ private static final String NON_EXISTS_MODULE_NAME = "NonExistModule";
private static final String ID_A_32 = AbiUtils.createId(ABI_32, MODULE_NAME_A);
private static final String ID_A_64 = AbiUtils.createId(ABI_64, MODULE_NAME_A);
private static final String ID_B_32 = AbiUtils.createId(ABI_32, MODULE_NAME_B);
@@ -327,6 +329,22 @@
}
/**
+ * Test that excluded module shouldn't be loaded.
+ */
+ public void testInitialization_ExcludeModule_SkipLoadingConfig() {
+ try {
+ Set<String> excludeFilters = new HashSet<String>() {{
+ add(NON_EXISTS_MODULE_NAME);
+ }};
+ mRepo.initialize(1, null, mTestsDir, ABIS, DEVICE_TOKENS, TEST_ARGS,
+ MODULE_ARGS, Collections.emptySet(), excludeFilters,
+ mMockBuildInfo);
+ } catch (Exception e) {
+ fail("Initialization should not fail if non-existing module is excluded");
+ }
+ }
+
+ /**
* Test that {@link ModuleRepo#getModules(String, int)} handles well all module being filtered.
*/
public void testFiltering_empty() throws Exception {
@@ -431,6 +449,8 @@
public void setCollectTestsOnly(boolean arg0) {}
@Override
public void setAbi(IAbi arg0) {}
+ @Override
+ public IAbi getAbi() {return null;}
}
/**
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ShardableTestStub.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ShardableTestStub.java
index 1a63b03..7b43972 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ShardableTestStub.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/ShardableTestStub.java
@@ -90,6 +90,11 @@
}
@Override
+ public IAbi getAbi() {
+ return null;
+ }
+
+ @Override
public long getRuntimeHint() {
return 1L;
}
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/TestStub.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/TestStub.java
index 6f199ae..a154f31 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/TestStub.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/TestStub.java
@@ -132,6 +132,11 @@
}
@Override
+ public IAbi getAbi() {
+ return null;
+ }
+
+ @Override
public long getRuntimeHint() {
return 1L;
}
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/retry/RetryFactoryTestTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/retry/RetryFactoryTestTest.java
new file mode 100644
index 0000000..01557e3
--- /dev/null
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/retry/RetryFactoryTestTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.testtype.retry;
+
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
+import com.android.compatibility.common.tradefed.testtype.CompatibilityTest;
+import com.android.compatibility.common.tradefed.util.RetryFilterHelper;
+import com.android.tradefed.config.OptionClass;
+import com.android.tradefed.config.OptionSetter;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.result.ITestInvocationListener;
+
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Unit tests for {@link RetryFactoryTest}.
+ */
+@RunWith(JUnit4.class)
+public class RetryFactoryTestTest {
+
+ private RetryFactoryTest mFactory;
+ private ITestInvocationListener mMockListener;
+ private RetryFilterHelper mSpyFilter;
+
+ /**
+ * A {@link CompatibilityTest} that does not run anything.
+ */
+ @OptionClass(alias = "compatibility")
+ public static class VoidCompatibilityTest extends CompatibilityTest {
+ @Override
+ public void run(ITestInvocationListener listener)
+ throws DeviceNotAvailableException {
+ // Do not run.
+ }
+ }
+
+ @Before
+ public void setUp() {
+ mSpyFilter = new RetryFilterHelper() {
+ @Override
+ public void validateBuildFingerprint(ITestDevice device)
+ throws DeviceNotAvailableException {
+ // do nothing
+ }
+ @Override
+ public void setCommandLineOptionsFor(Object obj) {
+ // do nothing
+ }
+ @Override
+ public void populateFiltersBySubPlan() {
+ // do nothing
+ }
+ };
+ mFactory = new RetryFactoryTest() {
+ @Override
+ RetryFilterHelper createFilterHelper(CompatibilityBuildHelper buildHelper) {
+ return mSpyFilter;
+ }
+ @Override
+ CompatibilityTest createTest() {
+ return new VoidCompatibilityTest();
+ }
+ };
+ mMockListener = EasyMock.createMock(ITestInvocationListener.class);
+ }
+
+ /**
+ * Tests that the CompatibilityTest created can receive all the options without throwing.
+ */
+ @Test
+ public void testRetry_receiveOption() throws Exception {
+ OptionSetter setter = new OptionSetter(mFactory);
+ setter.setOptionValue("retry", "10599");
+ EasyMock.replay(mMockListener);
+ mFactory.run(mMockListener);
+ EasyMock.verify(mMockListener);
+ }
+}
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/suite/CompatibilityTestSuiteTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/suite/CompatibilityTestSuiteTest.java
new file mode 100644
index 0000000..86569ef
--- /dev/null
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/testtype/suite/CompatibilityTestSuiteTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.tradefed.testtype.suite;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.android.compatibility.common.tradefed.testtype.CompatibilityTest;
+import com.android.tradefed.config.OptionSetter;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.testtype.IAbi;
+import com.android.tradefed.util.AbiUtils;
+
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Unit tests for {@link CompatibilityTestSuite}.
+ */
+public class CompatibilityTestSuiteTest {
+
+ private static final String FAKE_HOST_ARCH = "arm";
+ private CompatibilityTestSuite mTest;
+ private ITestDevice mMockDevice;
+
+ @Before
+ public void setUp() throws Exception {
+ mTest = new CompatibilityTestSuite() {
+ @Override
+ protected Set<String> getAbisForBuildTargetArch() {
+ return AbiUtils.getAbisForArch(FAKE_HOST_ARCH);
+ }
+ };
+ mMockDevice = EasyMock.createMock(ITestDevice.class);
+ mTest.setDevice(mMockDevice);
+ }
+
+ /**
+ * Test that {@link CompatibilityTestSuite#getAbis(ITestDevice)} is returning a proper
+ * intersection of CTS supported architectures and Device supported architectures.
+ */
+ @Test
+ public void testGetAbis() throws DeviceNotAvailableException {
+ EasyMock.expect(mMockDevice.getProperty(EasyMock.eq("ro.product.cpu.abilist")))
+ .andReturn("arm64-v8a,armeabi-v7a,armeabi");
+ Set<String> expectedAbis = new HashSet<>();
+ expectedAbis.add("arm64-v8a");
+ expectedAbis.add("armeabi-v7a");
+ EasyMock.replay(mMockDevice);
+ Set<IAbi> res = mTest.getAbis(mMockDevice);
+ assertEquals(2, res.size());
+ for (IAbi abi : res) {
+ assertTrue(expectedAbis.contains(abi.getName()));
+ }
+ EasyMock.verify(mMockDevice);
+ }
+
+ /**
+ * Test that {@link CompatibilityTestSuite#getAbis(ITestDevice)} is throwing an exception when
+ * none of the CTS build supported abi match the device abi.
+ */
+ @Test
+ public void testGetAbis_notSupported() throws DeviceNotAvailableException {
+ EasyMock.expect(mMockDevice.getProperty(EasyMock.eq("ro.product.cpu.abilist")))
+ .andReturn("armeabi");
+ EasyMock.replay(mMockDevice);
+ try {
+ mTest.getAbis(mMockDevice);
+ fail("Should have thrown an exception");
+ } catch (IllegalArgumentException e) {
+ assertEquals("None of the abi supported by this CTS build ('[armeabi-v7a, arm64-v8a]')"
+ + " are supported by the device ('[armeabi]').", e.getMessage());
+ }
+ EasyMock.verify(mMockDevice);
+ }
+
+ /**
+ * Test that {@link CompatibilityTestSuite#getAbis(ITestDevice)} is returning only the device
+ * primary abi.
+ */
+ @Test
+ public void testGetAbis_primaryAbiOnly() throws Exception {
+ OptionSetter setter = new OptionSetter(mTest);
+ setter.setOptionValue(CompatibilityTest.PRIMARY_ABI_RUN, "true");
+ EasyMock.expect(mMockDevice.getProperty(EasyMock.eq("ro.product.cpu.abi")))
+ .andReturn("arm64-v8a");
+ Set<String> expectedAbis = new HashSet<>();
+ expectedAbis.add("arm64-v8a");
+ EasyMock.replay(mMockDevice);
+ Set<IAbi> res = mTest.getAbis(mMockDevice);
+ assertEquals(1, res.size());
+ for (IAbi abi : res) {
+ assertTrue(expectedAbis.contains(abi.getName()));
+ }
+ EasyMock.verify(mMockDevice);
+ }
+
+ /**
+ * Test that {@link CompatibilityTestSuite#getAbis(ITestDevice)} is throwing an exception if
+ * the primary abi is not supported.
+ */
+ @Test
+ public void testGetAbis_primaryAbiOnly_NotSupported() throws Exception {
+ OptionSetter setter = new OptionSetter(mTest);
+ setter.setOptionValue(CompatibilityTest.PRIMARY_ABI_RUN, "true");
+ EasyMock.expect(mMockDevice.getProperty(EasyMock.eq("ro.product.cpu.abi")))
+ .andReturn("armeabi");
+ EasyMock.replay(mMockDevice);
+ try {
+ mTest.getAbis(mMockDevice);
+ fail("Should have thrown an exception");
+ } catch (IllegalArgumentException e) {
+ assertEquals("Your CTS hasn't been built with abi 'armeabi' support, "
+ + "this CTS currently supports '[armeabi-v7a, arm64-v8a]'.", e.getMessage());
+ }
+ EasyMock.verify(mMockDevice);
+ }
+
+ /**
+ * Test that {@link CompatibilityTestSuite#getAbis(ITestDevice)} is returning the list of abi
+ * supported by Compatibility and the device, and not the particular CTS build.
+ */
+ @Test
+ public void testGetAbis_skipCtsArchCheck() throws Exception {
+ OptionSetter setter = new OptionSetter(mTest);
+ setter.setOptionValue(CompatibilityTest.SKIP_HOST_ARCH_CHECK, "true");
+ EasyMock.expect(mMockDevice.getProperty(EasyMock.eq("ro.product.cpu.abilist")))
+ .andReturn("x86_64,x86,armeabi");
+ Set<String> expectedAbis = new HashSet<>();
+ expectedAbis.add("x86_64");
+ expectedAbis.add("x86");
+ EasyMock.replay(mMockDevice);
+ Set<IAbi> res = mTest.getAbis(mMockDevice);
+ assertEquals(2, res.size());
+ for (IAbi abi : res) {
+ assertTrue(expectedAbis.contains(abi.getName()));
+ }
+ EasyMock.verify(mMockDevice);
+ }
+
+ /**
+ * Test {@link CompatibilityTestSuite#getAbis(ITestDevice)} when we skip the Cts side
+ * architecture check and want to run x86 abi.
+ */
+ @Test
+ public void testGetAbis_skipCtsArchCheck_abiSpecified() throws Exception {
+ OptionSetter setter = new OptionSetter(mTest);
+ setter.setOptionValue(CompatibilityTest.SKIP_HOST_ARCH_CHECK, "true");
+ setter.setOptionValue(CompatibilityTest.ABI_OPTION, "x86");
+ Set<String> expectedAbis = new HashSet<>();
+ expectedAbis.add("x86");
+ EasyMock.replay(mMockDevice);
+ Set<IAbi> res = mTest.getAbis(mMockDevice);
+ assertEquals(1, res.size());
+ for (IAbi abi : res) {
+ assertTrue(expectedAbis.contains(abi.getName()));
+ }
+ EasyMock.verify(mMockDevice);
+ }
+}
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/CollectorUtilTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/CollectorUtilTest.java
index 5e06d26..3f13671 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/CollectorUtilTest.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/CollectorUtilTest.java
@@ -22,7 +22,7 @@
*/
public class CollectorUtilTest extends TestCase {
- String UNFORMATTED_JSON = "{"
+ private static final String UNFORMATTED_JSON = "{"
+ "\"stream_name_1\":"
+ "{\"id\":1,\"key1\":\"value1\"},"
+ "\"stream_name_2\":"
@@ -31,7 +31,7 @@
+ "{\"id\":2,\"key1\":\"value2\"},"
+ "}";
- String REFORMATTED_JSON = "{"
+ private static final String REFORMATTED_JSON = "{"
+ "\"stream_name_2\":"
+ "["
+ "{\"id\":1,\"key1\":\"value3\"}"
diff --git a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/RetryFilterHelperTest.java b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/RetryFilterHelperTest.java
index 05d35ec..328dc9e 100644
--- a/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/RetryFilterHelperTest.java
+++ b/common/host-side/tradefed/tests/src/com/android/compatibility/common/tradefed/util/RetryFilterHelperTest.java
@@ -15,38 +15,48 @@
*/
package com.android.compatibility.common.tradefed.util;
-import com.android.compatibility.common.tradefed.testtype.CompatibilityTest;
-import com.android.tradefed.config.OptionSetter;
+import static org.junit.Assert.*;
-import junit.framework.TestCase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.util.HashSet;
+import java.util.Set;
/**
* Unit tests for {@link RetryFilterHelper}
*/
-public class RetryFilterHelperTest extends TestCase {
+@RunWith(JUnit4.class)
+public class RetryFilterHelperTest {
private static final String TEST_STRING = "abcd";
private static final RetryType TEST_RETRY_TYPE = RetryType.FAILED;
+ /**
+ * Tests that options can be internally copied using
+ * {@link RetryFilterHelper#setAllOptionsFrom(RetryFilterHelper)}.
+ */
+ @Test
public void testSetAllOptionsFrom() throws Exception {
RetryFilterHelper helper = new RetryFilterHelper(null, 0);
- RetryFilterHelper otherObj = new RetryFilterHelper(null, 0);
- OptionSetter otherObjSetter = new OptionSetter(otherObj);
- otherObjSetter.setOptionValue(CompatibilityTest.SUBPLAN_OPTION, TEST_STRING);
+ RetryFilterHelper otherObj = new RetryFilterHelper(null, 0, TEST_STRING,
+ new HashSet<String>(), new HashSet<String>(), null ,null, null, null);
helper.setAllOptionsFrom(otherObj);
assertEquals(TEST_STRING, helper.mSubPlan);
}
+ /**
+ * Tests that options can be cleared using {@link RetryFilterHelper#clearOptions()}.
+ */
+ @Test
public void testClearOptions() throws Exception {
- RetryFilterHelper helper = new RetryFilterHelper(null, 0);
- OptionSetter setter = new OptionSetter(helper);
- setter.setOptionValue(CompatibilityTest.SUBPLAN_OPTION, TEST_STRING);
- setter.setOptionValue(CompatibilityTest.INCLUDE_FILTER_OPTION, TEST_STRING);
- setter.setOptionValue(CompatibilityTest.EXCLUDE_FILTER_OPTION, TEST_STRING);
- setter.setOptionValue(CompatibilityTest.ABI_OPTION, TEST_STRING);
- setter.setOptionValue(CompatibilityTest.MODULE_OPTION, TEST_STRING);
- setter.setOptionValue(CompatibilityTest.TEST_OPTION, TEST_STRING);
- setter.setOptionValue(CompatibilityTest.TEST_OPTION, TEST_RETRY_TYPE.name());
+ Set<String> include = new HashSet<>();
+ include.add(TEST_STRING);
+ Set<String> exclude = new HashSet<>();
+ exclude.add(TEST_STRING);
+ RetryFilterHelper helper = new RetryFilterHelper(null, 0, TEST_STRING, include, exclude,
+ TEST_STRING, TEST_STRING, TEST_STRING, TEST_RETRY_TYPE);
helper.clearOptions();
assertTrue(helper.mSubPlan == null);
assertTrue(helper.mIncludeFilters.isEmpty());
diff --git a/common/host-side/util/Android.mk b/common/host-side/util/Android.mk
index 771e334..23626bd 100644
--- a/common/host-side/util/Android.mk
+++ b/common/host-side/util/Android.mk
@@ -25,7 +25,7 @@
LOCAL_MODULE := compatibility-host-util
LOCAL_MODULE_TAGS := optional
-
+include cts/error_prone_rules.mk
include $(BUILD_HOST_JAVA_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/common/host-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java b/common/host-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java
index d614caf..38158b4 100644
--- a/common/host-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java
+++ b/common/host-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java
@@ -23,7 +23,7 @@
*/
public class ApiLevelUtil {
- public static String CODENAME = "ro.build.version.codename";
+ public static final String CODENAME = "ro.build.version.codename";
public static boolean isBefore(ITestDevice device, int version)
throws DeviceNotAvailableException {
diff --git a/common/host-side/util/src/com/android/compatibility/common/util/HostInfoStore.java b/common/host-side/util/src/com/android/compatibility/common/util/HostInfoStore.java
index a17f17a..3b7f6c8 100644
--- a/common/host-side/util/src/com/android/compatibility/common/util/HostInfoStore.java
+++ b/common/host-side/util/src/com/android/compatibility/common/util/HostInfoStore.java
@@ -22,7 +22,6 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
import java.util.List;
public class HostInfoStore extends InfoStore {
diff --git a/common/host-side/util/src/com/android/compatibility/common/util/MonitoringUtils.java b/common/host-side/util/src/com/android/compatibility/common/util/MonitoringUtils.java
index e24ca40..148a9a5 100644
--- a/common/host-side/util/src/com/android/compatibility/common/util/MonitoringUtils.java
+++ b/common/host-side/util/src/com/android/compatibility/common/util/MonitoringUtils.java
@@ -42,7 +42,8 @@
return true;
} else {
CLog.logAndDisplay(LogLevel.INFO,
- "Connectivity check failed, retrying in %dms",
+ "Connectivity check failed on %s, retrying in %dms",
+ device.getSerialNumber(),
CONNECTIVITY_CHECK_INTERVAL_MS);
RunUtil.getDefault().sleep(CONNECTIVITY_CHECK_INTERVAL_MS);
}
diff --git a/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java b/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
index 199b826..2cdcc23 100644
--- a/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
+++ b/common/host-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
@@ -28,7 +28,7 @@
* Name of read-only property detailing the first API level for which the product was
* shipped. Property should be undefined for factory ROM products.
*/
- public static String FIRST_API_LEVEL = "ro.product.first_api_level";
+ public static final String FIRST_API_LEVEL = "ro.product.first_api_level";
/** Returns whether the device build is the factory ROM */
public static boolean isFactoryROM(ITestDevice device) throws DeviceNotAvailableException {
diff --git a/common/host-side/util/tests/Android.mk b/common/host-side/util/tests/Android.mk
index b5806c7..338d6c3 100644
--- a/common/host-side/util/tests/Android.mk
+++ b/common/host-side/util/tests/Android.mk
@@ -23,5 +23,5 @@
LOCAL_MODULE := compatibility-host-util-tests
LOCAL_MODULE_TAGS := optional
-
+include cts/error_prone_rules.mk
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/common/host-side/util/tests/src/com/android/compatibility/common/util/DynamicConfigHandlerTest.java b/common/host-side/util/tests/src/com/android/compatibility/common/util/DynamicConfigHandlerTest.java
index 31dd598..ef0e824 100644
--- a/common/host-side/util/tests/src/com/android/compatibility/common/util/DynamicConfigHandlerTest.java
+++ b/common/host-side/util/tests/src/com/android/compatibility/common/util/DynamicConfigHandlerTest.java
@@ -33,7 +33,7 @@
*/
public class DynamicConfigHandlerTest extends TestCase {
- private static final String localConfig =
+ private static final String LOCAL_CONFIG =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<dynamicConfig>\n" +
" <entry key=\"test-config-1\">\n" +
@@ -61,7 +61,7 @@
" </entry>\n" +
"</dynamicConfig>\n";
- private static final String overrideJson =
+ private static final String OVERRIDE_JSON =
"{\n" +
" \"dynamicConfigEntries\": {\n" +
" \"override-config-1\": {\n" +
@@ -94,11 +94,11 @@
public void testDynamicConfigHandler() throws Exception {
String module = "test1";
- File localConfigFile = createFileFromStr(localConfig, module);
+ File localConfigFile = createFileFromStr(LOCAL_CONFIG, module);
File mergedFile = null;
try {
mergedFile = DynamicConfigHandler
- .getMergedDynamicConfigFile(localConfigFile, overrideJson, module);
+ .getMergedDynamicConfigFile(localConfigFile, OVERRIDE_JSON, module);
Map<String, List<String>> configMap = DynamicConfig.createConfigMap(mergedFile);
diff --git a/common/util/Android.mk b/common/util/Android.mk
index b6cf927..20bef9d 100644
--- a/common/util/Android.mk
+++ b/common/util/Android.mk
@@ -26,7 +26,7 @@
LOCAL_MODULE := compatibility-common-util-devicesidelib
-LOCAL_STATIC_JAVA_LIBRARIES := guava
+LOCAL_STATIC_JAVA_LIBRARIES := guava junit
LOCAL_SDK_VERSION := current
@@ -48,7 +48,7 @@
junit-host \
kxml2-2.3.0 \
platform-test-annotations-host
-
+include cts/error_prone_rules.mk
include $(BUILD_HOST_JAVA_LIBRARY)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/common/util/src/com/android/compatibility/common/util/AbiUtils.java b/common/util/src/com/android/compatibility/common/util/AbiUtils.java
index 76c962c..c9c82b7 100644
--- a/common/util/src/com/android/compatibility/common/util/AbiUtils.java
+++ b/common/util/src/com/android/compatibility/common/util/AbiUtils.java
@@ -15,11 +15,6 @@
*/
package com.android.compatibility.common.util;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
/**
* Utility class for handling device ABIs
*/
diff --git a/common/util/src/com/android/compatibility/common/util/CaseResult.java b/common/util/src/com/android/compatibility/common/util/CaseResult.java
index 36f77d7..a7c3318 100644
--- a/common/util/src/com/android/compatibility/common/util/CaseResult.java
+++ b/common/util/src/com/android/compatibility/common/util/CaseResult.java
@@ -119,7 +119,7 @@
public void mergeFrom(ICaseResult otherCaseResult) {
if (!otherCaseResult.getName().equals(getName())) {
throw new IllegalArgumentException(String.format(
- "Cannot merge case result with mismatched name. Expected %s, Found %d",
+ "Cannot merge case result with mismatched name. Expected %s, Found %s",
otherCaseResult.getName(), getName()));
}
diff --git a/common/util/src/com/android/compatibility/common/util/InfoStore.java b/common/util/src/com/android/compatibility/common/util/InfoStore.java
index b8014f7..c5a411e 100644
--- a/common/util/src/com/android/compatibility/common/util/InfoStore.java
+++ b/common/util/src/com/android/compatibility/common/util/InfoStore.java
@@ -15,7 +15,6 @@
*/
package com.android.compatibility.common.util;
-import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
diff --git a/common/util/src/com/android/compatibility/common/util/MetricsXmlSerializer.java b/common/util/src/com/android/compatibility/common/util/MetricsXmlSerializer.java
index a7b1153..ce8696b 100644
--- a/common/util/src/com/android/compatibility/common/util/MetricsXmlSerializer.java
+++ b/common/util/src/com/android/compatibility/common/util/MetricsXmlSerializer.java
@@ -19,7 +19,6 @@
import org.xmlpull.v1.XmlSerializer;
import java.io.IOException;
-import java.util.List;
//TODO(stuartscott): Delete file for v2, ReportLog can serialize itself.
/**
diff --git a/common/util/src/com/android/compatibility/common/util/TestStatus.java b/common/util/src/com/android/compatibility/common/util/TestStatus.java
index 744f760..5a9b170 100644
--- a/common/util/src/com/android/compatibility/common/util/TestStatus.java
+++ b/common/util/src/com/android/compatibility/common/util/TestStatus.java
@@ -22,7 +22,7 @@
PASS("pass"),
FAIL("fail");
- private String mValue;
+ private final String mValue;
private TestStatus(String storedValue) {
mValue = storedValue;
diff --git a/common/util/src/com/android/compatibility/common/util/TestSuiteFilter.java b/common/util/src/com/android/compatibility/common/util/TestSuiteFilter.java
index e498c17..d98bc6d 100644
--- a/common/util/src/com/android/compatibility/common/util/TestSuiteFilter.java
+++ b/common/util/src/com/android/compatibility/common/util/TestSuiteFilter.java
@@ -19,7 +19,6 @@
import junit.framework.TestResult;
import junit.framework.TestSuite;
-import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.Set;
diff --git a/common/util/src/com/android/compatibility/common/util/VendorInterfaceTest.java b/common/util/src/com/android/compatibility/common/util/VendorInterfaceTest.java
index 5a448f1..5bcaf0c 100644
--- a/common/util/src/com/android/compatibility/common/util/VendorInterfaceTest.java
+++ b/common/util/src/com/android/compatibility/common/util/VendorInterfaceTest.java
@@ -26,7 +26,8 @@
* AOSP requirement.
* <p>
* Test classes and test cases marked with this annotation will be included in the
- * cts-vendor-interface plan by default.
+ * cts-vendor-interface plan
+ * by default.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
diff --git a/common/util/src/com/android/compatibility/common/util/ZipUtil.java b/common/util/src/com/android/compatibility/common/util/ZipUtil.java
index 6cee83a..b44fd46 100644
--- a/common/util/src/com/android/compatibility/common/util/ZipUtil.java
+++ b/common/util/src/com/android/compatibility/common/util/ZipUtil.java
@@ -27,7 +27,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
public class ZipUtil {
diff --git a/common/util/tests/Android.mk b/common/util/tests/Android.mk
index 5e3370b..1aca670 100644
--- a/common/util/tests/Android.mk
+++ b/common/util/tests/Android.mk
@@ -23,5 +23,5 @@
LOCAL_MODULE := compatibility-common-util-tests
LOCAL_MODULE_TAGS := optional
-
+include cts/error_prone_rules.mk
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/common/util/tests/src/com/android/compatibility/common/util/DynamicConfigTest.java b/common/util/tests/src/com/android/compatibility/common/util/DynamicConfigTest.java
index df50d11..99ef733 100644
--- a/common/util/tests/src/com/android/compatibility/common/util/DynamicConfigTest.java
+++ b/common/util/tests/src/com/android/compatibility/common/util/DynamicConfigTest.java
@@ -30,7 +30,7 @@
* Unit tests for {@link DynamicConfig}
*/
public class DynamicConfigTest extends TestCase {
- private static final String correctConfig =
+ private static final String CORRECT_CONFIG =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<dynamicConfig>\n" +
" <entry key=\"test-config-1\">\n" +
@@ -55,7 +55,7 @@
" </entry>\n" +
"</dynamicConfig>\n";
- private static final String configWrongNodeName =
+ private static final String CONFIG_WRONG_NODE_NAME =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
"<dynamicCsonfig>\n" + //The node name dynamicConfig is intentionally mistyped
" <entry key=\"test-config-1\">\n" +
@@ -82,7 +82,7 @@
public void testCorrectConfig() throws Exception {
DynamicConfig config = new DynamicConfig();
- File file = createFileFromStr(correctConfig);
+ File file = createFileFromStr(CORRECT_CONFIG);
try {
config.initializeConfig(file);
assertEquals("Wrong Config", config.getValue("test-config-1"), "test config 1");
@@ -97,7 +97,7 @@
public void testConfigWithWrongNodeName() throws Exception {
DynamicConfig config = new DynamicConfig();
- File file = createFileFromStr(configWrongNodeName);
+ File file = createFileFromStr(CONFIG_WRONG_NODE_NAME);
try {
config.initializeConfig(file);
fail("Cannot detect error when config file has wrong node name");
diff --git a/common/util/tests/src/com/android/compatibility/common/util/ResultHandlerTest.java b/common/util/tests/src/com/android/compatibility/common/util/ResultHandlerTest.java
index 49c4045..932db8e 100644
--- a/common/util/tests/src/com/android/compatibility/common/util/ResultHandlerTest.java
+++ b/common/util/tests/src/com/android/compatibility/common/util/ResultHandlerTest.java
@@ -224,7 +224,7 @@
writer = new FileWriter(resultFile);
String buildInfo = String.format(XML_BUILD_INFO, DEVICE_A,
EXAMPLE_BUILD_ID, EXAMPLE_BUILD_PRODUCT);
- String summary = String.format(XML_SUMMARY, 2, 1, 1);
+ String summary = String.format(XML_SUMMARY, 2, 1);
String moduleATest = String.format(XML_TEST_PASS, METHOD_1);
String moduleACases = String.format(XML_CASE, CLASS_A, moduleATest);
String moduleA = String.format(XML_MODULE, NAME_A, ABI, DEVICE_A, RUNTIME_A, DONE_A,
diff --git a/error_prone_rules.mk b/error_prone_rules.mk
new file mode 100644
index 0000000..cc28b0d
--- /dev/null
+++ b/error_prone_rules.mk
@@ -0,0 +1,32 @@
+# 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.
+
+# Set of error prone rules to ensure code quality
+LOCAL_ERROR_PRONE_FLAGS:= -Xep:ArrayToString:ERROR \
+ -Xep:BoxedPrimitiveConstructor:ERROR \
+ -Xep:ConstantField:ERROR \
+ -Xep:FormatString:ERROR \
+ -Xep:GetClassOnClass:ERROR \
+ -Xep:JUnit3TestNotRun:ERROR \
+ -Xep:JUnitAmbiguousTestClass:ERROR \
+ -Xep:MissingFail:ERROR \
+ -Xep:MissingOverride:ERROR \
+ -Xep:Overrides:ERROR \
+ -Xep:ReferenceEquality:ERROR \
+ -Xep:RemoveUnusedImports:ERROR \
+ -Xep:ReturnValueIgnored:ERROR \
+ -Xep:SelfEquals:ERROR \
+ -Xep:SizeGreaterThanOrEqualsZero:ERROR \
+ -Xep:TryFailThrowable:ERROR
+
diff --git a/error_prone_rules_tests.mk b/error_prone_rules_tests.mk
new file mode 100644
index 0000000..1effdba
--- /dev/null
+++ b/error_prone_rules_tests.mk
@@ -0,0 +1,23 @@
+# 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.
+
+# Set of error prone rules to ensure code quality of tests
+
+# Goal is to eventually merge with error_prone_rules.mk
+LOCAL_ERROR_PRONE_FLAGS:= -Xep:CollectionIncompatibleType:ERROR \
+ -Xep:EqualsNaN:ERROR \
+ -Xep:FormatString:ERROR \
+ -Xep:JUnit3TestNotRun:ERROR \
+ -Xep:TryFailThrowable:ERROR
+
diff --git a/hostsidetests/aadb/Android.mk b/hostsidetests/aadb/Android.mk
index 5cc2c10..203151b 100644
--- a/hostsidetests/aadb/Android.mk
+++ b/hostsidetests/aadb/Android.mk
@@ -27,7 +27,7 @@
LOCAL_CTS_TEST_PACKAGE := android.aadb
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/abioverride/Android.mk b/hostsidetests/abioverride/Android.mk
index 88c44d9..9b92985 100644
--- a/hostsidetests/abioverride/Android.mk
+++ b/hostsidetests/abioverride/Android.mk
@@ -23,7 +23,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.host.abioverride
diff --git a/hostsidetests/abioverride/AndroidTest.xml b/hostsidetests/abioverride/AndroidTest.xml
index 2a3a963..671947f 100644
--- a/hostsidetests/abioverride/AndroidTest.xml
+++ b/hostsidetests/abioverride/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS AbiOverride host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAbiOverrideTestApp.apk" />
</target_preparer>
diff --git a/hostsidetests/abioverride/app/Android.mk b/hostsidetests/abioverride/app/Android.mk
index cdf063c..e49622c 100755
--- a/hostsidetests/abioverride/app/Android.mk
+++ b/hostsidetests/abioverride/app/Android.mk
@@ -34,7 +34,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAbiOverrideTestApp
diff --git a/hostsidetests/appsecurity/Android.mk b/hostsidetests/appsecurity/Android.mk
index 6afcce8..fa78eab 100644
--- a/hostsidetests/appsecurity/Android.mk
+++ b/hostsidetests/appsecurity/Android.mk
@@ -28,7 +28,7 @@
LOCAL_CTS_TEST_PACKAGE := android.appsecurity
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
index a1bcc30..afd7245 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
@@ -270,10 +270,14 @@
// Kick through a remount cycle, which should purge the adopted app
getDevice().executeShellCommand("sm mount " + vol.volId);
runDeviceTests(PKG, CLASS, "testDataInternal");
+ boolean didThrow = false;
try {
runDeviceTests(PKG, CLASS, "testDataRead");
- fail("Unexpected data from adopted volume picked up");
} catch (AssertionError expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("Unexpected data from adopted volume picked up");
}
getDevice().executeShellCommand("sm unmount " + vol.volId);
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
index 9ba3c82..cc42e9a 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
@@ -77,22 +77,30 @@
public void testFail() throws Exception {
// Sanity check that remote failure is host failure
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_23), false, false));
+ boolean didThrow = false;
try {
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest23",
"testFail");
- fail("Expected remote failure");
} catch (AssertionError expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("Expected remote failure");
}
}
public void testKill() throws Exception {
// Sanity check that remote kill is host failure
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_23), false, false));
+ boolean didThrow = false;
try {
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest23",
"testKill");
- fail("Expected remote failure");
} catch (AssertionError expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("Expected remote failure");
}
}
@@ -104,11 +112,15 @@
public void testCompatRevoked22() throws Exception {
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_22), false, false));
+ boolean didThrow = false;
try {
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest22",
"testCompatRevoked_part1");
- fail("App must be killed on a permission revoke");
} catch (AssertionError expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("App must be killed on a permission revoke");
}
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest22",
"testCompatRevoked_part2");
@@ -170,10 +182,15 @@
public void testRevokeAffectsWholeGroup23() throws Exception {
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_23), false, false));
+ boolean didThrow = false;
try {
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest23",
"testRevokeAffectsWholeGroup_part1");
} catch (AssertionError expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("Should have thrown an exception.");
}
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest23",
"testRevokeAffectsWholeGroup_part2");
@@ -181,11 +198,15 @@
public void testGrantPreviouslyRevokedWithPrejudiceShowsPrompt23() throws Exception {
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_23), false, false));
+ boolean didThrow = false;
try {
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest23",
"testGrantPreviouslyRevokedWithPrejudiceShowsPrompt_part1");
- fail("App must be killed on a permission revoke");
} catch (Throwable expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("App must be killed on a permission revoke");
}
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest23",
"testGrantPreviouslyRevokedWithPrejudiceShowsPrompt_part2");
@@ -226,10 +247,14 @@
public void testNoDowngradePermissionModel() throws Exception {
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_23), false, false));
+ boolean didThrow = false;
try {
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_22), true, false));
- fail("Permission mode downgrade not allowed");
} catch (AssertionError expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("Permission mode downgrade not allowed");
}
}
@@ -245,11 +270,15 @@
public void testRevokePropagatedOnUpgradeOldToNewModel() throws Exception {
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_22), false, false));
+ boolean didThrow = false;
try {
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest22",
"testRevokePropagatedOnUpgradeOldToNewModel_part1");
- fail("App must be killed on a permission revoke");
} catch (AssertionError expected) {
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("App must be killed on a permission revoke");
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_23), true, false));
runDeviceTests(USES_PERMISSION_PKG, "com.android.cts.usepermission.UsePermissionTest23",
diff --git a/hostsidetests/appsecurity/test-apps/Android.mk b/hostsidetests/appsecurity/test-apps/Android.mk
index 1d4e58f..446e047a 100644
--- a/hostsidetests/appsecurity/test-apps/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Build the test APKs using their own makefiles
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
index 606b9ce..4faf112 100644
--- a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
@@ -21,12 +21,12 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_PACKAGE_NAME := CtsAppAccessData
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# although not strictly necessary, sign this app with different cert than CtsAppWithData
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk b/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
index 1109280..c4f0eba 100644
--- a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
@@ -21,12 +21,12 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_PACKAGE_NAME := CtsAppWithData
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.mk b/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.mk
index b98ba68..1311944 100644
--- a/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.mk
@@ -22,7 +22,7 @@
LOCAL_PACKAGE_NAME := CtsDeclareNonRuntimePermissions
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
index ec89ce9..60ece87 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsDocumentClient
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
index 915d432..0084eb3 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsDocumentProvider
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/DocumentProvider/src/com/android/cts/documentprovider/MyDocumentsProvider.java b/hostsidetests/appsecurity/test-apps/DocumentProvider/src/com/android/cts/documentprovider/MyDocumentsProvider.java
index edf6f15..91abb89 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentProvider/src/com/android/cts/documentprovider/MyDocumentsProvider.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentProvider/src/com/android/cts/documentprovider/MyDocumentsProvider.java
@@ -256,7 +256,7 @@
@Override
public void deleteDocument(String documentId) throws FileNotFoundException {
final Doc doc = mDocs.get(documentId);
- mDocs.remove(doc);
+ mDocs.remove(doc.docId);
for (Doc parentDoc : mDocs.values()) {
parentDoc.children.remove(doc);
}
@@ -268,7 +268,7 @@
// There are no multi-parented documents in this provider, so it's safe to remove the
// document from mDocs.
final Doc doc = mDocs.get(documentId);
- mDocs.remove(doc);
+ mDocs.remove(doc.docId);
mDocs.get(parentDocumentId).children.remove(doc);
}
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
index 930ac82..a94b206 100644
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsEncryptionApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/Android.mk
index e5cd607..eadbb82 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Build the test APKs using their own makefiles
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
index b13432b..6d0a589 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
@@ -27,7 +27,7 @@
ctstestrunner
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
index 1dd66a6..a7078fe 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
@@ -21,7 +21,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
index 4cd5d79..e714536 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
@@ -24,7 +24,7 @@
legacy-android-test
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
index afd8903..930370a 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
@@ -21,7 +21,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
index 1b1ee7d..24d9f2a 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
@@ -24,7 +24,7 @@
legacy-android-test
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
index e1547a1..5172dff 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
@@ -23,7 +23,7 @@
legacy-android-test
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
index b1b7f83..4e49387 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsEscalateToRuntimePermissions
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
index 560607b..272d0f9 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
@@ -18,13 +18,13 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsExternalStorageApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
index 101d564..5645a7f 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsInstantCookieApp
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
index 31dcd58..d49fe73 100644
--- a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
@@ -21,12 +21,12 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_PACKAGE_NAME := CtsInstrumentationAppDiffCert
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with different cert than CtsTargetInstrumentationApp
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
index 8a7f8d9..9225ee2 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
@@ -21,7 +21,7 @@
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_EXPORT_PACKAGE_RESOURCES := true
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_a/Android.mk b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_a/Android.mk
index 5a5ab0d..15a0b25 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_a/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_a/Android.mk
@@ -19,7 +19,7 @@
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_EXPORT_PACKAGE_RESOURCES := true
LOCAL_PACKAGE_NAME := CtsIsolatedSplitAppFeatureA
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_b/Android.mk b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_b/Android.mk
index 39111fc..3b11085 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_b/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_b/Android.mk
@@ -19,7 +19,7 @@
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsIsolatedSplitAppFeatureB
LOCAL_SRC_FILES := $(call all-subdir-java-files)
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_c/Android.mk b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_c/Android.mk
index 15beac4..70880ba 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_c/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/feature_c/Android.mk
@@ -19,7 +19,7 @@
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsIsolatedSplitAppFeatureC
LOCAL_SRC_FILES := $(call all-subdir-java-files)
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
index fd4d927..ff6be32 100644
--- a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
../ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsMultiUserStorageApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk b/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
index 69d3b4a..31b683d 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
@@ -23,7 +23,7 @@
LOCAL_PACKAGE_NAME := CtsNoRestartBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/feature/Android.mk b/hostsidetests/appsecurity/test-apps/NoRestartApp/feature/Android.mk
index 204275b..c92375e 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/feature/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/feature/Android.mk
@@ -23,7 +23,7 @@
LOCAL_PACKAGE_NAME := CtsNoRestartFeature
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
index d038a70..f1dbf84 100644
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsPkgAccessApp
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
index e0e900e..780214b 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsPermissionDeclareApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with a different cert than CtsUsePermissionDiffCert
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
index d4567e3..78b7f91 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsPermissionDeclareAppCompat
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with a different cert than CtsUsePermissionDiffCert
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
index bb171e2..199e429 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
LOCAL_PACKAGE_NAME := CtsPrivilegedUpdateTests
@@ -46,7 +46,7 @@
LOCAL_BUILT_MODULE_STEM := package.apk
# Make sure the build system doesn't try to resign the APK
LOCAL_CERTIFICATE := PRESIGNED
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := CtsShimPrivUpgrade.apk
@@ -63,7 +63,7 @@
LOCAL_BUILT_MODULE_STEM := package.apk
# Make sure the build system doesn't try to resign the APK
LOCAL_CERTIFICATE := PRESIGNED
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := CtsShimPrivUpgradeWrongSHA.apk
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
index adf6a14..d265b5b 100644
--- a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
../ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsReadExternalStorageApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
index 548e397..3437b2f 100644
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsSharedUidInstall
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with a different cert than CtsSharedUidInstallDiffCert
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
index 0f6cd69..47b066a 100644
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsSharedUidInstallDiffCert
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with a different cert than CtsSharedUidInstall
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
index a77a172..9309f17 100644
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsSimpleAppInstall
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with a different cert than CtsSimpleAppInstallDiffCert
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
index e478afb..fe69246 100644
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsSimpleAppInstallDiffCert
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with a different cert than CtsSimpleAppInstall
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
index e12feec..f844a78 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_SPLITS := mdpi-v4 hdpi-v4 xhdpi-v4 xxhdpi-v4 v7 fr de
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_ASSET_DIR := $(LOCAL_PATH)/assets
@@ -48,7 +48,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -56,7 +56,7 @@
LOCAL_PACKAGE_SPLITS := v7
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MANIFEST_FILE := revision/AndroidManifest.xml
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
@@ -75,7 +75,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -83,7 +83,7 @@
LOCAL_PACKAGE_SPLITS := v7
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 101 --version-name OneHundredOne --replace-version
@@ -101,7 +101,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -109,7 +109,7 @@
LOCAL_PACKAGE_SPLITS := v7
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
LOCAL_AAPT_FLAGS := --version-code 100 --version-name OneHundred --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/feature/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/feature/Android.mk
index aea49c6..0603cc7 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/feature/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/feature/Android.mk
@@ -29,7 +29,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
featureOf := CtsSplitApp
featureOfApk := $(call intermediates-dir-for,APPS,$(featureOf))/package.apk
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/jni/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/jni/Android.mk
index b1e2002..e495ad3 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/jni/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/jni/Android.mk
@@ -24,6 +24,6 @@
LOCAL_LDLIBS += -llog
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_SHARED_LIBRARY)
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/libs/arm64-v8a/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/libs/arm64-v8a/Android.mk
index 51b91a4..fddee79 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/libs/arm64-v8a/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/libs/arm64-v8a/Android.mk
@@ -23,7 +23,7 @@
LOCAL_JAVA_RESOURCE_DIRS := raw
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 100 --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi-v7a/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi-v7a/Android.mk
index dc1d703..cddda28 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi-v7a/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi-v7a/Android.mk
@@ -23,7 +23,7 @@
LOCAL_JAVA_RESOURCE_DIRS := raw
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 100 --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi/Android.mk
index 28c2190..9b67d24 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/libs/armeabi/Android.mk
@@ -23,7 +23,7 @@
LOCAL_JAVA_RESOURCE_DIRS := raw
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 100 --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips/Android.mk
index d1565e6..aed7253 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips/Android.mk
@@ -23,7 +23,7 @@
LOCAL_JAVA_RESOURCE_DIRS := raw
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 100 --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips64/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips64/Android.mk
index 383030c..7798a0c 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips64/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/libs/mips64/Android.mk
@@ -23,7 +23,7 @@
LOCAL_JAVA_RESOURCE_DIRS := raw
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 100 --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86/Android.mk
index e9e71ee..8f604d3 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86/Android.mk
@@ -23,7 +23,7 @@
LOCAL_JAVA_RESOURCE_DIRS := raw
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 100 --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86_64/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86_64/Android.mk
index 87f0e4a..cf3dca1 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86_64/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/libs/x86_64/Android.mk
@@ -23,7 +23,7 @@
LOCAL_JAVA_RESOURCE_DIRS := raw
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
LOCAL_AAPT_FLAGS := --version-code 100 --replace-version
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk b/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
index 6367912..aa75be7 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
@@ -18,13 +18,13 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, ../StorageApp/src/)
LOCAL_PACKAGE_NAME := CtsStorageAppA
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts 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
index 2177da1..c335f23 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
@@ -18,13 +18,13 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, ../StorageApp/src/)
LOCAL_PACKAGE_NAME := CtsStorageAppB
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_DEX_PREOPT := false
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
index abee640..173deb5 100644
--- a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
@@ -18,14 +18,14 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
$(call all-java-files-under, ../StorageApp/src)
LOCAL_PACKAGE_NAME := CtsStorageStatsApp
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_DEX_PREOPT := false
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
index bfedb36..c3da07a 100644
--- a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsTargetInstrumentationApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with different cert than CtsInstrumentationAppDiffCert
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
index f8db5aa..8e51f22 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
@@ -34,7 +34,7 @@
LOCAL_PACKAGE_NAME := CtsUsePermissionApp22
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
index 9e6ea3e..5e623d8 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
@@ -32,7 +32,7 @@
LOCAL_PACKAGE_NAME := CtsUsePermissionApp23
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp24/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp24/Android.mk
index 739f220..a71f48b 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp24/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp24/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsUsePermissionApp24
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
index bda6782..80dc334 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
@@ -22,12 +22,12 @@
../PermissionDeclareApp/src/com/android/cts/permissiondeclareapp/GrantUriPermission.java
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_PACKAGE_NAME := CtsUsePermissionDiffCert
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# sign this app with a different cert than CtsPermissionDeclareApp
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
index 581af78..7e5627f 100644
--- a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsUsesLibraryApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
index 61d2493..9e4e0a2 100644
--- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
@@ -18,16 +18,16 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util
-#ctsdeviceutil
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-test \
+ compatibility-device-util \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
../ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
-LOCAL_JAVA_RESOURCE_DIRS := $(LOCAL_PATH)/res
-
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsWriteExternalStorageApp
diff --git a/hostsidetests/appsecurity/test-apps/keysets/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/Android.mk
index 7f116be..5b5fbed 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Build the test APKs using their own makefiles
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
index 30384d0..9de77f5 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
index da45804..5b75c49 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
index eea2e11..41415e9 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
index cefe00f..c4bc3a3 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
@@ -24,7 +24,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -38,6 +38,6 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
index f031e4b..78b00b3 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
@@ -25,7 +25,7 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -40,6 +40,6 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
index d1eeffa..51d8716 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
@@ -17,12 +17,12 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
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_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_PACKAGE_NAME := CtsKeySetTestApp
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
index 22c45a7..de64186 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
@@ -23,7 +23,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -36,7 +36,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -49,7 +49,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-ec-a
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -63,6 +63,6 @@
LOCAL_ADDITIONAL_CERTIFICATES := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
index 340e8c7..d60df9d 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
index 6389bf6..54ecb57 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
index 1e888ae..e953f17 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
@@ -25,7 +25,7 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -40,7 +40,7 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -56,6 +56,6 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
index 87a7ff8..a774832 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
@@ -25,7 +25,7 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
@@ -40,6 +40,6 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
index 42f700e..683d533 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
index 69d27ed..afb0590 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/tinyapp/Android.mk b/hostsidetests/appsecurity/test-apps/tinyapp/Android.mk
index 15981f6..adfce12 100644
--- a/hostsidetests/appsecurity/test-apps/tinyapp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/tinyapp/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE_TAGS := tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/atrace/Android.mk b/hostsidetests/atrace/Android.mk
index c4a0913..908176c 100644
--- a/hostsidetests/atrace/Android.mk
+++ b/hostsidetests/atrace/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.host.atrace
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/atrace/AtraceTestApp/Android.mk b/hostsidetests/atrace/AtraceTestApp/Android.mk
index 9218e56..e99d4d1 100644
--- a/hostsidetests/atrace/AtraceTestApp/Android.mk
+++ b/hostsidetests/atrace/AtraceTestApp/Android.mk
@@ -31,6 +31,6 @@
#LOCAL_DEX_PREOPT := false
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/bootstats/Android.mk b/hostsidetests/bootstats/Android.mk
index 24e2f8b..0849f82 100644
--- a/hostsidetests/bootstats/Android.mk
+++ b/hostsidetests/bootstats/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.bootstats
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/compilation/Android.mk b/hostsidetests/compilation/Android.mk
index 723e5c3..88339b9 100644
--- a/hostsidetests/compilation/Android.mk
+++ b/hostsidetests/compilation/Android.mk
@@ -23,7 +23,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsCompilationTestCases
diff --git a/hostsidetests/compilation/app/Android.mk b/hostsidetests/compilation/app/Android.mk
index 5bcf108..d2f38db 100644
--- a/hostsidetests/compilation/app/Android.mk
+++ b/hostsidetests/compilation/app/Android.mk
@@ -26,6 +26,6 @@
LOCAL_PACKAGE_NAME := CtsCompilationApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/content/Android.mk b/hostsidetests/content/Android.mk
index 342c8f5..62708f0 100644
--- a/hostsidetests/content/Android.mk
+++ b/hostsidetests/content/Android.mk
@@ -25,7 +25,7 @@
LOCAL_CTS_TEST_PACKAGE := android.content
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/content/test-apps/CtsSyncAccountAccessOtherCertTests/Android.mk b/hostsidetests/content/test-apps/CtsSyncAccountAccessOtherCertTests/Android.mk
index 8786bd5..67d049b 100644
--- a/hostsidetests/content/test-apps/CtsSyncAccountAccessOtherCertTests/Android.mk
+++ b/hostsidetests/content/test-apps/CtsSyncAccountAccessOtherCertTests/Android.mk
@@ -35,7 +35,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/hostsidetests/content/test-apps/CtsSyncAccountAccessSameCertTests/Android.mk b/hostsidetests/content/test-apps/CtsSyncAccountAccessSameCertTests/Android.mk
index c3c7058..7291fcd 100644
--- a/hostsidetests/content/test-apps/CtsSyncAccountAccessSameCertTests/Android.mk
+++ b/hostsidetests/content/test-apps/CtsSyncAccountAccessSameCertTests/Android.mk
@@ -30,7 +30,7 @@
LOCAL_PACKAGE_NAME := CtsSyncAccountAccessSameCertTestCases
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/hostsidetests/content/test-apps/SyncAccountAccessStubs/Android.mk b/hostsidetests/content/test-apps/SyncAccountAccessStubs/Android.mk
index 4c817d9..fc7cd4d 100644
--- a/hostsidetests/content/test-apps/SyncAccountAccessStubs/Android.mk
+++ b/hostsidetests/content/test-apps/SyncAccountAccessStubs/Android.mk
@@ -24,7 +24,7 @@
LOCAL_PACKAGE_NAME := CtsSyncAccountAccessStubs
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/hostsidetests/cpptools/Android.mk b/hostsidetests/cpptools/Android.mk
index 67acb25..97329cc 100644
--- a/hostsidetests/cpptools/Android.mk
+++ b/hostsidetests/cpptools/Android.mk
@@ -28,7 +28,7 @@
LOCAL_CTS_TEST_PACKAGE := android.tests.cpptools
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/cpptools/AndroidTest.xml b/hostsidetests/cpptools/AndroidTest.xml
index da96259..1f8c360 100644
--- a/hostsidetests/cpptools/AndroidTest.xml
+++ b/hostsidetests/cpptools/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CPP host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsCppToolsApp.apk" />
</target_preparer>
diff --git a/hostsidetests/cpptools/app/Android.mk b/hostsidetests/cpptools/app/Android.mk
index 4e4e51f..347412a 100644
--- a/hostsidetests/cpptools/app/Android.mk
+++ b/hostsidetests/cpptools/app/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsCppToolsApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/Android.mk b/hostsidetests/devicepolicy/Android.mk
index 1828e2c..1de6b93 100644
--- a/hostsidetests/devicepolicy/Android.mk
+++ b/hostsidetests/devicepolicy/Android.mk
@@ -27,7 +27,7 @@
LOCAL_CTS_TEST_PACKAGE := android.adminhostside
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
index 6454e46..c9bd048 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccountCheckAuthApp
@@ -27,7 +27,12 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ ctstestrunner \
+ ub-uiautomator \
+ android-support-test \
+ legacy-android-test
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
index 26e6dca..7423d13 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccountCheckNonTestOnlyOwnerApp
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
index eeba939..7a8c0b7 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccountCheckTestOnlyOwnerApp
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
index a86a98b..57f011e 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccountCheckTestOnlyOwnerUpdateApp
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
index 8036348..752ae96 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccountCheckAuthAppTester
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk b/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
index 6e70b01..cd3aa98 100644
--- a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccountManagementDevicePolicyApp
@@ -27,7 +27,12 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ ctstestrunner \
+ ub-uiautomator \
+ android-support-test \
+ legacy-android-test
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.mk b/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.mk
index 9d785c5..946a763 100644
--- a/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.mk
@@ -27,6 +27,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AutofillApp/Android.mk b/hostsidetests/devicepolicy/app/AutofillApp/Android.mk
index aa9cfa1..940c4a8 100644
--- a/hostsidetests/devicepolicy/app/AutofillApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/AutofillApp/Android.mk
@@ -25,13 +25,13 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDevicePolicyAutofillApp
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/CertInstaller/Android.mk b/hostsidetests/devicepolicy/app/CertInstaller/Android.mk
index 90c1657..fa84415 100644
--- a/hostsidetests/devicepolicy/app/CertInstaller/Android.mk
+++ b/hostsidetests/devicepolicy/app/CertInstaller/Android.mk
@@ -29,6 +29,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.mk b/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.mk
index ef72d61..06c1f87 100644
--- a/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.mk
+++ b/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.mk
@@ -25,13 +25,13 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsContactDirectoryProvider
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
index c24858d..05db43a 100644
--- a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
+++ b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
@@ -39,7 +39,7 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
@@ -64,7 +64,7 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package com.android.cts.comp2 \
--rename-instrumentation-target-package com.android.cts.comp2
diff --git a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk b/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
index e33baab..cb54cd7 100644
--- a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
@@ -16,7 +16,7 @@
include $(CLEAR_VARS)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsCustomizationApp
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk b/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
index 1ff51b9..fc316e6 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
@@ -26,11 +26,15 @@
LOCAL_JAVA_LIBRARIES := android.test.runner cts-junit
-LOCAL_STATIC_JAVA_LIBRARIES = android-support-v4 ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES = \
+ android-support-v4 \
+ ctstestrunner \
+ android-support-test \
+ legacy-android-test
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/AppRestrictionsDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/AppRestrictionsDelegateTest.java
index ab37090..55fc792 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/AppRestrictionsDelegateTest.java
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/AppRestrictionsDelegateTest.java
@@ -16,6 +16,7 @@
package com.android.cts.delegate;
import static android.app.admin.DevicePolicyManager.DELEGATION_APP_RESTRICTIONS;
+import static com.android.cts.delegate.DelegateTestUtils.assertExpectException;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
@@ -86,22 +87,16 @@
public void testCannotAccessApis() {
assertFalse("DelegateApp should not be an app restrictions delegate",
amIAppRestrictionsDelegate());
- try {
- mDpm.setApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG, null);
- fail("Expected SecurityException not thrown");
- } catch (SecurityException expected) {
- MoreAsserts.assertContainsRegex(
- "Caller with uid \\d+ is not a delegate of scope delegation-app-restrictions.",
- expected.getMessage());
- }
- try {
- mDpm.getApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG);
- fail("Expected SecurityException not thrown");
- } catch (SecurityException expected) {
- MoreAsserts.assertContainsRegex(
- "Caller with uid \\d+ is not a delegate of scope delegation-app-restrictions.",
- expected.getMessage());
- }
+
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.setApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG, null);
+ });
+
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.getApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG);
+ });
}
public void testCanAccessApis() throws InterruptedException {
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BlockUninstallDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BlockUninstallDelegateTest.java
index 65ebd64..f706b85 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BlockUninstallDelegateTest.java
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BlockUninstallDelegateTest.java
@@ -16,6 +16,7 @@
package com.android.cts.delegate;
import static android.app.admin.DevicePolicyManager.DELEGATION_BLOCK_UNINSTALL;
+import static com.android.cts.delegate.DelegateTestUtils.assertExpectException;
import android.app.admin.DevicePolicyManager;
import android.content.Context;
@@ -45,14 +46,11 @@
public void testCannotAccessApis() {
assertFalse("DelegateApp should not be a block uninstall delegate",
amIBlockUninstallDelegate());
- try {
- mDpm.setUninstallBlocked(null, TEST_APP_PKG, true);
- fail("Expected SecurityException not thrown");
- } catch (SecurityException expected) {
- MoreAsserts.assertContainsRegex(
- "Caller with uid \\d+ is not a delegate of scope delegation-block-uninstall.",
- expected.getMessage());
- }
+
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.setUninstallBlocked(null, TEST_APP_PKG, true);
+ });
}
public void testCanAccessApis() {
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java
index d8d0ab3..933e257 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java
@@ -16,6 +16,7 @@
package com.android.cts.delegate;
import static android.app.admin.DevicePolicyManager.DELEGATION_CERT_INSTALL;
+import static com.android.cts.delegate.DelegateTestUtils.assertExpectException;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
@@ -121,23 +122,16 @@
public void testCannotAccessApis() {
assertFalse(amICertInstallDelegate());
- try {
- mDpm.installCaCert(null, null);
- fail("Expected SecurityException not thrown");
- } catch (SecurityException expected) {
- MoreAsserts.assertContainsRegex(
- "Neither user \\d+ nor current process has "
- + "android.permission.MANAGE_CA_CERTIFICATES",
- expected.getMessage());
- }
- try {
- mDpm.removeKeyPair(null, "alias");
- fail("Expected SecurityException not thrown");
- } catch (SecurityException expected) {
- MoreAsserts.assertContainsRegex(
- "Caller with uid \\d+ is not a delegate of scope delegation-cert-install.",
- expected.getMessage());
- }
+
+ assertExpectException(SecurityException.class,
+ "Neither user \\d+ nor current process has", () -> {
+ mDpm.installCaCert(null, null);
+ });
+
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.removeKeyPair(null, "alias");
+ });
}
public void testCanAccessApis() throws Exception {
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/DelegateTestUtils.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/DelegateTestUtils.java
new file mode 100644
index 0000000..b162f86
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/DelegateTestUtils.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+package com.android.cts.delegate;
+
+import android.test.MoreAsserts;
+import junit.framework.Assert;
+
+/**
+ * Utils class for delegation tests.
+ */
+public class DelegateTestUtils {
+
+ @FunctionalInterface
+ public interface ExceptionRunnable {
+ void run() throws Exception;
+ }
+
+ public static void assertExpectException(Class<? extends Throwable> expectedExceptionType,
+ String expectedExceptionMessageRegex, ExceptionRunnable r) {
+ try {
+ r.run();
+ } catch (Throwable e) {
+ Assert.assertTrue("Expected " + expectedExceptionType.getName() + " but caught " + e,
+ expectedExceptionType.isAssignableFrom(e.getClass()));
+ if (expectedExceptionMessageRegex != null) {
+ MoreAsserts.assertContainsRegex(expectedExceptionMessageRegex, e.getMessage());
+ }
+ return; // Pass
+ }
+ Assert.fail("Expected " + expectedExceptionType.getName() + " was not thrown");
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/EnableSystemAppDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/EnableSystemAppDelegateTest.java
new file mode 100644
index 0000000..246f936
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/EnableSystemAppDelegateTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+package com.android.cts.delegate;
+
+import static android.app.admin.DevicePolicyManager.DELEGATION_ENABLE_SYSTEM_APP;
+import static android.content.pm.PackageManager.GET_META_DATA;
+import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
+import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
+import static com.android.cts.delegate.DelegateTestUtils.assertExpectException;
+
+import android.app.admin.DevicePolicyManager;
+import android.content.Intent;
+import android.test.InstrumentationTestCase;
+
+import java.util.List;
+
+/**
+ * Test that an app given the {@link DevicePolicyManager#DELEGATION_PERMISSION_GRANT} scope via
+ * {@link DevicePolicyManager#setDelegatedScopes} can grant permissions and check permission grant
+ * state.
+ */
+public class EnableSystemAppDelegateTest extends InstrumentationTestCase {
+
+ private static final String TEST_APP_PKG = "com.android.cts.launcherapps.simpleapp";
+
+ private DevicePolicyManager mDpm;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ mDpm = getInstrumentation().getContext().getSystemService(DevicePolicyManager.class);
+ }
+
+ public void testCannotAccessApis() {
+ assertFalse("DelegateApp should not be an enable system app delegate",
+ amIEnableSystemAppDelegate());
+
+ // Exercise enableSystemApp(String).
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.enableSystemApp(null, TEST_APP_PKG);
+ });
+
+ // Exercise enableSystemApp(Intent).
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.enableSystemApp(null, new Intent().setPackage(TEST_APP_PKG));
+ });
+ }
+
+ public void testCanAccessApis() {
+ assertTrue("DelegateApp is not an enable system app delegate",
+ amIEnableSystemAppDelegate());
+
+ // Exercise enableSystemApp(String).
+ assertExpectException(IllegalArgumentException.class,
+ "Only system apps can be enabled this way", () -> {
+ mDpm.enableSystemApp(null, TEST_APP_PKG);
+ });
+
+ // Exercise enableSystemApp(Intent).
+ mDpm.enableSystemApp(null, new Intent());
+ }
+
+ private boolean amIEnableSystemAppDelegate() {
+ final String packageName = getInstrumentation().getContext().getPackageName();
+ final List<String> scopes = mDpm.getDelegatedScopes(null, packageName);
+ return scopes.contains(DELEGATION_ENABLE_SYSTEM_APP);
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java
index 24bee4f..c403ffb 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java
@@ -18,6 +18,8 @@
import static android.app.admin.DevicePolicyManager.DELEGATION_APP_RESTRICTIONS;
import static android.app.admin.DevicePolicyManager.DELEGATION_BLOCK_UNINSTALL;
import static android.app.admin.DevicePolicyManager.DELEGATION_CERT_INSTALL;
+import static android.app.admin.DevicePolicyManager.DELEGATION_PERMISSION_GRANT;
+import static android.app.admin.DevicePolicyManager.DELEGATION_PACKAGE_ACCESS;
import static android.app.admin.DevicePolicyManager.DELEGATION_ENABLE_SYSTEM_APP;
import android.app.admin.DevicePolicyManager;
@@ -47,7 +49,10 @@
private static final String EXPECTED_DELEGATION_SCOPES[] = {
DELEGATION_APP_RESTRICTIONS,
DELEGATION_BLOCK_UNINSTALL,
- DELEGATION_CERT_INSTALL
+ DELEGATION_CERT_INSTALL,
+ DELEGATION_PERMISSION_GRANT,
+ DELEGATION_PACKAGE_ACCESS,
+ DELEGATION_ENABLE_SYSTEM_APP
};
@Override
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/PackageAccessDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/PackageAccessDelegateTest.java
new file mode 100644
index 0000000..86f2639
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/PackageAccessDelegateTest.java
@@ -0,0 +1,103 @@
+/*
+ * 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.
+ */
+package com.android.cts.delegate;
+
+import static android.app.admin.DevicePolicyManager.DELEGATION_PACKAGE_ACCESS;
+import static com.android.cts.delegate.DelegateTestUtils.assertExpectException;
+
+import android.app.admin.DevicePolicyManager;
+import android.content.Context;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.test.InstrumentationTestCase;
+import android.test.MoreAsserts;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Test that an app given the {@link DevicePolicyManager#DELEGATION_PACKAGE_ACCESS} scope via
+ * {@link DevicePolicyManager#setDelegatedScopes} can manage package hide and suspend status.
+ */
+public class PackageAccessDelegateTest extends InstrumentationTestCase {
+
+ private static final String TEST_APP_PKG = "com.android.cts.launcherapps.simpleapp";
+
+ private DevicePolicyManager mDpm;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Context context = getInstrumentation().getContext();
+ mDpm = context.getSystemService(DevicePolicyManager.class);
+ }
+
+ public void testCannotAccessApis() throws NameNotFoundException {
+ assertFalse("DelegateApp should not be a package access delegate",
+ amIPackageAccessDelegate());
+
+ // Exercise isApplicationHidden.
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.isApplicationHidden(null, TEST_APP_PKG);
+ });
+
+ // Exercise setApplicationHidden.
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.setApplicationHidden(null, TEST_APP_PKG, true /* hide */);
+ });
+
+ // Exercise isPackageSuspended.
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.isPackageSuspended(null, TEST_APP_PKG);
+ });
+
+ // Exercise setPackagesSuspended.
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.setPackagesSuspended(null, new String[] {TEST_APP_PKG}, true /* suspend */);
+ });
+ }
+
+ public void testCanAccessApis() throws NameNotFoundException {
+ assertTrue("DelegateApp is not a package access delegate", amIPackageAccessDelegate());
+
+ // Exercise isApplicationHidden.
+ assertFalse("Package should not be hidden", mDpm.isApplicationHidden(null, TEST_APP_PKG));
+
+ // Exercise setApplicationHidden.
+ assertTrue("Package not hidden successfully",
+ mDpm.setApplicationHidden(null, TEST_APP_PKG, true /* hide */));
+ assertTrue("Package should be hidden", mDpm.isApplicationHidden(null, TEST_APP_PKG));
+
+ // Exercise isPackageSuspended.
+ assertFalse("Package should not be suspended", mDpm.isPackageSuspended(null, TEST_APP_PKG));
+
+ // Exercise setPackagesSuspended.
+ String[] suspended = mDpm.setPackagesSuspended(null, new String[] {TEST_APP_PKG},
+ true /* suspend */);
+ assertTrue("Package not suspended successfully", suspended.length == 0);
+ assertTrue("Package should be suspended", mDpm.isPackageSuspended(null, TEST_APP_PKG));
+ }
+
+ private boolean amIPackageAccessDelegate() {
+ final String packageName = getInstrumentation().getContext().getPackageName();
+ final List<String> scopes = mDpm.getDelegatedScopes(null, packageName);
+ return scopes.contains(DELEGATION_PACKAGE_ACCESS);
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/PermissionGrantDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/PermissionGrantDelegateTest.java
new file mode 100644
index 0000000..81b74a2
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/PermissionGrantDelegateTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+package com.android.cts.delegate;
+
+import static android.app.admin.DevicePolicyManager.DELEGATION_PERMISSION_GRANT;
+import static android.app.admin.DevicePolicyManager.PERMISSION_POLICY_AUTO_GRANT;
+import static android.app.admin.DevicePolicyManager.PERMISSION_POLICY_AUTO_DENY;
+import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED;
+import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_DENIED;
+import static com.android.cts.delegate.DelegateTestUtils.assertExpectException;
+
+import android.app.admin.DevicePolicyManager;
+import android.content.Context;
+import android.test.InstrumentationTestCase;
+import android.test.MoreAsserts;
+
+import java.util.List;
+
+/**
+ * Test that an app given the {@link DevicePolicyManager#DELEGATION_PERMISSION_GRANT} scope via
+ * {@link DevicePolicyManager#setDelegatedScopes} can grant permissions and check permission grant
+ * state.
+ */
+public class PermissionGrantDelegateTest extends InstrumentationTestCase {
+
+ private static final String TEST_APP_PKG = "com.android.cts.launcherapps.simpleapp";
+ private static final String TEST_PERMISSION = "android.permission.READ_CONTACTS";
+
+ private DevicePolicyManager mDpm;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Context context = getInstrumentation().getContext();
+ mDpm = context.getSystemService(DevicePolicyManager.class);
+ }
+
+ public void testCannotAccessApis() {
+ assertFalse("DelegateApp should not be a permisssion grant delegate",
+ amIPermissionGrantDelegate());
+
+ // Exercise setPermissionPolicy.
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.setPermissionPolicy(null, PERMISSION_POLICY_AUTO_GRANT);
+ });
+ assertFalse("Permission policy should not have been set",
+ PERMISSION_POLICY_AUTO_GRANT == mDpm.getPermissionPolicy(null));
+
+ // Exercise setPermissionGrantState.
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.setPermissionGrantState(null, TEST_APP_PKG, TEST_PERMISSION,
+ PERMISSION_GRANT_STATE_GRANTED);
+ });
+
+ // Exercise getPermissionGrantState.
+ assertExpectException(SecurityException.class,
+ "Caller with uid \\d+ is not a delegate of scope", () -> {
+ mDpm.getPermissionGrantState(null, TEST_APP_PKG, TEST_PERMISSION);
+ });
+ }
+
+ public void testCanAccessApis() {
+ assertTrue("DelegateApp is not a permission grant delegate",
+ amIPermissionGrantDelegate());
+
+ // Exercise setPermissionPolicy.
+ mDpm.setPermissionPolicy(null, PERMISSION_POLICY_AUTO_DENY);
+ assertTrue("Permission policy was not set",
+ PERMISSION_POLICY_AUTO_DENY == mDpm.getPermissionPolicy(null));
+
+ // Exercise setPermissionGrantState.
+ assertTrue("Permission grant state was not set successfully",
+ mDpm.setPermissionGrantState(null, TEST_APP_PKG, TEST_PERMISSION,
+ PERMISSION_GRANT_STATE_DENIED));
+
+ // Exercise getPermissionGrantState.
+ assertEquals("Permission grant state is not denied", PERMISSION_GRANT_STATE_DENIED,
+ mDpm.getPermissionGrantState(null, TEST_APP_PKG, TEST_PERMISSION));
+ }
+
+ private boolean amIPermissionGrantDelegate() {
+ final String packageName = getInstrumentation().getContext().getPackageName();
+ final List<String> scopes = mDpm.getDelegatedScopes(null, packageName);
+ return scopes.contains(DELEGATION_PERMISSION_GRANT);
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
index 46d9cc0..7d277d9 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
@@ -26,11 +26,14 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
+ compatibility-device-util \
+ legacy-android-test
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
index 9afaa7a..ab38265 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
@@ -26,11 +26,14 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
+ compatibility-device-util \
+ legacy-android-test
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
index ba45435..e874b8b 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
index 73e0e25..1e4b9c7 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
index 4be285b..6ee4acf 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
index d9a9f89..68dc546 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
index 8595a39..0207110 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
index 516e32e..f8467c1 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
@@ -33,6 +33,6 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
index 962c5f5..8a0d559 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
@@ -33,6 +33,6 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
index 1167a08..d3a78d2 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
@@ -33,6 +33,6 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk b/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
index 4e9abd7..a4cd12c 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
@@ -30,11 +30,12 @@
ctstestrunner \
compatibility-device-util \
android-support-v4 \
- android-support-test
+ android-support-test \
+ legacy-android-test
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk b/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
index 964c389..ce3c537 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
@@ -26,11 +26,14 @@
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ ctstestrunner \
+ legacy-android-test
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/IntentSender/Android.mk b/hostsidetests/devicepolicy/app/IntentSender/Android.mk
index b0abc23..0fc0564 100644
--- a/hostsidetests/devicepolicy/app/IntentSender/Android.mk
+++ b/hostsidetests/devicepolicy/app/IntentSender/Android.mk
@@ -26,11 +26,15 @@
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ ctstestrunner \
+ ub-uiautomator \
+ legacy-android-test
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/Android.mk b/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
index 19fd3bd..5bb5c80 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
+++ b/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
@@ -26,11 +26,15 @@
LOCAL_JAVA_LIBRARIES := android.test.runner cts-junit
-LOCAL_STATIC_JAVA_LIBRARIES = android-support-v4 ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES = \
+ android-support-v4 \
+ ctstestrunner \
+ android-support-test \
+ legacy-android-test
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.mk b/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.mk
index 9e86d13..95b3e27 100644
--- a/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.mk
+++ b/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.mk
@@ -29,6 +29,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
index ae6282f..ce366d9 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
@@ -26,12 +26,18 @@
LOCAL_JAVA_LIBRARIES := android.test.runner cts-junit
-LOCAL_STATIC_JAVA_LIBRARIES = android-support-v4 ctstestrunner compatibility-device-util \
- ub-uiautomator android-support-test guava
+LOCAL_STATIC_JAVA_LIBRARIES = \
+ android-support-v4 \
+ ctstestrunner \
+ compatibility-device-util \
+ ub-uiautomator \
+ android-support-test \
+ guava \
+ legacy-android-test
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
index b8a5eae6..2eaa44f 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
@@ -132,6 +132,15 @@
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
+
+ <service
+ android:name=".CrossProfileNotificationListenerService"
+ android:label="CrossProfileNotificationListenerService"
+ android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
+ <intent-filter>
+ <action android:name="android.service.notification.NotificationListenerService" />
+ </intent-filter>
+ </service>
</application>
<instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/CrossProfileNotificationListenerService.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/CrossProfileNotificationListenerService.java
new file mode 100644
index 0000000..9a17733
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/CrossProfileNotificationListenerService.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+package com.android.cts.managedprofile;
+
+import static com.android.cts.managedprofile.NotificationListenerTest.ACTION_NOTIFICATION_POSTED;
+import static com.android.cts.managedprofile.NotificationListenerTest.ACTION_NOTIFICATION_REMOVED;
+import static com.android.cts.managedprofile.NotificationListenerTest.ACTION_LISTENER_CONNECTED;
+
+import android.content.Intent;
+import android.service.notification.NotificationListenerService;
+import android.service.notification.StatusBarNotification;
+import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
+
+public class CrossProfileNotificationListenerService extends NotificationListenerService {
+
+ static final String NOTIFICATION_CHANNEL = "NotificationListenerTest";
+ private static final String TAG = NotificationListenerTest.TAG;
+
+ @Override
+ public void onNotificationPosted(StatusBarNotification sbn) {
+ Log.i(TAG, "onNotificationPosted(" + sbn + ")");
+ sendBroadcastForNotification(sbn, ACTION_NOTIFICATION_POSTED);
+ }
+
+ @Override
+ public void onNotificationRemoved(StatusBarNotification sbn) {
+ Log.i(TAG, "onNotificationRemoved(" + sbn + ")");
+ sendBroadcastForNotification(sbn, ACTION_NOTIFICATION_REMOVED);
+ }
+
+ @Override
+ public void onListenerConnected() {
+ Log.i(TAG, "onListenerConnected() " + android.os.Process.myPid());
+ LocalBroadcastManager.getInstance(this).sendBroadcast(
+ new Intent(ACTION_LISTENER_CONNECTED));
+ }
+
+ @Override
+ public void onListenerDisconnected() {
+ Log.i(TAG, "onListenerDisconnected()");
+ }
+
+ private void sendBroadcastForNotification(StatusBarNotification sbn, String action) {
+ if (NOTIFICATION_CHANNEL.equals(sbn.getNotification().getChannelId())) {
+ LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(action));
+ } else {
+ Log.i(TAG, "Notification is for different channel "
+ + sbn.getNotification().getChannelId());
+ }
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
new file mode 100644
index 0000000..d4cbae7
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
@@ -0,0 +1,252 @@
+/*
+ * 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.
+ */
+package com.android.cts.managedprofile;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.UiAutomation;
+import android.app.admin.DevicePolicyManager;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.uiautomator.UiDevice;
+import android.support.v4.content.LocalBroadcastManager;
+import android.util.Log;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@SmallTest
+public class NotificationListenerTest {
+
+ static final String TAG = "ListenerTest";
+ static final String ACTION_NOTIFICATION_POSTED = "notification_posted";
+ static final String ACTION_NOTIFICATION_REMOVED = "notification_removed";
+ static final String ACTION_LISTENER_CONNECTED = "listener_connected";
+
+ private static final String PARAM_PROFILE_ID = "profile-id";
+
+ static final String SENDER_COMPONENT =
+ "com.android.cts.managedprofiletests.notificationsender/.SendNotification";
+
+ private final LocalBroadcastReceiver mReceiver = new LocalBroadcastReceiver();
+ private Context mContext;
+ private DevicePolicyManager mDpm;
+ private NotificationManager mNotificationManager;
+ private UiDevice mDevice;
+ private int mProfileUserId;
+ private String mPreviousListeners;
+ private boolean mChangedListeners;
+
+ @Before
+ public void setUp() throws Exception {
+ mContext = InstrumentationRegistry.getTargetContext();
+ mDpm = mContext.getSystemService(DevicePolicyManager.class);
+ mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+ mProfileUserId = getParam(InstrumentationRegistry.getArguments(), PARAM_PROFILE_ID);
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(ACTION_NOTIFICATION_POSTED);
+ filter.addAction(ACTION_NOTIFICATION_REMOVED);
+ filter.addAction(ACTION_LISTENER_CONNECTED);
+ LocalBroadcastManager.getInstance(mContext).registerReceiver(mReceiver, filter);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ LocalBroadcastManager.getInstance(mContext).unregisterReceiver(mReceiver);
+ if (mChangedListeners) {
+ if (mPreviousListeners != null) {
+ mDevice.executeShellCommand(
+ "settings put secure enabled_notification_listeners "
+ + mPreviousListeners);
+ } else {
+ mDevice.executeShellCommand(
+ "settings delete secure enabled_notification_listeners");
+ }
+ }
+ }
+
+ @Test
+ public void testSetEmptyWhitelist() throws Exception {
+ mDpm.setPermittedCrossProfileNotificationListeners(
+ BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT,
+ Collections.<String>emptyList());
+ }
+
+ @Test
+ public void testAddListenerToWhitelist() throws Exception {
+ mDpm.setPermittedCrossProfileNotificationListeners(
+ BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT,
+ Collections.singletonList(mContext.getPackageName()));
+ }
+
+ @Test
+ public void testSetNullWhitelist() throws Exception {
+ mDpm.setPermittedCrossProfileNotificationListeners(
+ BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT, null);
+ }
+
+ @Test
+ public void testCanReceiveNotifications() throws Exception {
+ enableNotificationListener();
+
+ sendProfileNotification();
+ assertTrue(mReceiver.waitForNotificationPostedReceived());
+ cancelProfileNotification();
+ assertTrue(mReceiver.waitForNotificationRemovedReceived());
+
+ mReceiver.reset();
+
+ sendPersonalNotification();
+ assertTrue(mReceiver.waitForNotificationPostedReceived());
+ cancelPersonalNotification();
+ assertTrue(mReceiver.waitForNotificationRemovedReceived());
+ }
+
+ @Test
+ public void testCannotReceiveProfileNotifications() throws Exception {
+ enableNotificationListener();
+
+ sendProfileNotification();
+ // Don't see notification or cancellation from work profile.
+ assertFalse(mReceiver.waitForNotificationPostedReceived());
+ cancelProfileNotification();
+ assertFalse(mReceiver.waitForNotificationRemovedReceived());
+
+ mReceiver.reset();
+
+ // Do see the one from the personal side.
+ sendPersonalNotification();
+ assertTrue(mReceiver.waitForNotificationPostedReceived());
+ cancelPersonalNotification();
+ assertTrue(mReceiver.waitForNotificationRemovedReceived());
+ }
+
+ private void cancelProfileNotification() throws IOException {
+ mDevice.executeShellCommand(
+ "am start --user " + mProfileUserId + " -a CANCEL_NOTIFICATION -n "
+ + SENDER_COMPONENT);
+ }
+
+ private void cancelPersonalNotification() throws IOException {
+ mDevice.executeShellCommand(
+ "am start -a CANCEL_NOTIFICATION -n "
+ + SENDER_COMPONENT);
+ }
+
+ private void sendProfileNotification() throws IOException {
+ mDevice.executeShellCommand(
+ "am start --user " + mProfileUserId + " -a POST_NOTIFICATION -n "
+ + SENDER_COMPONENT);
+ }
+
+ private void sendPersonalNotification() throws IOException {
+ mDevice.executeShellCommand(
+ "am start -a POST_NOTIFICATION -n "
+ + SENDER_COMPONENT);
+ }
+
+ private void enableNotificationListener() throws Exception {
+ String listeners = mDevice.executeShellCommand(
+ "settings get secure enabled_notification_listeners").trim();
+ if (listeners.equals("null")) {
+ listeners = null;
+ }
+ String testListener = new ComponentName(
+ mContext, CrossProfileNotificationListenerService.class).flattenToString();
+
+ if (listeners == null || !listeners.contains(testListener)) {
+ mPreviousListeners = listeners;
+ mChangedListeners = true;
+ String newListeners;
+ if (listeners != null && listeners.length() > 0) {
+ newListeners = listeners + ":" + testListener;
+ } else {
+ newListeners = testListener;
+ }
+ mDevice.executeShellCommand(
+ "settings put secure enabled_notification_listeners "
+ + newListeners);
+ Log.i(TAG, "Enabled notification listener " + testListener);
+ assertTrue(mReceiver.waitForListenerConnected());
+ }
+ }
+
+ private int getParam(Bundle arguments, String key) throws Exception {
+ String serial = arguments.getString(key);
+ if (serial == null) {
+ throw new IllegalArgumentException("Missing argument " + key);
+ }
+ return Integer.parseInt(serial);
+ }
+
+ static class LocalBroadcastReceiver extends BroadcastReceiver {
+
+ private static final int TIMEOUT_SECONDS = 10;
+
+ private CountDownLatch mNotificationPostedLatch = new CountDownLatch(1);
+ private CountDownLatch mNotificationRemovedLatch = new CountDownLatch(1);
+ private CountDownLatch mListenerConnectedLatch = new CountDownLatch(1);
+
+ public void reset() {
+ mNotificationPostedLatch = new CountDownLatch(1);
+ mNotificationRemovedLatch = new CountDownLatch(1);
+ mListenerConnectedLatch = new CountDownLatch(1);
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.i(TAG, "onReceive(" + intent + ")");
+ if (ACTION_NOTIFICATION_POSTED.equals(intent.getAction())) {
+ mNotificationPostedLatch.countDown();
+ } else if (ACTION_NOTIFICATION_REMOVED.equals(intent.getAction())) {
+ mNotificationRemovedLatch.countDown();
+ } else if (ACTION_LISTENER_CONNECTED.equals(intent.getAction())) {
+ mListenerConnectedLatch.countDown();
+ } else {
+ Log.e(TAG, "Received broadcast for unknown action: " + intent.getAction());
+ }
+ }
+
+ public boolean waitForNotificationPostedReceived() throws InterruptedException {
+ return mNotificationPostedLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ }
+
+ public boolean waitForNotificationRemovedReceived() throws InterruptedException {
+ return mNotificationRemovedLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ }
+
+ public boolean waitForListenerConnected() throws InterruptedException {
+ return mListenerConnectedLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ }
+ }
+
+}
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
index d911812..23de823 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
@@ -21,13 +21,11 @@
import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME;
import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION;
import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION;
-import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.Manifest;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.admin.DeviceAdminReceiver;
@@ -135,7 +133,7 @@
am.getAccountsByType(AccountAuthenticator.ACCOUNT_TYPE).length == 0);
}
- public Intent createBaseProvisioningIntent() {
+ private Intent createBaseProvisioningIntent() {
return new Intent(ACTION_PROVISION_MANAGED_PROFILE)
.putExtra(EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME, ADMIN_RECEIVER_COMPONENT)
.putExtra(EXTRA_PROVISIONING_SKIP_ENCRYPTION, true)
diff --git a/hostsidetests/devicepolicy/app/NotificationSender/Android.mk b/hostsidetests/devicepolicy/app/NotificationSender/Android.mk
new file mode 100644
index 0000000..8b85e66
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NotificationSender/Android.mk
@@ -0,0 +1,37 @@
+# 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)
+
+# Don't include this package in any target.
+LOCAL_MODULE_TAGS := optional
+
+# When built, explicitly put it in the data partition.
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
+
+LOCAL_PACKAGE_NAME := CtsNotificationSenderApp
+
+LOCAL_SDK_VERSION := current
+
+# tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/NotificationSender/AndroidManifest.xml b/hostsidetests/devicepolicy/app/NotificationSender/AndroidManifest.xml
new file mode 100644
index 0000000..0f5ac6d
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NotificationSender/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.managedprofiletests.notificationsender">
+
+ <application>
+ <activity android:name=".SendNotification"
+ android:exported="true">
+ </activity>
+ </application>
+</manifest>
+
diff --git a/hostsidetests/devicepolicy/app/NotificationSender/res/raw/ic_contact_picture.png b/hostsidetests/devicepolicy/app/NotificationSender/res/raw/ic_contact_picture.png
new file mode 100644
index 0000000..37b558b
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NotificationSender/res/raw/ic_contact_picture.png
Binary files differ
diff --git a/hostsidetests/devicepolicy/app/NotificationSender/src/com/android/cts/managedprofiletests/notificationsender/SendNotification.java b/hostsidetests/devicepolicy/app/NotificationSender/src/com/android/cts/managedprofiletests/notificationsender/SendNotification.java
new file mode 100644
index 0000000..80c4073
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NotificationSender/src/com/android/cts/managedprofiletests/notificationsender/SendNotification.java
@@ -0,0 +1,73 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.managedprofiletests.notificationsender;
+
+import android.app.Activity;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.util.Log;
+
+import java.lang.Override;
+
+/**
+ * A simple activity to post notifications to test notification
+ * listener whitelists.
+ */
+public class SendNotification extends Activity {
+
+ private static final String TAG = "ListenerTest";
+
+ static final int NOTIFICATION_ID = 98765;
+ static final String NOTIFICATION_CHANNEL = "NotificationListenerTest";
+
+ @Override
+ public void onCreate(Bundle icicle) {
+ super.onCreate(icicle);
+ Intent intent = getIntent();
+ if (intent != null && "POST_NOTIFICATION".equals(intent.getAction())) {
+ Log.i(TAG, "posting from " + android.os.Process.myUserHandle());
+ sendNotification();
+ } else if (intent != null && "CANCEL_NOTIFICATION".equals(intent.getAction())) {
+ Log.i(TAG, "cancelling from " + android.os.Process.myUserHandle());
+ cancelNotification();
+ }
+ finish();
+ }
+
+ private void sendNotification() {
+ NotificationManager notificationManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ notificationManager.createNotificationChannel(new NotificationChannel(
+ NOTIFICATION_CHANNEL, "Test channel", NotificationManager.IMPORTANCE_DEFAULT));
+ notificationManager.notify(NOTIFICATION_ID,
+ new Notification.Builder(getApplicationContext(), NOTIFICATION_CHANNEL)
+ .setSmallIcon(R.raw.ic_contact_picture)
+ .setContentTitle("Test title")
+ .build());
+ }
+
+ private void cancelNotification() {
+ NotificationManager notificationManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ notificationManager.cancel(NOTIFICATION_ID);
+ notificationManager.deleteNotificationChannel(NOTIFICATION_CHANNEL);
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk b/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
index 3c0a2a1..5cf5e66 100644
--- a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
+++ b/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
@@ -26,11 +26,15 @@
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4 ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-v4 \
+ ctstestrunner \
+ ub-uiautomator \
+ legacy-android-test
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk b/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
index 6f9ef5d..135b4cf 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
@@ -26,11 +26,15 @@
LOCAL_JAVA_LIBRARIES := android.test.runner conscrypt cts-junit
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
+ compatibility-device-util \
+ ub-uiautomator \
+ legacy-android-test
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SimpleApp/Android.mk b/hostsidetests/devicepolicy/app/SimpleApp/Android.mk
index f755018..46b6292 100644
--- a/hostsidetests/devicepolicy/app/SimpleApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/SimpleApp/Android.mk
@@ -25,13 +25,13 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsSimpleApp
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk b/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk
index 0b7c625..649c3ab 100644
--- a/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := 21
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
new file mode 100644
index 0000000..6b2609b
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
@@ -0,0 +1,42 @@
+# 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_PACKAGE_NAME := CtsDevicePolicySingleAdminTestApp
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner cts-junit
+
+LOCAL_STATIC_JAVA_LIBRARIES = \
+ android-support-v4 \
+ ctstestrunner \
+ compatibility-device-util \
+ ub-uiautomator \
+ android-support-test \
+ legacy-android-test
+
+LOCAL_SDK_VERSION := test_current
+
+# tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
new file mode 100644
index 0000000..6ae1eb4
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.devicepolicy.singleadmin">
+
+ <application
+ android:testOnly="true">
+
+ <uses-library android:name="android.test.runner" />
+
+ <receiver
+ android:name="com.android.cts.devicepolicy.singleadmin.ProvisioningSingleAdminTest$AdminReceiver"
+ android:permission="android.permission.BIND_DEVICE_ADMIN">
+ <meta-data android:name="android.app.device_admin"
+ android:resource="@xml/device_admin" />
+ <intent-filter>
+ <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
+ </intent-filter>
+ </receiver>
+
+ <activity android:name="com.android.compatibility.common.util.devicepolicy.provisioning.StartProvisioningActivity"/>
+
+ </application>
+
+ <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.cts.devicepolicy.singleadmin"
+ android:label="Managed Profile CTS Tests (Single admin receiver)"/>
+</manifest>
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/res/xml/device_admin.xml b/hostsidetests/devicepolicy/app/SingleAdminApp/res/xml/device_admin.xml
new file mode 100644
index 0000000..0f434d2
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/res/xml/device_admin.xml
@@ -0,0 +1,19 @@
+<!-- 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.
+-->
+<device-admin xmlns:android="http://schemas.android.com/apk/res/android" android:visible="false">
+ <uses-policies>
+ <force-lock />
+ </uses-policies>
+</device-admin>
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java b/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
new file mode 100644
index 0000000..2828b3d
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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
+ */
+package com.android.cts.devicepolicy.singleadmin;
+
+import static android.app.admin.DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE;
+import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME;
+import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION;
+
+import static org.junit.Assert.assertTrue;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+
+import com.android.compatibility.common.util.devicepolicy.provisioning.SilentProvisioningTestManager;
+
+import org.junit.Before;
+import org.junit.Test;
+
+@SmallTest
+public class ProvisioningSingleAdminTest {
+
+ private static final String ADMIN_RECEIVER_PACKAGE = AdminReceiver.class.getPackage().getName();
+ private static final String ADMIN_RECEIVER_NAME = AdminReceiver.class.getName();
+
+ private static final ComponentName ADMIN_RECEIVER_COMPONENT = new ComponentName(
+ ADMIN_RECEIVER_PACKAGE, ADMIN_RECEIVER_NAME);
+
+ private Context mContext;
+
+ public static class AdminReceiver extends DeviceAdminReceiver {
+ @Override
+ public void onProfileProvisioningComplete(Context context, Intent intent) {
+ super.onProfileProvisioningComplete(context, intent);
+ getManager(context).setProfileName(ADMIN_RECEIVER_COMPONENT, "Managed Profile");
+ getManager(context).setProfileEnabled(ADMIN_RECEIVER_COMPONENT);
+ }
+ }
+
+ @Before
+ public void setUp() {
+ mContext = InstrumentationRegistry.getTargetContext();
+ }
+
+ @Test
+ public void testManagedProfileProvisioning() throws InterruptedException {
+ assertProvisioningSucceeds(createProvisioningIntent());
+ }
+
+ private Intent createProvisioningIntent() {
+ return new Intent(ACTION_PROVISION_MANAGED_PROFILE)
+ .putExtra(EXTRA_PROVISIONING_SKIP_ENCRYPTION, true)
+ .putExtra(EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME, ADMIN_RECEIVER_PACKAGE);
+ }
+
+ private void assertProvisioningSucceeds(Intent intent) throws InterruptedException {
+ SilentProvisioningTestManager provisioningMgr = new SilentProvisioningTestManager(mContext);
+ assertTrue(provisioningMgr.startProvisioningAndWait(intent));
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/VpnApp/Android.mk b/hostsidetests/devicepolicy/app/VpnApp/Android.mk
index 8963230..9723b97 100644
--- a/hostsidetests/devicepolicy/app/VpnApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/VpnApp/Android.mk
@@ -29,6 +29,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk b/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk
index 5e5db1e..ac967a3 100644
--- a/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk
+++ b/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk
@@ -27,6 +27,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
index 699b476..8992f42 100644
--- a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
+++ b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
index 865d785..e4b282a 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
@@ -67,6 +67,9 @@
private static final String DELEGATION_CERT_INSTALL = "delegation-cert-install";
private static final String DELEGATION_APP_RESTRICTIONS = "delegation-app-restrictions";
private static final String DELEGATION_BLOCK_UNINSTALL = "delegation-block-uninstall";
+ private static final String DELEGATION_PERMISSION_GRANT = "delegation-permission-grant";
+ private static final String DELEGATION_PACKAGE_ACCESS = "delegation-package-access";
+ private static final String DELEGATION_ENABLE_SYSTEM_APP = "delegation-enable-system-app";
private static final String TEST_APP_APK = "CtsSimpleApp.apk";
private static final String TEST_APP_PKG = "com.android.cts.launcherapps.simpleapp";
@@ -189,7 +192,10 @@
final String delegationTests[] = {
".AppRestrictionsDelegateTest",
".CertInstallDelegateTest",
- ".BlockUninstallDelegateTest"
+ ".BlockUninstallDelegateTest",
+ ".PermissionGrantDelegateTest",
+ ".PackageAccessDelegateTest",
+ ".EnableSystemAppDelegateTest"
};
// Set a device lockscreen password (precondition for installing private key pairs).
@@ -208,7 +214,10 @@
setDelegatedScopes(DELEGATE_APP_PKG, Arrays.asList(
DELEGATION_APP_RESTRICTIONS,
DELEGATION_CERT_INSTALL,
- DELEGATION_BLOCK_UNINSTALL));
+ DELEGATION_BLOCK_UNINSTALL,
+ DELEGATION_PERMISSION_GRANT,
+ DELEGATION_PACKAGE_ACCESS,
+ DELEGATION_ENABLE_SYSTEM_APP));
runDeviceTestsAsUser(DELEGATE_APP_PKG, ".GeneralDelegateTest", mUserId);
executeDelegationTests(delegationTests, true /* positive result */);
@@ -220,7 +229,7 @@
executeDeviceTestClass(".DelegationTest");
} finally {
- // Clear lockscreen password previously set for installing private key pairs (DO only).
+ // Clear lockscreen password previously set for installing private key pairs.
changeUserCredential(null, "1234", mPrimaryUserId);
// Remove any remaining delegations.
setDelegatedScopes(DELEGATE_APP_PKG, null);
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileProvisioningSingleAdminTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileProvisioningSingleAdminTest.java
new file mode 100644
index 0000000..ef7099b
--- /dev/null
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileProvisioningSingleAdminTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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
+ */
+package com.android.cts.devicepolicy;
+
+import org.junit.Test;
+
+/**
+ * This class tests the provisioning flow with an APK that declares a single receiver with
+ * BIND_DEVICE_ADMIN permissions, which was a requirement for the app sending the
+ * ACTION_PROVISION_MANAGED_PROFILE intent before Android M.
+ */
+public class ManagedProfileProvisioningSingleAdminTest extends BaseDevicePolicyTest {
+
+ private static final String SINGLE_ADMIN_PKG = "com.android.cts.devicepolicy.singleadmin";
+ private static final String SINGLE_ADMIN_APP_APK = "CtsDevicePolicySingleAdminTestApp.apk";
+
+ private int mProfileUserId;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ // We need multi user to be supported in order to create a profile of the user owner.
+ mHasFeature = mHasFeature && hasDeviceFeature("android.software.managed_users");
+
+ if (mHasFeature) {
+ removeTestUsers();
+ installAppAsUser(SINGLE_ADMIN_APP_APK, mPrimaryUserId);
+ mProfileUserId = 0;
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (mHasFeature) {
+ if (mProfileUserId != 0) {
+ removeUser(mProfileUserId);
+ }
+ getDevice().uninstallPackage(SINGLE_ADMIN_PKG);
+ }
+ super.tearDown();
+ }
+
+ @Test
+ public void testEXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+
+ runDeviceTestsAsUser(SINGLE_ADMIN_PKG, ".ProvisioningSingleAdminTest",
+ "testManagedProfileProvisioning", mPrimaryUserId);
+
+ mProfileUserId = getFirstManagedProfileUserId();
+ }
+}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
index 26da677..1b501ac 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
@@ -22,6 +22,7 @@
import junit.framework.AssertionFailedError;
+import java.util.Collections;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
@@ -61,6 +62,12 @@
= "content://com.android.cts.contact.directory.provider/";
private static final String SET_CUSTOM_DIRECTORY_PREFIX_METHOD = "set_prefix";
+ private static final String NOTIFICATION_APK = "CtsNotificationSenderApp.apk";
+ private static final String NOTIFICATION_PKG =
+ "com.android.cts.managedprofiletests.notificationsender";
+ private static final String NOTIFICATION_ACTIVITY =
+ NOTIFICATION_PKG + ".SendNotification";
+
private static final String ADMIN_RECEIVER_TEST_CLASS =
MANAGED_PROFILE_PKG + ".BaseManagedProfileTest$BasicAdminReceiver";
@@ -75,6 +82,8 @@
private static final long TIMEOUT_USER_LOCKED_MILLIS = TimeUnit.SECONDS.toMillis(15);
+ private static final String PARAM_PROFILE_ID = "profile-id";
+
private int mParentUserId;
// ID of the profile we'll create. This will always be a profile of the parent.
@@ -112,6 +121,7 @@
getDevice().uninstallPackage(MANAGED_PROFILE_PKG);
getDevice().uninstallPackage(INTENT_SENDER_PKG);
getDevice().uninstallPackage(INTENT_RECEIVER_PKG);
+ getDevice().uninstallPackage(NOTIFICATION_PKG);
}
super.tearDown();
}
@@ -353,6 +363,60 @@
}
+ public void testCrossProfileNotificationListeners_EmptyWhitelist() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+
+ installAppAsUser(NOTIFICATION_APK, mProfileUserId);
+ installAppAsUser(NOTIFICATION_APK, mParentUserId);
+
+ // Profile owner in the profile sets an empty whitelist
+ runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".NotificationListenerTest",
+ "testSetEmptyWhitelist", mProfileUserId,
+ Collections.singletonMap(PARAM_PROFILE_ID, Integer.toString(mProfileUserId)));
+ // Listener outside the profile can only see personal notifications.
+ runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".NotificationListenerTest",
+ "testCannotReceiveProfileNotifications", mParentUserId,
+ Collections.singletonMap(PARAM_PROFILE_ID, Integer.toString(mProfileUserId)));
+ }
+
+ public void testCrossProfileNotificationListeners_NullWhitelist() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+
+ installAppAsUser(NOTIFICATION_APK, mProfileUserId);
+ installAppAsUser(NOTIFICATION_APK, mParentUserId);
+
+ // Profile owner in the profile sets a null whitelist
+ runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".NotificationListenerTest",
+ "testSetNullWhitelist", mProfileUserId,
+ Collections.singletonMap(PARAM_PROFILE_ID, Integer.toString(mProfileUserId)));
+ // Listener outside the profile can see profile and personal notifications
+ runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".NotificationListenerTest",
+ "testCanReceiveNotifications", mParentUserId,
+ Collections.singletonMap(PARAM_PROFILE_ID, Integer.toString(mProfileUserId)));
+ }
+
+ public void testCrossProfileNotificationListeners_InWhitelist() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+
+ installAppAsUser(NOTIFICATION_APK, mProfileUserId);
+ installAppAsUser(NOTIFICATION_APK, mParentUserId);
+
+ // Profile owner in the profile adds listener to the whitelist
+ runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".NotificationListenerTest",
+ "testAddListenerToWhitelist", mProfileUserId,
+ Collections.singletonMap(PARAM_PROFILE_ID, Integer.toString(mProfileUserId)));
+ // Listener outside the profile can see profile and personal notifications
+ runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".NotificationListenerTest",
+ "testCanReceiveNotifications", mParentUserId,
+ Collections.singletonMap(PARAM_PROFILE_ID, Integer.toString(mProfileUserId)));
+ }
+
public void testCrossProfileCopyPaste() throws Exception {
if (!mHasFeature) {
return;
diff --git a/hostsidetests/dumpsys/Android.mk b/hostsidetests/dumpsys/Android.mk
index 8a3470f..1b3768c 100644
--- a/hostsidetests/dumpsys/Android.mk
+++ b/hostsidetests/dumpsys/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.dumpsys
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
index b11a57b..a20895d 100644
--- a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
@@ -26,6 +26,6 @@
LOCAL_PACKAGE_NAME := CtsFramestatsTestApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
index dc9e4c9..f438d83 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
@@ -34,6 +34,6 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
index 1691103..eff16cf 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
@@ -34,6 +34,6 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/Android.mk b/hostsidetests/incident/Android.mk
index b02fc19..05a6353 100644
--- a/hostsidetests/incident/Android.mk
+++ b/hostsidetests/incident/Android.mk
@@ -20,7 +20,7 @@
# tag this module as a cts test artifact
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsIncidentHostTestCases
diff --git a/hostsidetests/incident/apps/batterystatsapp/Android.mk b/hostsidetests/incident/apps/batterystatsapp/Android.mk
index 78f710b..bf1858c 100644
--- a/hostsidetests/incident/apps/batterystatsapp/Android.mk
+++ b/hostsidetests/incident/apps/batterystatsapp/Android.mk
@@ -34,6 +34,6 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/boundwidgetapp/Android.mk b/hostsidetests/incident/apps/boundwidgetapp/Android.mk
index e9c1555..160f5d0 100644
--- a/hostsidetests/incident/apps/boundwidgetapp/Android.mk
+++ b/hostsidetests/incident/apps/boundwidgetapp/Android.mk
@@ -34,6 +34,6 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/errorsapp/Android.mk b/hostsidetests/incident/apps/errorsapp/Android.mk
index d6db6f7..87b9857 100644
--- a/hostsidetests/incident/apps/errorsapp/Android.mk
+++ b/hostsidetests/incident/apps/errorsapp/Android.mk
@@ -39,7 +39,7 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/errorsapp/jni/Android.mk b/hostsidetests/incident/apps/errorsapp/jni/Android.mk
index 7d3eb55..5101bf3 100644
--- a/hostsidetests/incident/apps/errorsapp/jni/Android.mk
+++ b/hostsidetests/incident/apps/errorsapp/jni/Android.mk
@@ -25,9 +25,6 @@
LOCAL_C_INCLUDES := $(JNI_H_INCLUDE)
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
-
LOCAL_SDK_VERSION := current
include $(BUILD_SHARED_LIBRARY)
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/Android.mk b/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
index a32926b..ce3ea11 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
@@ -34,6 +34,6 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
diff --git a/hostsidetests/incident/apps/netstatsapp/Android.mk b/hostsidetests/incident/apps/netstatsapp/Android.mk
index 682ec73..88ae35c 100644
--- a/hostsidetests/incident/apps/netstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/netstatsapp/Android.mk
@@ -34,6 +34,6 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/apps/storagedapp/Android.mk b/hostsidetests/incident/apps/storagedapp/Android.mk
index b081410..69d597e 100644
--- a/hostsidetests/incident/apps/storagedapp/Android.mk
+++ b/hostsidetests/incident/apps/storagedapp/Android.mk
@@ -34,6 +34,6 @@
LOCAL_SDK_VERSION := test_current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java b/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
index f961f6e..5739bf4 100644
--- a/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
+++ b/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
@@ -32,7 +32,7 @@
import com.android.tradefed.testtype.IBuildReceiver;
import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf.Message;
+import com.google.protobuf.MessageLite;
import com.google.protobuf.Parser;
import java.io.FileNotFoundException;
@@ -73,7 +73,7 @@
* @throws InvalidProtocolBufferException If there was an error parsing
* the proto. Note that a 0 length buffer is not necessarily an error.
*/
- public <T extends Message> T getDump(Parser<T> parser, String command)
+ public <T extends MessageLite> T getDump(Parser<T> parser, String command)
throws DeviceNotAvailableException, InvalidProtocolBufferException {
final CollectingByteOutputReceiver receiver = new CollectingByteOutputReceiver();
getDevice().executeShellCommand(command, receiver);
diff --git a/hostsidetests/inputmethodservice/common/Android.mk b/hostsidetests/inputmethodservice/common/Android.mk
index 83bc34d..67b8f9d 100644
--- a/hostsidetests/inputmethodservice/common/Android.mk
+++ b/hostsidetests/inputmethodservice/common/Android.mk
@@ -26,7 +26,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsInputMethodServiceCommon
diff --git a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/DeviceEventConstants.java b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/DeviceEventConstants.java
index 1f694d2..307693a 100644
--- a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/DeviceEventConstants.java
+++ b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/DeviceEventConstants.java
@@ -50,6 +50,12 @@
public static final String EXTRA_EVENT_SENDER = "event_sender";
/**
+ * Intent extra key for Event parameters like
+ * {@link DeviceEventTypeParam#ON_START_INPUT_RESTARTING}
+ */
+ public static final String EXTRA_EVENT_PARAMS = "event_params";
+
+ /**
* Intent extra key for what type a device event is. Values are {@link DeviceEventType#name()}.
*
* @see android.content.Intent#putExtra(String,String)
@@ -67,6 +73,29 @@
public static final String EXTRA_EVENT_TIME = "event_time";
/**
+ * Parameter for {@link DeviceEventType}.
+ */
+ public enum DeviceEventTypeParam {
+
+ /**
+ * Param for {@link DeviceEventType#ON_START_INPUT}. Represents if IME is restarting.
+ */
+ ON_START_INPUT_RESTARTING(DeviceEventType.ON_START_INPUT, "onStartInput.restarting");
+
+ private final DeviceEventType mType;
+ private final String mName;
+
+ DeviceEventTypeParam(DeviceEventType type, String name) {
+ mType = type;
+ mName = name;
+ }
+
+ public String getName() {
+ return mName;
+ }
+ }
+
+ /**
* Types of device event, a value of {@link #EXTRA_EVENT_TYPE}.
*/
public enum DeviceEventType {
@@ -106,5 +135,15 @@
/** Test start and end event types. */
TEST_START,
TEST_END,
+
+ /**
+ * {@link android.view.inputmethod.InputMethod#showSoftInput}
+ */
+ SHOW_SOFT_INPUT,
+
+ /**
+ * {@link android.view.inputmethod.InputMethod#hideSoftInput}
+ */
+ HIDE_SOFT_INPUT,
}
}
diff --git a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/EventProviderConstants.java b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/EventProviderConstants.java
index 172e1a7..9288051 100644
--- a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/EventProviderConstants.java
+++ b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/EventProviderConstants.java
@@ -58,6 +58,9 @@
// This is constants holding class, can't instantiate.
private EventTableConstants() {}
+ /** Column name of the table that holds Event extras in json format. */
+ public static final String EXTRAS = "extras";
+
/** Name of the table in content provider and database. */
public static final String NAME = "events";
diff --git a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/DeviceTestConstants.java b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/DeviceTestConstants.java
index 6afd337..aa90e11 100644
--- a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/DeviceTestConstants.java
+++ b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/DeviceTestConstants.java
@@ -43,4 +43,10 @@
public static final String TEST_CREATE_IME1 = "testCreateIme1";
public static final String TEST_SWITCH_IME1_TO_IME2 = "testSwitchIme1ToIme2";
public static final String TEST_IME1_IS_NOT_CURRENT_IME = "testIme1IsNotCurrentIme";
+ public static final String TEST_SEARCH_VIEW_GIVE_FOCUS_SHOW_IME1
+ = "testSearchView_giveFocusShowIme1";
+ public static final String TEST_SEARCH_VIEW_SET_QUERY_HIDE_IME1
+ = "testSearchView_setQueryHideIme1";
+ public static final String TEST_ON_START_INPUT_CALLED_ONCE_IME1
+ = "testOnStartInputCalledOnceIme1";
}
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
index d4786bc..1986e5a 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
@@ -36,7 +36,7 @@
CtsInputMethodServiceLib
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsInputMethodServiceDeviceTests
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/res/layout/activity_inputmethod_test.xml b/hostsidetests/inputmethodservice/deviceside/devicetest/res/layout/activity_inputmethod_test.xml
index 94ba557..f0efb94 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/res/layout/activity_inputmethod_test.xml
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/res/layout/activity_inputmethod_test.xml
@@ -25,5 +25,14 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"/>
+ <SearchView
+ android:id="@+id/search_view"
+ android:layout_below="@id/text_entry"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:iconifiedByDefault="false"
+ android:queryHint="hint"
+ android:inputType="textCapCharacters"
+ android:imeOptions="actionDone" />
</RelativeLayout>
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
index f4c0698..e5613ff 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
@@ -16,12 +16,19 @@
package android.inputmethodservice.cts.devicetest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import static android.inputmethodservice.cts.DeviceEvent.isFrom;
import static android.inputmethodservice.cts.DeviceEvent.isNewerThan;
import static android.inputmethodservice.cts.DeviceEvent.isType;
+import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.HIDE_SOFT_INPUT;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_CREATE;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_DESTROY;
+import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_FINISH_INPUT;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_START_INPUT;
+import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.SHOW_SOFT_INPUT;
import static android.inputmethodservice.cts.common.ImeCommandConstants.ACTION_IME_COMMAND;
import static android.inputmethodservice.cts.common.ImeCommandConstants.COMMAND_SWITCH_INPUT_METHOD;
import static android.inputmethodservice.cts.common.ImeCommandConstants.EXTRA_ARG_STRING1;
@@ -29,24 +36,29 @@
import static android.inputmethodservice.cts.devicetest.BusyWaitUtils.pollingCheck;
import static android.inputmethodservice.cts.devicetest.MoreCollectors.startingFrom;
+import android.app.Activity;
import android.inputmethodservice.cts.DeviceEvent;
import android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType;
+import android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventTypeParam;
import android.inputmethodservice.cts.common.Ime1Constants;
import android.inputmethodservice.cts.common.Ime2Constants;
import android.inputmethodservice.cts.common.test.DeviceTestConstants;
import android.inputmethodservice.cts.common.test.ShellCommandUtils;
import android.inputmethodservice.cts.devicetest.SequenceMatcher.MatchResult;
import android.os.SystemClock;
+import android.widget.SearchView;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Arrays;
+import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.function.IntFunction;
import java.util.function.Predicate;
import java.util.stream.Collector;
+import java.util.stream.Collectors;
@RunWith(AndroidJUnit4.class)
public class InputMethodServiceDeviceTest {
@@ -136,6 +148,82 @@
"CtsInputMethod1 is uninstalled or disabled, and current IME becomes other IME");
}
+ @Test
+ public void testSearchView_giveFocusShowIme1() throws Throwable {
+ final TestHelper helper = new TestHelper(
+ getClass(), DeviceTestConstants.TEST_SEARCH_VIEW_GIVE_FOCUS_SHOW_IME1);
+
+ helper.launchActivity(DeviceTestConstants.PACKAGE, DeviceTestConstants.TEST_ACTIVITY_CLASS);
+ helper.findUiObject(R.id.search_view).click();
+ pollingCheck(() -> helper.queryAllEvents()
+ .collect(startingFrom(helper.isStartOfTest()))
+ .filter(isFrom(Ime1Constants.CLASS).and(isType(SHOW_SOFT_INPUT)))
+ .findAny().isPresent(),
+ TIMEOUT, "CtsInputMethod1.showSoftInput is called");
+ pollingCheck(() -> helper.queryAllEvents()
+ .collect(startingFrom(helper.isStartOfTest()))
+ .filter(isFrom(Ime1Constants.CLASS).and(isType(ON_START_INPUT)))
+ .findAny().isPresent(),
+ TIMEOUT, "CtsInputMethod1.onStartInput is called");
+ }
+
+ @Test
+ public void testSearchView_setQueryHideIme1() throws Throwable {
+ final TestHelper helper = new TestHelper(
+ getClass(), DeviceTestConstants.TEST_SEARCH_VIEW_SET_QUERY_HIDE_IME1);
+
+ final Activity activity = helper.launchActivitySync(
+ DeviceTestConstants.PACKAGE, DeviceTestConstants.TEST_ACTIVITY_CLASS);
+ final SearchView searchView = (SearchView) activity.findViewById(R.id.search_view);
+ helper.findUiObject(R.id.search_view).click();
+ // test SearchView.onSubmitQuery() closes IME. Alternatively, onCloseClicked() closes IME.
+ // submits the query, should dismiss the inputMethod.
+ activity.runOnUiThread(() -> searchView.setQuery("test", true /* submit */));
+
+ pollingCheck(() -> helper.queryAllEvents()
+ .collect(startingFrom(helper.isStartOfTest()))
+ .filter(isFrom(Ime1Constants.CLASS).and(isType(ON_FINISH_INPUT)))
+ .findAny().isPresent(),
+ TIMEOUT, "CtsInputMethod1.onFinishInput is called");
+ pollingCheck(() -> helper.queryAllEvents()
+ .collect(startingFrom(helper.isStartOfTest()))
+ .filter(isFrom(Ime1Constants.CLASS).and(isType(HIDE_SOFT_INPUT)))
+ .findAny().isPresent(),
+ TIMEOUT, "CtsInputMethod1.hideSoftInput is called");
+ }
+
+ @Test
+ public void testOnStartInputCalledOnceIme1() throws Exception {
+ final TestHelper helper = new TestHelper(
+ getClass(), DeviceTestConstants.TEST_ON_START_INPUT_CALLED_ONCE_IME1);
+
+ helper.launchActivity(DeviceTestConstants.PACKAGE, DeviceTestConstants.TEST_ACTIVITY_CLASS);
+ helper.findUiObject(R.id.text_entry).click();
+
+ // we should've only one onStartInput call.
+ pollingCheck(() -> helper.queryAllEvents()
+ .collect(startingFrom(helper.isStartOfTest()))
+ .filter(isFrom(Ime1Constants.CLASS).and(isType(ON_START_INPUT)))
+ .findAny()
+ .isPresent(),
+ TIMEOUT, "CtsInputMethod1.onStartInput is called");
+ List<DeviceEvent> startInputEvents = helper.queryAllEvents()
+ .collect(startingFrom(helper.isStartOfTest()))
+ .filter(isFrom(Ime1Constants.CLASS).and(isType(ON_START_INPUT)))
+ .collect(Collectors.toList());
+
+ assertEquals("CtsInputMethod1.onStartInput is called exactly once",
+ startInputEvents.size(),
+ 1);
+
+ // check if that single event didn't cause IME restart.
+ final DeviceEvent event = startInputEvents.get(0);
+ Boolean isRestarting = DeviceEvent.getEventParamBoolean(
+ DeviceEventTypeParam.ON_START_INPUT_RESTARTING, event);
+ assertTrue(isRestarting != null);
+ assertFalse(isRestarting);
+ }
+
/**
* Build stream collector of {@link DeviceEvent} collecting sequence that elements have
* specified types.
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
index a4b1aae..7f6ba2e 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
@@ -20,9 +20,12 @@
import static android.inputmethodservice.cts.DeviceEvent.isType;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.TEST_START;
+import android.app.Instrumentation;
+import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Resources;
import android.database.Cursor;
import android.inputmethodservice.cts.DeviceEvent;
import android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType;
@@ -54,6 +57,7 @@
private final ContentResolver mResolver;
private final Context mTargetContext;
private final UiDevice mUiDevice;
+ private final Instrumentation mInstrumentation;
/**
* Construct a helper object of specified test method.
@@ -66,7 +70,8 @@
mTestInfo = new TestInfo(testContext.getPackageName(), testClass.getName(), testMethod);
mResolver = testContext.getContentResolver();
mTargetContext = InstrumentationRegistry.getTargetContext();
- mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+ mUiDevice = UiDevice.getInstance(mInstrumentation);
}
/**
@@ -105,6 +110,22 @@
}
/**
+ * Launch test activity synchronously.
+ *
+ * @param packageName activity's app package name.
+ * @param className activity's class name.
+ * @return instance of Activity
+ */
+ Activity launchActivitySync(final String packageName, final String className) {
+ final Intent intent = new Intent()
+ .setAction(Intent.ACTION_MAIN)
+ .setClassName(packageName, className)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ return mInstrumentation.startActivitySync(intent);
+ }
+
+ /**
* Return all device events as {@link Stream}
* @return {@link Stream<DeviceEvent>} of all device events.
*/
diff --git a/hostsidetests/inputmethodservice/deviceside/ime1/Android.mk b/hostsidetests/inputmethodservice/deviceside/ime1/Android.mk
index fe67791..c573ea4 100644
--- a/hostsidetests/inputmethodservice/deviceside/ime1/Android.mk
+++ b/hostsidetests/inputmethodservice/deviceside/ime1/Android.mk
@@ -32,7 +32,7 @@
CtsInputMethodServiceLib
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsInputMethod1
diff --git a/hostsidetests/inputmethodservice/deviceside/ime2/Android.mk b/hostsidetests/inputmethodservice/deviceside/ime2/Android.mk
index cf9cb37..dbbb460 100644
--- a/hostsidetests/inputmethodservice/deviceside/ime2/Android.mk
+++ b/hostsidetests/inputmethodservice/deviceside/ime2/Android.mk
@@ -32,7 +32,7 @@
CtsInputMethodServiceLib
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsInputMethod2
diff --git a/hostsidetests/inputmethodservice/deviceside/lib/Android.mk b/hostsidetests/inputmethodservice/deviceside/lib/Android.mk
index 0223d0d..6977d6b 100644
--- a/hostsidetests/inputmethodservice/deviceside/lib/Android.mk
+++ b/hostsidetests/inputmethodservice/deviceside/lib/Android.mk
@@ -19,12 +19,13 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-annotations \
+ json \
CtsInputMethodServiceCommon
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsInputMethodServiceLib
diff --git a/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/DeviceEvent.java b/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/DeviceEvent.java
index b6098f9..ff412ef 100644
--- a/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/DeviceEvent.java
+++ b/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/DeviceEvent.java
@@ -17,17 +17,20 @@
package android.inputmethodservice.cts;
import static android.inputmethodservice.cts.common.DeviceEventConstants.ACTION_DEVICE_EVENT;
+import static android.inputmethodservice.cts.common.DeviceEventConstants.EXTRA_EVENT_PARAMS;
import static android.inputmethodservice.cts.common.DeviceEventConstants.EXTRA_EVENT_TIME;
import static android.inputmethodservice.cts.common.DeviceEventConstants.EXTRA_EVENT_TYPE;
import static android.inputmethodservice.cts.common.DeviceEventConstants.EXTRA_EVENT_SENDER;
import static android.inputmethodservice.cts.common.DeviceEventConstants.RECEIVER_CLASS;
import static android.inputmethodservice.cts.common.DeviceEventConstants.RECEIVER_PACKAGE;
+
import android.content.ContentValues;
import android.content.Intent;
import android.database.Cursor;
import android.inputmethodservice.cts.common.DeviceEventConstants;
import android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType;
+import android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventTypeParam;
import android.inputmethodservice.cts.common.EventProviderConstants.EventTableConstants;
import android.inputmethodservice.cts.common.test.TestInfo;
import android.inputmethodservice.cts.db.Entity;
@@ -35,8 +38,16 @@
import android.inputmethodservice.cts.db.Table;
import android.os.SystemClock;
import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.text.TextUtils;
import android.util.Log;
+import com.android.json.stream.JsonReader;
+import com.android.json.stream.JsonWriter;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
import java.util.function.Predicate;
import java.util.stream.Stream;
@@ -51,21 +62,85 @@
public static final Table<DeviceEvent> TABLE = new DeviceEventTable(EventTableConstants.NAME);
+ public static IntentBuilder builder() {
+ return new IntentBuilder();
+ }
+
/**
- * Create an intent to send a device event.
- * @param sender an event sender.
- * @param type an event type defined at {@link DeviceEventType}.
- * @return an intent that has event {@code sender}, {@code type}, time from
- * {@link SystemClock#uptimeMillis()}, and target component of event receiver.
+ * Builder to create an intent to send a device event.
+ * The built intent that has event {@code sender}, {@code type}, {@code paramsString}, time from
+ * {@link SystemClock#uptimeMillis()}, and target component of event receiver.
+ *
*/
- public static Intent newDeviceEventIntent(@NonNull final String sender,
- @NonNull final DeviceEventType type) {
- return new Intent()
- .setAction(ACTION_DEVICE_EVENT)
- .setClassName(RECEIVER_PACKAGE, RECEIVER_CLASS)
- .putExtra(EXTRA_EVENT_SENDER, sender)
- .putExtra(EXTRA_EVENT_TYPE, type.name())
- .putExtra(EXTRA_EVENT_TIME, SystemClock.uptimeMillis());
+ public static final class IntentBuilder {
+ String mSender;
+ DeviceEventType mType;
+ JsonWriter mJsonWriter;
+ StringWriter mStringWriter;
+
+ /**
+ * @param type an event type defined at {@link DeviceEventType}.
+ */
+ public IntentBuilder setType(DeviceEventType type) {
+ mType = type;
+ return this;
+ }
+
+ /**
+ * @param sender an event sender.
+ */
+ public void setSender(String sender) {
+ mSender = sender;
+ }
+
+ public IntentBuilder with(DeviceEventTypeParam eventParam, boolean value) {
+ appendToJson(eventParam, value);
+ return this;
+ }
+
+ public Intent build() {
+ Intent intent = new Intent()
+ .setAction(ACTION_DEVICE_EVENT)
+ .setClassName(RECEIVER_PACKAGE, RECEIVER_CLASS)
+ .putExtra(EXTRA_EVENT_SENDER, mSender)
+ .putExtra(EXTRA_EVENT_TYPE, mType.name())
+ .putExtra(EXTRA_EVENT_PARAMS, getJsonString())
+ .putExtra(EXTRA_EVENT_TIME, SystemClock.uptimeMillis());
+
+ mJsonWriter = null;
+ mStringWriter = null;
+ return intent;
+ }
+
+ private String getJsonString() {
+ if (mJsonWriter == null) {
+ return "";
+ }
+ try {
+ mJsonWriter.endObject();
+ mJsonWriter.flush();
+ } catch (IOException e) {
+ throw new RuntimeException("IntentBuilder.getJsonString() failed.", e);
+ }
+ return mStringWriter.toString();
+ }
+
+ private void appendToJson(DeviceEventTypeParam eventParam, boolean value) {
+ final String key = eventParam.getName();
+ if (TextUtils.isEmpty(key)) {
+ return;
+ }
+ try {
+ if (mJsonWriter == null) {
+ mStringWriter = new StringWriter();
+ mJsonWriter = new JsonWriter(mStringWriter);
+ mJsonWriter.beginObject();
+ }
+ mJsonWriter.name(key).value(value);
+ } catch (IOException e) {
+ throw new RuntimeException("IntentBuilder.appendToJson() failed.", e);
+ }
+ }
}
/**
@@ -93,7 +168,16 @@
"Intent must have " + EXTRA_EVENT_TIME + ": " + intent);
}
- return new DeviceEvent(sender, type, intent.getLongExtra(EXTRA_EVENT_TIME, 0L));
+ String paramsString = intent.getStringExtra(DeviceEventConstants.EXTRA_EVENT_PARAMS);
+ if (paramsString == null) {
+ paramsString = "";
+ }
+
+ return new DeviceEvent(
+ sender,
+ type,
+ paramsString,
+ intent.getLongExtra(EXTRA_EVENT_TIME, 0L));
}
/**
@@ -158,13 +242,21 @@
public final DeviceEventType type;
/**
+ * Event parameters formatted as json string.
+ * e.g. {@link DeviceEventTypeParam#ON_START_INPUT_RESTARTING}
+ */
+ public final String paramsString;
+
+ /**
* Event time, value is from {@link SystemClock#uptimeMillis()}.
*/
public final long time;
- private DeviceEvent(final String sender, final DeviceEventType type, final long time) {
+ private DeviceEvent(
+ final String sender, final DeviceEventType type, String paramsString, final long time) {
this.sender = sender;
this.type = type;
+ this.paramsString = paramsString;
this.time = time;
}
@@ -174,6 +266,37 @@
}
/**
+ * @param eventParam {@link DeviceEventTypeParam} to look for.
+ * @param event {@link DeviceEvent} to look in.
+ * @return Event parameter for provided key. If key is not found in
+ * {@link DeviceEvent#paramsString}, null is returned.
+ *
+ * TODO: Support other primitive and custom types.
+ */
+ @Nullable
+ public static Boolean getEventParamBoolean(
+ DeviceEventTypeParam eventParam, final DeviceEvent event) {
+ StringReader stringReader = new StringReader(event.paramsString);
+ JsonReader reader = new JsonReader(stringReader);
+
+ try {
+ reader.beginObject();
+ while (reader.hasNext()) {
+ String name = reader.nextName();
+ if (name.equals(eventParam.getName())) {
+ Boolean value = reader.nextBoolean();
+ reader.endObject();
+ return value;
+ }
+ }
+ reader.endObject();
+ } catch (IOException e) {
+ throw new RuntimeException("DeviceEvent.getEventParamBoolean() failed.", e);
+ }
+ return null;
+ }
+
+ /**
* Abstraction of device event table in database.
*/
private static final class DeviceEventTable extends Table<DeviceEvent> {
@@ -183,16 +306,19 @@
private final Field SENDER;
private final Field TYPE;
private final Field TIME;
+ private final Field PARAMS;
private DeviceEventTable(final String name) {
super(name, new Entity.Builder<DeviceEvent>()
.addField(EventTableConstants.SENDER, Cursor.FIELD_TYPE_STRING)
.addField(EventTableConstants.TYPE, Cursor.FIELD_TYPE_STRING)
.addField(EventTableConstants.TIME, Cursor.FIELD_TYPE_INTEGER)
+ .addField(EventTableConstants.EXTRAS, Cursor.FIELD_TYPE_STRING)
.build());
SENDER = getField(EventTableConstants.SENDER);
TYPE = getField(EventTableConstants.TYPE);
TIME = getField(EventTableConstants.TIME);
+ PARAMS = getField(EventTableConstants.EXTRAS);
}
@Override
@@ -200,6 +326,7 @@
final ContentValues values = new ContentValues();
SENDER.putString(values, event.sender);
TYPE.putString(values, event.type.name());
+ PARAMS.putString(values, event.paramsString);
TIME.putLong(values, event.time);
return values;
}
@@ -214,6 +341,7 @@
final DeviceEvent event = new DeviceEvent(
SENDER.getString(cursor),
DeviceEventType.valueOf(TYPE.getString(cursor)),
+ PARAMS.getString(cursor),
TIME.getLong(cursor));
builder.accept(event);
if (DEBUG_STREAM) {
diff --git a/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/ime/CtsBaseInputMethod.java b/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/ime/CtsBaseInputMethod.java
index 6ae3568..b37873c 100644
--- a/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/ime/CtsBaseInputMethod.java
+++ b/hostsidetests/inputmethodservice/deviceside/lib/src/android/inputmethodservice/cts/ime/CtsBaseInputMethod.java
@@ -16,18 +16,21 @@
package android.inputmethodservice.cts.ime;
+import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.HIDE_SOFT_INPUT;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_CREATE;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_DESTROY;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_FINISH_INPUT;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_FINISH_INPUT_VIEW;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_START_INPUT;
import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.ON_START_INPUT_VIEW;
+import static android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType.SHOW_SOFT_INPUT;
-import android.content.Intent;
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.cts.DeviceEvent;
-import android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventType;
+import android.inputmethodservice.cts.common.DeviceEventConstants.DeviceEventTypeParam;
import android.inputmethodservice.cts.ime.ImeCommandReceiver.ImeCommandCallbacks;
+
+import android.os.ResultReceiver;
import android.util.Log;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
@@ -42,13 +45,33 @@
new ImeCommandReceiver<>();
private String mLogTag;
+ private class CtsInputMethodImpl extends InputMethodImpl {
+ @Override
+ public void showSoftInput(int flags, ResultReceiver resultReceiver) {
+ sendEvent(DeviceEvent.builder().setType(SHOW_SOFT_INPUT));
+ if (DEBUG) {
+ Log.d(mLogTag, "showSoftInput called");
+ }
+ super.showSoftInput(flags, resultReceiver);
+ }
+
+ @Override
+ public void hideSoftInput(int flags, ResultReceiver resultReceiver) {
+ sendEvent(DeviceEvent.builder().setType(HIDE_SOFT_INPUT));
+ if (DEBUG) {
+ Log.d(mLogTag, "hideSoftInput called");
+ }
+ super.hideSoftInput(flags, resultReceiver);
+ }
+ }
+
@Override
public void onCreate() {
mLogTag = getClass().getSimpleName();
if (DEBUG) {
Log.d(mLogTag, "onCreate:");
}
- sendEvent(ON_CREATE);
+ sendEvent(DeviceEvent.builder().setType(ON_CREATE));
super.onCreate();
@@ -62,8 +85,10 @@
+ " editorInfo=" + editorInfo
+ " restarting=" + restarting);
}
- sendEvent(ON_START_INPUT, editorInfo, restarting);
+ sendEvent(DeviceEvent.builder()
+ .setType(ON_START_INPUT)
+ .with(DeviceEventTypeParam.ON_START_INPUT_RESTARTING, restarting));
super.onStartInput(editorInfo, restarting);
}
@@ -74,7 +99,8 @@
+ " editorInfo=" + editorInfo
+ " restarting=" + restarting);
}
- sendEvent(ON_START_INPUT_VIEW, editorInfo, restarting);
+
+ sendEvent(DeviceEvent.builder().setType(ON_START_INPUT_VIEW));
super.onStartInputView(editorInfo, restarting);
}
@@ -84,7 +110,7 @@
if (DEBUG) {
Log.d(mLogTag, "onFinishInputView: finishingInput=" + finishingInput);
}
- sendEvent(ON_FINISH_INPUT_VIEW, finishingInput);
+ sendEvent(DeviceEvent.builder().setType(ON_FINISH_INPUT_VIEW));
super.onFinishInputView(finishingInput);
}
@@ -94,7 +120,7 @@
if (DEBUG) {
Log.d(mLogTag, "onFinishInput:");
}
- sendEvent(ON_FINISH_INPUT);
+ sendEvent(DeviceEvent.builder().setType(ON_FINISH_INPUT));
super.onFinishInput();
}
@@ -104,13 +130,23 @@
if (DEBUG) {
Log.d(mLogTag, "onDestroy:");
}
- sendEvent(ON_DESTROY);
+ sendEvent(DeviceEvent.builder().setType(ON_DESTROY));
super.onDestroy();
unregisterReceiver(mImeCommandReceiver);
}
+ @Override
+ public AbstractInputMethodImpl onCreateInputMethodInterface() {
+ final CtsInputMethodImpl inputMethod = new CtsInputMethodImpl();
+ if (DEBUG) {
+ Log.d(mLogTag, "onCreateInputMethodInterface");
+ }
+
+ return inputMethod;
+ }
+
//
// Implementations of {@link ImeCommandCallbacks}.
//
@@ -142,10 +178,8 @@
}
}
- private void sendEvent(final DeviceEventType type, final Object... args) {
- final String sender = getClass().getName();
- final Intent intent = DeviceEvent.newDeviceEventIntent(sender, type);
- // TODO: Send arbitrary {@code args} in {@code intent}.
- sendBroadcast(intent);
+ private void sendEvent(final DeviceEvent.IntentBuilder intentBuilder) {
+ intentBuilder.setSender(getClass().getName());
+ sendBroadcast(intentBuilder.build());
}
}
diff --git a/hostsidetests/inputmethodservice/deviceside/provider/Android.mk b/hostsidetests/inputmethodservice/deviceside/provider/Android.mk
index 03b3946..61a7574 100644
--- a/hostsidetests/inputmethodservice/deviceside/provider/Android.mk
+++ b/hostsidetests/inputmethodservice/deviceside/provider/Android.mk
@@ -31,7 +31,7 @@
CtsInputMethodServiceLib
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsInputMethodServiceEventProvider
diff --git a/hostsidetests/inputmethodservice/hostside/Android.mk b/hostsidetests/inputmethodservice/hostside/Android.mk
index 19478f1..68b4498 100644
--- a/hostsidetests/inputmethodservice/hostside/Android.mk
+++ b/hostsidetests/inputmethodservice/hostside/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsInputMethodServiceHostTestCases
diff --git a/hostsidetests/inputmethodservice/hostside/AndroidTest.xml b/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
index 470e666..f4cc85e 100644
--- a/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
+++ b/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
@@ -20,7 +20,7 @@
<option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
<option name="run-command" value="wm dismiss-keyguard" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsInputMethodServiceEventProvider.apk" />
<option name="test-file-name" value="CtsInputMethodServiceDeviceTests.apk" />
diff --git a/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java b/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java
index 973b87e..02c3e55 100644
--- a/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java
+++ b/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java
@@ -78,13 +78,7 @@
@Test
public void testUninstallCurrentIme() throws Exception {
- final TestInfo testCreateIme1 = new TestInfo(DeviceTestConstants.PACKAGE,
- DeviceTestConstants.TEST_CLASS, DeviceTestConstants.TEST_CREATE_IME1);
- sendTestStartEvent(testCreateIme1);
- installPackage(Ime1Constants.APK, "-r");
- shell(ShellCommandUtils.enableIme(Ime1Constants.IME_ID));
- shell(ShellCommandUtils.setCurrentIme(Ime1Constants.IME_ID));
- assertTrue(runDeviceTestMethod(testCreateIme1));
+ installAndSetIme1();
final TestInfo testIme1IsNotCurrentIme = new TestInfo(DeviceTestConstants.PACKAGE,
DeviceTestConstants.TEST_CLASS, DeviceTestConstants.TEST_IME1_IS_NOT_CURRENT_IME);
@@ -96,13 +90,7 @@
@Test
public void testDisableCurrentIme() throws Exception {
- final TestInfo testCreateIme1 = new TestInfo(DeviceTestConstants.PACKAGE,
- DeviceTestConstants.TEST_CLASS, DeviceTestConstants.TEST_CREATE_IME1);
- sendTestStartEvent(testCreateIme1);
- installPackage(Ime1Constants.APK, "-r");
- shell(ShellCommandUtils.enableIme(Ime1Constants.IME_ID));
- shell(ShellCommandUtils.setCurrentIme(Ime1Constants.IME_ID));
- assertTrue(runDeviceTestMethod(testCreateIme1));
+ installAndSetIme1();
final TestInfo testIme1IsNotCurrentIme = new TestInfo(DeviceTestConstants.PACKAGE,
DeviceTestConstants.TEST_CLASS, DeviceTestConstants.TEST_IME1_IS_NOT_CURRENT_IME);
@@ -112,6 +100,49 @@
assertEquals(shell(ShellCommandUtils.getCurrentIme()), mDefaultImeId);
}
+ @Test
+ public void testSearchView_giveFocusShowIme() throws Exception {
+ installAndSetIme1();
+
+ final TestInfo testGiveFocusShowIme1 = new TestInfo(DeviceTestConstants.PACKAGE,
+ DeviceTestConstants.TEST_CLASS,
+ DeviceTestConstants.TEST_SEARCH_VIEW_GIVE_FOCUS_SHOW_IME1);
+ sendTestStartEvent(testGiveFocusShowIme1);
+ assertTrue(runDeviceTestMethod(testGiveFocusShowIme1));
+ }
+
+ @Test
+ public void testSearchView_setQueryHideIme() throws Exception {
+ installAndSetIme1();
+
+ final TestInfo testSetQueryHideIme1 = new TestInfo(DeviceTestConstants.PACKAGE,
+ DeviceTestConstants.TEST_CLASS,
+ DeviceTestConstants.TEST_SEARCH_VIEW_SET_QUERY_HIDE_IME1);
+ sendTestStartEvent(testSetQueryHideIme1);
+ assertTrue(runDeviceTestMethod(testSetQueryHideIme1));
+ }
+
+ @Test
+ public void testOnStartInputCalledOnce() throws Exception {
+ installAndSetIme1();
+
+ final TestInfo testSetQueryHideIme1 = new TestInfo(DeviceTestConstants.PACKAGE,
+ DeviceTestConstants.TEST_CLASS,
+ DeviceTestConstants.TEST_ON_START_INPUT_CALLED_ONCE_IME1);
+ sendTestStartEvent(testSetQueryHideIme1);
+ assertTrue(runDeviceTestMethod(testSetQueryHideIme1));
+ }
+
+ private void installAndSetIme1() throws Exception {
+ final TestInfo testCreateIme1 = new TestInfo(DeviceTestConstants.PACKAGE,
+ DeviceTestConstants.TEST_CLASS, DeviceTestConstants.TEST_CREATE_IME1);
+ sendTestStartEvent(testCreateIme1);
+ installPackage(Ime1Constants.APK, "-r");
+ shell(ShellCommandUtils.enableIme(Ime1Constants.IME_ID));
+ shell(ShellCommandUtils.setCurrentIme(Ime1Constants.IME_ID));
+ assertTrue(runDeviceTestMethod(testCreateIme1));
+ }
+
private void sendTestStartEvent(final TestInfo deviceTest) throws Exception {
final String sender = deviceTest.getTestName();
// {@link EventType#EXTRA_EVENT_TIME} will be recorded at device side.
diff --git a/hostsidetests/jdwpsecurity/Android.mk b/hostsidetests/jdwpsecurity/Android.mk
index 3c8ead8..c57559b 100644
--- a/hostsidetests/jdwpsecurity/Android.mk
+++ b/hostsidetests/jdwpsecurity/Android.mk
@@ -26,7 +26,7 @@
LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.host.jdwpsecurity
diff --git a/hostsidetests/jdwpsecurity/app/Android.mk b/hostsidetests/jdwpsecurity/app/Android.mk
index 22f236a..eae6088 100644
--- a/hostsidetests/jdwpsecurity/app/Android.mk
+++ b/hostsidetests/jdwpsecurity/app/Android.mk
@@ -19,5 +19,5 @@
LOCAL_MODULE := CtsJdwpApp
LOCAL_SRC_FILES := $(call all-subdir-java-files)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/allocation-tracking/Android.mk b/hostsidetests/jvmti/allocation-tracking/Android.mk
index c5619ad..511f543 100644
--- a/hostsidetests/jvmti/allocation-tracking/Android.mk
+++ b/hostsidetests/jvmti/allocation-tracking/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiTrackingHostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/allocation-tracking/app/Android.mk b/hostsidetests/jvmti/allocation-tracking/app/Android.mk
index 71ab1b5..7b40a4f 100644
--- a/hostsidetests/jvmti/allocation-tracking/app/Android.mk
+++ b/hostsidetests/jvmti/allocation-tracking/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
index 6894a21..f042a89 100644
--- a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
+++ b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
@@ -31,6 +31,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import java.util.zip.ZipFile;
/**
@@ -80,6 +81,8 @@
RemoteAndroidTestRunner runner = new RemoteAndroidTestRunner(mTestPackageName, RUNNER,
device.getIDevice());
+ // set a max deadline limit to avoid hanging forever
+ runner.setMaxTimeToOutputResponse(2, TimeUnit.MINUTES);
TestResults tr = new TestResults(new AttachAgent(device, mTestPackageName, mTestApk));
diff --git a/hostsidetests/jvmti/redefining/Android.mk b/hostsidetests/jvmti/redefining/Android.mk
index d0a728d..4c8ac15 100644
--- a/hostsidetests/jvmti/redefining/Android.mk
+++ b/hostsidetests/jvmti/redefining/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRedefineClassesHostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/redefining/app/Android.mk b/hostsidetests/jvmti/redefining/app/Android.mk
index 704f464..8ade23d 100644
--- a/hostsidetests/jvmti/redefining/app/Android.mk
+++ b/hostsidetests/jvmti/redefining/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-902/Android.mk b/hostsidetests/jvmti/run-tests/test-902/Android.mk
index 7479ad8..f16dd85 100644
--- a/hostsidetests/jvmti/run-tests/test-902/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-902/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest902HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-902/app/Android.mk b/hostsidetests/jvmti/run-tests/test-902/app/Android.mk
index 3fd9dc9..7c9001b 100644
--- a/hostsidetests/jvmti/run-tests/test-902/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-902/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-903/Android.mk b/hostsidetests/jvmti/run-tests/test-903/Android.mk
index 1b67da1..b7d15bd 100644
--- a/hostsidetests/jvmti/run-tests/test-903/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-903/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest903HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-903/app/Android.mk b/hostsidetests/jvmti/run-tests/test-903/app/Android.mk
index a501186..c523dce 100644
--- a/hostsidetests/jvmti/run-tests/test-903/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-903/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-904/Android.mk b/hostsidetests/jvmti/run-tests/test-904/Android.mk
index b814acb..3655374 100644
--- a/hostsidetests/jvmti/run-tests/test-904/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-904/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest904HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-904/app/Android.mk b/hostsidetests/jvmti/run-tests/test-904/app/Android.mk
index 83f0efc..e248dab 100644
--- a/hostsidetests/jvmti/run-tests/test-904/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-904/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-905/Android.mk b/hostsidetests/jvmti/run-tests/test-905/Android.mk
index 9e58b9b..065585e 100644
--- a/hostsidetests/jvmti/run-tests/test-905/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-905/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest905HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-905/app/Android.mk b/hostsidetests/jvmti/run-tests/test-905/app/Android.mk
index 662ea5f..12472e1 100644
--- a/hostsidetests/jvmti/run-tests/test-905/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-905/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-906/Android.mk b/hostsidetests/jvmti/run-tests/test-906/Android.mk
index 553b898..5a61e0f 100644
--- a/hostsidetests/jvmti/run-tests/test-906/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-906/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest906HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-906/app/Android.mk b/hostsidetests/jvmti/run-tests/test-906/app/Android.mk
index f383007..783ec20 100644
--- a/hostsidetests/jvmti/run-tests/test-906/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-906/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-907/Android.mk b/hostsidetests/jvmti/run-tests/test-907/Android.mk
index cf79d0b..5629150 100644
--- a/hostsidetests/jvmti/run-tests/test-907/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-907/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest907HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-907/app/Android.mk b/hostsidetests/jvmti/run-tests/test-907/app/Android.mk
index 3ecb219..9ecfdd5 100644
--- a/hostsidetests/jvmti/run-tests/test-907/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-907/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-908/Android.mk b/hostsidetests/jvmti/run-tests/test-908/Android.mk
index 40ef837..f260e26 100644
--- a/hostsidetests/jvmti/run-tests/test-908/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-908/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest908HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-908/app/Android.mk b/hostsidetests/jvmti/run-tests/test-908/app/Android.mk
index c4eea2e..8cbf7db 100644
--- a/hostsidetests/jvmti/run-tests/test-908/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-908/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-910/Android.mk b/hostsidetests/jvmti/run-tests/test-910/Android.mk
index 8cfe0a5..bc06790 100644
--- a/hostsidetests/jvmti/run-tests/test-910/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-910/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest910HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-910/app/Android.mk b/hostsidetests/jvmti/run-tests/test-910/app/Android.mk
index 108682a..acb8180 100644
--- a/hostsidetests/jvmti/run-tests/test-910/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-910/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-913/Android.mk b/hostsidetests/jvmti/run-tests/test-913/Android.mk
index 8075fe2..d9cdd01 100644
--- a/hostsidetests/jvmti/run-tests/test-913/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-913/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest913HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-913/app/Android.mk b/hostsidetests/jvmti/run-tests/test-913/app/Android.mk
index 03cb328..95b6bce 100644
--- a/hostsidetests/jvmti/run-tests/test-913/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-913/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-914/Android.mk b/hostsidetests/jvmti/run-tests/test-914/Android.mk
index 5f7ddee..e28f495 100644
--- a/hostsidetests/jvmti/run-tests/test-914/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-914/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest914HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-914/app/Android.mk b/hostsidetests/jvmti/run-tests/test-914/app/Android.mk
index c294d56..3146e3a 100644
--- a/hostsidetests/jvmti/run-tests/test-914/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-914/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-915/Android.mk b/hostsidetests/jvmti/run-tests/test-915/Android.mk
index 2e2e438..7934916 100644
--- a/hostsidetests/jvmti/run-tests/test-915/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-915/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest915HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-915/app/Android.mk b/hostsidetests/jvmti/run-tests/test-915/app/Android.mk
index d712a74..4a52e4c 100644
--- a/hostsidetests/jvmti/run-tests/test-915/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-915/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-917/Android.mk b/hostsidetests/jvmti/run-tests/test-917/Android.mk
index 1e84675..80199f7 100644
--- a/hostsidetests/jvmti/run-tests/test-917/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-917/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest917HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-917/app/Android.mk b/hostsidetests/jvmti/run-tests/test-917/app/Android.mk
index 8b87082..83a6d38 100644
--- a/hostsidetests/jvmti/run-tests/test-917/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-917/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-918/Android.mk b/hostsidetests/jvmti/run-tests/test-918/Android.mk
index 5d6f8d0..5600ece 100644
--- a/hostsidetests/jvmti/run-tests/test-918/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-918/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest918HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-918/app/Android.mk b/hostsidetests/jvmti/run-tests/test-918/app/Android.mk
index 30f9597..fd9f80f 100644
--- a/hostsidetests/jvmti/run-tests/test-918/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-918/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-919/Android.mk b/hostsidetests/jvmti/run-tests/test-919/Android.mk
index 8916d6e..76ad7db 100644
--- a/hostsidetests/jvmti/run-tests/test-919/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-919/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest919HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-919/app/Android.mk b/hostsidetests/jvmti/run-tests/test-919/app/Android.mk
index a9b7089..f333322 100644
--- a/hostsidetests/jvmti/run-tests/test-919/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-919/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-920/Android.mk b/hostsidetests/jvmti/run-tests/test-920/Android.mk
index f92ed94..678ded5 100644
--- a/hostsidetests/jvmti/run-tests/test-920/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-920/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest920HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-920/app/Android.mk b/hostsidetests/jvmti/run-tests/test-920/app/Android.mk
index a24d668..740c410 100644
--- a/hostsidetests/jvmti/run-tests/test-920/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-920/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-922/Android.mk b/hostsidetests/jvmti/run-tests/test-922/Android.mk
index 2de665a..aab0515 100644
--- a/hostsidetests/jvmti/run-tests/test-922/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-922/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest922HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-922/app/Android.mk b/hostsidetests/jvmti/run-tests/test-922/app/Android.mk
index ada0edc..dc69693 100644
--- a/hostsidetests/jvmti/run-tests/test-922/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-922/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-923/Android.mk b/hostsidetests/jvmti/run-tests/test-923/Android.mk
index dd1de3c..6bac152 100644
--- a/hostsidetests/jvmti/run-tests/test-923/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-923/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest923HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-923/app/Android.mk b/hostsidetests/jvmti/run-tests/test-923/app/Android.mk
index c94d431..6284f7d 100644
--- a/hostsidetests/jvmti/run-tests/test-923/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-923/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-924/Android.mk b/hostsidetests/jvmti/run-tests/test-924/Android.mk
index 28c4b89..c16350b 100644
--- a/hostsidetests/jvmti/run-tests/test-924/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-924/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest924HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-924/app/Android.mk b/hostsidetests/jvmti/run-tests/test-924/app/Android.mk
index f1acfd0..18e4f72 100644
--- a/hostsidetests/jvmti/run-tests/test-924/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-924/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-926/Android.mk b/hostsidetests/jvmti/run-tests/test-926/Android.mk
index fcd46ad..3ea1d85 100644
--- a/hostsidetests/jvmti/run-tests/test-926/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-926/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest926HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-926/app/Android.mk b/hostsidetests/jvmti/run-tests/test-926/app/Android.mk
index a597fb1..3436029 100644
--- a/hostsidetests/jvmti/run-tests/test-926/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-926/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-927/Android.mk b/hostsidetests/jvmti/run-tests/test-927/Android.mk
index 939601c..98d5f2e 100644
--- a/hostsidetests/jvmti/run-tests/test-927/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-927/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest927HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-927/app/Android.mk b/hostsidetests/jvmti/run-tests/test-927/app/Android.mk
index 9c71950..1e8fdb3 100644
--- a/hostsidetests/jvmti/run-tests/test-927/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-927/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-928/Android.mk b/hostsidetests/jvmti/run-tests/test-928/Android.mk
index 2eac8f9..6084806 100644
--- a/hostsidetests/jvmti/run-tests/test-928/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-928/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest928HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-928/app/Android.mk b/hostsidetests/jvmti/run-tests/test-928/app/Android.mk
index 2eb3612..fa3537f 100644
--- a/hostsidetests/jvmti/run-tests/test-928/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-928/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-930/Android.mk b/hostsidetests/jvmti/run-tests/test-930/Android.mk
index 2ac9ae2..10a3d18 100644
--- a/hostsidetests/jvmti/run-tests/test-930/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-930/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest930HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-930/app/Android.mk b/hostsidetests/jvmti/run-tests/test-930/app/Android.mk
index 873b273..6affa06 100644
--- a/hostsidetests/jvmti/run-tests/test-930/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-930/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-931/Android.mk b/hostsidetests/jvmti/run-tests/test-931/Android.mk
index ae04387..063c6f5 100644
--- a/hostsidetests/jvmti/run-tests/test-931/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-931/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest931HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-931/app/Android.mk b/hostsidetests/jvmti/run-tests/test-931/app/Android.mk
index c03028a..52eed76 100644
--- a/hostsidetests/jvmti/run-tests/test-931/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-931/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-932/Android.mk b/hostsidetests/jvmti/run-tests/test-932/Android.mk
index c952c86..198adae 100644
--- a/hostsidetests/jvmti/run-tests/test-932/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-932/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest932HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-932/app/Android.mk b/hostsidetests/jvmti/run-tests/test-932/app/Android.mk
index 651a9ee..e0c96d3 100644
--- a/hostsidetests/jvmti/run-tests/test-932/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-932/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-940/Android.mk b/hostsidetests/jvmti/run-tests/test-940/Android.mk
index 4ed5dec..453dee0 100644
--- a/hostsidetests/jvmti/run-tests/test-940/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-940/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest940HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-940/app/Android.mk b/hostsidetests/jvmti/run-tests/test-940/app/Android.mk
index c2121eb..0ba569c 100644
--- a/hostsidetests/jvmti/run-tests/test-940/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-940/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-942/Android.mk b/hostsidetests/jvmti/run-tests/test-942/Android.mk
index d2605b7..8a6657f 100644
--- a/hostsidetests/jvmti/run-tests/test-942/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-942/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest942HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-942/app/Android.mk b/hostsidetests/jvmti/run-tests/test-942/app/Android.mk
index 82d3b6a..a29d4b6 100644
--- a/hostsidetests/jvmti/run-tests/test-942/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-942/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-944/Android.mk b/hostsidetests/jvmti/run-tests/test-944/Android.mk
index 16f9c7f..b90c3e3 100644
--- a/hostsidetests/jvmti/run-tests/test-944/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-944/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest944HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-944/app/Android.mk b/hostsidetests/jvmti/run-tests/test-944/app/Android.mk
index c820284..d564fc5 100644
--- a/hostsidetests/jvmti/run-tests/test-944/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-944/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-945/Android.mk b/hostsidetests/jvmti/run-tests/test-945/Android.mk
index e86d85e..754d7ca 100644
--- a/hostsidetests/jvmti/run-tests/test-945/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-945/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest945HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-945/app/Android.mk b/hostsidetests/jvmti/run-tests/test-945/app/Android.mk
index b704807..b1a8290 100644
--- a/hostsidetests/jvmti/run-tests/test-945/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-945/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-947/Android.mk b/hostsidetests/jvmti/run-tests/test-947/Android.mk
index 4b4cead..6a612e2 100644
--- a/hostsidetests/jvmti/run-tests/test-947/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-947/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest947HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-947/app/Android.mk b/hostsidetests/jvmti/run-tests/test-947/app/Android.mk
index 42cc459..5d315e8 100644
--- a/hostsidetests/jvmti/run-tests/test-947/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-947/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-951/Android.mk b/hostsidetests/jvmti/run-tests/test-951/Android.mk
index ba45b86..5a6d494 100644
--- a/hostsidetests/jvmti/run-tests/test-951/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-951/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest951HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-951/app/Android.mk b/hostsidetests/jvmti/run-tests/test-951/app/Android.mk
index 6b22274..273bec3 100644
--- a/hostsidetests/jvmti/run-tests/test-951/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-951/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-981/Android.mk b/hostsidetests/jvmti/run-tests/test-981/Android.mk
index 4bbc20a..151379b 100644
--- a/hostsidetests/jvmti/run-tests/test-981/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-981/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest981HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-981/app/Android.mk b/hostsidetests/jvmti/run-tests/test-981/app/Android.mk
index ec8f7aa..88727c2 100644
--- a/hostsidetests/jvmti/run-tests/test-981/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-981/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-982/Android.mk b/hostsidetests/jvmti/run-tests/test-982/Android.mk
index 908adaf..154bc70 100644
--- a/hostsidetests/jvmti/run-tests/test-982/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-982/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest982HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-982/app/Android.mk b/hostsidetests/jvmti/run-tests/test-982/app/Android.mk
index a06c76d..c6099b3 100644
--- a/hostsidetests/jvmti/run-tests/test-982/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-982/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/run-tests/test-984/Android.mk b/hostsidetests/jvmti/run-tests/test-984/Android.mk
index 3ddb2ad..1ff5f2e 100644
--- a/hostsidetests/jvmti/run-tests/test-984/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-984/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiRunTest984HostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/run-tests/test-984/app/Android.mk b/hostsidetests/jvmti/run-tests/test-984/app/Android.mk
index b30ff35..0a3c5ef 100644
--- a/hostsidetests/jvmti/run-tests/test-984/app/Android.mk
+++ b/hostsidetests/jvmti/run-tests/test-984/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES :=
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/jvmti/tagging/Android.mk b/hostsidetests/jvmti/tagging/Android.mk
index 61e06a4..b5674cb 100644
--- a/hostsidetests/jvmti/tagging/Android.mk
+++ b/hostsidetests/jvmti/tagging/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE := CtsJvmtiTaggingHostTestCases
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/tagging/app/Android.mk b/hostsidetests/jvmti/tagging/app/Android.mk
index 343dc32..3cd89c1 100644
--- a/hostsidetests/jvmti/tagging/app/Android.mk
+++ b/hostsidetests/jvmti/tagging/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceAppBase
LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
LOCAL_MULTILIB := both
diff --git a/hostsidetests/monkey/Android.mk b/hostsidetests/monkey/Android.mk
index 7c7ecb5..34305e8 100644
--- a/hostsidetests/monkey/Android.mk
+++ b/hostsidetests/monkey/Android.mk
@@ -28,7 +28,7 @@
LOCAL_CTS_TEST_PACKAGE := zzz.android.monkey
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/monkey/src/com/android/cts/monkey/CategoryTest.java b/hostsidetests/monkey/src/com/android/cts/monkey/CategoryTest.java
index ff04f6c..f3bb5d9 100644
--- a/hostsidetests/monkey/src/com/android/cts/monkey/CategoryTest.java
+++ b/hostsidetests/monkey/src/com/android/cts/monkey/CategoryTest.java
@@ -16,31 +16,73 @@
package com.android.cts.monkey;
+import com.android.tradefed.device.CollectingOutputReceiver;
+
+import java.util.concurrent.TimeUnit;
+
public class CategoryTest extends AbstractMonkeyTest {
+ private static final long MAX_TIMEOUT = 5 * 60 * 1000; // 5 min
+
public void testDefaultCategories() throws Exception {
- String out = mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[0] + " 5000");
- assertTrue(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
- assertTrue(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ String cmd = MONKEY_CMD + " -v -p " + PKGS[0] + " 5000";
+ CollectingOutputReceiver receiver = new CollectingOutputReceiver();
+ try {
+ mDevice.executeShellCommand(cmd, receiver, MAX_TIMEOUT, TimeUnit.MILLISECONDS, 0);
+ String out = receiver.getOutput();
+ assertTrue(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
+ assertTrue(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ } finally {
+ receiver.cancel();
+ receiver.clearBuffer();
+ receiver = null;
+ }
}
public void testSingleCategory() throws Exception {
- String out = mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[0]
- + " -c android.intent.category.LAUNCHER 5000");
- assertTrue(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
- assertFalse(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ String cmd = MONKEY_CMD + " -v -p " + PKGS[0]
+ + " -c android.intent.category.LAUNCHER 5000";
+ CollectingOutputReceiver receiver = new CollectingOutputReceiver();
+ try {
+ mDevice.executeShellCommand(cmd, receiver, MAX_TIMEOUT, TimeUnit.MILLISECONDS, 0);
+ String out = receiver.getOutput();
+ assertTrue(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
+ assertFalse(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ } finally {
+ receiver.cancel();
+ receiver.clearBuffer();
+ receiver = null;
+ }
- out = mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[0]
- + " -c android.intent.category.MONKEY 5000");
- assertFalse(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
- assertTrue(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ CollectingOutputReceiver receiver2 = new CollectingOutputReceiver();
+ try {
+ mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[0]
+ + " -c android.intent.category.MONKEY 5000", receiver2, MAX_TIMEOUT,
+ TimeUnit.MILLISECONDS, 0);
+ String out = receiver2.getOutput();
+ assertFalse(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
+ assertTrue(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ } finally {
+ receiver2.cancel();
+ receiver2.clearBuffer();
+ receiver2 = null;
+ }
}
public void testMultipleCategories() throws Exception {
- String out = mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[0]
+ String cmd = MONKEY_CMD + " -v -p " + PKGS[0]
+ " -c android.intent.category.LAUNCHER"
- + " -c android.intent.category.MONKEY 5000");
- assertTrue(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
- assertTrue(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ + " -c android.intent.category.MONKEY 5000";
+ CollectingOutputReceiver receiver = new CollectingOutputReceiver();
+ try {
+ mDevice.executeShellCommand(cmd, receiver, MAX_TIMEOUT, TimeUnit.MILLISECONDS, 0);
+ String out = receiver.getOutput();
+ assertTrue(out.contains("cmp=com.android.cts.monkey/.MonkeyActivity"));
+ assertTrue(out.contains("cmp=com.android.cts.monkey/.BaboonActivity"));
+ } finally {
+ receiver.cancel();
+ receiver.clearBuffer();
+ receiver = null;
+ }
}
}
diff --git a/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java b/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java
index 997f7c6..0241879 100644
--- a/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java
+++ b/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java
@@ -16,6 +16,7 @@
package com.android.cts.monkey;
+import com.android.ddmlib.NullOutputReceiver;
import com.android.tradefed.device.DeviceNotAvailableException;
import java.util.Scanner;
@@ -32,7 +33,8 @@
public void testNotMonkey() throws Exception {
mDevice.executeShellCommand("am start -W -a android.intent.action.MAIN "
- + "-n com.android.cts.monkey/com.android.cts.monkey.MonkeyActivity");
+ + "-n com.android.cts.monkey/com.android.cts.monkey.MonkeyActivity",
+ new NullOutputReceiver());
assertIsUserAMonkey(false);
}
diff --git a/hostsidetests/monkey/src/com/android/cts/monkey/PackageTest.java b/hostsidetests/monkey/src/com/android/cts/monkey/PackageTest.java
index 986304c..b3a22d6 100644
--- a/hostsidetests/monkey/src/com/android/cts/monkey/PackageTest.java
+++ b/hostsidetests/monkey/src/com/android/cts/monkey/PackageTest.java
@@ -16,10 +16,14 @@
package com.android.cts.monkey;
+import com.android.tradefed.device.CollectingOutputReceiver;
+
+import java.util.concurrent.TimeUnit;
import java.util.regex.Pattern;
public class PackageTest extends AbstractMonkeyTest {
+ private static final long MAX_TIMEOUT = 5 * 60 * 1000; // 5 min
private static final int MAX_ERROR_LENGTH = 256;
private static final Pattern ALLOW_MONKEY =
Pattern.compile("^.*Allowing.*cmp=com\\.android\\.cts\\.monkey/\\.MonkeyActivity.*$",
@@ -30,23 +34,49 @@
Pattern.MULTILINE);
public void testSinglePackage() throws Exception {
- String out = mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[0] + " 5000");
- String error = truncateError(out);
- assertTrue("Monkey not found in: " + error, ALLOW_MONKEY.matcher(out).find());
- assertFalse("Chimp found in: " + error, ALLOW_CHIMP.matcher(out).find());
+ String cmd = MONKEY_CMD + " -v -p " + PKGS[0] + " 5000";
+ CollectingOutputReceiver receiver = new CollectingOutputReceiver();
+ try {
+ mDevice.executeShellCommand(cmd, receiver, MAX_TIMEOUT, TimeUnit.MILLISECONDS, 0);
+ String out = receiver.getOutput();
+ String error = truncateError(out);
+ assertTrue("Monkey not found in: " + error, ALLOW_MONKEY.matcher(out).find());
+ assertFalse("Chimp found in: " + error, ALLOW_CHIMP.matcher(out).find());
+ } finally {
+ receiver.cancel();
+ receiver.clearBuffer();
+ receiver = null;
+ }
- out = mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[1] + " 5000");
- error = truncateError(out);
- assertFalse("Monkey found in: " + error, ALLOW_MONKEY.matcher(out).find());
- assertTrue("Chimp not found in: " + error, ALLOW_CHIMP.matcher(out).find());
+ String cmd2 = MONKEY_CMD + " -v -p " + PKGS[1] + " 5000";
+ CollectingOutputReceiver receiver2 = new CollectingOutputReceiver();
+ try {
+ mDevice.executeShellCommand(cmd2, receiver2, MAX_TIMEOUT, TimeUnit.MILLISECONDS, 0);
+ String out = receiver2.getOutput();
+ String error = truncateError(out);
+ assertFalse("Monkey found in: " + error, ALLOW_MONKEY.matcher(out).find());
+ assertTrue("Chimp not found in: " + error, ALLOW_CHIMP.matcher(out).find());
+ } finally {
+ receiver2.cancel();
+ receiver2.clearBuffer();
+ receiver2 = null;
+ }
}
public void testMultiplePackages() throws Exception {
- String out = mDevice.executeShellCommand(MONKEY_CMD + " -v -p " + PKGS[0]
- + " -p " + PKGS[1] + " 5000");
- String error = truncateError(out);
- assertTrue("Monkey not found in: " + error, ALLOW_MONKEY.matcher(out).find());
- assertTrue("Chimp not found in: " + error, ALLOW_CHIMP.matcher(out).find());
+ String cmd = MONKEY_CMD + " -v -p " + PKGS[0] + " -p " + PKGS[1] + " 5000";
+ CollectingOutputReceiver receiver = new CollectingOutputReceiver();
+ try {
+ mDevice.executeShellCommand(cmd, receiver, MAX_TIMEOUT, TimeUnit.MILLISECONDS, 0);
+ String out = receiver.getOutput();
+ String error = truncateError(out);
+ assertTrue("Monkey not found in: " + error, ALLOW_MONKEY.matcher(out).find());
+ assertTrue("Chimp not found in: " + error, ALLOW_CHIMP.matcher(out).find());
+ } finally {
+ receiver.cancel();
+ receiver.clearBuffer();
+ receiver = null;
+ }
}
private static final String truncateError(String input) {
diff --git a/hostsidetests/monkey/src/com/android/cts/monkey/SeedTest.java b/hostsidetests/monkey/src/com/android/cts/monkey/SeedTest.java
index a0016e2..973e986 100644
--- a/hostsidetests/monkey/src/com/android/cts/monkey/SeedTest.java
+++ b/hostsidetests/monkey/src/com/android/cts/monkey/SeedTest.java
@@ -25,7 +25,9 @@
String out1 = mDevice.executeShellCommand(cmd1);
String out2 = mDevice.executeShellCommand(cmd1);
assertOutputs(out1, out2);
+ }
+ public void testSeed2() throws Exception {
String cmd2 = MONKEY_CMD + " -s 3007 -v -p " + PKGS[0] + " 125";
String out3 = mDevice.executeShellCommand(cmd2);
String out4 = mDevice.executeShellCommand(cmd2);
diff --git a/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.mk b/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.mk
index 573b488..56b27f0 100644
--- a/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.mk
+++ b/hostsidetests/monkey/test-apps/CtsMonkeyApp/Android.mk
@@ -31,6 +31,6 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.mk b/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.mk
index 22c8bf3..1cf9256 100644
--- a/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.mk
+++ b/hostsidetests/monkey/test-apps/CtsMonkeyApp2/Android.mk
@@ -31,6 +31,6 @@
LOCAL_DEX_PREOPT := false
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/multiuser/Android.mk b/hostsidetests/multiuser/Android.mk
index ec18912..a043b55 100644
--- a/hostsidetests/multiuser/Android.mk
+++ b/hostsidetests/multiuser/Android.mk
@@ -27,7 +27,7 @@
LOCAL_CTS_TEST_PACKAGE := android.host.multiuser
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/net/Android.mk b/hostsidetests/net/Android.mk
index 1c3f053..88fbe0c 100644
--- a/hostsidetests/net/Android.mk
+++ b/hostsidetests/net/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.net.hostsidenetwork
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/net/app/Android.mk b/hostsidetests/net/app/Android.mk
index 1c1a798..5e8c2b6 100644
--- a/hostsidetests/net/app/Android.mk
+++ b/hostsidetests/net/app/Android.mk
@@ -31,6 +31,6 @@
LOCAL_DEX_PREOPT := false
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/net/app2/Android.mk b/hostsidetests/net/app2/Android.mk
index 706455d..02071bf 100644
--- a/hostsidetests/net/app2/Android.mk
+++ b/hostsidetests/net/app2/Android.mk
@@ -30,6 +30,6 @@
LOCAL_DEX_PREOPT := false
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/numberblocking/Android.mk b/hostsidetests/numberblocking/Android.mk
index 42c7169..1aac30f 100644
--- a/hostsidetests/numberblocking/Android.mk
+++ b/hostsidetests/numberblocking/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsHostsideNumberBlockingTestCases
diff --git a/hostsidetests/numberblocking/AndroidTest.xml b/hostsidetests/numberblocking/AndroidTest.xml
index c7597c4..70ccef9 100644
--- a/hostsidetests/numberblocking/AndroidTest.xml
+++ b/hostsidetests/numberblocking/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS number blocking test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsHostsideNumberBlockingAppTest.apk" />
</target_preparer>
diff --git a/hostsidetests/numberblocking/app/Android.mk b/hostsidetests/numberblocking/app/Android.mk
index 5755f84..e98e508 100644
--- a/hostsidetests/numberblocking/app/Android.mk
+++ b/hostsidetests/numberblocking/app/Android.mk
@@ -27,10 +27,10 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test legacy-android-test
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsHostsideNumberBlockingAppTest
diff --git a/hostsidetests/os/Android.mk b/hostsidetests/os/Android.mk
index e54703e..3b8a1cf 100644
--- a/hostsidetests/os/Android.mk
+++ b/hostsidetests/os/Android.mk
@@ -28,7 +28,7 @@
LOCAL_CTS_TEST_PACKAGE := android.host.os
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/os/AndroidTest.xml b/hostsidetests/os/AndroidTest.xml
index 5563021..ccf56e1 100644
--- a/hostsidetests/os/AndroidTest.xml
+++ b/hostsidetests/os/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for the CTS OS host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDeviceOsTestApp.apk" />
<option name="test-file-name" value="CtsHostProcfsTestApp.apk" />
diff --git a/hostsidetests/os/app/Android.mk b/hostsidetests/os/app/Android.mk
index 86c109e..1897198 100644
--- a/hostsidetests/os/app/Android.mk
+++ b/hostsidetests/os/app/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceOsTestApp
diff --git a/hostsidetests/os/test-apps/Android.mk b/hostsidetests/os/test-apps/Android.mk
index 4afd486..9fadf37 100644
--- a/hostsidetests/os/test-apps/Android.mk
+++ b/hostsidetests/os/test-apps/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Build the test APKs using their own makefiles
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
index 7ab0433..cfe131c 100644
--- a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
+++ b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
@@ -24,6 +24,6 @@
LOCAL_PACKAGE_NAME := CtsHostLinkVerificationApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/ProcfsTestApp/Android.mk b/hostsidetests/os/test-apps/ProcfsTestApp/Android.mk
index f7b98c3..a168845 100644
--- a/hostsidetests/os/test-apps/ProcfsTestApp/Android.mk
+++ b/hostsidetests/os/test-apps/ProcfsTestApp/Android.mk
@@ -26,6 +26,6 @@
LOCAL_PACKAGE_NAME := CtsHostProcfsTestApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
index a333d42..67335f4 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
@@ -30,6 +30,6 @@
LOCAL_PACKAGE_NAME := CtsStaticSharedLibConsumerApp1
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
index 9c2efaf..8ce6c9a 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
@@ -27,6 +27,6 @@
LOCAL_PACKAGE_NAME := CtsStaticSharedLibConsumerApp2
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.mk
index 8a46932..c1f8cd1 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp1/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.mk
index 41d1eec..bd7a27e 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp2/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS := --shared-lib
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.mk
index 0be0049..04b794c 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp3/Android.mk
@@ -23,7 +23,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS := --shared-lib
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.mk
index e5becb5..b4c5248 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp4/Android.mk
@@ -25,7 +25,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PROGUARD_ENABLED := disabled
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.mk
index bfe894a..99acb17 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp5/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS := --shared-lib
diff --git a/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.mk
index 335cce9..ef92c71 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibProviderApp6/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS := --shared-lib
diff --git a/hostsidetests/sample/Android.mk b/hostsidetests/sample/Android.mk
index bfdaeda..427d72a 100644
--- a/hostsidetests/sample/Android.mk
+++ b/hostsidetests/sample/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsSampleHostTestCases
diff --git a/hostsidetests/sample/AndroidTest.xml b/hostsidetests/sample/AndroidTest.xml
index 5f5d23d..6d011a1 100644
--- a/hostsidetests/sample/AndroidTest.xml
+++ b/hostsidetests/sample/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Sample host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSampleDeviceApp.apk" />
</target_preparer>
diff --git a/hostsidetests/sample/app/Android.mk b/hostsidetests/sample/app/Android.mk
index 7e7cd91..c69f29f 100644
--- a/hostsidetests/sample/app/Android.mk
+++ b/hostsidetests/sample/app/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsSampleDeviceApp
diff --git a/hostsidetests/sample/app2/Android.mk b/hostsidetests/sample/app2/Android.mk
index 0900f1f..4c20ae3 100644
--- a/hostsidetests/sample/app2/Android.mk
+++ b/hostsidetests/sample/app2/Android.mk
@@ -30,7 +30,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsSampleDeviceApp2
diff --git a/hostsidetests/security/Android.mk b/hostsidetests/security/Android.mk
index ffb5add..5544dc6 100644
--- a/hostsidetests/security/Android.mk
+++ b/hostsidetests/security/Android.mk
@@ -23,7 +23,7 @@
LOCAL_MODULE_TAGS := optional
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Must match the package name in CtsTestCaseList.mk
LOCAL_MODULE := CtsSecurityHostTestCases
diff --git a/hostsidetests/security/securityPatch/CVE-2016-6730/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-6730/Android.mk
index 14337ab..350a4fe 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-6730/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-6730/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-6731/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-6731/Android.mk
index 718dbe3..4e14be4 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-6731/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-6731/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-6732/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-6732/Android.mk
index 03b7b87..7c289a4 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-6732/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-6732/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-6733/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-6733/Android.mk
index 7b02188..a535f0b 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-6733/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-6733/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-6734/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-6734/Android.mk
index e1eebbd..9450db9 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-6734/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-6734/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-6735/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-6735/Android.mk
index 8935cd6..d089c40 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-6735/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-6735/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-6736/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-6736/Android.mk
index fd7fc21..bb6efc8 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-6736/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-6736/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8412/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8412/Android.mk
index bba13f3..197690f 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8412/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8412/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8424/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8424/Android.mk
index 5ff169b..2b33fd4 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8424/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8424/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8425/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8425/Android.mk
index e984812..8b1ab64 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8425/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8425/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8426/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8426/Android.mk
index a134d9c..c5c7521 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8426/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8426/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8427/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8427/Android.mk
index 131f240..5e4c323 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8427/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8427/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8428/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8428/Android.mk
index 21326f9..dd68436 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8428/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8428/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8429/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8429/Android.mk
index bfe8718..438a578 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8429/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8429/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8430/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8430/Android.mk
index 839047b..f0a0e60 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8430/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8430/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8431/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8431/Android.mk
index d0ef823..ccfbab8 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8431/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8431/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8432/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8432/Android.mk
index 614d20b..235c323 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8432/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8432/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8434/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8434/Android.mk
index 6b20fe4..8c8cc35 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8434/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8434/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8435/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8435/Android.mk
index 62efb65..6dbedc1 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8435/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8435/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8444/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8444/Android.mk
index 50e2f6a..2e667ab 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8444/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8444/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8448/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8448/Android.mk
index cd6049f..155f72b 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8448/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8448/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8449/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8449/Android.mk
index ce1e1bb..a905cc9 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8449/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8449/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8460/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8460/Android.mk
index b9c51d1..51f8169 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8460/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8460/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-8482/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-8482/Android.mk
index b41fb16..16ceff2 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-8482/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-8482/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2016-9120/Android.mk b/hostsidetests/security/securityPatch/CVE-2016-9120/Android.mk
index 95ddb3d..b5d138d 100644
--- a/hostsidetests/security/securityPatch/CVE-2016-9120/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2016-9120/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2017-0403/Android.mk b/hostsidetests/security/securityPatch/CVE-2017-0403/Android.mk
index cb31e4d..bd84bec 100644
--- a/hostsidetests/security/securityPatch/CVE-2017-0403/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2017-0403/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2017-0404/Android.mk b/hostsidetests/security/securityPatch/CVE-2017-0404/Android.mk
index 9e30d30..66978e0 100644
--- a/hostsidetests/security/securityPatch/CVE-2017-0404/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2017-0404/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/securityPatch/CVE-2017-0429/Android.mk b/hostsidetests/security/securityPatch/CVE-2017-0429/Android.mk
index afb77b4..495a935 100644
--- a/hostsidetests/security/securityPatch/CVE-2017-0429/Android.mk
+++ b/hostsidetests/security/securityPatch/CVE-2017-0429/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
index 46779de..2bed406 100644
--- a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
+++ b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
@@ -46,6 +46,7 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.Scanner;
@@ -60,6 +61,8 @@
*/
public class SELinuxHostTest extends DeviceTestCase implements IBuildReceiver, IDeviceTest {
+ private static final Map<ITestDevice, File> cachedDevicePolicyFiles = new HashMap<>(1);
+
private File sepolicyAnalyze;
private File checkSeapp;
private File checkFc;
@@ -133,10 +136,33 @@
sepolicyAnalyze = buildHelper.getTestFile("sepolicy-analyze");
sepolicyAnalyze.setExecutable(true);
- /* obtain sepolicy file from running device */
- devicePolicyFile = File.createTempFile("sepolicy", ".tmp");
- devicePolicyFile.deleteOnExit();
- mDevice.pullFile("/sys/fs/selinux/policy", devicePolicyFile);
+ devicePolicyFile = getDevicePolicyFile(mDevice);
+ }
+
+ // NOTE: cts/tools/selinux depends on this method. Rename/change with caution.
+ /**
+ * Returns the host-side file containing the SELinux policy of the device under test.
+ */
+ public static File getDevicePolicyFile(ITestDevice device) throws Exception {
+ // IMPLEMENTATION DETAILS: We cache the host-side policy file on per-device basis (in case
+ // CTS supports running against multiple devices at the same time). HashMap is used instead
+ // of WeakHashMap because in the grand scheme of things, keeping ITestDevice and
+ // corresponding File objects from being garbage-collected is not a big deal in CTS. If this
+ // becomes a big deal, this can be switched to WeakHashMap.
+ File file;
+ synchronized (cachedDevicePolicyFiles) {
+ file = cachedDevicePolicyFiles.get(device);
+ }
+ if (file != null) {
+ return file;
+ }
+ file = File.createTempFile("sepolicy", ".tmp");
+ file.deleteOnExit();
+ device.pullFile("/sys/fs/selinux/policy", file);
+ synchronized (cachedDevicePolicyFiles) {
+ cachedDevicePolicyFiles.put(device, file);
+ }
+ return file;
}
/**
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/Android.mk b/hostsidetests/services/activityandwindowmanager/activitymanager/Android.mk
index 3a50232..6ca5278 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/Android.mk
@@ -30,7 +30,7 @@
LOCAL_CTS_TEST_PACKAGE := android.server
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/AndroidTest.xml b/hostsidetests/services/activityandwindowmanager/activitymanager/AndroidTest.xml
index 3aecd01..883cc5b 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/AndroidTest.xml
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/AndroidTest.xml
@@ -14,16 +14,17 @@
limitations under the License.
-->
<configuration description="Config for CTS Sample host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDeviceServicesTestApp.apk" />
<option name="test-file-name" value="CtsDeviceServicesTestSecondApp.apk" />
<option name="test-file-name" value="CtsDeviceServicesTestThirdApp.apk" />
+ <option name="test-file-name" value="CtsDeviceDebuggableApp.apk" />
<option name="test-file-name" value="CtsDeviceDisplaySizeApp.apk" />
<option name="test-file-name" value="CtsDeviceTranslucentTestApp.apk" />
</target_preparer>
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CtsServicesHostTestCases.jar" />
- <option name="runtime-hint" value="4m7s" />
+ <option name="runtime-hint" value="4m44s" />
</test>
</configuration>
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/app/Android.mk b/hostsidetests/services/activityandwindowmanager/activitymanager/app/Android.mk
index 2633c0a..9a5dcbc 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/app/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/app/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceServicesTestApp
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/Android.mk b/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/Android.mk
new file mode 100644
index 0000000..fa381fb
--- /dev/null
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/Android.mk
@@ -0,0 +1,31 @@
+# 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)
+
+# don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_SDK_VERSION := test_current
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
+
+LOCAL_PACKAGE_NAME := CtsDeviceDebuggableApp
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/AndroidManifest.xml b/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/AndroidManifest.xml
new file mode 100644
index 0000000..c00f2b6
--- /dev/null
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.server.cts.debuggable">
+
+ <!--
+ * Security policy requires that only debuggable processes can be profiled
+ * which is tested by ActivityManagerAmProfileTests.
+ -->
+ <application android:debuggable="true">
+ <activity android:name=".DebuggableAppActivity"
+ android:resizeableActivity="true"
+ android:exported="true" />
+ </application>
+
+</manifest>
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/src/android/server/cts/debuggable/DebuggableAppActivity.java b/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/src/android/server/cts/debuggable/DebuggableAppActivity.java
new file mode 100644
index 0000000..504ffcf
--- /dev/null
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/appDebuggable/src/android/server/cts/debuggable/DebuggableAppActivity.java
@@ -0,0 +1,22 @@
+/*
+ * 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
+ */
+
+package android.server.cts.debuggable;
+
+import android.app.Activity;
+
+public class DebuggableAppActivity extends Activity {
+}
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/appDisplaySize/Android.mk b/hostsidetests/services/activityandwindowmanager/activitymanager/appDisplaySize/Android.mk
index 7f7abd2..95af843 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/appDisplaySize/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/appDisplaySize/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceDisplaySizeApp
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/appSecondUid/Android.mk b/hostsidetests/services/activityandwindowmanager/activitymanager/appSecondUid/Android.mk
index b591589..109279f 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/appSecondUid/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/appSecondUid/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceServicesTestSecondApp
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/appThirdUid/Android.mk b/hostsidetests/services/activityandwindowmanager/activitymanager/appThirdUid/Android.mk
index 4e71662..73304b4 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/appThirdUid/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/appThirdUid/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceServicesTestThirdApp
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerAmProfileTests.java b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerAmProfileTests.java
new file mode 100644
index 0000000..f462c60
--- /dev/null
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerAmProfileTests.java
@@ -0,0 +1,166 @@
+/*
+ * 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.
+ */
+
+package android.server.cts;
+
+import com.google.common.io.Files;
+
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.util.FileUtil;
+
+import java.io.File;
+import java.lang.StringBuilder;
+
+/**
+ * Build: mmma -j32 cts/hostsidetests/services
+ * Run: cts/hostsidetests/services/activityandwindowmanager/util/run-test CtsServicesHostTestCases android.server.cts.ActivityManagerAmProfileTests
+ *
+ * Please talk to Android Studio team first if you want to modify or delete these tests.
+ */
+public class ActivityManagerAmProfileTests extends ActivityManagerTestBase {
+
+ private static final String TEST_PACKAGE_NAME = "android.server.cts.debuggable";
+ private static final String TEST_ACTIVITY_NAME = "DebuggableAppActivity";
+ private static final String OUTPUT_FILE_PATH = "/data/local/tmp/profile.trace";
+ private static final String FIRST_WORD_NO_STREAMING = "*version\n";
+ private static final String FIRST_WORD_STREAMING = "SLOW"; // Magic word set by runtime.
+
+ private ITestDevice mDevice;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mDevice = getDevice();
+ setComponentName(TEST_PACKAGE_NAME);
+ }
+
+ /**
+ * Test am profile functionality with the following 3 configurable options:
+ * starting the activity before start profiling? yes;
+ * sampling-based profiling? no;
+ * using streaming output mode? no.
+ */
+ public void testAmProfileStartNoSamplingNoStreaming() throws Exception {
+ // am profile start ... , and the same to the following 3 test methods.
+ testProfile(true, false, false);
+ }
+
+ /**
+ * The following tests are similar to testAmProfileStartNoSamplingNoStreaming(),
+ * only different in the three configuration options.
+ */
+ public void testAmProfileStartNoSamplingStreaming() throws Exception {
+ testProfile(true, false, true);
+ }
+ public void testAmProfileStartSamplingNoStreaming() throws Exception {
+ testProfile(true, true, false);
+ }
+ public void testAmProfileStartSamplingStreaming() throws Exception {
+ testProfile(true, true, true);
+ }
+ public void testAmStartStartProfilerNoSamplingNoStreaming() throws Exception {
+ // am start --start-profiler ..., and the same to the following 3 test methods.
+ testProfile(false, false, false);
+ }
+ public void testAmStartStartProfilerNoSamplingStreaming() throws Exception {
+ testProfile(false, false, true);
+ }
+ public void testAmStartStartProfilerSamplingNoStreaming() throws Exception {
+ testProfile(false, true, false);
+ }
+ public void testAmStartStartProfilerSamplingStreaming() throws Exception {
+ testProfile(false, true, true);
+ }
+
+ private void testProfile(boolean startActivityFirst,
+ boolean sampling, boolean streaming) throws Exception {
+ if (startActivityFirst) {
+ launchActivity(TEST_ACTIVITY_NAME);
+ }
+
+ String cmd = getStartCmd(TEST_ACTIVITY_NAME, startActivityFirst, sampling, streaming);
+ executeShellCommand(cmd);
+ // Go to home screen and then warm start the activity to generate some interesting trace.
+ pressHomeButton();
+ launchActivity(TEST_ACTIVITY_NAME);
+
+ cmd = "am profile stop " + componentName;
+ executeShellCommand(cmd);
+ // Sleep for 0.1 second (100 milliseconds) so the generation of the profiling
+ // file is complete.
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ //ignored
+ }
+ verifyOutputFileFormat(streaming);
+ }
+
+ private String getStartCmd(String activityName, boolean activityAlreadyStarted,
+ boolean sampling, boolean streaming) {
+ StringBuilder builder = new StringBuilder("am");
+ if (activityAlreadyStarted) {
+ builder.append(" profile start");
+ } else {
+ builder.append(String.format(" start -n %s/.%s -W -S --start-profiler %s",
+ componentName, activityName, OUTPUT_FILE_PATH));
+ }
+ if (sampling) {
+ builder.append(" --sampling 1000");
+ }
+ if (streaming) {
+ builder.append(" --streaming");
+ }
+ if (activityAlreadyStarted) {
+ builder.append(String.format(" %s %s", componentName, OUTPUT_FILE_PATH));
+ } else {
+
+ }
+ return builder.toString();
+ }
+
+ private void verifyOutputFileFormat(boolean streaming) throws Exception {
+ String expectedFirstWord = streaming ? FIRST_WORD_STREAMING : FIRST_WORD_NO_STREAMING;
+ byte[] data = readFileOnClient(OUTPUT_FILE_PATH);
+ assertTrue("data size=" + data.length, data.length >= expectedFirstWord.length());
+ String actualFirstWord = new String(data, 0, expectedFirstWord.length());
+ assertTrue("Unexpected first word: '" + actualFirstWord + "'",
+ actualFirstWord.equals(expectedFirstWord));
+ // Clean up.
+ executeShellCommand("rm -f " + OUTPUT_FILE_PATH);
+ }
+
+ private byte[] readFileOnClient(String clientPath) throws Exception {
+ assertTrue("File not found on client: " + clientPath,
+ mDevice.doesFileExist(clientPath));
+ File copyOnHost = File.createTempFile("host", "copy");
+ try {
+ executeAdbCommand("pull", clientPath, copyOnHost.getPath());
+ return Files.toByteArray(copyOnHost);
+ } finally {
+ FileUtil.deleteFile(copyOnHost);
+ }
+ }
+
+ private String[] executeAdbCommand(String... command) throws DeviceNotAvailableException {
+ String output = mDevice.executeAdbCommand(command);
+ // "".split() returns { "" }, but we want an empty array
+ String[] lines = output.equals("") ? new String[0] : output.split("\n");
+ return lines;
+ }
+
+}
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/Android.mk b/hostsidetests/services/activityandwindowmanager/windowmanager/Android.mk
index 79470c6..2ce16d8 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/Android.mk
@@ -30,7 +30,7 @@
LOCAL_CTS_TEST_PACKAGE := android.server.cts
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/AndroidTest.xml b/hostsidetests/services/activityandwindowmanager/windowmanager/AndroidTest.xml
index f1d8397..194cd05 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/AndroidTest.xml
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS window manager host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDragAndDropSourceApp.apk" />
<option name="test-file-name" value="CtsDragAndDropTargetApp.apk" />
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowapp/Android.mk b/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowapp/Android.mk
index a0f71dd..1bdeeb4 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowapp/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowapp/Android.mk
@@ -26,7 +26,7 @@
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceAlertWindowTestApp
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowappsdk25/Android.mk b/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowappsdk25/Android.mk
index 940f7a6..4a4c0c7 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowappsdk25/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/alertwindowappsdk25/Android.mk
@@ -25,7 +25,7 @@
LOCAL_SDK_VERSION := 25
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceAlertWindowTestAppSdk25
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/dndsourceapp/Android.mk b/hostsidetests/services/activityandwindowmanager/windowmanager/dndsourceapp/Android.mk
index 1ec751c..4cd44ed 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/dndsourceapp/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/dndsourceapp/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDragAndDropSourceApp
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetapp/Android.mk b/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetapp/Android.mk
index 7dc512c..10fe386 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetapp/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetapp/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDragAndDropTargetApp
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetappsdk23/Android.mk b/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetappsdk23/Android.mk
index a42f8d0..2907241 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetappsdk23/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/dndtargetappsdk23/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := 23
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDragAndDropTargetAppSdk23
diff --git a/hostsidetests/services/activityandwindowmanager/windowmanager/frametestapp/Android.mk b/hostsidetests/services/activityandwindowmanager/windowmanager/frametestapp/Android.mk
index e5aa610..7719315 100644
--- a/hostsidetests/services/activityandwindowmanager/windowmanager/frametestapp/Android.mk
+++ b/hostsidetests/services/activityandwindowmanager/windowmanager/frametestapp/Android.mk
@@ -24,7 +24,7 @@
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDeviceWindowFramesTestApp
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
index 810fe64..3871c0d 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher1
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
index 3eb0cde..65a1a28 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher2
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
index 0b072a5..ab0b4ce 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutBackupLauncher3
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
index a729fe8..179f2be 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher1
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
index 12a0995..6376c86 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher2
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
index 4232034..f59093b 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutBackupPublisher3
diff --git a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk b/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
index 183531b..f48b4ce 100644
--- a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
@@ -19,7 +19,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutMultiuserTest
diff --git a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk b/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
index 11bfc2f..d9d7079 100644
--- a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
@@ -21,7 +21,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutUpgradeVersion1
@@ -52,7 +52,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutUpgradeVersion2
diff --git a/hostsidetests/shortcuts/hostside/Android.mk b/hostsidetests/shortcuts/hostside/Android.mk
index 830ec94..6eeb001 100644
--- a/hostsidetests/shortcuts/hostside/Android.mk
+++ b/hostsidetests/shortcuts/hostside/Android.mk
@@ -27,7 +27,7 @@
LOCAL_JAVA_LIBRARIES := tools-common-prebuilt cts-tradefed tradefed
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/sustainedperf/Android.mk b/hostsidetests/sustainedperf/Android.mk
index a9f06e4..3187415 100644
--- a/hostsidetests/sustainedperf/Android.mk
+++ b/hostsidetests/sustainedperf/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_TAGS := tests
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MODULE := CtsSustainedPerformanceHostTestCases
LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
diff --git a/hostsidetests/sustainedperf/AndroidTest.xml b/hostsidetests/sustainedperf/AndroidTest.xml
index 8b843d2..59ba8d2 100644
--- a/hostsidetests/sustainedperf/AndroidTest.xml
+++ b/hostsidetests/sustainedperf/AndroidTest.xml
@@ -14,11 +14,11 @@
limitations under the License.
-->
<configuration description="Config for CTS Sustained Performance host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSustainedPerformanceTestCases.apk" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSustainedPerformanceDeviceTestApp.apk" />
</target_preparer>
diff --git a/hostsidetests/sustainedperf/app/Android.mk b/hostsidetests/sustainedperf/app/Android.mk
index 41f61e4..473621a 100644
--- a/hostsidetests/sustainedperf/app/Android.mk
+++ b/hostsidetests/sustainedperf/app/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsSustainedPerformanceDeviceTestApp
diff --git a/hostsidetests/sustainedperf/dhrystone/Android.mk b/hostsidetests/sustainedperf/dhrystone/Android.mk
index 4c6b53d..b7a2baf 100644
--- a/hostsidetests/sustainedperf/dhrystone/Android.mk
+++ b/hostsidetests/sustainedperf/dhrystone/Android.mk
@@ -14,5 +14,5 @@
LOCAL_MULTILIB := both
LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_EXECUTABLE)
diff --git a/hostsidetests/sustainedperf/shadertoy_android/Android.mk b/hostsidetests/sustainedperf/shadertoy_android/Android.mk
index 0c6c2a4..c9a5000 100644
--- a/hostsidetests/sustainedperf/shadertoy_android/Android.mk
+++ b/hostsidetests/sustainedperf/shadertoy_android/Android.mk
@@ -33,6 +33,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/systemui/Android.mk b/hostsidetests/systemui/Android.mk
index d4305f5..a2bcf05 100644
--- a/hostsidetests/systemui/Android.mk
+++ b/hostsidetests/systemui/Android.mk
@@ -29,7 +29,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/systemui/AndroidTest.xml b/hostsidetests/systemui/AndroidTest.xml
index 21e7e4c..8a83259 100644
--- a/hostsidetests/systemui/AndroidTest.xml
+++ b/hostsidetests/systemui/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS System UI host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSystemUiDeviceApp.apk" />
</target_preparer>
diff --git a/hostsidetests/systemui/app/Android.mk b/hostsidetests/systemui/app/Android.mk
index ca987e7..6e45818 100644
--- a/hostsidetests/systemui/app/Android.mk
+++ b/hostsidetests/systemui/app/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsSystemUiDeviceApp
diff --git a/hostsidetests/theme/Android.mk b/hostsidetests/theme/Android.mk
index 7d1d18c..c79bd13 100644
--- a/hostsidetests/theme/Android.mk
+++ b/hostsidetests/theme/Android.mk
@@ -38,7 +38,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/theme/AndroidTest.xml b/hostsidetests/theme/AndroidTest.xml
index 6f80107..be16edf 100644
--- a/hostsidetests/theme/AndroidTest.xml
+++ b/hostsidetests/theme/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Theme host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsThemeDeviceApp.apk" />
</target_preparer>
diff --git a/hostsidetests/theme/app/Android.mk b/hostsidetests/theme/app/Android.mk
index 5f6b11c..cb97bc0 100644
--- a/hostsidetests/theme/app/Android.mk
+++ b/hostsidetests/theme/app/Android.mk
@@ -36,7 +36,7 @@
LOCAL_PACKAGE_NAME := CtsThemeDeviceApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := 23
diff --git a/hostsidetests/theme/assets/OMR1 b/hostsidetests/theme/assets/OMR1
new file mode 120000
index 0000000..978b4e8
--- /dev/null
+++ b/hostsidetests/theme/assets/OMR1
@@ -0,0 +1 @@
+26
\ No newline at end of file
diff --git a/hostsidetests/theme/assets/P b/hostsidetests/theme/assets/P
new file mode 120000
index 0000000..978b4e8
--- /dev/null
+++ b/hostsidetests/theme/assets/P
@@ -0,0 +1 @@
+26
\ No newline at end of file
diff --git a/hostsidetests/trustedvoice/Android.mk b/hostsidetests/trustedvoice/Android.mk
index d80f725..a0bc98b 100644
--- a/hostsidetests/trustedvoice/Android.mk
+++ b/hostsidetests/trustedvoice/Android.mk
@@ -28,7 +28,7 @@
LOCAL_CTS_TEST_PACKAGE := android.host.trustedvoice
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/trustedvoice/AndroidTest.xml b/hostsidetests/trustedvoice/AndroidTest.xml
index 7a11095..47cfe74 100644
--- a/hostsidetests/trustedvoice/AndroidTest.xml
+++ b/hostsidetests/trustedvoice/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Trustedvoice host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTrustedVoiceApp.apk" />
</target_preparer>
diff --git a/hostsidetests/trustedvoice/app/Android.mk b/hostsidetests/trustedvoice/app/Android.mk
index 7a759d8..c9140e5 100644
--- a/hostsidetests/trustedvoice/app/Android.mk
+++ b/hostsidetests/trustedvoice/app/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsTrustedVoiceApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/tv/Android.mk b/hostsidetests/tv/Android.mk
index cb5e2bd..687252d 100644
--- a/hostsidetests/tv/Android.mk
+++ b/hostsidetests/tv/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.tv.hostsidetv
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/tv/app/Android.mk b/hostsidetests/tv/app/Android.mk
index 454d352..c26a46a 100644
--- a/hostsidetests/tv/app/Android.mk
+++ b/hostsidetests/tv/app/Android.mk
@@ -30,6 +30,6 @@
LOCAL_DEX_PREOPT := false
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/tv/app2/Android.mk b/hostsidetests/tv/app2/Android.mk
index 166baec..ef34420 100644
--- a/hostsidetests/tv/app2/Android.mk
+++ b/hostsidetests/tv/app2/Android.mk
@@ -23,7 +23,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/ui/Android.mk b/hostsidetests/ui/Android.mk
index e2457c5..be29fdd 100644
--- a/hostsidetests/ui/Android.mk
+++ b/hostsidetests/ui/Android.mk
@@ -31,7 +31,7 @@
LOCAL_CTS_TEST_PACKAGE := android.ui.cts
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/ui/appA/Android.mk b/hostsidetests/ui/appA/Android.mk
index 2d94543..4699e6c 100644
--- a/hostsidetests/ui/appA/Android.mk
+++ b/hostsidetests/ui/appA/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsDeviceTaskSwitchingAppA
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/ui/appB/Android.mk b/hostsidetests/ui/appB/Android.mk
index 24108ca..39ef2c9 100644
--- a/hostsidetests/ui/appB/Android.mk
+++ b/hostsidetests/ui/appB/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsDeviceTaskSwitchingAppB
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/ui/control/Android.mk b/hostsidetests/ui/control/Android.mk
index fa63c59..771431d 100644
--- a/hostsidetests/ui/control/Android.mk
+++ b/hostsidetests/ui/control/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsDeviceTaskSwitchingControl
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/usage/Android.mk b/hostsidetests/usage/Android.mk
index 482ba91..dd0eb86 100644
--- a/hostsidetests/usage/Android.mk
+++ b/hostsidetests/usage/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.host.app.usage
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/usage/AndroidTest.xml b/hostsidetests/usage/AndroidTest.xml
index 98a7899..a1b105c 100644
--- a/hostsidetests/usage/AndroidTest.xml
+++ b/hostsidetests/usage/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS App Usage host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAppUsageTestApp.apk" />
</target_preparer>
diff --git a/hostsidetests/usage/app/Android.mk b/hostsidetests/usage/app/Android.mk
index 7347b9b..0d765e7 100644
--- a/hostsidetests/usage/app/Android.mk
+++ b/hostsidetests/usage/app/Android.mk
@@ -26,6 +26,6 @@
LOCAL_PACKAGE_NAME := CtsAppUsageTestApp
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/usb/Android.mk b/hostsidetests/usb/Android.mk
index bc98445..47b1f13 100644
--- a/hostsidetests/usb/Android.mk
+++ b/hostsidetests/usb/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.usb
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/usb/SerialTestApp/Android.mk b/hostsidetests/usb/SerialTestApp/Android.mk
index f71c7f4..62bc7e2 100644
--- a/hostsidetests/usb/SerialTestApp/Android.mk
+++ b/hostsidetests/usb/SerialTestApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -29,6 +29,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/webkit/Android.mk b/hostsidetests/webkit/Android.mk
index 6fe433c..897940b 100644
--- a/hostsidetests/webkit/Android.mk
+++ b/hostsidetests/webkit/Android.mk
@@ -26,7 +26,7 @@
LOCAL_CTS_TEST_PACKAGE := android.webkit.hostside
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/webkit/AndroidTest.xml b/hostsidetests/webkit/AndroidTest.xml
index 5a0eeca..99215d9 100644
--- a/hostsidetests/webkit/AndroidTest.xml
+++ b/hostsidetests/webkit/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS WebView host test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsWebViewStartupApp.apk" />
</target_preparer>
diff --git a/hostsidetests/webkit/app/Android.mk b/hostsidetests/webkit/app/Android.mk
index 6370fa4..28c0c01 100644
--- a/hostsidetests/webkit/app/Android.mk
+++ b/hostsidetests/webkit/app/Android.mk
@@ -38,6 +38,6 @@
LOCAL_DEX_PREOPT := false
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/JobScheduler/Android.mk b/tests/JobScheduler/Android.mk
index acfcbb2..ae1fa4d 100755
--- a/tests/JobScheduler/Android.mk
+++ b/tests/JobScheduler/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Must match the package name in CtsTestCaseList.mk
LOCAL_PACKAGE_NAME := CtsJobSchedulerTestCases
diff --git a/tests/JobScheduler/AndroidTest.xml b/tests/JobScheduler/AndroidTest.xml
index 619edfb..0504882 100644
--- a/tests/JobScheduler/AndroidTest.xml
+++ b/tests/JobScheduler/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Job Scheduler test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsJobSchedulerTestCases.apk" />
<option name="test-file-name" value="CtsJobSchedulerJobPerm.apk" />
diff --git a/tests/JobScheduler/jobperm/Android.mk b/tests/JobScheduler/jobperm/Android.mk
index 97bfd3e..ca00ca7 100644
--- a/tests/JobScheduler/jobperm/Android.mk
+++ b/tests/JobScheduler/jobperm/Android.mk
@@ -26,7 +26,7 @@
$(call all-java-files-under, src) \
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsJobSchedulerJobPerm
diff --git a/tests/ProcessTest/Android.mk b/tests/ProcessTest/Android.mk
index 5611b3b..2feff2e 100644
--- a/tests/ProcessTest/Android.mk
+++ b/tests/ProcessTest/Android.mk
@@ -24,6 +24,8 @@
LOCAL_SRC_FILES := $(call all-subdir-java-files)
+LOCAL_STATIC_JAVA_LIBRARIES := legacy-android-test junit
+
LOCAL_PACKAGE_NAME := ProcessTests
LOCAL_DEX_PREOPT := false
diff --git a/tests/acceleration/Android.mk b/tests/acceleration/Android.mk
index e55c0dd..845e291 100644
--- a/tests/acceleration/Android.mk
+++ b/tests/acceleration/Android.mk
@@ -24,12 +24,13 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner compatibility-device-util legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccelerationTestCases
diff --git a/tests/acceleration/AndroidTest.xml b/tests/acceleration/AndroidTest.xml
index 60e4bae..f8df29a 100644
--- a/tests/acceleration/AndroidTest.xml
+++ b/tests/acceleration/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS Acceleration test cases">
<option name="config-descriptor:metadata" key="component" value="framework" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAccelerationTestCases.apk" />
</target_preparer>
diff --git a/tests/accessibility/Android.mk b/tests/accessibility/Android.mk
index 7af9d90..d8da5ef 100644
--- a/tests/accessibility/Android.mk
+++ b/tests/accessibility/Android.mk
@@ -27,7 +27,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := test_current
diff --git a/tests/accessibility/AndroidTest.xml b/tests/accessibility/AndroidTest.xml
index bc18a7f..0d0ba65 100644
--- a/tests/accessibility/AndroidTest.xml
+++ b/tests/accessibility/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Accessibility test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAccessibilityTestCases.apk" />
</target_preparer>
diff --git a/tests/accessibilityservice/Android.mk b/tests/accessibilityservice/Android.mk
index 62f2e57..e0dc678 100644
--- a/tests/accessibilityservice/Android.mk
+++ b/tests/accessibilityservice/Android.mk
@@ -18,12 +18,15 @@
LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner mockito-target-minus-junit4
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
+ mockito-target-minus-junit4 \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAccessibilityServiceTestCases
diff --git a/tests/accessibilityservice/AndroidTest.xml b/tests/accessibilityservice/AndroidTest.xml
index b2cb477..800d1f2 100644
--- a/tests/accessibilityservice/AndroidTest.xml
+++ b/tests/accessibilityservice/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS accessibility service test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAccessibilityServiceTestCases.apk" />
</target_preparer>
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java
index 0f8b9c0..218bcc6 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java
@@ -18,6 +18,7 @@
import android.graphics.RectF;
import android.os.Bundle;
import android.os.Debug;
+import android.os.Message;
import android.os.Parcelable;
import android.text.SpannableString;
import android.text.Spanned;
@@ -25,7 +26,10 @@
import android.text.style.ClickableSpan;
import android.text.style.URLSpan;
import android.view.View;
+import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityNodeProvider;
+import android.view.accessibility.AccessibilityRequestPreparer;
import android.widget.EditText;
import android.widget.TextView;
@@ -34,10 +38,21 @@
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH;
import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX;
import static android.view.accessibility.AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
/**
* Test cases for actions taken on text views.
@@ -193,25 +208,10 @@
textAvailableExtraData.contains(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY));
assertNull("Text locations should not be populated by default",
text.getExtras().get(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY));
- Bundle getTextArgs = new Bundle();
- getTextArgs.putInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX, 0);
- getTextArgs.putInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH,
- text.getText().length());
+ final Bundle getTextArgs = getTextLocationArguments(text);
assertTrue("Refresh failed", text.refreshWithExtraData(
AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, getTextArgs));
- final Parcelable[] parcelables = text.getExtras()
- .getParcelableArray(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY);
- final RectF[] locations = Arrays.copyOf(parcelables, parcelables.length, RectF[].class);
- assertEquals(text.getText().length(), locations.length);
- // The text should all be on one line, running left to right
- for (int i = 0; i < locations.length; i++) {
- assertEquals(locations[0].top, locations[i].top);
- assertEquals(locations[0].bottom, locations[i].bottom);
- assertTrue(locations[i].right > locations[i].left);
- if (i > 0) {
- assertTrue(locations[i].left > locations[i-1].left);
- }
- }
+ assertNodeContainsTextLocationInfoOnOneLineLTR(text);
}
public void testTextLocations_textOutsideOfViewBounds_locationsShouldBeNull() {
@@ -223,12 +223,9 @@
List<String> textAvailableExtraData = text.getAvailableExtraData();
assertTrue("Text view should offer text location to accessibility",
textAvailableExtraData.contains(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY));
- Bundle getTextArgs = new Bundle();
- getTextArgs.putInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX, 0);
- getTextArgs.putInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH,
- text.getText().length());
+ final Bundle getTextArgs = getTextLocationArguments(text);
assertTrue("Refresh failed", text.refreshWithExtraData(
- AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, getTextArgs));
+ EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, getTextArgs));
Parcelable[] parcelables = text.getExtras()
.getParcelableArray(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY);
final RectF[] locationsBeforeScroll = Arrays.copyOf(
@@ -255,7 +252,7 @@
getInstrumentation().runOnMainSync(() -> editText.scrollTo(0, (int) oneLineDownY + 1));
assertTrue("Refresh failed", text.refreshWithExtraData(
- AccessibilityNodeInfo.EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, getTextArgs));
+ EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, getTextArgs));
parcelables = text.getExtras()
.getParcelableArray(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY);
final RectF[] locationsAfterScroll = Arrays.copyOf(
@@ -266,6 +263,132 @@
assertNotNull(locationsAfterScroll[firstNullRectIndex]);
}
+ public void testTextLocations_withRequestPreparer_shouldHoldOffUntilReady() {
+ final TextView textView = (TextView) getActivity().findViewById(R.id.text);
+ makeTextViewVisibleAndSetText(textView, getString(R.string.a_b));
+
+ final AccessibilityNodeInfo text = mUiAutomation.getRootInActiveWindow()
+ .findAccessibilityNodeInfosByText(getString(R.string.a_b)).get(0);
+ final List<String> textAvailableExtraData = text.getAvailableExtraData();
+ final Bundle getTextArgs = getTextLocationArguments(text);
+
+ // Register a request preparer that will capture the message indicating that preparation
+ // is complete
+ final AtomicReference<Message> messageRefForPrepare = new AtomicReference<>(null);
+ // Use mockito's asynchronous signaling
+ Runnable mockRunnableForPrepare = mock(Runnable.class);
+
+ AccessibilityManager a11yManager =
+ getActivity().getSystemService(AccessibilityManager.class);
+ AccessibilityRequestPreparer requestPreparer = new AccessibilityRequestPreparer(
+ textView, AccessibilityRequestPreparer.REQUEST_TYPE_EXTRA_DATA) {
+ @Override
+ public void onPrepareExtraData(int virtualViewId,
+ String extraDataKey, Bundle args, Message preparationFinishedMessage) {
+ assertEquals(AccessibilityNodeProvider.HOST_VIEW_ID, virtualViewId);
+ assertEquals(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, extraDataKey);
+ assertEquals(0, args.getInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX));
+ assertEquals(text.getText().length(),
+ args.getInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH));
+ messageRefForPrepare.set(preparationFinishedMessage);
+ mockRunnableForPrepare.run();
+ }
+ };
+ a11yManager.addAccessibilityRequestPreparer(requestPreparer);
+ verify(mockRunnableForPrepare, times(0)).run();
+
+ // Make the extra data request in another thread
+ Runnable mockRunnableForData = mock(Runnable.class);
+ new Thread() {
+ @Override
+ public void run() {
+ assertTrue("Refresh failed", text.refreshWithExtraData(
+ EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, getTextArgs));
+ mockRunnableForData.run();
+ }
+ }.start();
+
+ // The extra data request should trigger the request preparer
+ verify(mockRunnableForPrepare, timeout(TIMEOUT_ASYNC_PROCESSING)).run();
+ // Verify that the request for extra data didn't return. This is a bit racy, as we may still
+ // not catch it if it does return prematurely, but it does provide some protection.
+ getInstrumentation().waitForIdleSync();
+ verify(mockRunnableForData, times(0)).run();
+
+ // Declare preparation for the request complete, and verify that it runs to completion
+ messageRefForPrepare.get().sendToTarget();
+ verify(mockRunnableForData, timeout(TIMEOUT_ASYNC_PROCESSING)).run();
+ assertNodeContainsTextLocationInfoOnOneLineLTR(text);
+ a11yManager.removeAccessibilityRequestPreparer(requestPreparer);
+ }
+
+ public void testTextLocations_withUnresponsiveRequestPreparer_shouldTimeout() {
+ final TextView textView = (TextView) getActivity().findViewById(R.id.text);
+ makeTextViewVisibleAndSetText(textView, getString(R.string.a_b));
+
+ final AccessibilityNodeInfo text = mUiAutomation.getRootInActiveWindow()
+ .findAccessibilityNodeInfosByText(getString(R.string.a_b)).get(0);
+ final List<String> textAvailableExtraData = text.getAvailableExtraData();
+ final Bundle getTextArgs = getTextLocationArguments(text);
+
+ // Use mockito's asynchronous signaling
+ Runnable mockRunnableForPrepare = mock(Runnable.class);
+
+ AccessibilityManager a11yManager =
+ getActivity().getSystemService(AccessibilityManager.class);
+ AccessibilityRequestPreparer requestPreparer = new AccessibilityRequestPreparer(
+ textView, AccessibilityRequestPreparer.REQUEST_TYPE_EXTRA_DATA) {
+ @Override
+ public void onPrepareExtraData(int virtualViewId,
+ String extraDataKey, Bundle args, Message preparationFinishedMessage) {
+ mockRunnableForPrepare.run();
+ }
+ };
+ a11yManager.addAccessibilityRequestPreparer(requestPreparer);
+ verify(mockRunnableForPrepare, times(0)).run();
+
+ // Make the extra data request in another thread
+ Runnable mockRunnableForData = mock(Runnable.class);
+ new Thread() {
+ @Override
+ public void run() {
+ assertTrue("Refresh failed", text.refreshWithExtraData(
+ EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY, getTextArgs));
+ mockRunnableForData.run();
+ }
+ }.start();
+
+ // The extra data request should trigger the request preparer
+ verify(mockRunnableForPrepare, timeout(TIMEOUT_ASYNC_PROCESSING)).run();
+
+ // Declare preparation for the request complete, and verify that it runs to completion
+ verify(mockRunnableForData, timeout(TIMEOUT_ASYNC_PROCESSING)).run();
+ a11yManager.removeAccessibilityRequestPreparer(requestPreparer);
+ }
+
+ private Bundle getTextLocationArguments(AccessibilityNodeInfo info) {
+ Bundle args = new Bundle();
+ args.putInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX, 0);
+ args.putInt(EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH, info.getText().length());
+ return args;
+ }
+
+ private void assertNodeContainsTextLocationInfoOnOneLineLTR(AccessibilityNodeInfo info) {
+ final Parcelable[] parcelables = info.getExtras()
+ .getParcelableArray(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY);
+ final RectF[] locations = Arrays.copyOf(parcelables, parcelables.length, RectF[].class);
+ assertEquals(info.getText().length(), locations.length);
+ // The text should all be on one line, running left to right
+ for (int i = 0; i < locations.length; i++) {
+ assertEquals(locations[0].top, locations[i].top);
+ assertEquals(locations[0].bottom, locations[i].bottom);
+ assertTrue(locations[i].right > locations[i].left);
+ if (i > 0) {
+ assertTrue(locations[i].left > locations[i-1].left);
+ }
+ }
+ }
+
private void onClickCallback() {
synchronized (mClickableSpanCallbackLock) {
mClickableSpanCalled.set(true);
diff --git a/tests/admin/Android.mk b/tests/admin/Android.mk
index 595c0a3..d30cca1 100644
--- a/tests/admin/Android.mk
+++ b/tests/admin/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsAdminTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_INSTRUMENTATION_FOR := CtsAdminApp
diff --git a/tests/admin/AndroidTest.xml b/tests/admin/AndroidTest.xml
index 2d230a5..664056e 100644
--- a/tests/admin/AndroidTest.xml
+++ b/tests/admin/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for the CTS device admin tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="install-arg" value="-t" />
<option name="test-file-name" value="CtsAdminApp.apk" />
diff --git a/tests/admin/app/Android.mk b/tests/admin/app/Android.mk
index aac8a89..b0e7ff5 100644
--- a/tests/admin/app/Android.mk
+++ b/tests/admin/app/Android.mk
@@ -22,14 +22,14 @@
LOCAL_JAVA_LIBRARIES := guava
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsAdminApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
index bb1dc10..f479dca 100644
--- a/tests/app/Android.mk
+++ b/tests/app/Android.mk
@@ -37,7 +37,7 @@
$(call all-java-files-under, appSdk25/src) \
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAppTestCases
diff --git a/tests/app/AndroidTest.xml b/tests/app/AndroidTest.xml
index 9c1f57d..b51aa79 100644
--- a/tests/app/AndroidTest.xml
+++ b/tests/app/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS App test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSimpleApp.apk" />
<option name="test-file-name" value="CtsAppTestStubs.apk" />
diff --git a/tests/app/app/Android.mk b/tests/app/app/Android.mk
index 3c0a0c5..4b6057d 100644
--- a/tests/app/app/Android.mk
+++ b/tests/app/app/Android.mk
@@ -37,7 +37,7 @@
src/android/app/stubs/ISecondary.aidl
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAppTestStubs
diff --git a/tests/app/app/AndroidManifest.xml b/tests/app/app/AndroidManifest.xml
index 7d5da99..7ecd0ee 100644
--- a/tests/app/app/AndroidManifest.xml
+++ b/tests/app/app/AndroidManifest.xml
@@ -42,6 +42,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BODY_SENSORS" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
+ <uses-permission android:name="android.permission.SET_WALLPAPER" />
<application android:label="Android TestCase"
android:icon="@drawable/size_48x48"
diff --git a/tests/app/app/src/android/app/stubs/DisplayTestActivity.java b/tests/app/app/src/android/app/stubs/DisplayTestActivity.java
index b5233da..e030ceb 100644
--- a/tests/app/app/src/android/app/stubs/DisplayTestActivity.java
+++ b/tests/app/app/src/android/app/stubs/DisplayTestActivity.java
@@ -27,12 +27,20 @@
* An {@link Activity} that exposes the underlying {@link Display} details.
*/
public class DisplayTestActivity extends Activity {
+ public final OrientationTestUtils.Observer configurationChangeObserver =
+ new OrientationTestUtils.Observer();
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
+ @Override
+ public void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ configurationChangeObserver.onObserved();
+ }
+
public Display getDisplay() {
return getSystemService(WindowManager.class).getDefaultDisplay();
}
diff --git a/tests/app/app/src/android/app/stubs/OrientationTestUtils.java b/tests/app/app/src/android/app/stubs/OrientationTestUtils.java
index 645a7ad..e9c9813 100644
--- a/tests/app/app/src/android/app/stubs/OrientationTestUtils.java
+++ b/tests/app/app/src/android/app/stubs/OrientationTestUtils.java
@@ -17,11 +17,14 @@
package android.app.stubs;
import android.app.Activity;
-import android.app.Instrumentation;
import android.content.pm.ActivityInfo;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static org.junit.Assert.assertTrue;
public class OrientationTestUtils {
-
/**
* Change the activity's orientation to something different and then switch back. This is used
* to trigger {@link Activity#onConfigurationChanged(android.content.res.Configuration)}.
@@ -29,45 +32,75 @@
* @param activity whose orientation will be changed and restored
*/
public static void toggleOrientation(Activity activity) {
- toggleOrientationSync(activity, null);
- }
-
- /**
- * Same as {@link #toggleOrientation(Activity)} except {@link Instrumentation#waitForIdleSync()}
- * is called after each orientation change.
- *
- * @param activity whose orientation will be changed and restored
- * @param instrumentation use for idle syncing
- */
- public static void toggleOrientationSync(final Activity activity,
- final Instrumentation instrumentation) {
- final int originalOrientation = activity.getResources().getConfiguration().orientation;
- final int newOrientation = originalOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
- ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
- : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
- changeOrientation(activity, instrumentation, newOrientation);
- changeOrientation(activity, instrumentation, originalOrientation);
+ final int[] orientations = getOrientations(activity);
+ activity.setRequestedOrientation(orientations[1]);
+ activity.setRequestedOrientation(orientations[0]);
}
/**
* Switches the device's orientation from landscape to portrait or portrait to landscape.
*
- * @param activity whose orientation will be changed.
- * @param instrumentation use for idle syncing
+ * @param activity whose orientation will be changed
+ * @return original orientation
*/
- public static void switchOrientation(final Activity activity, Instrumentation instrumentation) {
- final int originalOrientation = activity.getResources().getConfiguration().orientation;
- final int newOrientation = originalOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
- ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
- : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
- changeOrientation(activity, instrumentation, newOrientation);
+ public static void switchOrientation(final Activity activity) {
+ final int[] orientations = getOrientations(activity);
+ activity.setRequestedOrientation(orientations[1]);
}
- private static void changeOrientation(final Activity activity,
- Instrumentation instrumentation, final int orientation) {
- activity.setRequestedOrientation(orientation);
- if (instrumentation != null) {
- instrumentation.waitForIdleSync();
+ /**
+ * Returns original orientation and toggled orientation.
+ * @param activity whose orienetaion will be returned
+ * @return The first element is original orientation adn the second element is toggled
+ * orientation.
+ */
+ private static int[] getOrientations(final Activity activity) {
+ final int originalOrientation = activity.getResources().getConfiguration().orientation;
+ final int newOrientation = originalOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
+ ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
+ : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
+ return new int[] { originalOrientation, newOrientation };
+ }
+
+ /**
+ * Observer used in stub activities to wait for some event.
+ */
+ public static class Observer {
+ private static final int TIMEOUT_SEC = 3;
+ private final AtomicReference<CountDownLatch> mLatch = new AtomicReference();
+
+ /**
+ * Starts observing event.
+ * The returned CountDownLatch will get activated when onObserved is invoked after this
+ * call. The method cannot be called multiple times unless reset() is invoked.
+ * @return CountDownLatch will get activated when onObserved is invoked after this call.
+ */
+ public void startObserving() {
+ final CountDownLatch latch = new CountDownLatch(1);
+ assertTrue(mLatch.compareAndSet(null, latch));
+ }
+
+ /**
+ * Waits until onObserved is invoked.
+ */
+ public void await() throws InterruptedException {
+ try {
+ assertTrue(mLatch.get().await(TIMEOUT_SEC, TimeUnit.SECONDS));
+ } finally {
+ mLatch.set(null);
+ }
+ }
+
+ /**
+ * Notifies an event is observed.
+ * If this method is invoked after startObserving, the returned CountDownLatch will get
+ * activated. Otherwise it does nothing.
+ */
+ public void onObserved() {
+ final CountDownLatch latch = mLatch.get();
+ if (latch != null) {
+ latch.countDown();
+ }
}
}
}
diff --git a/tests/app/app/src/android/app/stubs/TestDialog.java b/tests/app/app/src/android/app/stubs/TestDialog.java
index e404e65..18ef3be 100644
--- a/tests/app/app/src/android/app/stubs/TestDialog.java
+++ b/tests/app/app/src/android/app/stubs/TestDialog.java
@@ -50,8 +50,10 @@
public boolean isOnKeyDownCalled;
public boolean isOnKeyUpCalled;
public boolean isOnKeyMultipleCalled;
- public boolean isOnSaveInstanceStateCalled;
- public static boolean isOnRestoreInstanceStateCalled;
+ public final OrientationTestUtils.Observer onSaveInstanceStateObserver =
+ new OrientationTestUtils.Observer();
+ public final static OrientationTestUtils.Observer onRestoreInstanceStateObserver =
+ new OrientationTestUtils.Observer();
public boolean isOnWindowAttributesChangedCalled;
public boolean isOnCreatePanelMenuCalled;
public boolean isOnCreatePanelViewCalled;
@@ -167,16 +169,15 @@
@Override
public Bundle onSaveInstanceState() {
- isOnSaveInstanceStateCalled = true;
saveInstanceState = super.onSaveInstanceState();
+ onSaveInstanceStateObserver.onObserved();
return saveInstanceState;
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
- isOnRestoreInstanceStateCalled = true;
this.savedInstanceState = savedInstanceState;
-
+ onRestoreInstanceStateObserver.onObserved();
super.onRestoreInstanceState(savedInstanceState);
}
diff --git a/tests/app/app2/Android.mk b/tests/app/app2/Android.mk
index 794c689..6c5ea7c 100644
--- a/tests/app/app2/Android.mk
+++ b/tests/app/app2/Android.mk
@@ -30,7 +30,7 @@
LOCAL_PACKAGE_NAME := CtsAppTestStubsDifferentUid
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_DEX_PREOPT := false
diff --git a/tests/app/appSdk25/Android.mk b/tests/app/appSdk25/Android.mk
index 64eda91..e08de21 100644
--- a/tests/app/appSdk25/Android.mk
+++ b/tests/app/appSdk25/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SDK_VERSION := 25
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAppTestSdk25
diff --git a/tests/app/src/android/app/cts/DialogTest.java b/tests/app/src/android/app/cts/DialogTest.java
index 42b1fed..c16101f 100755
--- a/tests/app/src/android/app/cts/DialogTest.java
+++ b/tests/app/src/android/app/cts/DialogTest.java
@@ -210,13 +210,10 @@
assertFalse(d.isShowing());
}
- public void testOnSaveInstanceState() {
+ public void testOnSaveInstanceState() throws InterruptedException {
startDialogActivity(DialogStubActivity.TEST_ONSTART_AND_ONSTOP);
final TestDialog d = (TestDialog) mActivity.getDialog();
- assertFalse(d.isOnSaveInstanceStateCalled);
- assertFalse(TestDialog.isOnRestoreInstanceStateCalled);
-
//skip if the device doesn't support both of portrait and landscape orientation screens.
final PackageManager pm = mContext.getPackageManager();
if(!(pm.hasSystemFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE)
@@ -224,10 +221,11 @@
return;
}
- OrientationTestUtils.toggleOrientationSync(mActivity, mInstrumentation);
-
- assertTrue(d.isOnSaveInstanceStateCalled);
- assertTrue(TestDialog.isOnRestoreInstanceStateCalled);
+ d.onSaveInstanceStateObserver.startObserving();
+ TestDialog.onRestoreInstanceStateObserver.startObserving();
+ OrientationTestUtils.toggleOrientation(mActivity);
+ d.onSaveInstanceStateObserver.await();
+ TestDialog.onRestoreInstanceStateObserver.await();
}
public void testGetCurrentFocus() throws Throwable {
diff --git a/tests/app/src/android/app/cts/DisplayTest.java b/tests/app/src/android/app/cts/DisplayTest.java
index 079a0b9..94c852c 100644
--- a/tests/app/src/android/app/cts/DisplayTest.java
+++ b/tests/app/src/android/app/cts/DisplayTest.java
@@ -55,7 +55,9 @@
final int origHeight = origDisplay.getHeight();
// Change orientation
- OrientationTestUtils.switchOrientation(mActivity, mInstrumentation);
+ mActivity.configurationChangeObserver.startObserving();
+ OrientationTestUtils.switchOrientation(mActivity);
+ mActivity.configurationChangeObserver.await();
// Get a {@link Display} instance after rotation.
final Display updatedDisplay = mActivity.getDisplay();
diff --git a/tests/app/src/android/app/cts/TimePickerDialogTest.java b/tests/app/src/android/app/cts/TimePickerDialogTest.java
index 3da25ab..47a666c 100644
--- a/tests/app/src/android/app/cts/TimePickerDialogTest.java
+++ b/tests/app/src/android/app/cts/TimePickerDialogTest.java
@@ -16,21 +16,31 @@
package android.app.cts;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.app.AlertDialog;
import android.app.TimePickerDialog;
import android.app.TimePickerDialog.OnTimeSetListener;
-import android.app.stubs.DialogStubActivity;
+import android.app.stubs.R;
import android.content.Context;
import android.os.Bundle;
-import android.test.ActivityInstrumentationTestCase2;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
import android.test.UiThreadTest;
+import android.test.suitebuilder.annotation.MediumTest;
import android.widget.TimePicker;
-import android.app.stubs.R;
-
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test {@link TimePickerDialog}.
*/
-public class TimePickerDialogTest extends ActivityInstrumentationTestCase2<DialogStubActivity> {
+@MediumTest
+@RunWith(AndroidJUnit4.class)
+public class TimePickerDialogTest {
private static final String HOUR = "hour";
private static final String MINUTE = "minute";
private static final String IS_24_HOUR = "is24hour";
@@ -44,17 +54,10 @@
private OnTimeSetListener mOnTimeSetListener;
private Context mContext;
- private DialogStubActivity mActivity;
- public TimePickerDialogTest() {
- super("android.app.stubs", DialogStubActivity.class);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mContext = getInstrumentation().getContext();
+ @Before
+ public void setUp() throws Exception {
+ mContext = InstrumentationRegistry.getTargetContext();
mOnTimeSetListener = new OnTimeSetListener(){
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
mCallbackHour = hourOfDay;
@@ -64,9 +67,31 @@
}
@UiThreadTest
+ @Test
+ public void testConstructor() {
+ new TimePickerDialog(mContext, null, 1, 1, false);
+
+ new TimePickerDialog(mContext, null, 1, 1, true);
+
+ new TimePickerDialog(mContext, AlertDialog.THEME_TRADITIONAL, null, 1, 1, false);
+
+ new TimePickerDialog(mContext, AlertDialog.THEME_HOLO_DARK, null, 1, 1, false);
+
+ new TimePickerDialog(mContext,
+ android.R.style.Theme_Material_Dialog_Alert, null, 1, 1, false);
+ }
+
+ @UiThreadTest
+ @Test(expected = NullPointerException.class)
+ public void testConstructorWithNullContext() {
+ new TimePickerDialog(null, null, 0, 0, false);
+ }
+
+ @UiThreadTest
+ @Test
public void testSaveInstanceState() {
TimePickerDialog tD = new TimePickerDialog(
- mContext, mOnTimeSetListener, TARGET_HOUR, TARGET_MINUTE, true);
+ mContext, mOnTimeSetListener, TARGET_HOUR, TARGET_MINUTE, true);
Bundle b = tD.onSaveInstanceState();
@@ -87,6 +112,7 @@
}
@UiThreadTest
+ @Test
public void testOnClick() {
TimePickerDialog timePickerDialog = buildDialog();
timePickerDialog.onClick(null, TimePickerDialog.BUTTON_POSITIVE);
@@ -95,21 +121,16 @@
assertEquals(TARGET_MINUTE, mCallbackMinute);
}
+ @UiThreadTest
+ @Test
public void testOnTimeChanged() throws Throwable {
final int minute = 34;
- startDialogActivity(DialogStubActivity.TEST_TIMEPICKERDIALOG);
- final TimePickerDialog d = (TimePickerDialog) mActivity.getDialog();
-
- runTestOnUiThread(new Runnable() {
- public void run() {
- d.onTimeChanged(null, TARGET_HOUR, minute);
- }
- });
- getInstrumentation().waitForIdleSync();
-
+ final TimePickerDialog d = buildDialog();
+ d.onTimeChanged(null, TARGET_HOUR, minute);
}
@UiThreadTest
+ @Test
public void testUpdateTime() {
TimePickerDialog timePickerDialog = buildDialog();
int minute = 18;
@@ -123,6 +144,7 @@
}
@UiThreadTest
+ @Test
public void testOnRestoreInstanceState() {
int minute = 27;
Bundle b1 = new Bundle();
@@ -141,10 +163,6 @@
assertFalse(b2.getBoolean(IS_24_HOUR));
}
- private void startDialogActivity(int dialogNumber) {
- mActivity = DialogStubActivity.startDialogActivity(this, dialogNumber);
- }
-
private TimePickerDialog buildDialog() {
return new TimePickerDialog(
mContext, mOnTimeSetListener, TARGET_HOUR, TARGET_MINUTE, true);
diff --git a/tests/app/src/android/app/cts/WallpaperColorsTest.java b/tests/app/src/android/app/cts/WallpaperColorsTest.java
new file mode 100644
index 0000000..922118c
--- /dev/null
+++ b/tests/app/src/android/app/cts/WallpaperColorsTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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
+ */
+
+package android.app.cts;
+
+import android.app.WallpaperColors;
+import android.graphics.Color;
+import android.os.Debug;
+import android.os.Parcel;
+import android.support.test.runner.AndroidJUnit4;
+import android.util.Pair;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+
+@RunWith(AndroidJUnit4.class)
+public class WallpaperColorsTest {
+
+ @Test
+ public void getWallpaperColorsTest() {
+ ArrayList<Pair<Color, Integer>> colorList = new ArrayList<>();
+ colorList.add(new Pair<>(Color.valueOf(Color.WHITE), 5));
+ colorList.add(new Pair<>(Color.valueOf(Color.BLACK), 5));
+
+ WallpaperColors colors = new WallpaperColors(colorList);
+ Assert.assertSame(colors.getColors(), colorList);
+ }
+
+ @Test
+ public void supportsDarkTextOverrideTest() {
+ ArrayList<Pair<Color, Integer>> colorList = new ArrayList<>();
+ colorList.add(new Pair<>(Color.valueOf(Color.BLACK), 5));
+
+ // Black should not support dark text!
+ WallpaperColors colors = new WallpaperColors(colorList);
+ Assert.assertFalse(colors.supportsDarkText());
+
+ // Override it
+ colors = new WallpaperColors(colorList, true);
+ Assert.assertTrue(colors.supportsDarkText());
+ }
+
+ @Test
+ public void equalsTest() {
+ ArrayList<Pair<Color, Integer>> list1 = new ArrayList<>();
+ list1.add(new Pair<>(Color.valueOf(Color.BLACK), 5));
+ WallpaperColors colors1 = new WallpaperColors(list1);
+
+ ArrayList<Pair<Color, Integer>> list2 = new ArrayList<>();
+ list2.add(new Pair<>(Color.valueOf(Color.WHITE), 1));
+ WallpaperColors colors2 = new WallpaperColors(list2);
+
+ // Different list
+ Assert.assertNotEquals(colors1, null);
+ Assert.assertNotEquals(colors1, colors2);
+
+ // List with same values
+ ArrayList<Pair<Color, Integer>> list3 = new ArrayList<>();
+ list3.add(new Pair<>(Color.valueOf(Color.BLACK), 5));
+ WallpaperColors colors3 = new WallpaperColors(list3);
+ Assert.assertEquals(colors1, colors3);
+ Assert.assertEquals(colors1.hashCode(), colors3.hashCode());
+
+ // same values but different overrides
+ WallpaperColors colors4 = new WallpaperColors(list1, true);
+ WallpaperColors colors5 = new WallpaperColors(list1, false);
+ Assert.assertNotEquals(colors4, colors5);
+ }
+
+ @Test
+ public void parcelTest() {
+ ArrayList<Pair<Color, Integer>> colorList = new ArrayList<>();
+ colorList.add(new Pair<>(Color.valueOf(Color.WHITE), 5));
+ colorList.add(new Pair<>(Color.valueOf(Color.BLACK), 3));
+ WallpaperColors wallpaperColors = new WallpaperColors(colorList);
+
+ Parcel parcel = Parcel.obtain();
+ wallpaperColors.writeToParcel(parcel, 0);
+ parcel.setDataPosition(0);
+ WallpaperColors newColors = new WallpaperColors(parcel);
+ Assert.assertEquals(wallpaperColors, newColors);
+ Assert.assertEquals(parcel.dataPosition(), parcel.dataSize());
+ parcel.recycle();
+ }
+
+}
diff --git a/tests/app/src/android/app/cts/WallpaperManagerTest.java b/tests/app/src/android/app/cts/WallpaperManagerTest.java
index 9f66e15..e3455c6 100644
--- a/tests/app/src/android/app/cts/WallpaperManagerTest.java
+++ b/tests/app/src/android/app/cts/WallpaperManagerTest.java
@@ -16,23 +16,208 @@
package android.app.cts;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.nullable;
+import static org.mockito.Mockito.atLeast;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+
+import android.app.WallpaperColors;
import android.app.WallpaperManager;
+import android.content.BroadcastReceiver;
import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Point;
-import android.test.AndroidTestCase;
+import android.os.Handler;
+import android.os.Looper;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
-public class WallpaperManagerTest extends AndroidTestCase {
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.MockitoAnnotations;
+
+import android.app.stubs.R;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+@RunWith(AndroidJUnit4.class)
+public class WallpaperManagerTest {
+
+ private static final boolean DEBUG = false;
+ private static final String TAG = "WallpaperManagerTest";
private WallpaperManager mWallpaperManager;
+ private Context mContext;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ mContext = InstrumentationRegistry.getTargetContext();
mWallpaperManager = WallpaperManager.getInstance(mContext);
}
+ @Test
+ public void setBitmapTest() {
+ Bitmap tmpWallpaper = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(tmpWallpaper);
+ canvas.drawColor(Color.RED);
+
+ try {
+ int which = WallpaperManager.FLAG_SYSTEM;
+ int oldWallpaperId = mWallpaperManager.getWallpaperId(which);
+ mWallpaperManager.setBitmap(tmpWallpaper);
+ int newWallpaperId = mWallpaperManager.getWallpaperId(which);
+ Assert.assertNotEquals(oldWallpaperId, newWallpaperId);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ tmpWallpaper.recycle();
+ }
+ }
+
+ @Test
+ public void setResourceTest() {
+ try {
+ int which = WallpaperManager.FLAG_SYSTEM;
+ int oldWallpaperId = mWallpaperManager.getWallpaperId(which);
+ mWallpaperManager.setResource(R.drawable.robot);
+ int newWallpaperId = mWallpaperManager.getWallpaperId(which);
+ Assert.assertNotEquals(oldWallpaperId, newWallpaperId);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Test
+ public void wallpaperChangedBroadcastTest() {
+ Bitmap tmpWallpaper = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
+ Canvas canvas = new Canvas(tmpWallpaper);
+ canvas.drawColor(Color.BLACK);
+
+ CountDownLatch latch = new CountDownLatch(1);
+ mContext.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ latch.countDown();
+ }
+ }, new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED));
+
+ try {
+ mWallpaperManager.setBitmap(tmpWallpaper);
+
+ // Wait for 5 sec since this is an async call.
+ // Should fail if Intent.ACTION_WALLPAPER_CHANGED isn't delivered.
+ latch.await(5, TimeUnit.SECONDS);
+ if (latch.getCount() > 0) {
+ throw new AssertionError("Intent.ACTION_WALLPAPER_CHANGED not received.");
+ }
+ } catch (InterruptedException | IOException e) {
+ throw new AssertionError("Intent.ACTION_WALLPAPER_CHANGED not received.");
+ } finally {
+ tmpWallpaper.recycle();
+ }
+ }
+
+ @Test
+ public void wallpaperClearBroadcastTest() {
+ CountDownLatch latch = new CountDownLatch(1);
+ mContext.registerReceiver(new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ latch.countDown();
+ }
+ }, new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED));
+
+ try {
+ mWallpaperManager.clear(WallpaperManager.FLAG_LOCK | WallpaperManager.FLAG_SYSTEM);
+
+ // Wait for 5 sec since this is an async call.
+ // Should fail if Intent.ACTION_WALLPAPER_CHANGED isn't delivered.
+ latch.await(5, TimeUnit.SECONDS);
+ if (latch.getCount() > 0) {
+ throw new AssertionError("Intent.ACTION_WALLPAPER_CHANGED not received.");
+ }
+ } catch (InterruptedException | IOException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ @Test
+ public void invokeOnColorsChangedListenerTest_systemOnly() {
+ int both = WallpaperManager.FLAG_LOCK | WallpaperManager.FLAG_SYSTEM;
+ // Expect both since the first step is to migrate the current wallpaper
+ // to the lock screen.
+ verifyColorListenerInvoked(WallpaperManager.FLAG_SYSTEM, both);
+ }
+
+ @Test
+ public void invokeOnColorsChangedListenerTest_lockOnly() {
+ verifyColorListenerInvoked(WallpaperManager.FLAG_LOCK, WallpaperManager.FLAG_LOCK);
+ }
+
+ @Test
+ public void invokeOnColorsChangedListenerTest_both() {
+ int both = WallpaperManager.FLAG_LOCK | WallpaperManager.FLAG_SYSTEM;
+ verifyColorListenerInvoked(both, both);
+ }
+
+ @Test
+ public void invokeOnColorsChangedListenerTest_clearLock() throws IOException {
+ verifyColorListenerInvokedClearing(WallpaperManager.FLAG_LOCK);
+ }
+
+ @Test
+ public void invokeOnColorsChangedListenerTest_clearSystem() throws IOException {
+ verifyColorListenerInvokedClearing(WallpaperManager.FLAG_SYSTEM);
+ }
+
+ /**
+ * Removing a listener should not invoke it anymore
+ */
+ @Test
+ public void addRemoveOnColorsChangedListenerTest_onlyInvokeAdded() throws IOException {
+ ensureCleanState();
+
+ final CountDownLatch latch = new CountDownLatch(1);
+ WallpaperManager.OnColorsChangedListener counter = (colors, whichWp) -> latch.countDown();
+
+ // Add and remove listener
+ WallpaperManager.OnColorsChangedListener listener =
+ mock(WallpaperManager.OnColorsChangedListener.class);
+ mWallpaperManager.addOnColorsChangedListener(listener);
+ mWallpaperManager.removeOnColorsChangedListener(listener);
+
+ // Verify that the listener is not called
+ mWallpaperManager.addOnColorsChangedListener(counter);
+ try {
+ mWallpaperManager.setResource(R.drawable.robot);
+ latch.await(5, TimeUnit.SECONDS);
+ if (latch.getCount() > 0) {
+ throw new AssertionError("Registered listener not invoked");
+ }
+ } catch (InterruptedException | IOException e) {
+ throw new RuntimeException(e);
+ }
+ verify(listener, never()).onColorsChanged(any(WallpaperColors.class), anyInt());
+ mWallpaperManager.removeOnColorsChangedListener(counter);
+ }
+
/**
* Suggesting desired dimensions is only a hint to the system that can be ignored.
*
@@ -40,7 +225,8 @@
* is greater than 0. If so, then we check whether that the size is at least the
* as big as the screen.
*/
- public void testSuggestDesiredDimensions() {
+ @Test
+ public void suggestDesiredDimensionsTest() {
final Point min = getScreenSize();
final int w = min.x * 3;
final int h = min.y * 2;
@@ -58,19 +244,163 @@
Point actualSize = new Point(mWallpaperManager.getDesiredMinimumWidth(),
mWallpaperManager.getDesiredMinimumHeight());
if (actualSize.x > 0 || actualSize.y > 0) {
- if((actualSize.x < minSize.x || actualSize.y < minSize.y)){
+ if ((actualSize.x < minSize.x || actualSize.y < minSize.y)) {
throw new AssertionError("Expected at least x: " + minSize.x + " y: "
- + minSize.y + ", got x: " + actualSize.x +
- " y: " + actualSize.y );
+ + minSize.y + ", got x: " + actualSize.x +
+ " y: " + actualSize.y);
}
}
}
private Point getScreenSize() {
- WindowManager wm = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
+ WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
Display d = wm.getDefaultDisplay();
Point p = new Point();
d.getRealSize(p);
return p;
}
-}
+
+ /**
+ * Helper to set a listener anc verify if it was called with the same flags.
+ * Executes operation synchronously.
+ *
+ * @param which FLAG_LOCK, FLAG_SYSTEM or a combination of both.
+ */
+ private void verifyColorListenerInvoked(int which, int whichExpected) {
+ ensureCleanState();
+ int expected = 0;
+ if ((whichExpected & WallpaperManager.FLAG_LOCK) != 0) expected++;
+ if ((whichExpected & WallpaperManager.FLAG_SYSTEM) != 0) expected++;
+ ArrayList<Integer> received = new ArrayList<>();
+
+ final CountDownLatch latch = new CountDownLatch(expected);
+ Handler handler = new Handler(Looper.getMainLooper());
+
+ WallpaperManager.OnColorsChangedListener listener =
+ mock(WallpaperManager.OnColorsChangedListener.class);
+ WallpaperManager.OnColorsChangedListener counter = (colors, whichWp) -> {
+ handler.post(()-> {
+ received.add(whichWp);
+ boolean ok = false;
+ if ((whichWp & WallpaperManager.FLAG_LOCK) != 0 &&
+ (whichExpected & WallpaperManager.FLAG_LOCK) != 0) {
+ latch.countDown();
+ ok = true;
+ }
+ if ((whichWp & WallpaperManager.FLAG_SYSTEM) != 0 &&
+ (whichExpected & WallpaperManager.FLAG_SYSTEM) != 0) {
+ latch.countDown();
+ ok = true;
+ }
+ if (!ok) {
+ throw new AssertionError("Unexpected which flag: " + whichWp +
+ " should be: " + whichExpected);
+ }
+ });
+ };
+
+ mWallpaperManager.addOnColorsChangedListener(listener);
+ mWallpaperManager.addOnColorsChangedListener(counter);
+
+ try {
+ mWallpaperManager.setResource(R.drawable.robot, which);
+ latch.await(5, TimeUnit.SECONDS);
+ if (latch.getCount() != 0) {
+ throw new AssertionError("Didn't receive all color events. Expected: " +
+ whichExpected + " received: " + received);
+ }
+ } catch (InterruptedException | IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ mWallpaperManager.removeOnColorsChangedListener(listener);
+ mWallpaperManager.removeOnColorsChangedListener(counter);
+ }
+
+ /**
+ * Helper to clear a wallpaper synchronously.
+ *
+ * @param which FLAG_LOCK, FLAG_SYSTEM or a combination of both.
+ */
+ private void verifyColorListenerInvokedClearing(int which) {
+ ensureCleanState();
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ WallpaperManager.OnColorsChangedListener listener =
+ mock(WallpaperManager.OnColorsChangedListener.class);
+ WallpaperManager.OnColorsChangedListener counter = (colors, whichWp) -> {
+ latch.countDown();
+ };
+
+ mWallpaperManager.addOnColorsChangedListener(listener);
+ mWallpaperManager.addOnColorsChangedListener(counter);
+
+ try {
+ mWallpaperManager.clear(which);
+ latch.await(5, TimeUnit.SECONDS);
+ } catch (InterruptedException | IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ verify(listener, atLeast(1))
+ .onColorsChanged(nullable(WallpaperColors.class), anyInt());
+
+ mWallpaperManager.removeOnColorsChangedListener(listener);
+ mWallpaperManager.removeOnColorsChangedListener(counter);
+ }
+
+ /**
+ * Helper method to make sure a wallpaper is set for both FLAG_SYSTEM and FLAG_LOCK
+ * and its callbacks were already called. Necessary to cleanup previous tests states.
+ *
+ * This is necessary to avoid race conditions between tests
+ */
+ private void ensureCleanState() {
+ Bitmap bmp = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
+ int expectedEvents = 3; // Changed wallpaper, LOCK and SYSTEM
+ CountDownLatch latch = new CountDownLatch(expectedEvents);
+ if (DEBUG) {
+ Log.d("WP", "Started latch expecting: " + latch.getCount());
+ }
+ BroadcastReceiver receiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ latch.countDown();
+ if (DEBUG) {
+ Log.d("WP", "broadcast state count down: " + latch.getCount());
+ }
+ }
+ };
+ WallpaperManager.OnColorsChangedListener callback = (colors, which) -> {
+ if ((which & WallpaperManager.FLAG_LOCK) != 0) {
+ latch.countDown();
+ }
+ if ((which & WallpaperManager.FLAG_SYSTEM) != 0) {
+ latch.countDown();
+ }
+ if (DEBUG) {
+ Log.d("WP", "color state count down: " + which + " - " + colors);
+ }
+ };
+ mContext.registerReceiver(receiver, new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED));
+ mWallpaperManager.addOnColorsChangedListener(callback);
+
+ try {
+ mWallpaperManager.setBitmap(bmp);
+
+ // Wait for up to 5 sec since this is an async call.
+ // Will pass as soon as the expected callbacks are executed.
+ latch.await(5, TimeUnit.SECONDS);
+ if (latch.getCount() != 0) {
+ Log.w(TAG, "Did not receive all events! This is probably a bug.");
+ }
+ } catch (InterruptedException | IOException e) {
+ throw new RuntimeException("Can't ensure a clean state.");
+ } finally {
+ mContext.unregisterReceiver(receiver);
+ mWallpaperManager.removeOnColorsChangedListener(callback);
+ bmp.recycle();
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/aslr/Android.mk b/tests/aslr/Android.mk
index 6ad636b..9b4866f 100644
--- a/tests/aslr/Android.mk
+++ b/tests/aslr/Android.mk
@@ -33,6 +33,6 @@
libgtest
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_EXECUTABLE)
diff --git a/tests/autofillservice/Android.mk b/tests/autofillservice/Android.mk
index f4437f7..1dbb4cc 100644
--- a/tests/autofillservice/Android.mk
+++ b/tests/autofillservice/Android.mk
@@ -32,7 +32,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsAutoFillServiceTestCases
diff --git a/tests/autofillservice/AndroidTest.xml b/tests/autofillservice/AndroidTest.xml
index 885537f..ea7e99f 100644
--- a/tests/autofillservice/AndroidTest.xml
+++ b/tests/autofillservice/AndroidTest.xml
@@ -14,9 +14,8 @@
limitations under the License.
-->
<configuration description="Config for AutoFill Framework CTS tests.">
-
- <target_preparer
- class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAutoFillServiceTestCases.apk" />
</target_preparer>
diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk
index d791fa6..c8c7d87 100644
--- a/tests/backup/Android.mk
+++ b/tests/backup/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsBackupTestCases
diff --git a/tests/backup/AndroidTest.xml b/tests/backup/AndroidTest.xml
index 96417c8..3d96fe2 100644
--- a/tests/backup/AndroidTest.xml
+++ b/tests/backup/AndroidTest.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
<configuration description="Config for CTS Backup test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsBackupApp.apk" />
<option name="test-file-name" value="CtsBackupTestCases.apk" />
diff --git a/tests/backup/app/Android.mk b/tests/backup/app/Android.mk
index 8d7e3e9..dd1992b 100644
--- a/tests/backup/app/Android.mk
+++ b/tests/backup/app/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PACKAGE_NAME := CtsBackupApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
compatibility-device-util \
diff --git a/tests/camera/Android.mk b/tests/camera/Android.mk
index af7474e..d6331e7 100644
--- a/tests/camera/Android.mk
+++ b/tests/camera/Android.mk
@@ -29,7 +29,7 @@
LOCAL_MODULE := CtsCameraUtils
LOCAL_SDK_VERSION := current
-
+-include cts/error_prone_rules_tests.mk
include $(BUILD_STATIC_JAVA_LIBRARY)
# CtsCameraTestCases package
@@ -58,7 +58,7 @@
$(call all-renderscript-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsCameraTestCases
diff --git a/tests/camera/AndroidTest.xml b/tests/camera/AndroidTest.xml
index 656b96d..869d2c3 100644
--- a/tests/camera/AndroidTest.xml
+++ b/tests/camera/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS Camera test cases">
<option name="config-descriptor:metadata" key="component" value="camera" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsCameraTestCases.apk" />
</target_preparer>
diff --git a/tests/camera/src/android/hardware/camera2/cts/PerformanceTest.java b/tests/camera/src/android/hardware/camera2/cts/PerformanceTest.java
index b88a80f..1cf0f50 100644
--- a/tests/camera/src/android/hardware/camera2/cts/PerformanceTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/PerformanceTest.java
@@ -66,7 +66,7 @@
private static final String TAG = "PerformanceTest";
private static final String REPORT_LOG_NAME = "CtsCameraTestCases";
private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
- private static final int NUM_TEST_LOOPS = 5;
+ private static final int NUM_TEST_LOOPS = 10;
private static final int NUM_MAX_IMAGES = 4;
private static final int NUM_RESULTS_WAIT = 30;
private static final int[] REPROCESS_FORMATS = {ImageFormat.YUV_420_888, ImageFormat.PRIVATE};
@@ -205,6 +205,39 @@
}
counter++;
mReportLog.submit(getInstrumentation());
+
+ if (VERBOSE) {
+ Log.v(TAG, "Camera " + id + " device open times(ms): "
+ + Arrays.toString(cameraOpenTimes)
+ + ". Average(ms): " + Stat.getAverage(cameraOpenTimes)
+ + ". Min(ms): " + Stat.getMin(cameraOpenTimes)
+ + ". Max(ms): " + Stat.getMax(cameraOpenTimes));
+ Log.v(TAG, "Camera " + id + " configure stream times(ms): "
+ + Arrays.toString(configureStreamTimes)
+ + ". Average(ms): " + Stat.getAverage(configureStreamTimes)
+ + ". Min(ms): " + Stat.getMin(configureStreamTimes)
+ + ". Max(ms): " + Stat.getMax(configureStreamTimes));
+ Log.v(TAG, "Camera " + id + " start preview times(ms): "
+ + Arrays.toString(startPreviewTimes)
+ + ". Average(ms): " + Stat.getAverage(startPreviewTimes)
+ + ". Min(ms): " + Stat.getMin(startPreviewTimes)
+ + ". Max(ms): " + Stat.getMax(startPreviewTimes));
+ Log.v(TAG, "Camera " + id + " stop preview times(ms): "
+ + Arrays.toString(stopPreviewTimes)
+ + ". Average(ms): " + Stat.getAverage(stopPreviewTimes)
+ + ". nMin(ms): " + Stat.getMin(stopPreviewTimes)
+ + ". nMax(ms): " + Stat.getMax(stopPreviewTimes));
+ Log.v(TAG, "Camera " + id + " device close times(ms): "
+ + Arrays.toString(cameraCloseTimes)
+ + ". Average(ms): " + Stat.getAverage(cameraCloseTimes)
+ + ". Min(ms): " + Stat.getMin(cameraCloseTimes)
+ + ". Max(ms): " + Stat.getMax(cameraCloseTimes));
+ Log.v(TAG, "Camera " + id + " camera launch times(ms): "
+ + Arrays.toString(cameraLaunchTimes)
+ + ". Average(ms): " + Stat.getAverage(cameraLaunchTimes)
+ + ". Min(ms): " + Stat.getMin(cameraLaunchTimes)
+ + ". Max(ms): " + Stat.getMax(cameraLaunchTimes));
+ }
}
if (mCameraIds.length != 0) {
String streamName = "test_camera_launch_average";
@@ -1085,7 +1118,7 @@
if (imageAvailable.block(timeout)) {
imageAvailable.close();
- imageReceived = false;
+ imageReceived = true;
} else {
throw new TimeoutRuntimeException("Unable to get the first image after "
+ CameraTestUtils.CAPTURE_IMAGE_TIMEOUT_MS + "ms");
diff --git a/tests/camera/utils/src/android/hardware/camera2/cts/helpers/CameraErrorCollector.java b/tests/camera/utils/src/android/hardware/camera2/cts/helpers/CameraErrorCollector.java
index e8d5837..aa048cf 100644
--- a/tests/camera/utils/src/android/hardware/camera2/cts/helpers/CameraErrorCollector.java
+++ b/tests/camera/utils/src/android/hardware/camera2/cts/helpers/CameraErrorCollector.java
@@ -25,17 +25,15 @@
import android.media.Image;
import android.util.Log;
import android.util.Size;
-
-import org.hamcrest.CoreMatchers;
-import org.hamcrest.Matcher;
-import org.junit.rules.ErrorCollector;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import org.hamcrest.CoreMatchers;
+import org.hamcrest.Matcher;
+import org.junit.rules.ErrorCollector;
/**
* A camera test ErrorCollector class to gather the test failures during a test,
@@ -891,7 +889,7 @@
if ((value = expectKeyValueNotNull(characteristics, key)) == null) {
return;
}
- String reason = "Key " + key.getName() + " value " + value
+ String reason = "Key " + key.getName() + " value " + Arrays.toString(value)
+ " doesn't contain the expected value " + expected;
expectContains(reason, value, expected);
}
@@ -909,7 +907,7 @@
if ((value = expectKeyValueNotNull(characteristics, key)) == null) {
return;
}
- String reason = "Key " + key.getName() + " value " + value
+ String reason = "Key " + key.getName() + " value " + Arrays.toString(value)
+ " doesn't contain the expected value " + expected;
expectContains(reason, value, expected);
}
@@ -927,7 +925,7 @@
if ((value = expectKeyValueNotNull(characteristics, key)) == null) {
return;
}
- String reason = "Key " + key.getName() + " value " + value
+ String reason = "Key " + key.getName() + " value " + Arrays.toString(value)
+ " doesn't contain the expected value " + expected;
expectContains(reason, value, expected);
}
@@ -948,7 +946,7 @@
public <T> void expectContains(T[] values, T expected) {
String reason = "Expected value " + expected
- + " is not contained in the given values " + values;
+ + " is not contained in the given values " + Arrays.toString(values);
expectContains(reason, values, expected);
}
@@ -984,7 +982,7 @@
public void expectContains(int[] values, int expected) {
String reason = "Expected value " + expected
- + " is not contained in the given values " + values;
+ + " is not contained in the given values " + Arrays.toString(values);
expectContains(reason, values, expected);
}
@@ -1028,7 +1026,7 @@
*/
public void expectContains(boolean[] values, boolean expected) {
String reason = "Expected value " + expected
- + " is not contained in the given values " + values;
+ + " is not contained in the given values " + Arrays.toString(values);
expectContains(reason, values, expected);
}
diff --git a/tests/dram/Android.mk b/tests/dram/Android.mk
index e286e8d..5c44668 100644
--- a/tests/dram/Android.mk
+++ b/tests/dram/Android.mk
@@ -30,7 +30,7 @@
LOCAL_PACKAGE_NAME := CtsDramTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := 16
diff --git a/tests/dram/AndroidTest.xml b/tests/dram/AndroidTest.xml
index b3a5051..bc0e8b6 100644
--- a/tests/dram/AndroidTest.xml
+++ b/tests/dram/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Dram test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDramTestCases.apk" />
</target_preparer>
diff --git a/tests/filesystem/Android.mk b/tests/filesystem/Android.mk
index 417d7c4..97f24b0 100644
--- a/tests/filesystem/Android.mk
+++ b/tests/filesystem/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PACKAGE_NAME := CtsFileSystemTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := 16
diff --git a/tests/filesystem/AndroidTest.xml b/tests/filesystem/AndroidTest.xml
index 40212a2..8429d28 100644
--- a/tests/filesystem/AndroidTest.xml
+++ b/tests/filesystem/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS File System test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsFileSystemTestCases.apk" />
</target_preparer>
diff --git a/tests/fragment/Android.mk b/tests/fragment/Android.mk
index 053e668..0225b21 100644
--- a/tests/fragment/Android.mk
+++ b/tests/fragment/Android.mk
@@ -34,13 +34,13 @@
android-common \
compatibility-device-util \
ctstestrunner \
- platform-test-annotations
+ legacy-android-test
#LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/fragment/AndroidTest.xml b/tests/fragment/AndroidTest.xml
index 2a9faae9..cbce128 100644
--- a/tests/fragment/AndroidTest.xml
+++ b/tests/fragment/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for app.usage Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsFragmentTestCases.apk" />
</target_preparer>
diff --git a/tests/inputmethod/Android.mk b/tests/inputmethod/Android.mk
index 7de22d4..5093e6f 100644
--- a/tests/inputmethod/Android.mk
+++ b/tests/inputmethod/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MULTILIB := both
diff --git a/tests/inputmethod/AndroidTest.xml b/tests/inputmethod/AndroidTest.xml
index ed1e6be..f88fcd5 100644
--- a/tests/inputmethod/AndroidTest.xml
+++ b/tests/inputmethod/AndroidTest.xml
@@ -16,7 +16,7 @@
-->
<configuration description="Config for CTS InputMethod test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsInputMethodTestCases.apk" />
</target_preparer>
diff --git a/tests/jank/Android.mk b/tests/jank/Android.mk
index 0d4f533..8e2348b 100644
--- a/tests/jank/Android.mk
+++ b/tests/jank/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PACKAGE_NAME := CtsJankDeviceTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
compatibility-device-util \
diff --git a/tests/jank/AndroidTest.xml b/tests/jank/AndroidTest.xml
index aeb3d65..acdce636 100644
--- a/tests/jank/AndroidTest.xml
+++ b/tests/jank/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Jank test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUiDeviceTestCases.apk" />
<option name="test-file-name" value="CtsJankDeviceTestCases.apk" />
diff --git a/tests/jdwp/Android.mk b/tests/jdwp/Android.mk
index 87ea31e..da4ea38 100644
--- a/tests/jdwp/Android.mk
+++ b/tests/jdwp/Android.mk
@@ -24,7 +24,7 @@
LOCAL_MODULE_TAGS := optional
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_JAVA_LIBRARY)
diff --git a/tests/jdwp/runner/device-side/Android.mk b/tests/jdwp/runner/device-side/Android.mk
index 871fc39..f04bf4a 100644
--- a/tests/jdwp/runner/device-side/Android.mk
+++ b/tests/jdwp/runner/device-side/Android.mk
@@ -30,6 +30,6 @@
LOCAL_MODULE_TAGS := optional
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_JAVA_LIBRARY)
diff --git a/tests/jdwp/runner/host-side/Android.mk b/tests/jdwp/runner/host-side/Android.mk
index 7398f69..702174c 100644
--- a/tests/jdwp/runner/host-side/Android.mk
+++ b/tests/jdwp/runner/host-side/Android.mk
@@ -30,6 +30,6 @@
LOCAL_JAVA_RESOURCE_DIRS := resources
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)
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 fb86862..6abc6d7 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
@@ -182,6 +182,14 @@
* {@inheritDoc}
*/
@Override
+ public IAbi getAbi() {
+ return mAbi;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void setBuild(IBuildInfo build) {
mBuildHelper = new CompatibilityBuildHelper(build);
}
@@ -464,6 +472,7 @@
// A DalvikTest to run any tests not contained in packages from TEST_PACKAGES, may be empty
DalvikTest catchAll = new DalvikTest();
OptionCopier.copyOptionsNoThrow(this, catchAll);
+ catchAll.mAbi = mAbi;
shards.add(catchAll);
// estimate catchAll's runtime to be that of a single package in TEST_PACKAGES
long runtimeHint = mRuntimeHint / TEST_PACKAGES.size();
@@ -474,7 +483,8 @@
DalvikTest test = new DalvikTest();
OptionCopier.copyOptionsNoThrow(this, test);
test.addIncludeFilter(packageName);
- test.mRuntimeHint = runtimeHint;
+ test.mRuntimeHint = runtimeHint / TEST_PACKAGES.size();
+ test.mAbi = mAbi;
shards.add(test);
}
// return a shard for each package in TEST_PACKAGE, plus a shard for any other tests
diff --git a/tests/leanbackjank/Android.mk b/tests/leanbackjank/Android.mk
index 25fd9a0..5b5f053 100644
--- a/tests/leanbackjank/Android.mk
+++ b/tests/leanbackjank/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsLeanbackJankTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
compatibility-device-util \
diff --git a/tests/leanbackjank/AndroidTest.xml b/tests/leanbackjank/AndroidTest.xml
index 2828243..b3fc240 100644
--- a/tests/leanbackjank/AndroidTest.xml
+++ b/tests/leanbackjank/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS LeanbackJank test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLeanbackJankTestCases.apk" />
<option name="test-file-name" value="CtsLeanbackJankApp.apk" />
diff --git a/tests/leanbackjank/app/Android.mk b/tests/leanbackjank/app/Android.mk
index 0328fdf..3925c2a 100644
--- a/tests/leanbackjank/app/Android.mk
+++ b/tests/leanbackjank/app/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PACKAGE_NAME := CtsLeanbackJankApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_RESOURCE_DIR := \
$(TOP)/frameworks/support/v17/leanback/res \
@@ -47,4 +47,6 @@
--extra-packages android.support.v17.leanback \
--extra-packages android.support.v7.recyclerview
+LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/leanbackjank/app/proguard.flags b/tests/leanbackjank/app/proguard.flags
new file mode 100644
index 0000000..0674e77
--- /dev/null
+++ b/tests/leanbackjank/app/proguard.flags
@@ -0,0 +1 @@
+-dontobfuscate
\ No newline at end of file
diff --git a/tests/leanbackjank/app/res/values/dimens.xml b/tests/leanbackjank/app/res/values/dimens.xml
new file mode 100644
index 0000000..30792fd
--- /dev/null
+++ b/tests/leanbackjank/app/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ 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
+ -->
+
+<resources>
+ <dimen name="shadow_unfocused_z">0dp</dimen>
+ <dimen name="shadow_focused_z">10dp</dimen>
+</resources>
\ No newline at end of file
diff --git a/tests/leanbackjank/app/src/android/leanbackjank/app/presenter/CardPresenter.java b/tests/leanbackjank/app/src/android/leanbackjank/app/presenter/CardPresenter.java
index bedbc5d..4e6b55d 100644
--- a/tests/leanbackjank/app/src/android/leanbackjank/app/presenter/CardPresenter.java
+++ b/tests/leanbackjank/app/src/android/leanbackjank/app/presenter/CardPresenter.java
@@ -17,11 +17,15 @@
package android.leanbackjank.app.presenter;
import android.graphics.drawable.Drawable;
+import android.net.Uri;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
+import com.bumptech.glide.load.resource.drawable.GlideDrawable;
+import com.bumptech.glide.request.RequestListener;
+import com.bumptech.glide.request.target.Target;
import android.leanbackjank.app.R;
import android.leanbackjank.app.model.Movie;
@@ -46,25 +50,17 @@
ImageCardView cardView = new ImageCardView(parent.getContext()) {
@Override
public void setSelected(boolean selected) {
- updateCardBackgroundColor(this, selected);
+ findViewById(R.id.info_field).setBackgroundColor(
+ selected ? sSelectedBackgroundColor : sDefaultBackgroundColor);
super.setSelected(selected);
}
};
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
- updateCardBackgroundColor(cardView, false);
return new ViewHolder(cardView);
}
- private static void updateCardBackgroundColor(ImageCardView view, boolean selected) {
- int color = selected ? sSelectedBackgroundColor : sDefaultBackgroundColor;
- // Both background colors should be set because the view's background is temporarily visible
- // during animations.
- view.setBackgroundColor(color);
- view.findViewById(R.id.info_field).setBackgroundColor(color);
- }
-
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
Movie movie = (Movie) item;
@@ -73,10 +69,27 @@
cardView.setTitleText(movie.getTitle());
cardView.setContentText(movie.getStudio());
cardView.setMainImageDimensions(CARD_WIDTH, CARD_HEIGHT);
+ cardView.setBackgroundColor(sDefaultBackgroundColor);
+
Glide.with(viewHolder.view.getContext())
.load(R.drawable.gradation)
.centerCrop()
.error(mDefaultCardImage)
+ .listener(new RequestListener<Integer, GlideDrawable>() {
+ @Override
+ public boolean onException(Exception e, Integer i, Target<GlideDrawable> target,
+ boolean b) {
+ return false;
+ }
+
+ @Override
+ public boolean onResourceReady(GlideDrawable glideDrawable, Integer i,
+ Target<GlideDrawable> target, boolean b, boolean b1) {
+ // Remove the background color to reduce overdraw.
+ cardView.setBackground(null);
+ return false;
+ }
+ })
.into(cardView.getMainImageView());
}
diff --git a/tests/leanbackjank/app/src/android/leanbackjank/app/ui/MainFragment.java b/tests/leanbackjank/app/src/android/leanbackjank/app/ui/MainFragment.java
index 399681c..ee04924 100644
--- a/tests/leanbackjank/app/src/android/leanbackjank/app/ui/MainFragment.java
+++ b/tests/leanbackjank/app/src/android/leanbackjank/app/ui/MainFragment.java
@@ -15,6 +15,7 @@
package android.leanbackjank.app.ui;
import android.content.Intent;
+import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.leanbackjank.app.IntentKeys;
import android.leanbackjank.app.R;
@@ -32,6 +33,7 @@
import android.support.v17.leanback.widget.ListRowPresenter;
import android.support.v17.leanback.widget.Presenter;
import android.support.v17.leanback.widget.PresenterSelector;
+import android.support.v17.leanback.widget.ShadowOverlayHelper;
import android.util.DisplayMetrics;
import android.view.View;
@@ -166,7 +168,17 @@
}
public void buildRowAdapterItems(HashMap<String, List<Movie>> data) {
- mRowsAdapter = new ArrayObjectAdapter(new ListRowPresenter());
+ ListRowPresenter listRowPresenter = new ListRowPresenter() {
+ @Override
+ protected ShadowOverlayHelper.Options createShadowOverlayOptions() {
+ Resources res = getResources();
+ ShadowOverlayHelper.Options options = new ShadowOverlayHelper.Options();
+ options.dynamicShadowZ(res.getDimension(R.dimen.shadow_unfocused_z),
+ res.getDimension(R.dimen.shadow_focused_z));
+ return options;
+ }
+ };
+ mRowsAdapter = new ArrayObjectAdapter(listRowPresenter);
CardPresenter cardPresenter = new CardPresenter();
int i = 0;
diff --git a/tests/libcore/javautilcollections/Android.mk b/tests/libcore/javautilcollections/Android.mk
index 2c7b7b1..fc90888 100644
--- a/tests/libcore/javautilcollections/Android.mk
+++ b/tests/libcore/javautilcollections/Android.mk
@@ -29,6 +29,6 @@
guava-testlib-20.0-prebuilt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsLibcoreJavaUtilCollectionsTestCases
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/libcore/javautilcollections/AndroidTest.xml b/tests/libcore/javautilcollections/AndroidTest.xml
index 7261c80..40800cd 100644
--- a/tests/libcore/javautilcollections/AndroidTest.xml
+++ b/tests/libcore/javautilcollections/AndroidTest.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Libcore java.util Collection test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="not-shardable" value="true" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLibcoreJavaUtilCollectionsTestCases.apk" />
</target_preparer>
@@ -66,4 +68,4 @@
<option name="test-timeout" value="1200000" />
<option name="shell-timeout" value="1400000" />
</test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/tests/libcore/jsr166/Android.mk b/tests/libcore/jsr166/Android.mk
index bc01844..2a9b870 100644
--- a/tests/libcore/jsr166/Android.mk
+++ b/tests/libcore/jsr166/Android.mk
@@ -34,7 +34,7 @@
LOCAL_PROGUARD_ENABLED := disabled
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
diff --git a/tests/libcore/jsr166/AndroidTest.xml b/tests/libcore/jsr166/AndroidTest.xml
index 078199e..f7db008 100644
--- a/tests/libcore/jsr166/AndroidTest.xml
+++ b/tests/libcore/jsr166/AndroidTest.xml
@@ -19,7 +19,7 @@
<option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/user.home" />
<option name="teardown-command" value="rm -rf /data/local/tmp/ctslibcore" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<!-- this has just the instrumentation which acts as the tests we want to run -->
<option name="test-file-name" value="CtsLibcoreJsr166TestCases.apk" />
diff --git a/tests/libcore/luni/Android.mk b/tests/libcore/luni/Android.mk
index 384ec72..7b5d733 100644
--- a/tests/libcore/luni/Android.mk
+++ b/tests/libcore/luni/Android.mk
@@ -46,7 +46,7 @@
LOCAL_MULTILIB := both
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# NOTE: virtualdeviceknownfailures.txt is only used for simulated/cloud-based
# continuous build configurations, so it's not referenced in AndroidTest.xml
diff --git a/tests/libcore/luni/AndroidTest.xml b/tests/libcore/luni/AndroidTest.xml
index d791dba..01b5e94 100644
--- a/tests/libcore/luni/AndroidTest.xml
+++ b/tests/libcore/luni/AndroidTest.xml
@@ -19,7 +19,7 @@
<option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/user.home" />
<option name="teardown-command" value="rm -rf /data/local/tmp/ctslibcore" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<!-- this has just the instrumentation which acts as the tests we want to run -->
<option name="test-file-name" value="CtsLibcoreTestCases.apk" />
diff --git a/tests/libcore/ojluni/Android.mk b/tests/libcore/ojluni/Android.mk
index e31b553..a6e378f 100644
--- a/tests/libcore/ojluni/Android.mk
+++ b/tests/libcore/ojluni/Android.mk
@@ -37,7 +37,7 @@
LOCAL_MULTILIB := both
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
diff --git a/tests/libcore/ojluni/AndroidTest.xml b/tests/libcore/ojluni/AndroidTest.xml
index 761567d..566cb5b 100644
--- a/tests/libcore/ojluni/AndroidTest.xml
+++ b/tests/libcore/ojluni/AndroidTest.xml
@@ -19,7 +19,7 @@
<option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/user.home" />
<option name="teardown-command" value="rm -rf /data/local/tmp/ctslibcore" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<!-- this has the CoreTestRunner which needs to be in a separate APK -->
<option name="test-file-name" value="CtsLibcoreTestRunner.apk" />
diff --git a/tests/libcore/okhttp/Android.mk b/tests/libcore/okhttp/Android.mk
index c308b59..98ed152 100644
--- a/tests/libcore/okhttp/Android.mk
+++ b/tests/libcore/okhttp/Android.mk
@@ -40,7 +40,7 @@
LOCAL_MULTILIB := both
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
diff --git a/tests/libcore/okhttp/AndroidTest.xml b/tests/libcore/okhttp/AndroidTest.xml
index 484fdfb..cd16406 100644
--- a/tests/libcore/okhttp/AndroidTest.xml
+++ b/tests/libcore/okhttp/AndroidTest.xml
@@ -19,7 +19,7 @@
<option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/user.home" />
<option name="teardown-command" value="rm -rf /data/local/tmp/ctslibcore" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<!-- this has just the instrumentation which acts as the tests we want to run -->
<option name="test-file-name" value="CtsLibcoreOkHttpTestCases.apk" />
diff --git a/tests/libcore/runner/Android.mk b/tests/libcore/runner/Android.mk
index d7399cd..3b20cfa 100644
--- a/tests/libcore/runner/Android.mk
+++ b/tests/libcore/runner/Android.mk
@@ -33,6 +33,6 @@
LOCAL_PROGUARD_ENABLED := disabled
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/libcore/wycheproof/Android.mk b/tests/libcore/wycheproof/Android.mk
index b92b469..c14da89 100644
--- a/tests/libcore/wycheproof/Android.mk
+++ b/tests/libcore/wycheproof/Android.mk
@@ -44,7 +44,7 @@
LOCAL_MULTILIB := both
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_RESOURCE_FILES := libcore/expectations/knownfailures.txt
diff --git a/tests/libcore/wycheproof/AndroidTest.xml b/tests/libcore/wycheproof/AndroidTest.xml
index d4d1c42..d09866e 100644
--- a/tests/libcore/wycheproof/AndroidTest.xml
+++ b/tests/libcore/wycheproof/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Libcore Wycheproof test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<!-- this has just the instrumentation which acts as the tests we want to run -->
<option name="test-file-name" value="CtsLibcoreWycheproofTestCases.apk" />
diff --git a/tests/netlegacy22.api/Android.mk b/tests/netlegacy22.api/Android.mk
index 3fca098..836bd9b 100644
--- a/tests/netlegacy22.api/Android.mk
+++ b/tests/netlegacy22.api/Android.mk
@@ -30,6 +30,6 @@
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/netlegacy22.api/AndroidTest.xml b/tests/netlegacy22.api/AndroidTest.xml
index 17e71f4..07e83a1 100644
--- a/tests/netlegacy22.api/AndroidTest.xml
+++ b/tests/netlegacy22.api/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Legacy android.net APIs test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetTestCasesLegacyApi22.apk" />
</target_preparer>
diff --git a/tests/netlegacy22.permission/Android.mk b/tests/netlegacy22.permission/Android.mk
index d21cd67..2f9221d 100644
--- a/tests/netlegacy22.permission/Android.mk
+++ b/tests/netlegacy22.permission/Android.mk
@@ -30,6 +30,6 @@
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/netlegacy22.permission/AndroidTest.xml b/tests/netlegacy22.permission/AndroidTest.xml
index 5b4ffa0..de6a3c9 100644
--- a/tests/netlegacy22.permission/AndroidTest.xml
+++ b/tests/netlegacy22.permission/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Legacy android.net Permission test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetTestCasesLegacyPermission22.apk" />
</target_preparer>
diff --git a/tests/netsecpolicy/usescleartexttraffic-false/Android.mk b/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
index 6b24a37..847d5ec 100644
--- a/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
+++ b/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficFalse
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/netsecpolicy/usescleartexttraffic-true/Android.mk b/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
index 9727959..95da495 100644
--- a/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
+++ b/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficTrue
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk b/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
index 7a964cc..009b3fc 100644
--- a/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
+++ b/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsNetSecPolicyUsesCleartextTrafficUnspecified
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/openglperf2/Android.mk b/tests/openglperf2/Android.mk
index f46c7d4..0a87b05 100644
--- a/tests/openglperf2/Android.mk
+++ b/tests/openglperf2/Android.mk
@@ -30,7 +30,7 @@
LOCAL_PACKAGE_NAME := CtsOpenGlPerf2TestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := 16
diff --git a/tests/openglperf2/AndroidTest.xml b/tests/openglperf2/AndroidTest.xml
index 5e50e8d..613647e 100644
--- a/tests/openglperf2/AndroidTest.xml
+++ b/tests/openglperf2/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS OpenGL test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsOpenGlPerf2TestCases.apk" />
</target_preparer>
diff --git a/tests/pdf/Android.mk b/tests/pdf/Android.mk
index 1e4a1ca..3a7e2a0 100644
--- a/tests/pdf/Android.mk
+++ b/tests/pdf/Android.mk
@@ -34,7 +34,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsPdfTestCases
diff --git a/tests/sample/Android.mk b/tests/sample/Android.mk
index 419faa5..fe790c7 100755
--- a/tests/sample/Android.mk
+++ b/tests/sample/Android.mk
@@ -25,12 +25,15 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ android-support-test \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsSampleDeviceTestCases
diff --git a/tests/sample/AndroidTest.xml b/tests/sample/AndroidTest.xml
index ae790fb..ed6bbe4 100644
--- a/tests/sample/AndroidTest.xml
+++ b/tests/sample/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Sample test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSampleDeviceTestCases.apk" />
</target_preparer>
diff --git a/tests/sensor/Android.mk b/tests/sensor/Android.mk
index 7b6dd32..0928579 100644
--- a/tests/sensor/Android.mk
+++ b/tests/sensor/Android.mk
@@ -32,7 +32,7 @@
LOCAL_SDK_VERSION := current
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
+-include cts/error_prone_rules_tests.mk
include $(BUILD_STATIC_JAVA_LIBRARY)
#
@@ -60,7 +60,7 @@
LOCAL_SDK_VERSION := current
LOCAL_NDK_STL_VARIANT := c++_shared
-
+-include cts/error_prone_rules_tests.mk
include $(BUILD_SHARED_LIBRARY)
#
@@ -73,7 +73,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
diff --git a/tests/sensor/AndroidTest.xml b/tests/sensor/AndroidTest.xml
index 8d1207e..edffd03 100644
--- a/tests/sensor/AndroidTest.xml
+++ b/tests/sensor/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS Sensor test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSensorTestCases.apk" />
</target_preparer>
diff --git a/tests/sensor/src/android/hardware/cts/SensorBatchingTests.java b/tests/sensor/src/android/hardware/cts/SensorBatchingTests.java
index cb4076c..1b2b25c 100644
--- a/tests/sensor/src/android/hardware/cts/SensorBatchingTests.java
+++ b/tests/sensor/src/android/hardware/cts/SensorBatchingTests.java
@@ -87,11 +87,11 @@
runBatchingSensorTest(Sensor.TYPE_ACCELEROMETER_UNCALIBRATED, RATE_50HZ, BATCHING_PERIOD);
}
- public void tesAccelUncalibrated_fastest_flush() throws Throwable {
+ public void testAccelUncalibrated_fastest_flush() throws Throwable {
runFlushSensorTest(Sensor.TYPE_ACCELEROMETER_UNCALIBRATED, RATE_FASTEST, BATCHING_PERIOD);
}
- public void tesAccelUncalibrated_50hz_flush() throws Throwable {
+ public void testAccelUncalibrated_50hz_flush() throws Throwable {
runFlushSensorTest(Sensor.TYPE_ACCELEROMETER_UNCALIBRATED, RATE_50HZ, BATCHING_PERIOD);
}
diff --git a/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java b/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
index 62e7fe4..44135bc 100644
--- a/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
@@ -177,7 +177,7 @@
for (Sensor s : sensors) {
int id = s.getId();
if (id != 0) {
- errors.add(String.format("sensor \"%s\" has id %d", s.getName(), s));
+ errors.add(String.format("sensor \"%s\" has id %d", s.getName(), id));
}
}
if (errors.size() > 0) {
diff --git a/tests/sensor/src/android/hardware/cts/helpers/FrameworkUnitTests.java b/tests/sensor/src/android/hardware/cts/helpers/FrameworkUnitTests.java
index 87a9a2e..6480f55 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/FrameworkUnitTests.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/FrameworkUnitTests.java
@@ -23,6 +23,7 @@
import android.hardware.cts.helpers.sensorverification.EventGapVerificationTest;
import android.hardware.cts.helpers.sensorverification.EventOrderingVerificationTest;
import android.hardware.cts.helpers.sensorverification.FrequencyVerificationTest;
+import android.hardware.cts.helpers.sensorverification.InitialValueVerificationTest;
import android.hardware.cts.helpers.sensorverification.JitterVerificationTest;
import android.hardware.cts.helpers.sensorverification.MagnitudeVerificationTest;
import android.hardware.cts.helpers.sensorverification.MeanVerificationTest;
@@ -42,12 +43,13 @@
addTestSuite(SensorStatsTest.class);
// sensorverification
+ addTestSuite(EventGapVerificationTest.class);
addTestSuite(EventOrderingVerificationTest.class);
addTestSuite(FrequencyVerificationTest.class);
+ addTestSuite(InitialValueVerificationTest.class);
addTestSuite(JitterVerificationTest.class);
addTestSuite(MagnitudeVerificationTest.class);
addTestSuite(MeanVerificationTest.class);
- addTestSuite(EventGapVerificationTest.class);
addTestSuite(StandardDeviationVerificationTest.class);
addTestSuite(TimestampClockSourceVerificationTest.class);
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java b/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
index 92c0ede..06aa815 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
@@ -38,31 +38,37 @@
private SensorCtsHelper() {}
/**
- * Get percentiles using nearest rank algorithm.
+ * Get low and high percentiles values of an array
*
- * @param percentiles List of percentiles interested. Its range is 0 to 1, instead of in %.
- * The value will be internally bounded.
+ * @param lowPercentile Lower boundary percentile, range [0, 1]
+ * @param highPercentile Higher boundary percentile, range [0, 1]
*
- * @throws IllegalArgumentException if the collection or percentiles is null or empty
+ * @throws IllegalArgumentException if the collection or percentiles is null or empty.
*/
public static <TValue extends Comparable<? super TValue>> List<TValue> getPercentileValue(
- Collection<TValue> collection, float[] percentiles) {
+ Collection<TValue> collection, float lowPecentile, float highPercentile) {
validateCollection(collection);
- if(percentiles == null || percentiles.length == 0) {
- throw new IllegalStateException("percentiles cannot be null or empty");
+ if (lowPecentile > highPercentile || lowPecentile < 0 || highPercentile > 1) {
+ throw new IllegalStateException("percentile has to be in range [0, 1], and " +
+ "lowPecentile has to be less than or equal to highPercentile");
}
List<TValue> arrayCopy = new ArrayList<TValue>(collection);
Collections.sort(arrayCopy);
List<TValue> percentileValues = new ArrayList<TValue>();
- for (float p : percentiles) {
- // zero-based array index
- int arrayIndex = (int) Math.round(arrayCopy.size() * p - .5f);
- // bound the index to avoid out of range error
- arrayIndex = Math.min(Math.max(arrayIndex, 0), arrayCopy.size() - 1);
- percentileValues.add(arrayCopy.get(arrayIndex));
- }
+ // lower percentile: rounding upwards, index range 1 .. size - 1 for percentile > 0
+ // for percentile == 0, index will be 0.
+ int lowArrayIndex = Math.min(arrayCopy.size() - 1,
+ arrayCopy.size() - (int)(arrayCopy.size() * (1 - lowPecentile)));
+ percentileValues.add(arrayCopy.get(lowArrayIndex));
+
+ // upper percentile: rounding downwards, index range 0 .. size - 2 for percentile < 1
+ // for percentile == 1, index will be size - 1.
+ // Also, lower bound by lowerArrayIndex to avoid low percentile value being higher than
+ // high percentile value.
+ int highArrayIndex = Math.max(lowArrayIndex, (int)(arrayCopy.size() * highPercentile - 1));
+ percentileValues.add(arrayCopy.get(highArrayIndex));
return percentileValues;
}
@@ -221,6 +227,30 @@
}
/**
+ * Format an array of floats.
+ *
+ * @param array the array of floats
+ *
+ * @return The formatted string
+ */
+ public static String formatFloatArray(float[] array) {
+ StringBuilder sb = new StringBuilder();
+ if (array.length > 1) {
+ sb.append("(");
+ }
+ for (int i = 0; i < array.length; i++) {
+ sb.append(String.format("%.2f", array[i]));
+ if (i != array.length - 1) {
+ sb.append(", ");
+ }
+ }
+ if (array.length > 1) {
+ sb.append(")");
+ }
+ return sb.toString();
+ }
+
+ /**
* @return A {@link File} representing a root directory to store sensor tests data.
*/
public static File getSensorTestDataDirectory() throws IOException {
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java b/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
index bc3db99..3892366 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
@@ -64,6 +64,8 @@
public static final String STANDARD_DEVIATION_KEY = "standard_deviation";
public static final String MAGNITUDE_KEY = "magnitude";
public static final String DELAYED_BATCH_DELIVERY = "delayed_batch_delivery";
+ public static final String INITIAL_MEAN_KEY = "initial_mean";
+ public static final String LATER_MEAN_KEY = "later_mean";
private final Map<String, Object> mValues = new HashMap<>();
private final Map<String, SensorStats> mSensorStats = new HashMap<>();
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/SensorOperationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/SensorOperationTest.java
index 30da9a0..abfa692 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/SensorOperationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/SensorOperationTest.java
@@ -59,7 +59,7 @@
op = new FakeSensorOperation(true, 0, TimeUnit.MILLISECONDS);
try {
op.execute(mTestNode);
- fail("AssertionError expected");
+ throw new Error("AssertionError expected");
} catch (AssertionError e) {
// Expected
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/TestSensorOperation.java b/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/TestSensorOperation.java
index 5ef2d3c..8aaadab 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/TestSensorOperation.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensoroperations/TestSensorOperation.java
@@ -40,6 +40,7 @@
import android.hardware.cts.helpers.sensorverification.JitterVerification;
import android.hardware.cts.helpers.sensorverification.MagnitudeVerification;
import android.hardware.cts.helpers.sensorverification.MeanVerification;
+import android.hardware.cts.helpers.sensorverification.InitialValueVerification;
import android.hardware.cts.helpers.sensorverification.StandardDeviationVerification;
import android.os.Handler;
import android.os.SystemClock;
@@ -110,6 +111,7 @@
addVerification(MeanVerification.getDefault(mEnvironment));
addVerification(StandardDeviationVerification.getDefault(mEnvironment));
addVerification(EventTimestampSynchronizationVerification.getDefault(mEnvironment));
+ addVerification(InitialValueVerification.getDefault(mEnvironment));
}
public void addVerification(ISensorVerification verification) {
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventBasicVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventBasicVerificationTest.java
index 34be3c4..b682ac5 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventBasicVerificationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventBasicVerificationTest.java
@@ -65,7 +65,7 @@
try {
verification.verify(stats);
- fail("Expect an AssertionError due to insufficient samples");
+ throw new Error("Expect an AssertionError due to insufficient samples");
} catch (AssertionError e) {
//Expected
}
@@ -81,7 +81,7 @@
try {
verification.verify(stats);
- fail("Expect an AssertionError due to wrong sensor event");
+ throw new Error("Expect an AssertionError due to wrong sensor event");
} catch (AssertionError e) {
//Expected
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerificationTest.java
index f1dc229c8..9cb7436 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerificationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/EventOrderingVerificationTest.java
@@ -58,7 +58,7 @@
EventOrderingVerification verification = getVerification(0, 2, 1, 3, 4);
try {
verification.verify(stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
@@ -75,7 +75,7 @@
EventOrderingVerification verification = getVerification(4, 0, 1, 2, 3);
try {
verification.verify(stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/FrequencyVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/FrequencyVerificationTest.java
index bbf022a..8780a7d 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/FrequencyVerificationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/FrequencyVerificationTest.java
@@ -55,7 +55,7 @@
verification = getVerification(850.0, 975.0, timestamps);
try {
verification.verify(getEnvironment(950), stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
@@ -65,7 +65,7 @@
verification = getVerification(1025.0, 1150.0, timestamps);
try {
verification.verify(getEnvironment(1050), stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/InitialValueVerification.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/InitialValueVerification.java
new file mode 100644
index 0000000..da6a013
--- /dev/null
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/InitialValueVerification.java
@@ -0,0 +1,187 @@
+/*
+ * 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.
+ */
+package android.hardware.cts.helpers.sensorverification;
+
+import android.hardware.Sensor;
+import android.hardware.cts.helpers.SensorCtsHelper;
+import android.hardware.cts.helpers.SensorStats;
+import android.hardware.cts.helpers.TestSensorEnvironment;
+import android.hardware.cts.helpers.TestSensorEvent;
+import android.util.Pair;
+
+import junit.framework.Assert;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A {@link ISensorVerification} which verifies that there are no ramps when starting the
+ * collection. To verify this, we compute the mean value at the beginning of the collection and
+ * compare it to the mean value at the end of the collection.
+ */
+public class InitialValueVerification extends AbstractSensorVerification {
+ public static final String PASSED_KEY = "initial_value_passed";
+ // Default length of the initial window: 2 seconds in ns
+ private static final long DEFAULT_INITIAL_WINDOW_LENGTH = 2_000_000_000L;
+
+ // sensorType: max absolute delta between the two means and initial window length
+ private static final Map<Integer, Pair<Float, Long>> DEFAULTS =
+ new HashMap<Integer, Pair<Float, Long>>(12);
+
+ static {
+ // Use a method so that the @deprecation warning can be set for that method only
+ setDefaults();
+ }
+
+ // First time stamp in nano seconds
+ private long mFirstTimestamp;
+ private float[] mInitialSum = null;
+ private int mInitialCount = 0;
+ private float[] mLaterSum = null;
+ private int mLaterCount = 0;
+
+ private final float mMaxAbsoluteDelta;
+ private final long mInitialWindowLength;
+
+ /**
+ * Construct a {@link InitialValueVerification}
+ *
+ * @param maxAbsoluteDelta the acceptable max absolute delta between the two means.
+ */
+ public InitialValueVerification(float maxAbsoluteDelta, long initialWindowLength) {
+ mMaxAbsoluteDelta = maxAbsoluteDelta;
+ mInitialWindowLength = initialWindowLength;
+ }
+
+ /**
+ * Get the default {@link InitialValueVerification} for a sensor.
+ *
+ * @param environment the test environment
+ * @return the verification or null if the verification does not apply to the sensor.
+ */
+ public static InitialValueVerification getDefault(TestSensorEnvironment environment) {
+ int sensorType = environment.getSensor().getType();
+ if (!DEFAULTS.containsKey(sensorType)) {
+ return null;
+ }
+ Pair<Float, Long> maxAbsoluteDeltaAndInitialWindowLength = DEFAULTS.get(sensorType);
+ return new InitialValueVerification(maxAbsoluteDeltaAndInitialWindowLength.first,
+ maxAbsoluteDeltaAndInitialWindowLength.second);
+ }
+
+ /**
+ * Verify that the mean at the initial window and later are similar to each other. Add
+ * {@value #PASSED_KEY}, {@value SensorStats#INITIAL_MEAN_KEY},
+ * {@value SensorStats#LATER_MEAN_KEY} keys to {@link SensorStats}.
+ *
+ * @throws AssertionError if the verification failed.
+ */
+ @Override
+ public void verify(TestSensorEnvironment environment, SensorStats stats) {
+ verify(stats);
+ }
+
+ /**
+ * Visible for unit tests only.
+ */
+ void verify(SensorStats stats) {
+ if (mInitialCount == 0) {
+ Assert.fail("Didn't collect any measurements");
+ }
+ if (mLaterCount == 0) {
+ Assert.fail(String.format("Didn't collect any measurements after %dns",
+ mInitialWindowLength));
+ }
+ float[] initialMeans = new float[mInitialSum.length];
+ float[] laterMeans = new float[mInitialSum.length];
+ boolean success = true;
+ for (int i = 0; i < mInitialSum.length; i++) {
+ initialMeans[i] = mInitialSum[i] / mInitialCount;
+ laterMeans[i] = mLaterSum[i] / mLaterCount;
+ if (Math.abs(initialMeans[i] - laterMeans[i]) > mMaxAbsoluteDelta) {
+ success = false;
+ }
+ }
+ stats.addValue(SensorStats.INITIAL_MEAN_KEY, initialMeans);
+ stats.addValue(SensorStats.LATER_MEAN_KEY, laterMeans);
+ stats.addValue(PASSED_KEY, success);
+ if (!success) {
+ Assert.fail(String.format(
+ "Means too far from each other: initial means = %s,"
+ + "later means = %s, max allowed delta = %.2f",
+ SensorCtsHelper.formatFloatArray(initialMeans),
+ SensorCtsHelper.formatFloatArray(laterMeans),
+ mMaxAbsoluteDelta));
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public InitialValueVerification clone() {
+ return new InitialValueVerification(mMaxAbsoluteDelta, mInitialWindowLength);
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void addSensorEventInternal(TestSensorEvent event) {
+ if (mInitialSum == null) {
+ mFirstTimestamp = event.timestamp;
+ mInitialSum = new float[event.values.length];
+ mLaterSum = new float[event.values.length];
+ }
+ if (event.timestamp - mFirstTimestamp <= mInitialWindowLength) {
+ for (int i = 0; i < event.values.length; i++) {
+ mInitialSum[i] += event.values[i];
+ }
+ mInitialCount++;
+ } else {
+ for (int i = 0; i < event.values.length; i++) {
+ mLaterSum[i] += event.values[i];
+ }
+ mLaterCount++;
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ private static void setDefaults() {
+ DEFAULTS.put(Sensor.TYPE_ACCELEROMETER,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_MAGNETIC_FIELD,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_GYROSCOPE,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_GYROSCOPE_UNCALIBRATED,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_ORIENTATION,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ // Very tight absolute delta for the barometer.
+ DEFAULTS.put(Sensor.TYPE_PRESSURE,
+ new Pair<Float, Long>(3f, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_GRAVITY,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_LINEAR_ACCELERATION,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_ROTATION_VECTOR,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_GAME_ROTATION_VECTOR,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ DEFAULTS.put(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR,
+ new Pair<Float, Long>(Float.MAX_VALUE, DEFAULT_INITIAL_WINDOW_LENGTH));
+ }
+}
+
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/InitialValueVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/InitialValueVerificationTest.java
new file mode 100644
index 0000000..5e28d26
--- /dev/null
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/InitialValueVerificationTest.java
@@ -0,0 +1,127 @@
+/*
+ * 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.
+ */
+
+package android.hardware.cts.helpers.sensorverification;
+
+import junit.framework.TestCase;
+
+import android.hardware.cts.helpers.SensorStats;
+import android.hardware.cts.helpers.TestSensorEnvironment;
+import android.hardware.cts.helpers.TestSensorEvent;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Tests for {@link InitialValueVerification}.
+ */
+public class InitialValueVerificationTest extends TestCase {
+ private static final long INITIAL_WINDOW_LENGTH = 2_000_000_000L; // 2s
+ private static final long TOTAL_WINDOW_LENGTH = 5_000_000_000L; // 5s
+ private static final long SENSOR_PERIOD = 500_000_000L; // 0.5s
+ private static final float MAX_ABSOLUTE_DELTA = 3f;
+ private static final Random random = new Random(123L);
+ private static final float NOISE_STD = 0.01f;
+
+ /**
+ * Test {@link InitialValueVerification#verify(SensorStats)}.
+ */
+ public void testVerify() {
+ float[] initialValues = new float[] {80.4f, 12.3f, -67f};
+ verifyStatsWithTwoWindows(initialValues, initialValues, true);
+
+ // Only modify the first element in the array but close enough
+ float[] laterValues = new float[] {78.1f, 12.3f, -67f};
+ verifyStatsWithTwoWindows(initialValues, laterValues, true);
+ // Only modify the first element in the array but by more than the MAX_ABSOLUTE_DELTA
+ laterValues = new float[] {70.1f, 12.3f, -67f};
+ verifyStatsWithTwoWindows(initialValues, laterValues, false);
+
+ // Only modify the second element in the array but close enough
+ laterValues = new float[] {80.4f, 11.3f, -67f};
+ verifyStatsWithTwoWindows(initialValues, laterValues, true);
+ // Only modify the second element in the array but by more than the MAX_ABSOLUTE_DELTA
+ laterValues = new float[] {80.4f, 7.3f, -67f};
+ verifyStatsWithTwoWindows(initialValues, laterValues, false);
+
+ // Only modify the third element in the array but close enough
+ laterValues = new float[] {80.4f, 12.3f, -65f};
+ verifyStatsWithTwoWindows(initialValues, laterValues, true);
+ // Only modify the third element in the array but by more than the MAX_ABSOLUTE_DELTA
+ laterValues = new float[] {80.4f, 12.3f, 45f};
+ verifyStatsWithTwoWindows(initialValues, laterValues, false);
+ }
+
+ private static InitialValueVerification getVerification(Collection<TestSensorEvent> events,
+ float maxAbsoluteDelta, long initialWindowLength) {
+ InitialValueVerification verification =
+ new InitialValueVerification(maxAbsoluteDelta, initialWindowLength);
+ verification.addSensorEvents(events);
+ return verification;
+ }
+
+ private static void verifyStatsWithTwoWindows(float[] initialValues, float[] laterValues,
+ boolean pass) {
+ List<TestSensorEvent> events = new ArrayList<>();
+ // Initial window
+ for (long timestamp = 0L; timestamp <= INITIAL_WINDOW_LENGTH; timestamp += SENSOR_PERIOD) {
+ float[] initialValuesWithNoise = addNoise(initialValues);
+ events.add(new TestSensorEvent(null /* sensor */, timestamp, 0 /* accuracy */,
+ initialValuesWithNoise));
+ }
+ // Later window
+ for (long timestamp = INITIAL_WINDOW_LENGTH
+ + SENSOR_PERIOD; timestamp <= TOTAL_WINDOW_LENGTH; timestamp += SENSOR_PERIOD) {
+ float[] laterValuesWithNoise = addNoise(laterValues);
+ events.add(new TestSensorEvent(null /* sensor */, timestamp, 0 /* accuracy */,
+ laterValuesWithNoise));
+ }
+ SensorStats stats = new SensorStats();
+ InitialValueVerification verification =
+ getVerification(events, MAX_ABSOLUTE_DELTA, INITIAL_WINDOW_LENGTH);
+
+ try {
+ verification.verify(stats);
+ assertTrue(pass);
+ } catch (AssertionError e) {
+ assertFalse(pass);
+ }
+ verifyStats(stats, pass, initialValues, laterValues);
+ }
+
+ private static float[] addNoise(float[] values) {
+ float[] valuesWithNoise = new float[values.length];
+ for(int i = 0; i < values.length; i++) {
+ valuesWithNoise[i] = values[i] + random.nextFloat() * NOISE_STD;
+ }
+ return valuesWithNoise;
+ }
+
+ private static void verifyStats(SensorStats stats, boolean passed, float[] initialMeans,
+ float[] laterMeans) {
+ assertEquals(passed, stats.getValue(InitialValueVerification.PASSED_KEY));
+ float[] actualInitialMeans = (float[]) stats.getValue(SensorStats.INITIAL_MEAN_KEY);
+ float[] actualLaterMeans = (float[]) stats.getValue(SensorStats.LATER_MEAN_KEY);
+ assertEquals(initialMeans.length, actualInitialMeans.length);
+ assertEquals(laterMeans.length, actualLaterMeans.length);
+ for (int i = 0; i < initialMeans.length; i++) {
+ assertEquals(initialMeans[i], actualInitialMeans[i], 0.1);
+ assertEquals(laterMeans[i], actualLaterMeans[i], 0.1);
+ }
+ }
+}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java
index 694c61f..e0d2c77 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerification.java
@@ -110,11 +110,9 @@
}
List<Long> deltas = getDeltaValues();
- float percentiles[] = new float[2];
- percentiles[0] = mOutlierMargin;
- percentiles[1] = 1 - percentiles[0];
+ List<Long> percentileValues =
+ SensorCtsHelper.getPercentileValue(deltas, mOutlierMargin, 1 - mOutlierMargin);
- List<Long> percentileValues = SensorCtsHelper.getPercentileValue(deltas, percentiles);
double normalizedRange =
(double)(percentileValues.get(1) - percentileValues.get(0)) / mThresholdNs;
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerificationTest.java
index d8e1586..4ac4999 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerificationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/JitterVerificationTest.java
@@ -62,7 +62,7 @@
verification = getVerification(1, timestamps);
try {
verification.verify(environment, stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MagnitudeVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MagnitudeVerificationTest.java
index ac873c1..dfd951d 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MagnitudeVerificationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MagnitudeVerificationTest.java
@@ -57,7 +57,7 @@
} else {
try {
verification.verify(stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
index 6603895..17882d7 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
@@ -20,6 +20,7 @@
import android.hardware.Sensor;
import android.hardware.SensorManager;
+import android.hardware.cts.helpers.SensorCtsHelper;
import android.hardware.cts.helpers.SensorStats;
import android.hardware.cts.helpers.TestSensorEnvironment;
@@ -33,24 +34,28 @@
public static final String PASSED_KEY = "mean_passed";
// sensorType: {expected, threshold}
- private static final Map<Integer, Object[]> DEFAULTS = new HashMap<Integer, Object[]>(5);
+ private static final Map<Integer, ExpectedValuesAndThresholds> DEFAULTS
+ = new HashMap<Integer, ExpectedValuesAndThresholds>(5);
static {
// Use a method so that the @deprecation warning can be set for that method only
setDefaults();
}
private final float[] mExpected;
- private final float[] mThreshold;
+ private final float[] mUpperThresholds;
+ private final float[] mLowerThresholds;
/**
* Construct a {@link MeanVerification}
*
* @param expected the expected values
- * @param threshold the thresholds
+ * @param upperThresholds the upper thresholds
+ * @param lowerThresholds the lower thresholds
*/
- public MeanVerification(float[] expected, float[] threshold) {
+ public MeanVerification(float[] expected, float[] upperThresholds, float[] lowerThresholds) {
mExpected = expected;
- mThreshold = threshold;
+ mUpperThresholds = upperThresholds;
+ mLowerThresholds = lowerThresholds;
}
/**
@@ -64,9 +69,10 @@
if (!DEFAULTS.containsKey(sensorType)) {
return null;
}
- float[] expected = (float[]) DEFAULTS.get(sensorType)[0];
- float[] threshold = (float[]) DEFAULTS.get(sensorType)[1];
- return new MeanVerification(expected, threshold);
+ float[] expected = DEFAULTS.get(sensorType).mExpectedValues;
+ float[] upperThresholds = DEFAULTS.get(sensorType).mUpperThresholds;
+ float[] lowerThresholds = DEFAULTS.get(sensorType).mLowerThresholds;
+ return new MeanVerification(expected, upperThresholds, lowerThresholds);
}
/**
@@ -92,66 +98,104 @@
float[] means = getMeans();
boolean failed = false;
- StringBuilder meanSb = new StringBuilder();
- StringBuilder expectedSb = new StringBuilder();
-
- if (means.length > 1) {
- meanSb.append("(");
- expectedSb.append("(");
- }
for (int i = 0; i < means.length; i++) {
- if (Math.abs(means[i] - mExpected[i]) > mThreshold[i]) {
+ if (means[i] > mExpected[i] + mUpperThresholds[i]) {
failed = true;
}
- meanSb.append(String.format("%.2f", means[i]));
- if (i != means.length - 1) meanSb.append(", ");
- expectedSb.append(String.format("%.2f+/-%.2f", mExpected[i], mThreshold[i]));
- if (i != means.length - 1) expectedSb.append(", ");
- }
- if (means.length > 1) {
- meanSb.append(")");
- expectedSb.append(")");
+ if (means[i] < mExpected[i] - mLowerThresholds[i]) {
+ failed = true;
+ }
}
stats.addValue(PASSED_KEY, !failed);
stats.addValue(SensorStats.MEAN_KEY, means);
if (failed) {
- Assert.fail(String.format("Mean out of range: mean=%s (expected %s)", meanSb.toString(),
- expectedSb.toString()));
+ Assert.fail(String.format("Mean out of range: mean=%s (expected %s)",
+ SensorCtsHelper.formatFloatArray(means),
+ SensorCtsHelper.formatFloatArray(mExpected)));
}
}
@Override
public MeanVerification clone() {
- return new MeanVerification(mExpected, mThreshold);
+ return new MeanVerification(mExpected, mUpperThresholds, mLowerThresholds);
}
@SuppressWarnings("deprecation")
private static void setDefaults() {
// Sensors that we don't want to test at this time but still want to record the values.
// Gyroscope should be 0 for a static device
- DEFAULTS.put(Sensor.TYPE_GYROSCOPE, new Object[]{
- new float[]{0.0f, 0.0f, 0.0f},
- new float[]{Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE}});
+ DEFAULTS.put(Sensor.TYPE_GYROSCOPE,
+ new ExpectedValuesAndThresholds(new float[]{0.0f, 0.0f, 0.0f},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE}));
// Pressure will not be exact in a controlled environment but should be relatively close to
- // sea level. Second values should always be 0.
- DEFAULTS.put(Sensor.TYPE_PRESSURE, new Object[]{
- new float[]{SensorManager.PRESSURE_STANDARD_ATMOSPHERE, 0.0f, 0.0f},
- new float[]{Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE}});
+ // sea level (400HPa and 200HPa are very lax thresholds).
+ // Second values should always be 0.
+ DEFAULTS.put(Sensor.TYPE_PRESSURE,
+ new ExpectedValuesAndThresholds(new float[]{SensorManager.PRESSURE_STANDARD_ATMOSPHERE,
+ 0.0f,
+ 0.0f},
+ new float[]{100f,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE},
+ new float[]{400f,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE}));
// Linear acceleration should be 0 in all directions for a static device
- DEFAULTS.put(Sensor.TYPE_LINEAR_ACCELERATION, new Object[]{
- new float[]{0.0f, 0.0f, 0.0f},
- new float[]{Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE}});
+ DEFAULTS.put(Sensor.TYPE_LINEAR_ACCELERATION,
+ new ExpectedValuesAndThresholds(new float[]{0.0f, 0.0f, 0.0f},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE}));
// Game rotation vector should be (0, 0, 0, 1, 0) for a static device
- DEFAULTS.put(Sensor.TYPE_GAME_ROTATION_VECTOR, new Object[]{
- new float[]{0.0f, 0.0f, 0.0f, 1.0f, 0.0f},
- new float[]{Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE,
- Float.MAX_VALUE}});
+ DEFAULTS.put(Sensor.TYPE_GAME_ROTATION_VECTOR,
+ new ExpectedValuesAndThresholds(new float[]{0.0f, 0.0f, 0.0f, 1.0f, 0.0f},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE}));
// Uncalibrated gyroscope should be 0 for a static device but allow a bigger threshold
- DEFAULTS.put(Sensor.TYPE_GYROSCOPE_UNCALIBRATED, new Object[]{
- new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
- new float[]{Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE,
- Float.MAX_VALUE, Float.MAX_VALUE}});
+ DEFAULTS.put(Sensor.TYPE_GYROSCOPE_UNCALIBRATED,
+ new ExpectedValuesAndThresholds(new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE},
+ new float[]{Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE,
+ Float.MAX_VALUE}));
+ }
+
+ private static final class ExpectedValuesAndThresholds {
+ private float[] mExpectedValues;
+ private float[] mUpperThresholds;
+ private float[] mLowerThresholds;
+ private ExpectedValuesAndThresholds(float[] expectedValues,
+ float[] upperThresholds,
+ float[] lowerThresholds) {
+ mExpectedValues = expectedValues;
+ mUpperThresholds = upperThresholds;
+ mLowerThresholds = lowerThresholds;
+ }
}
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerificationTest.java
index d7fcf9f..6661e78 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerificationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerificationTest.java
@@ -29,6 +29,7 @@
* Tests for {@link MeanVerification}.
*/
public class MeanVerificationTest extends TestCase {
+ private static final float[] MEANS = {2.0f, 3.0f, 6.0f};
/**
* Test {@link MeanVerification#verify(TestSensorEnvironment, SensorStats)}.
@@ -43,62 +44,106 @@
};
float[] expected = {2.0f, 3.0f, 6.0f};
- float[] threshold = {0.1f, 0.1f, 0.1f};
+ float[] upperThresholds = {0.3f, 0.3f, 0.3f};
+ float[] lowerThresholds = {0.1f, 0.1f, 0.1f};
SensorStats stats = new SensorStats();
- MeanVerification verification = getVerification(expected, threshold, values);
+ MeanVerification verification =
+ getVerification(expected, upperThresholds, lowerThresholds, values);
verification.verify(stats);
- verifyStats(stats, true, new float[]{2.0f, 3.0f, 6.0f});
+ verifyStats(stats, true, MEANS);
- expected = new float[]{2.5f, 2.5f, 5.5f};
- threshold = new float[]{0.6f, 0.6f, 0.6f};
+ // Test the lower threshold
+ expected = new float[]{2.4f, 3.3f, 6.4f};
+ lowerThresholds = new float[]{0.6f, 0.6f, 0.6f};
stats = new SensorStats();
- verification = getVerification(expected, threshold, values);
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
verification.verify(stats);
- verifyStats(stats, true, new float[]{2.0f, 3.0f, 6.0f});
+ verifyStats(stats, true, MEANS);
- expected = new float[]{2.5f, 2.5f, 5.5f};
- threshold = new float[]{0.1f, 0.6f, 0.6f};
+ lowerThresholds = new float[]{0.1f, 0.6f, 0.6f};
stats = new SensorStats();
- verification = getVerification(expected, threshold, values);
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
try {
verification.verify(stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
- verifyStats(stats, false, new float[]{2.0f, 3.0f, 6.0f});
+ verifyStats(stats, false, MEANS);
- expected = new float[]{2.5f, 2.5f, 5.5f};
- threshold = new float[]{0.6f, 0.1f, 0.6f};
+ lowerThresholds = new float[]{0.6f, 0.1f, 0.6f};
stats = new SensorStats();
- verification = getVerification(expected, threshold, values);
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
try {
verification.verify(stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
- verifyStats(stats, false, new float[]{2.0f, 3.0f, 6.0f});
+ verifyStats(stats, false, MEANS);
- threshold = new float[]{0.6f, 0.6f, 0.1f};
+ lowerThresholds = new float[]{0.6f, 0.6f, 0.1f};
stats = new SensorStats();
- verification = getVerification(expected, threshold, values);
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
try {
verification.verify(stats);
- fail("Expected an AssertionError");
+ throw new Error("Expected an AssertionError");
} catch (AssertionError e) {
// Expected;
}
- verifyStats(stats, false, new float[]{2.0f, 3.0f, 6.0f});
+ verifyStats(stats, false, MEANS);
+
+ // Test the upper threshold
+ expected = new float[]{1.5f, 2.8f, 5.7f};
+ upperThresholds = new float[]{0.6f, 0.6f, 0.6f};
+ lowerThresholds = new float[]{0.1f, 0.1f, 0.1f};
+ stats = new SensorStats();
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
+ verification.verify(stats);
+ verifyStats(stats, true, MEANS);
+
+ upperThresholds = new float[]{0.1f, 0.6f, 0.6f};
+ stats = new SensorStats();
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
+ try {
+ verification.verify(stats);
+ throw new Error("Expected an AssertionError");
+ } catch (AssertionError e) {
+ // Expected;
+ }
+ verifyStats(stats, false, MEANS);
+
+ upperThresholds = new float[]{0.6f, 0.1f, 0.6f};
+ stats = new SensorStats();
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
+ try {
+ verification.verify(stats);
+ throw new Error("Expected an AssertionError");
+ } catch (AssertionError e) {
+ // Expected;
+ }
+ verifyStats(stats, false, MEANS);
+
+ upperThresholds = new float[]{0.6f, 0.6f, 0.1f};
+ stats = new SensorStats();
+ verification = getVerification(expected, upperThresholds, lowerThresholds, values);
+ try {
+ verification.verify(stats);
+ throw new Error("Expected an AssertionError");
+ } catch (AssertionError e) {
+ // Expected;
+ }
+ verifyStats(stats, false, MEANS);
}
- private static MeanVerification getVerification(float[] expected, float[] threshold,
- float[] ... values) {
+ private static MeanVerification getVerification(float[] expected, float[] upperThresholds,
+ float[] lowerThresholds, float[] ... values) {
Collection<TestSensorEvent> events = new ArrayList<>(values.length);
for (float[] value : values) {
events.add(new TestSensorEvent(null, 0, 0, value));
}
- MeanVerification verification = new MeanVerification(expected, threshold);
+ MeanVerification verification =
+ new MeanVerification(expected, upperThresholds, lowerThresholds);
verification.addSensorEvents(events);
return verification;
}
@@ -106,6 +151,7 @@
private void verifyStats(SensorStats stats, boolean passed, float[] means) {
assertEquals(passed, stats.getValue(MeanVerification.PASSED_KEY));
float[] actual = (float[]) stats.getValue(SensorStats.MEAN_KEY);
+ assertEquals(means.length, actual.length);
for (int i = 0; i < means.length; i++) {
assertEquals(means[i], actual[i], 0.1);
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java
index b8412a6..a65323d 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java
@@ -191,7 +191,7 @@
for (int i = 0; i < indices.length; i++) {
assertEquals(indices[i], actualIndices[i]);
}
- } catch (Throwable t) {
+ } catch (Exception t) {
}
}
diff --git a/tests/signature/Android.mk b/tests/signature/Android.mk
index 8502c59..b78fb95 100644
--- a/tests/signature/Android.mk
+++ b/tests/signature/Android.mk
@@ -23,13 +23,14 @@
LOCAL_PACKAGE_NAME := CtsSignatureTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner \
compatibility-device-util \
- android-support-test
+ android-support-test \
+ legacy-android-test
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/signature/AndroidTest.xml b/tests/signature/AndroidTest.xml
index 6d23620..d1524af 100644
--- a/tests/signature/AndroidTest.xml
+++ b/tests/signature/AndroidTest.xml
@@ -35,7 +35,7 @@
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
<option name="push" value="system-current.api->/data/local/tmp/signature-test/system-current.api" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSignatureTestCases.apk" />
</target_preparer>
diff --git a/tests/signature/api/Android.mk b/tests/signature/api/Android.mk
index 3d67cd8..fed7d66 100644
--- a/tests/signature/api/Android.mk
+++ b/tests/signature/api/Android.mk
@@ -29,7 +29,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_ETC)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE) : frameworks/base/api/current.txt | $(APICHECK)
@@ -48,7 +48,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_ETC)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE) : frameworks/base/api/system-current.txt | $(APICHECK)
diff --git a/tests/simplecpu/Android.mk b/tests/simplecpu/Android.mk
index cb13016..1d006e1 100644
--- a/tests/simplecpu/Android.mk
+++ b/tests/simplecpu/Android.mk
@@ -30,7 +30,7 @@
LOCAL_PACKAGE_NAME := CtsSimpleCpuTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := 16
diff --git a/tests/simplecpu/AndroidTest.xml b/tests/simplecpu/AndroidTest.xml
index b48ae43..eaf35c6 100644
--- a/tests/simplecpu/AndroidTest.xml
+++ b/tests/simplecpu/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS File System test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSimpleCpuTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/accounts/Android.mk b/tests/tests/accounts/Android.mk
index 7d3187c..04388ed 100644
--- a/tests/tests/accounts/Android.mk
+++ b/tests/tests/accounts/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- CtsAccountTestsCommon ctstestrunner
+ CtsAccountTestsCommon ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -33,7 +33,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/accounts/AndroidTest.xml b/tests/tests/accounts/AndroidTest.xml
index c15cdce..af95665 100644
--- a/tests/tests/accounts/AndroidTest.xml
+++ b/tests/tests/accounts/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Accounts test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUnaffiliatedAccountAuthenticators.apk" />
<option name="test-file-name" value="CtsAccountManagerTestCases.apk" />
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
index 73fb4f3..315a046 100644
--- a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
@@ -36,7 +36,7 @@
LOCAL_PACKAGE_NAME := CtsUnaffiliatedAccountAuthenticators
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/alarmclock/Android.mk b/tests/tests/alarmclock/Android.mk
index 6c74c5c..7810ad8 100644
--- a/tests/tests/alarmclock/Android.mk
+++ b/tests/tests/alarmclock/Android.mk
@@ -30,7 +30,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/alarmclock/AndroidTest.xml b/tests/tests/alarmclock/AndroidTest.xml
index 525257e..222d574 100644
--- a/tests/tests/alarmclock/AndroidTest.xml
+++ b/tests/tests/alarmclock/AndroidTest.xml
@@ -14,13 +14,14 @@
limitations under the License.
-->
<configuration description="Configuration for AlarmClock Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAlarmClockService.apk" />
<option name="test-file-name" value="CtsAlarmClockTestCases.apk" />
</target_preparer>
- <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+ <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command"
value="settings put secure voice_interaction_service android.alarmclock.service/.MainInteractionService" />
</target_preparer>
@@ -28,4 +29,4 @@
<test class="com.android.tradefed.testtype.AndroidJUnitTest">
<option name="package" value="android.alarmclock.cts" />
</test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/tests/tests/alarmclock/common/Android.mk b/tests/tests/alarmclock/common/Android.mk
index ec0022b..7e95cff 100644
--- a/tests/tests/alarmclock/common/Android.mk
+++ b/tests/tests/alarmclock/common/Android.mk
@@ -28,6 +28,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/tests/alarmclock/service/Android.mk b/tests/tests/alarmclock/service/Android.mk
index 14fdd5d..645393b 100644
--- a/tests/tests/alarmclock/service/Android.mk
+++ b/tests/tests/alarmclock/service/Android.mk
@@ -30,6 +30,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/animation/Android.mk b/tests/tests/animation/Android.mk
index 2aeac88..31c1253 100644
--- a/tests/tests/animation/Android.mk
+++ b/tests/tests/animation/Android.mk
@@ -30,13 +30,14 @@
android-common \
compatibility-device-util \
ctstestrunner \
- platform-test-annotations
+ platform-test-annotations \
+ legacy-android-test
LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/animation/AndroidTest.xml b/tests/tests/animation/AndroidTest.xml
index 680256c..fe65ff6 100644
--- a/tests/tests/animation/AndroidTest.xml
+++ b/tests/tests/animation/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Animation test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAnimationTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
index 29e8e80..186f424 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
@@ -24,6 +24,7 @@
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -38,6 +39,7 @@
import android.support.test.filters.MediumTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
+import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.LinearInterpolator;
@@ -860,6 +862,47 @@
}
/**
+ * Test that when a child animator is being manipulated outside of an AnimatorSet, by the time
+ * AnimatorSet starts, it will not be affected, and all the child animators would start at their
+ * scheduled start time.
+ */
+ @Test
+ public void testManipulateChildOutsideOfSet() throws Throwable {
+ final ValueAnimator fadeIn = ObjectAnimator.ofFloat(mActivity.view, View.ALPHA, 0f, 1f);
+ fadeIn.setDuration(200);
+ final ValueAnimator fadeOut = ObjectAnimator.ofFloat(mActivity.view, View.ALPHA, 1f, 0f);
+ fadeOut.setDuration(200);
+
+ ValueAnimator.AnimatorUpdateListener listener = mock(
+ ValueAnimator.AnimatorUpdateListener.class);
+ fadeIn.addUpdateListener(listener);
+
+ AnimatorSet show = new AnimatorSet();
+ show.play(fadeIn);
+
+ AnimatorSet hideNShow = new AnimatorSet();
+ hideNShow.play(fadeIn).after(fadeOut);
+
+ mActivityRule.runOnUiThread(() ->
+ show.start()
+ );
+
+ verify(listener, timeout(100).atLeast(2)).onAnimationUpdate(fadeIn);
+
+ AnimatorListenerAdapter adapter = mock(AnimatorListenerAdapter.class);
+ hideNShow.addListener(adapter);
+ // Start hideNShow after fadeIn is started for 100ms
+ mActivityRule.runOnUiThread(() ->
+ hideNShow.start()
+ );
+
+ verify(adapter, timeout(800)).onAnimationEnd(hideNShow, false);
+ // Now that the hideNShow finished we need to check whether the fadeIn animation ran again.
+ assertEquals(1f, mActivity.view.getAlpha(), 0);
+
+ }
+
+ /**
*
* This test verifies that custom ValueAnimators will be start()'ed in a set.
*/
diff --git a/tests/tests/app.usage/Android.mk b/tests/tests/app.usage/Android.mk
index f8bab5b..5a97450 100644
--- a/tests/tests/app.usage/Android.mk
+++ b/tests/tests/app.usage/Android.mk
@@ -35,6 +35,6 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/app.usage/AndroidTest.xml b/tests/tests/app.usage/AndroidTest.xml
index d4967f9..b488568 100644
--- a/tests/tests/app.usage/AndroidTest.xml
+++ b/tests/tests/app.usage/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for app.usage Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUsageStatsTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/app/Android.mk b/tests/tests/app/Android.mk
index d710ce8..b85609e 100644
--- a/tests/tests/app/Android.mk
+++ b/tests/tests/app/Android.mk
@@ -35,6 +35,6 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/app/AndroidTest.xml b/tests/tests/app/AndroidTest.xml
index 739e0ba..c4387d1 100644
--- a/tests/tests/app/AndroidTest.xml
+++ b/tests/tests/app/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for app Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAndroidAppTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/appwidget/Android.mk b/tests/tests/appwidget/Android.mk
index 077461d..c4abdeb 100644
--- a/tests/tests/appwidget/Android.mk
+++ b/tests/tests/appwidget/Android.mk
@@ -32,7 +32,7 @@
legacy-android-test
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/appwidget/AndroidTest.xml b/tests/tests/appwidget/AndroidTest.xml
index 9c599f1..30aecaf 100644
--- a/tests/tests/appwidget/AndroidTest.xml
+++ b/tests/tests/appwidget/AndroidTest.xml
@@ -13,7 +13,7 @@
limitations under the License.
-->
<configuration description="Config for CTS App Widget test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAppWidgetLauncher1.apk" />
<option name="test-file-name" value="CtsAppWidgetLauncher2.apk" />
diff --git a/tests/tests/appwidget/packages/launchermanifest/Android.mk b/tests/tests/appwidget/packages/launchermanifest/Android.mk
index 9746d2b..01a48d5 100644
--- a/tests/tests/appwidget/packages/launchermanifest/Android.mk
+++ b/tests/tests/appwidget/packages/launchermanifest/Android.mk
@@ -31,7 +31,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.appwidget.cts.packages.launcher1
@@ -54,7 +54,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.appwidget.cts.packages.launcher2
@@ -75,7 +75,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.appwidget.cts.packages.launcher3
diff --git a/tests/tests/assist/Android.mk b/tests/tests/assist/Android.mk
index 9b7d774..49ec503 100644
--- a/tests/tests/assist/Android.mk
+++ b/tests/tests/assist/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner compatibility-device-util
diff --git a/tests/tests/assist/AndroidTest.xml b/tests/tests/assist/AndroidTest.xml
index a920816..2ed7ac3 100644
--- a/tests/tests/assist/AndroidTest.xml
+++ b/tests/tests/assist/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Assist test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAssistService.apk" />
<option name="test-file-name" value="CtsAssistApp.apk" />
diff --git a/tests/tests/assist/service/Android.mk b/tests/tests/assist/service/Android.mk
index 9b9ed84..de3fdca 100644
--- a/tests/tests/assist/service/Android.mk
+++ b/tests/tests/assist/service/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsAssistService
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/assist/testapp/Android.mk b/tests/tests/assist/testapp/Android.mk
index f21fc39..284da7b 100644
--- a/tests/tests/assist/testapp/Android.mk
+++ b/tests/tests/assist/testapp/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsAssistApp
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/background/AndroidTest.xml b/tests/tests/background/AndroidTest.xml
index a02f92d..96e3e9b 100644
--- a/tests/tests/background/AndroidTest.xml
+++ b/tests/tests/background/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for background restrictions CTS test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsBackgroundRestrictionsTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/bionic/Android.mk b/tests/tests/bionic/Android.mk
index 6c4009c..05ae8be 100644
--- a/tests/tests/bionic/Android.mk
+++ b/tests/tests/bionic/Android.mk
@@ -39,7 +39,7 @@
LOCAL_CXX_STL := libc++_static
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.bionic
diff --git a/tests/tests/bluetooth/Android.mk b/tests/tests/bluetooth/Android.mk
index c02b23d..0060a38 100644
--- a/tests/tests/bluetooth/Android.mk
+++ b/tests/tests/bluetooth/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_JAVA_LIBRARIES += android.test.runner
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -32,6 +32,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/bluetooth/AndroidTest.xml b/tests/tests/bluetooth/AndroidTest.xml
index fb4b205..69bb280 100644
--- a/tests/tests/bluetooth/AndroidTest.xml
+++ b/tests/tests/bluetooth/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Bluetooth test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsBluetoothTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/calendarcommon/Android.mk b/tests/tests/calendarcommon/Android.mk
index 7a8296c..042e260 100644
--- a/tests/tests/calendarcommon/Android.mk
+++ b/tests/tests/calendarcommon/Android.mk
@@ -25,13 +25,13 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/calendarcommon/AndroidTest.xml b/tests/tests/calendarcommon/AndroidTest.xml
index c411e69..f9e81f6 100644
--- a/tests/tests/calendarcommon/AndroidTest.xml
+++ b/tests/tests/calendarcommon/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Calendar test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsCalendarcommon2TestCases.apk" />
</target_preparer>
diff --git a/tests/tests/car/Android.mk b/tests/tests/car/Android.mk
index cebd099..246409b 100644
--- a/tests/tests/car/Android.mk
+++ b/tests/tests/car/Android.mk
@@ -24,14 +24,14 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test legacy-android-test
LOCAL_JAVA_LIBRARIES := android.car
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/car/AndroidTest.xml b/tests/tests/car/AndroidTest.xml
index d82c101..68ab35c 100644
--- a/tests/tests/car/AndroidTest.xml
+++ b/tests/tests/car/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Automotive test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsCarTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/carrierapi/Android.mk b/tests/tests/carrierapi/Android.mk
index 298c6ab..f66bfca 100644
--- a/tests/tests/carrierapi/Android.mk
+++ b/tests/tests/carrierapi/Android.mk
@@ -33,7 +33,7 @@
LOCAL_PACKAGE_NAME := CtsCarrierApiTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_LIBRARIES += android.test.runner telephony-common
diff --git a/tests/tests/carrierapi/AndroidTest.xml b/tests/tests/carrierapi/AndroidTest.xml
index fa8f4cc..a3c8458 100644
--- a/tests/tests/carrierapi/AndroidTest.xml
+++ b/tests/tests/carrierapi/AndroidTest.xml
@@ -17,7 +17,7 @@
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.TokenRequirement">
<option name="token" value="sim-card-with-certs" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsCarrierApiTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/colormode/Android.mk b/tests/tests/colormode/Android.mk
index d187069..f0741aa 100644
--- a/tests/tests/colormode/Android.mk
+++ b/tests/tests/colormode/Android.mk
@@ -24,12 +24,12 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsColorModeTestCases
diff --git a/tests/tests/colormode/AndroidTest.xml b/tests/tests/colormode/AndroidTest.xml
index 3f797aa..db24dc3 100644
--- a/tests/tests/colormode/AndroidTest.xml
+++ b/tests/tests/colormode/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Color Mode test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsColorModeTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/contactsproviderwipe/Android.mk b/tests/tests/contactsproviderwipe/Android.mk
index b7bd687..a4a01b8 100644
--- a/tests/tests/contactsproviderwipe/Android.mk
+++ b/tests/tests/contactsproviderwipe/Android.mk
@@ -30,12 +30,11 @@
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- $(call all-java-files-under, common/src)
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsContactsProviderWipe
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/contactsproviderwipe/AndroidTest.xml b/tests/tests/contactsproviderwipe/AndroidTest.xml
index e20faa6..940a64c 100644
--- a/tests/tests/contactsproviderwipe/AndroidTest.xml
+++ b/tests/tests/contactsproviderwipe/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Provider test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsContactsProviderWipe.apk" />
</target_preparer>
diff --git a/tests/tests/content/Android.mk b/tests/tests/content/Android.mk
index 6821a39..2c1c567 100644
--- a/tests/tests/content/Android.mk
+++ b/tests/tests/content/Android.mk
@@ -48,7 +48,7 @@
LOCAL_PACKAGE_NAME := CtsContentTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/content/AndroidTest.xml b/tests/tests/content/AndroidTest.xml
index 44199a8..e20317a 100644
--- a/tests/tests/content/AndroidTest.xml
+++ b/tests/tests/content/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Content test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsContentTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/database/Android.mk b/tests/tests/database/Android.mk
index 1be93c6..4378dc5 100644
--- a/tests/tests/database/Android.mk
+++ b/tests/tests/database/Android.mk
@@ -35,6 +35,6 @@
LOCAL_PACKAGE_NAME := CtsDatabaseTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/database/AndroidTest.xml b/tests/tests/database/AndroidTest.xml
index 4af84e0..cd85b38 100644
--- a/tests/tests/database/AndroidTest.xml
+++ b/tests/tests/database/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Database test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDatabaseTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/debug/Android.mk b/tests/tests/debug/Android.mk
index e2164b0..ff2d50f 100644
--- a/tests/tests/debug/Android.mk
+++ b/tests/tests/debug/Android.mk
@@ -28,7 +28,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
diff --git a/tests/tests/debug/AndroidTest.xml b/tests/tests/debug/AndroidTest.xml
index 2c36912..7674720 100644
--- a/tests/tests/debug/AndroidTest.xml
+++ b/tests/tests/debug/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Debug test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDebugTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/display/Android.mk b/tests/tests/display/Android.mk
index 4ad08a3..ab7693c 100644
--- a/tests/tests/display/Android.mk
+++ b/tests/tests/display/Android.mk
@@ -27,10 +27,10 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDisplayTestCases
diff --git a/tests/tests/display/AndroidTest.xml b/tests/tests/display/AndroidTest.xml
index f7f52de..012bd68 100644
--- a/tests/tests/display/AndroidTest.xml
+++ b/tests/tests/display/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Acceleration test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDisplayTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/dpi/Android.mk b/tests/tests/dpi/Android.mk
index 963db7a..cfd8165 100644
--- a/tests/tests/dpi/Android.mk
+++ b/tests/tests/dpi/Android.mk
@@ -31,7 +31,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/dpi/AndroidTest.xml b/tests/tests/dpi/AndroidTest.xml
index 7b50015..0d78c93 100644
--- a/tests/tests/dpi/AndroidTest.xml
+++ b/tests/tests/dpi/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS DPI test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDpiTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/dpi2/Android.mk b/tests/tests/dpi2/Android.mk
index 6e7c649..1fcedf1 100644
--- a/tests/tests/dpi2/Android.mk
+++ b/tests/tests/dpi2/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/dpi2/AndroidTest.xml b/tests/tests/dpi2/AndroidTest.xml
index 988f319..bce205c 100644
--- a/tests/tests/dpi2/AndroidTest.xml
+++ b/tests/tests/dpi2/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS DPI test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDpiTestCases2.apk" />
</target_preparer>
diff --git a/tests/tests/dreams/Android.mk b/tests/tests/dreams/Android.mk
index eb46897..5ae5d85 100644
--- a/tests/tests/dreams/Android.mk
+++ b/tests/tests/dreams/Android.mk
@@ -34,6 +34,6 @@
#LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/dreams/AndroidTest.xml b/tests/tests/dreams/AndroidTest.xml
index 92a2f97..6af3467 100644
--- a/tests/tests/dreams/AndroidTest.xml
+++ b/tests/tests/dreams/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Dreams test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDreamsTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/drm/Android.mk b/tests/tests/drm/Android.mk
index d67c048..a915062 100644
--- a/tests/tests/drm/Android.mk
+++ b/tests/tests/drm/Android.mk
@@ -24,12 +24,12 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsDrmTestCases
diff --git a/tests/tests/drm/AndroidTest.xml b/tests/tests/drm/AndroidTest.xml
index 5fc854e..00561d8 100644
--- a/tests/tests/drm/AndroidTest.xml
+++ b/tests/tests/drm/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS DRM test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDrmTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/drm/src/android/drm/cts/DrmInfoTest.java b/tests/tests/drm/src/android/drm/cts/DrmInfoTest.java
index 656df5b..2b42df4 100644
--- a/tests/tests/drm/src/android/drm/cts/DrmInfoTest.java
+++ b/tests/tests/drm/src/android/drm/cts/DrmInfoTest.java
@@ -16,6 +16,7 @@
package android.drm.cts;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Collection;
@@ -111,7 +112,7 @@
private static void checkInvalidData(byte[] data) throws Exception {
try {
DrmInfo info = new DrmInfo(DEFAULT_TYPE, data, DEFAULT_MIME);
- fail("Data " + data + " was accepted for DrmInfo");
+ fail("Data " + Arrays.toString(data) + " was accepted for DrmInfo");
} catch(IllegalArgumentException e) {
// Expected and thus intentionally ignored.
}
diff --git a/tests/tests/effect/Android.mk b/tests/tests/effect/Android.mk
index c347152..bf78071 100644
--- a/tests/tests/effect/Android.mk
+++ b/tests/tests/effect/Android.mk
@@ -29,7 +29,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/effect/AndroidTest.xml b/tests/tests/effect/AndroidTest.xml
index 7ba983e..4fef2d7 100644
--- a/tests/tests/effect/AndroidTest.xml
+++ b/tests/tests/effect/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Effect test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsEffectTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/externalservice/Android.mk b/tests/tests/externalservice/Android.mk
index 14e82c5..cc9c518 100644
--- a/tests/tests/externalservice/Android.mk
+++ b/tests/tests/externalservice/Android.mk
@@ -30,7 +30,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsExternalServiceTestCases
diff --git a/tests/tests/externalservice/AndroidTest.xml b/tests/tests/externalservice/AndroidTest.xml
index 36ecb04..da33cb6 100644
--- a/tests/tests/externalservice/AndroidTest.xml
+++ b/tests/tests/externalservice/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS External Service test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsExternalServiceService.apk" />
<option name="test-file-name" value="CtsExternalServiceTestCases.apk" />
diff --git a/tests/tests/externalservice/service/Android.mk b/tests/tests/externalservice/service/Android.mk
index e99a71d..c2cea8a 100644
--- a/tests/tests/externalservice/service/Android.mk
+++ b/tests/tests/externalservice/service/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsExternalServiceService
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/gesture/Android.mk b/tests/tests/gesture/Android.mk
index 7d71585..3ac8ca3 100755
--- a/tests/tests/gesture/Android.mk
+++ b/tests/tests/gesture/Android.mk
@@ -30,7 +30,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsGestureTestCases
diff --git a/tests/tests/gesture/AndroidTest.xml b/tests/tests/gesture/AndroidTest.xml
index 8cc1cd4..b655a31 100644
--- a/tests/tests/gesture/AndroidTest.xml
+++ b/tests/tests/gesture/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Gesture test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsGestureTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/graphics/Android.mk b/tests/tests/graphics/Android.mk
index af59cbf..6ac89fe 100644
--- a/tests/tests/graphics/Android.mk
+++ b/tests/tests/graphics/Android.mk
@@ -38,7 +38,7 @@
LOCAL_PACKAGE_NAME := CtsGraphicsTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Enforce public / test api only
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/graphics/AndroidTest.xml b/tests/tests/graphics/AndroidTest.xml
index a9f746b..6485931 100644
--- a/tests/tests/graphics/AndroidTest.xml
+++ b/tests/tests/graphics/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Graphics test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsGraphicsTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
index 417dd69..29aefbe4 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
@@ -32,12 +32,15 @@
import android.graphics.ColorSpace;
import android.graphics.Matrix;
import android.graphics.Paint;
+import android.os.Debug;
import android.os.Parcel;
import android.os.StrictMode;
import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.LargeTest;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
+import android.view.Surface;
import com.android.compatibility.common.util.ColorUtils;
import com.android.compatibility.common.util.WidgetTestUtils;
@@ -51,6 +54,8 @@
import java.nio.CharBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
@SmallTest
@RunWith(AndroidJUnit4.class)
@@ -1447,6 +1452,114 @@
nValidateNdkAccessAfterRecycle(bitmap);
}
+ private void runGcAndFinalizersSync() {
+ final CountDownLatch fence = new CountDownLatch(1);
+ new Object() {
+ @Override
+ protected void finalize() throws Throwable {
+ try {
+ fence.countDown();
+ } finally {
+ super.finalize();
+ }
+ }
+ };
+ try {
+ do {
+ Runtime.getRuntime().gc();
+ Runtime.getRuntime().runFinalization();
+ } while (!fence.await(100, TimeUnit.MILLISECONDS));
+ } catch (InterruptedException ex) {
+ throw new RuntimeException(ex);
+ }
+ Runtime.getRuntime().gc();
+ }
+
+ private void assertNotLeaking(int iteration, Debug.MemoryInfo start, Debug.MemoryInfo end) {
+ Debug.getMemoryInfo(end);
+ if (end.getTotalPss() - start.getTotalPss() > 2000 /* kB */) {
+ runGcAndFinalizersSync();
+ Debug.getMemoryInfo(end);
+ if (end.getTotalPss() - start.getTotalPss() > 2000 /* kB */) {
+ // Guarded by if so we don't continually generate garbage for the
+ // assertion string.
+ assertEquals("Memory leaked, iteration=" + iteration,
+ start.getTotalPss(), end.getTotalPss(),
+ 2000 /* kb */);
+ }
+ }
+ }
+
+ @Test
+ @LargeTest
+ public void testHardwareBitmapNotLeaking() {
+ Debug.MemoryInfo meminfoStart = new Debug.MemoryInfo();
+ Debug.MemoryInfo meminfoEnd = new Debug.MemoryInfo();
+ BitmapFactory.Options opts = new BitmapFactory.Options();
+ opts.inPreferredConfig = Config.HARDWARE;
+ opts.inScaled = false;
+
+ for (int i = 0; i < 2000; i++) {
+ if (i == 2) {
+ // Not really the "start" but by having done a couple
+ // we've fully initialized any state that may be required,
+ // so memory usage should be stable now
+ runGcAndFinalizersSync();
+ Debug.getMemoryInfo(meminfoStart);
+ }
+ if (i % 100 == 5) {
+ assertNotLeaking(i, meminfoStart, meminfoEnd);
+ }
+ Bitmap bitmap = BitmapFactory.decodeResource(mRes, R.drawable.robot, opts);
+ assertNotNull(bitmap);
+ // Make sure nothing messed with the bitmap
+ assertEquals(128, bitmap.getWidth());
+ assertEquals(128, bitmap.getHeight());
+ assertEquals(Config.HARDWARE, bitmap.getConfig());
+ bitmap.recycle();
+ }
+
+ assertNotLeaking(2000, meminfoStart, meminfoEnd);
+ }
+
+ @Test
+ @LargeTest
+ public void testDrawingHardwareBitmapNotLeaking() {
+ Debug.MemoryInfo meminfoStart = new Debug.MemoryInfo();
+ Debug.MemoryInfo meminfoEnd = new Debug.MemoryInfo();
+ BitmapFactory.Options opts = new BitmapFactory.Options();
+ opts.inPreferredConfig = Config.HARDWARE;
+ opts.inScaled = false;
+ RenderTarget renderTarget = RenderTarget.create();
+ renderTarget.setDefaultSize(128, 128);
+ final Surface surface = renderTarget.getSurface();
+
+ for (int i = 0; i < 2000; i++) {
+ if (i == 2) {
+ // Not really the "start" but by having done a couple
+ // we've fully initialized any state that may be required,
+ // so memory usage should be stable now
+ runGcAndFinalizersSync();
+ Debug.getMemoryInfo(meminfoStart);
+ }
+ if (i % 100 == 5) {
+ assertNotLeaking(i, meminfoStart, meminfoEnd);
+ }
+ Bitmap bitmap = BitmapFactory.decodeResource(mRes, R.drawable.robot, opts);
+ assertNotNull(bitmap);
+ // Make sure nothing messed with the bitmap
+ assertEquals(128, bitmap.getWidth());
+ assertEquals(128, bitmap.getHeight());
+ assertEquals(Config.HARDWARE, bitmap.getConfig());
+ Canvas canvas = surface.lockHardwareCanvas();
+ canvas.drawBitmap(bitmap, 0, 0, null);
+ surface.unlockCanvasAndPost(canvas);
+ bitmap.recycle();
+ }
+
+ assertNotLeaking(2000, meminfoStart, meminfoEnd);
+ }
+
private void strictModeTest(Runnable runnable) {
StrictMode.ThreadPolicy originalPolicy = StrictMode.getThreadPolicy();
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
diff --git a/tests/tests/graphics/src/android/graphics/cts/RenderTarget.java b/tests/tests/graphics/src/android/graphics/cts/RenderTarget.java
new file mode 100644
index 0000000..185dbef
--- /dev/null
+++ b/tests/tests/graphics/src/android/graphics/cts/RenderTarget.java
@@ -0,0 +1,214 @@
+/*
+ * 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.
+ */
+package android.graphics.cts;
+
+import static android.opengl.EGL14.EGL_ALPHA_SIZE;
+import static android.opengl.EGL14.EGL_BLUE_SIZE;
+import static android.opengl.EGL14.EGL_CONFIG_CAVEAT;
+import static android.opengl.EGL14.EGL_CONTEXT_CLIENT_VERSION;
+import static android.opengl.EGL14.EGL_DEFAULT_DISPLAY;
+import static android.opengl.EGL14.EGL_DEPTH_SIZE;
+import static android.opengl.EGL14.EGL_GREEN_SIZE;
+import static android.opengl.EGL14.EGL_HEIGHT;
+import static android.opengl.EGL14.EGL_NONE;
+import static android.opengl.EGL14.EGL_NO_CONTEXT;
+import static android.opengl.EGL14.EGL_OPENGL_ES2_BIT;
+import static android.opengl.EGL14.EGL_RED_SIZE;
+import static android.opengl.EGL14.EGL_RENDERABLE_TYPE;
+import static android.opengl.EGL14.EGL_SURFACE_TYPE;
+import static android.opengl.EGL14.EGL_WIDTH;
+import static android.opengl.EGL14.EGL_WINDOW_BIT;
+import static android.opengl.EGL14.eglChooseConfig;
+import static android.opengl.EGL14.eglCreateContext;
+import static android.opengl.EGL14.eglCreatePbufferSurface;
+import static android.opengl.EGL14.eglGetDisplay;
+import static android.opengl.EGL14.eglInitialize;
+import static android.opengl.EGL14.eglMakeCurrent;
+import static android.opengl.GLES20.glDeleteTextures;
+import static android.opengl.GLES20.glGenTextures;
+
+import android.graphics.SurfaceTexture;
+import android.opengl.EGLConfig;
+import android.opengl.EGLContext;
+import android.opengl.EGLDisplay;
+import android.opengl.EGLSurface;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.os.Message;
+import android.view.Surface;
+
+public final class RenderTarget {
+ private static final int SETUP_THREAD = 1;
+ private static final int CREATE_SINK = 2;
+ private static final int DESTROY_SINK = 3;
+ private static final int UPDATE_TEX_IMAGE = 4;
+
+ private static final Handler sHandler;
+ static {
+ HandlerThread thread = new HandlerThread("RenderTarget-GL");
+ thread.start();
+ sHandler = new Handler(thread.getLooper(), new RenderTargetThread());
+ sHandler.sendEmptyMessage(SETUP_THREAD);
+ }
+
+ public static RenderTarget create() {
+ GenericFuture<RenderTarget> future = new GenericFuture<>();
+ Message.obtain(sHandler, CREATE_SINK, future).sendToTarget();
+ try {
+ return future.get();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Failed to createSink()", e);
+ }
+ }
+
+ private final SurfaceTexture mSurfaceTexture;
+ private final int mGlTexId;
+ private Surface mSurface;
+
+ private RenderTarget(SurfaceTexture surfaceTexture, int glTexId) {
+ mSurfaceTexture = surfaceTexture;
+ mGlTexId = glTexId;
+ mSurface = new Surface(mSurfaceTexture);
+ }
+
+ public Surface getSurface() {
+ return mSurface;
+ }
+
+ public void setDefaultSize(int width, int height) {
+ mSurfaceTexture.setDefaultBufferSize(width, height);
+ }
+
+ public void destroy() {
+ mSurface = null;
+ Message.obtain(sHandler, DESTROY_SINK, this).sendToTarget();
+ }
+
+ private static class RenderTargetThread implements Handler.Callback,
+ SurfaceTexture.OnFrameAvailableListener {
+ @Override
+ public boolean handleMessage(Message msg) {
+ switch (msg.what) {
+ case SETUP_THREAD:
+ setupThread();
+ return true;
+ case CREATE_SINK:
+ createSink((GenericFuture<RenderTarget>) msg.obj);
+ return true;
+ case DESTROY_SINK:
+ destroySink((RenderTarget) msg.obj);
+ return true;
+ case UPDATE_TEX_IMAGE:
+ updateTexImage((SurfaceTexture) msg.obj);
+ default:
+ return false;
+ }
+ }
+
+ private void createSink(GenericFuture<RenderTarget> sinkFuture) {
+ int[] tex = new int[1];
+ glGenTextures(1, tex, 0);
+ SurfaceTexture texture = new SurfaceTexture(tex[0]);
+ texture.setOnFrameAvailableListener(this);
+ sinkFuture.setResult(new RenderTarget(texture, tex[0]));
+ }
+
+ private void destroySink(RenderTarget sink) {
+ sHandler.removeMessages(UPDATE_TEX_IMAGE, sink.mSurfaceTexture);
+ sink.mSurfaceTexture.setOnFrameAvailableListener(null);
+ sink.mSurfaceTexture.release();
+ glDeleteTextures(1, new int[] { sink.mGlTexId }, 0);
+ }
+
+ private void updateTexImage(SurfaceTexture texture) {
+ texture.updateTexImage();
+ }
+
+ private void setupThread() {
+ EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+ if (display == null) {
+ throw new IllegalStateException("eglGetDisplay failed");
+ }
+ int[] version = new int[2];
+ if (!eglInitialize(display, version, 0, version, 1)) {
+ throw new IllegalStateException("eglInitialize failed");
+ }
+ final int[] egl_attribs = new int[] {
+ EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
+ EGL_RED_SIZE, 8,
+ EGL_GREEN_SIZE, 8,
+ EGL_BLUE_SIZE, 8,
+ EGL_ALPHA_SIZE, 8,
+ EGL_DEPTH_SIZE, 0,
+ EGL_CONFIG_CAVEAT, EGL_NONE,
+ EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
+ EGL_NONE
+ };
+ EGLConfig[] configs = new EGLConfig[1];
+ int[] num_configs = new int[1];
+ if (!eglChooseConfig(display, egl_attribs, 0, configs, 0, 1, num_configs, 0)
+ || num_configs[0] <= 0 || configs[0] == null) {
+ throw new IllegalStateException("eglChooseConfig failed");
+ }
+ EGLConfig config = configs[0];
+ final int[] gl_attribs = new int[] {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL_NONE
+ };
+ EGLContext context = eglCreateContext(display, config, EGL_NO_CONTEXT, gl_attribs, 0);
+ if (context == null) {
+ throw new IllegalStateException("eglCreateContext failed");
+ }
+ final int[] pbuffer_attribs = new int[] { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE };
+ EGLSurface pbuffer = eglCreatePbufferSurface(display, config, pbuffer_attribs, 0);
+ if (pbuffer == null) {
+ throw new IllegalStateException("create pbuffer surface failed");
+ }
+ if (!eglMakeCurrent(display, pbuffer, pbuffer, context)) {
+ throw new IllegalStateException("Failed to make current");
+ }
+ }
+
+ @Override
+ public void onFrameAvailable(SurfaceTexture surfaceTexture) {
+ Message.obtain(sHandler, UPDATE_TEX_IMAGE, surfaceTexture).sendToTarget();
+ }
+ }
+
+ private static class GenericFuture<T> {
+ private boolean mHasResult = false;
+ private T mResult;
+ public void setResult(T result) {
+ synchronized (this) {
+ if (mHasResult) {
+ throw new IllegalStateException("Result already set");
+ }
+ mHasResult = true;
+ mResult = result;
+ notifyAll();
+ }
+ }
+
+ public T get() throws InterruptedException {
+ synchronized (this) {
+ while (!mHasResult) {
+ wait();
+ }
+ return mResult;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
index 4a05b85..17edc3f 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
@@ -99,7 +99,7 @@
@AfterClass
public static void tearDownClass() throws Exception {
- if (sTransitionScaleBefore != Float.NaN) {
+ if (!Float.isNaN(sTransitionScaleBefore)) {
SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(),
"settings put global transition_animation_scale " +
sTransitionScaleBefore);
diff --git a/tests/tests/hardware/Android.mk b/tests/tests/hardware/Android.mk
index 957c012..68e7e50 100644
--- a/tests/tests/hardware/Android.mk
+++ b/tests/tests/hardware/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MULTILIB := both
diff --git a/tests/tests/hardware/AndroidTest.xml b/tests/tests/hardware/AndroidTest.xml
index e33ffa0..7d574d3 100644
--- a/tests/tests/hardware/AndroidTest.xml
+++ b/tests/tests/hardware/AndroidTest.xml
@@ -14,7 +14,7 @@
-->
<configuration description="Config for CTS Hardware test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsHardwareTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/hardware/res/raw/gamepad_button_a_down.json b/tests/tests/hardware/res/raw/gamepad_button_a_down.json
new file mode 100644
index 0000000..21f5186
--- /dev/null
+++ b/tests/tests/hardware/res/raw/gamepad_button_a_down.json
@@ -0,0 +1,5 @@
+{
+ "id": 1,
+ "command": "report",
+ "report": [0x01, 0x01, 0x80, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00]
+}
diff --git a/tests/tests/hardware/res/raw/gamepad_button_a_up.json b/tests/tests/hardware/res/raw/gamepad_button_a_up.json
new file mode 100644
index 0000000..ab1eb0e
--- /dev/null
+++ b/tests/tests/hardware/res/raw/gamepad_button_a_up.json
@@ -0,0 +1,5 @@
+{
+ "id": 1,
+ "command": "report",
+ "report": [0x01, 0x00, 0x80, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00]
+}
\ No newline at end of file
diff --git a/tests/tests/hardware/res/raw/gamepad_delay.json b/tests/tests/hardware/res/raw/gamepad_delay.json
new file mode 100644
index 0000000..a25c3dd
--- /dev/null
+++ b/tests/tests/hardware/res/raw/gamepad_delay.json
@@ -0,0 +1,5 @@
+{
+ "id": 1,
+ "command": "delay",
+ "duration": 10
+}
diff --git a/tests/tests/hardware/res/raw/gamepad_press_a.json b/tests/tests/hardware/res/raw/gamepad_press_a.json
deleted file mode 100644
index ff3ca4f..0000000
--- a/tests/tests/hardware/res/raw/gamepad_press_a.json
+++ /dev/null
@@ -1,39 +0,0 @@
-{
- "id": 1,
- "command": "register",
- "name": "Odie (Test)",
- "vid": 0x18d1,
- "pid": 0x2c40,
- "descriptor": [0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x01, 0x05, 0x09, 0x0a, 0x01, 0x00,
- 0x0a, 0x02, 0x00, 0x0a, 0x04, 0x00, 0x0a, 0x05, 0x00, 0x0a, 0x07, 0x00, 0x0a, 0x08, 0x00,
- 0x0a, 0x0e, 0x00, 0x0a, 0x0f, 0x00, 0x0a, 0x0d, 0x00, 0x05, 0x0c, 0x0a, 0x24, 0x02, 0x0a,
- 0x23, 0x02, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x0b, 0x81, 0x02, 0x75, 0x01, 0x95,
- 0x01, 0x81, 0x03, 0x05, 0x01, 0x75, 0x04, 0x95, 0x01, 0x25, 0x07, 0x46, 0x3b, 0x01, 0x66,
- 0x14, 0x00, 0x09, 0x39, 0x81, 0x42, 0x66, 0x00, 0x00, 0x09, 0x01, 0xa1, 0x00, 0x09, 0x30,
- 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x05, 0x02, 0x09, 0xc5, 0x09, 0xc4, 0x15, 0x00, 0x26,
- 0xff, 0x00, 0x35, 0x00, 0x46, 0xff, 0x00, 0x75, 0x08, 0x95, 0x06, 0x81, 0x02, 0xc0, 0x85,
- 0x02, 0x05, 0x08, 0x0a, 0x01, 0x00, 0x0a, 0x02, 0x00, 0x0a, 0x03, 0x00, 0x0a, 0x04, 0x00,
- 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x04, 0x91, 0x02, 0x75, 0x04, 0x95, 0x01, 0x91,
- 0x03, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x05, 0x01, 0x09, 0x06, 0xa1,
- 0x02, 0x05, 0x06, 0x09, 0x20, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81,
- 0x02, 0x06, 0xbc, 0xff, 0x0a, 0xad, 0xbd, 0x75, 0x08, 0x95, 0x06, 0x81, 0x02, 0xc0, 0xc0],
- "report": [0x01, 0x00, 0x80, 0x90, 0x80, 0x7f, 0x73, 0x00, 0x00]
-}
-
-{
- "id": 1,
- "command": "report",
- "report": [0x01, 0x01, 0x80, 0x90, 0x80, 0x7f, 0x73, 0x00, 0x00]
-}
-
-{
- "id": 1,
- "command": "delay",
- "duration": 10
-}
-
-{
- "id": 1,
- "command": "report",
- "report": [0x01, 0x00, 0x80, 0x90, 0x80, 0x7f, 0x73, 0x00, 0x00]
-}
diff --git a/tests/tests/hardware/res/raw/gamepad_register_device.json b/tests/tests/hardware/res/raw/gamepad_register_device.json
new file mode 100644
index 0000000..cfd71eb
--- /dev/null
+++ b/tests/tests/hardware/res/raw/gamepad_register_device.json
@@ -0,0 +1,20 @@
+{
+ "id": 1,
+ "command": "register",
+ "name": "Odie (Test)",
+ "vid": 0x18d1,
+ "pid": 0x2c40,
+ "descriptor": [0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x01, 0x05, 0x09, 0x0a, 0x01, 0x00,
+ 0x0a, 0x02, 0x00, 0x0a, 0x04, 0x00, 0x0a, 0x05, 0x00, 0x0a, 0x07, 0x00, 0x0a, 0x08, 0x00,
+ 0x0a, 0x0e, 0x00, 0x0a, 0x0f, 0x00, 0x0a, 0x0d, 0x00, 0x05, 0x0c, 0x0a, 0x24, 0x02, 0x0a,
+ 0x23, 0x02, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x0b, 0x81, 0x02, 0x75, 0x01, 0x95,
+ 0x01, 0x81, 0x03, 0x05, 0x01, 0x75, 0x04, 0x95, 0x01, 0x25, 0x07, 0x46, 0x3b, 0x01, 0x66,
+ 0x14, 0x00, 0x09, 0x39, 0x81, 0x42, 0x66, 0x00, 0x00, 0x09, 0x01, 0xa1, 0x00, 0x09, 0x30,
+ 0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x05, 0x02, 0x09, 0xc5, 0x09, 0xc4, 0x15, 0x00, 0x26,
+ 0xff, 0x00, 0x35, 0x00, 0x46, 0xff, 0x00, 0x75, 0x08, 0x95, 0x06, 0x81, 0x02, 0xc0, 0x85,
+ 0x02, 0x05, 0x08, 0x0a, 0x01, 0x00, 0x0a, 0x02, 0x00, 0x0a, 0x03, 0x00, 0x0a, 0x04, 0x00,
+ 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x04, 0x91, 0x02, 0x75, 0x04, 0x95, 0x01, 0x91,
+ 0x03, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x05, 0x01, 0x09, 0x06, 0xa1,
+ 0x02, 0x05, 0x06, 0x09, 0x20, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x81,
+ 0x02, 0x06, 0xbc, 0xff, 0x0a, 0xad, 0xbd, 0x75, 0x08, 0x95, 0x06, 0x81, 0x02, 0xc0, 0xc0]
+}
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/InputCallback.java b/tests/tests/hardware/src/android/hardware/input/cts/InputCallback.java
index accdcaf..b4bda4e 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/InputCallback.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/InputCallback.java
@@ -22,4 +22,7 @@
public interface InputCallback {
public void onKeyEvent(KeyEvent ev);
public void onMotionEvent(MotionEvent ev);
+ public void onInputDeviceAdded(int deviceId);
+ public void onInputDeviceRemoved(int deviceId);
+ public void onInputDeviceChanged(int deviceId);
}
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/InputCtsActivity.java b/tests/tests/hardware/src/android/hardware/input/cts/InputCtsActivity.java
index b16cadb..72aa056 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/InputCtsActivity.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/InputCtsActivity.java
@@ -17,15 +17,28 @@
package android.hardware.input.cts;
import android.app.Activity;
+import android.content.Context;
+import android.hardware.input.InputManager;
+import android.hardware.input.InputManager.InputDeviceListener;
+import android.os.Bundle;
+import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
-import java.util.ArrayList;
-import java.util.List;
+public class InputCtsActivity extends Activity implements InputDeviceListener {
+ private static final String TAG = "InputCtsActivity";
-public class InputCtsActivity extends Activity {
private InputCallback mInputCallback;
+ private InputManager mInputManager;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ mInputManager = getApplicationContext().getSystemService(InputManager.class);
+ mInputManager.registerInputDeviceListener(this, null);
+ }
+
@Override
public boolean dispatchGenericMotionEvent(MotionEvent ev) {
if (mInputCallback != null) {
@@ -61,4 +74,20 @@
public void setInputCallback(InputCallback callback) {
mInputCallback = callback;
}
+
+ @Override
+ public void onInputDeviceAdded(int deviceId) {
+ mInputCallback.onInputDeviceAdded(deviceId);
+ }
+
+ @Override
+ public void onInputDeviceRemoved(int deviceId) {
+ mInputCallback.onInputDeviceRemoved(deviceId);
+ }
+
+ @Override
+ public void onInputDeviceChanged(int deviceId) {
+ mInputManager.getInputDevice(deviceId); // if this isn't called, won't get new notifications
+ mInputCallback.onInputDeviceChanged(deviceId);
+ }
}
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
new file mode 100644
index 0000000..e44bcb4
--- /dev/null
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2015 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.hardware.input.cts.tests;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.view.KeyEvent;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import android.hardware.cts.R;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class GamepadTestCase extends InputTestCase {
+ private static final String TAG = "GamepadTests";
+
+ @Test
+ public void testButtonA() throws Exception {
+ registerInputDevice(R.raw.gamepad_register_device);
+
+ sendHidCommands(R.raw.gamepad_button_a_down);
+ sendHidCommands(R.raw.gamepad_delay);
+ assertReceivedKeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BUTTON_A);
+
+ sendHidCommands(R.raw.gamepad_button_a_up);
+ assertReceivedKeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_BUTTON_A);
+
+ assertNoMoreEvents();
+ }
+}
+
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
index fba5f51..18a7e64 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
@@ -16,68 +16,88 @@
package android.hardware.input.cts.tests;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import android.app.Instrumentation;
import android.app.UiAutomation;
-import android.hardware.input.cts.InputCtsActivity;
import android.hardware.input.cts.InputCallback;
-import android.system.ErrnoException;
-import android.system.Os;
-import android.test.ActivityInstrumentationTestCase2;
-import android.util.Log;
+import android.hardware.input.cts.InputCtsActivity;
+import android.os.ParcelFileDescriptor;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.rule.ActivityTestRule;
import android.view.KeyEvent;
import android.view.MotionEvent;
import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
-import java.io.Writer;
-import java.util.ArrayList;
+
import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-import java.util.List;
-import java.util.UUID;
-public class InputTestCase extends ActivityInstrumentationTestCase2<InputCtsActivity> {
- private static final String TAG = "InputTestCase";
- private static final String HID_EXECUTABLE = "hid";
- private static final int SHELL_UID = 2000;
+import libcore.io.IoUtils;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+
+public class InputTestCase {
+ // hid executable expects "-" argument to read from stdin instead of a file
+ private static final String HID_COMMAND = "hid -";
private static final String[] KEY_ACTIONS = {"DOWN", "UP", "MULTIPLE"};
- private File mFifo;
- private Writer mWriter;
+ private OutputStream mOutputStream;
- private BlockingQueue<KeyEvent> mKeys;
- private BlockingQueue<MotionEvent> mMotions;
+ private final BlockingQueue<KeyEvent> mKeys;
+ private final BlockingQueue<MotionEvent> mMotions;
private InputListener mInputListener;
+ private Instrumentation mInstrumentation;
+
+ private volatile CountDownLatch mDeviceAddedSignal; // to wait for onInputDeviceAdded signal
+
public InputTestCase() {
- super(InputCtsActivity.class);
mKeys = new LinkedBlockingQueue<KeyEvent>();
mMotions = new LinkedBlockingQueue<MotionEvent>();
mInputListener = new InputListener();
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- mFifo = setupFifo();
+ @Rule
+ public ActivityTestRule<InputCtsActivity> mActivityRule =
+ new ActivityTestRule<>(InputCtsActivity.class);
+
+ @Before
+ public void setUp() throws Exception {
clearKeys();
clearMotions();
- getActivity().setInputCallback(mInputListener);
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+ mActivityRule.getActivity().setInputCallback(mInputListener);
+ setupPipes();
}
- @Override
- protected void tearDown() throws Exception {
- if (mFifo != null) {
- mFifo.delete();
- mFifo = null;
+ @After
+ public void tearDown() throws Exception {
+ IoUtils.closeQuietly(mOutputStream);
+ }
+
+ /**
+ * Register an input device. May cause a failure if the device added notification
+ * is not received within the timeout period
+ *
+ * @param resourceId The resource id from which to send the register command.
+ */
+ public void registerInputDevice(int resourceId) {
+ mDeviceAddedSignal = new CountDownLatch(1);
+ sendHidCommands(resourceId);
+ try {
+ mDeviceAddedSignal.await(2L, TimeUnit.SECONDS);
+ } catch (InterruptedException ex) {
+ fail("Device added notification was not received within the allotted time.");
}
- closeQuietly(mWriter);
- mWriter = null;
- super.tearDown();
}
/**
@@ -89,9 +109,8 @@
*/
public void sendHidCommands(int id) {
try {
- Writer w = getWriter();
- w.write(getEvents(id));
- w.flush();
+ mOutputStream.write(getEvents(id).getBytes());
+ mOutputStream.flush();
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -153,40 +172,20 @@
mMotions.clear();
}
- private File setupFifo() throws ErrnoException {
- File dir = getActivity().getCacheDir();
- String filename = dir.getAbsolutePath() + File.separator + UUID.randomUUID().toString();
- Os.mkfifo(filename, 0666);
- File f = new File(filename);
- return f;
- }
+ private void setupPipes() throws IOException {
+ UiAutomation ui = mInstrumentation.getUiAutomation();
+ ParcelFileDescriptor[] pipes = ui.executeShellCommandRw(HID_COMMAND);
- private Writer getWriter() throws IOException {
- if (mWriter == null) {
- UiAutomation ui = getInstrumentation().getUiAutomation();
- ui.executeShellCommand("hid " + mFifo.getAbsolutePath());
- mWriter = new FileWriter(mFifo);
- }
- return mWriter;
+ mOutputStream = new ParcelFileDescriptor.AutoCloseOutputStream(pipes[1]);
+ IoUtils.closeQuietly(pipes[0]); // hid command is write-only
}
private String getEvents(int id) throws IOException {
InputStream is =
- getInstrumentation().getTargetContext().getResources().openRawResource(id);
+ mInstrumentation.getTargetContext().getResources().openRawResource(id);
return readFully(is);
}
-
- private static void closeQuietly(AutoCloseable closeable) {
- if (closeable != null) {
- try {
- closeable.close();
- } catch (RuntimeException rethrown) {
- throw rethrown;
- } catch (Exception ignored) { }
- }
- }
-
private static String readFully(InputStream is) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int read = 0;
@@ -198,6 +197,7 @@
}
private class InputListener implements InputCallback {
+ @Override
public void onKeyEvent(KeyEvent ev) {
boolean done = false;
do {
@@ -208,6 +208,7 @@
} while (!done);
}
+ @Override
public void onMotionEvent(MotionEvent ev) {
boolean done = false;
do {
@@ -217,5 +218,20 @@
} catch (InterruptedException ignore) { }
} while (!done);
}
+
+ @Override
+ public void onInputDeviceAdded(int deviceId) {
+ mDeviceAddedSignal.countDown();
+ }
+
+ @Override
+ public void onInputDeviceRemoved(int deviceId) {
+ }
+
+ @Override
+ public void onInputDeviceChanged(int deviceId) {
+ }
}
+
+
}
diff --git a/tests/tests/icu/Android.mk b/tests/tests/icu/Android.mk
index 45fed49..4a65c44 100644
--- a/tests/tests/icu/Android.mk
+++ b/tests/tests/icu/Android.mk
@@ -34,7 +34,7 @@
android-icu4j-tests
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsIcuTestCases
diff --git a/tests/tests/icu/AndroidTest.xml b/tests/tests/icu/AndroidTest.xml
index 5d8bd19..c64898e 100644
--- a/tests/tests/icu/AndroidTest.xml
+++ b/tests/tests/icu/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS ICU test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsIcuTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/incident/Android.mk b/tests/tests/incident/Android.mk
index 7d07ec0..bb83dda 100644
--- a/tests/tests/incident/Android.mk
+++ b/tests/tests/incident/Android.mk
@@ -27,12 +27,13 @@
LOCAL_PACKAGE_NAME := CtsIncidentTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
#LOCAL_SDK_VERSION := current
LOCAL_JAVA_LIBRARIES += android.test.runner
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner
+ ctstestrunner \
+ legacy-android-test
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/incident/AndroidTest.xml b/tests/tests/incident/AndroidTest.xml
index 529b674..0471de1 100644
--- a/tests/tests/incident/AndroidTest.xml
+++ b/tests/tests/incident/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Configuration for OS Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsIncidentTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/jni/Android.mk b/tests/tests/jni/Android.mk
index 7672d2f..38111fc 100644
--- a/tests/tests/jni/Android.mk
+++ b/tests/tests/jni/Android.mk
@@ -28,7 +28,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
diff --git a/tests/tests/jni/AndroidTest.xml b/tests/tests/jni/AndroidTest.xml
index c1746de..1daa4c4 100644
--- a/tests/tests/jni/AndroidTest.xml
+++ b/tests/tests/jni/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS JNI test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsJniTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/keystore/Android.mk b/tests/tests/keystore/Android.mk
index ae1b804..21578d4 100644
--- a/tests/tests/keystore/Android.mk
+++ b/tests/tests/keystore/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_LIBRARIES := bouncycastle
diff --git a/tests/tests/keystore/AndroidTest.xml b/tests/tests/keystore/AndroidTest.xml
index 41b8541..08238a7 100644
--- a/tests/tests/keystore/AndroidTest.xml
+++ b/tests/tests/keystore/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Keystore test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsKeystoreTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/libcorefileio/Android.mk b/tests/tests/libcorefileio/Android.mk
index d329c9d..066d727 100644
--- a/tests/tests/libcorefileio/Android.mk
+++ b/tests/tests/libcorefileio/Android.mk
@@ -28,6 +28,6 @@
LOCAL_PACKAGE_NAME := CtsLibcoreFileIOTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/libcorefileio/AndroidTest.xml b/tests/tests/libcorefileio/AndroidTest.xml
index e21d3a2..03d9f22 100644
--- a/tests/tests/libcorefileio/AndroidTest.xml
+++ b/tests/tests/libcorefileio/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Legacy Libcore test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLibcoreFileIOTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/libcorelegacy22/Android.mk b/tests/tests/libcorelegacy22/Android.mk
index 408fd3b..2788337 100644
--- a/tests/tests/libcorelegacy22/Android.mk
+++ b/tests/tests/libcorelegacy22/Android.mk
@@ -30,6 +30,6 @@
LOCAL_SDK_VERSION := 22
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/libcorelegacy22/AndroidTest.xml b/tests/tests/libcorelegacy22/AndroidTest.xml
index a313035..3f18a12 100644
--- a/tests/tests/libcorelegacy22/AndroidTest.xml
+++ b/tests/tests/libcorelegacy22/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Legacy Libcore test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLibcoreLegacy22TestCases.apk" />
</target_preparer>
diff --git a/tests/tests/location/Android.mk b/tests/tests/location/Android.mk
index bfd9a08..3c98287 100644
--- a/tests/tests/location/Android.mk
+++ b/tests/tests/location/Android.mk
@@ -45,7 +45,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
diff --git a/tests/tests/location/AndroidTest.xml b/tests/tests/location/AndroidTest.xml
index 4ac850e..108915e 100644
--- a/tests/tests/location/AndroidTest.xml
+++ b/tests/tests/location/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS Location test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLocationTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/location2/Android.mk b/tests/tests/location2/Android.mk
index a081213..de01ba8 100644
--- a/tests/tests/location2/Android.mk
+++ b/tests/tests/location2/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit legacy-android-test
diff --git a/tests/tests/location2/AndroidTest.xml b/tests/tests/location2/AndroidTest.xml
index 31f4684..03ef041 100644
--- a/tests/tests/location2/AndroidTest.xml
+++ b/tests/tests/location2/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS Location test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLocation2TestCases.apk" />
</target_preparer>
diff --git a/tests/tests/media/Android.mk b/tests/tests/media/Android.mk
index b7ae9d2..9db91bb 100644
--- a/tests/tests/media/Android.mk
+++ b/tests/tests/media/Android.mk
@@ -77,7 +77,7 @@
LOCAL_JAVA_LIBRARIES += android.test.runner org.apache.http.legacy
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/media/AndroidTest.xml b/tests/tests/media/AndroidTest.xml
index 08ee0a0..ac5ec91 100644
--- a/tests/tests/media/AndroidTest.xml
+++ b/tests/tests/media/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Media test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsMediaTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java b/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
index 4b5b1d7..93f3b66 100644
--- a/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
+++ b/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
@@ -205,7 +205,7 @@
public void onlyH263SW() { ex(H263(SW), allTests); }
public void bytebuffer() { ex(H264(SW), new EarlyEosTest().byteBuffer()); }
- public void texture() { ex(H264(HW), new EarlyEosTest().texture()); }
+ public void onlyTexture() { ex(H264(HW), new EarlyEosTest().texture()); }
/* inidividual tests */
public void testH264_adaptiveEarlyEos() { ex(H264(), adaptiveEarlyEos); }
diff --git a/tests/tests/media/src/android/media/cts/MediaCasTest.java b/tests/tests/media/src/android/media/cts/MediaCasTest.java
index a3cdefc..97cdcdd 100644
--- a/tests/tests/media/src/android/media/cts/MediaCasTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCasTest.java
@@ -177,7 +177,8 @@
@Override
public void onEvent(MediaCas MediaCas, int event, int arg, byte[] data) {
Log.d(TAG, "Received MediaCas event: "
- + "event=" + event + ", arg=" + arg + ", data=" + data);
+ + "event=" + event + ", arg=" + arg
+ + ", data=" + Arrays.toString(data));
}
}, null);
} finally {
@@ -509,9 +510,11 @@
@Override
public void onEvent(MediaCas mediaCas, int event, int arg, byte[] data) {
Log.d(TAG, "Received MediaCas event: event=" + event
- + ", arg=" + arg + ", data=" + data);
+ + ", arg=" + arg + ", data=" + Arrays.toString(data));
if (mediaCas == mMediaCas && event == mEvent
- && arg == mArg && Arrays.equals(data, mData)) {
+ && arg == mArg && (Arrays.equals(data, mData) ||
+ data == null && mData.length == 0 ||
+ mData == null && data.length == 0)) {
mIsIdential = true;
}
mLatch.countDown();
diff --git a/tests/tests/mediastress/Android.mk b/tests/tests/mediastress/Android.mk
index 34bc778..55e7a3a 100644
--- a/tests/tests/mediastress/Android.mk
+++ b/tests/tests/mediastress/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
diff --git a/tests/tests/mediastress/AndroidTest.xml b/tests/tests/mediastress/AndroidTest.xml
index b41fcf3..1879e03 100644
--- a/tests/tests/mediastress/AndroidTest.xml
+++ b/tests/tests/mediastress/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS Media Stress test cases">
<target_preparer class="android.mediastress.cts.preconditions.MediaPreparer" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsMediaStressTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/mediastress/preconditions/Android.mk b/tests/tests/mediastress/preconditions/Android.mk
index 573f083..c6c1cf2 100644
--- a/tests/tests/mediastress/preconditions/Android.mk
+++ b/tests/tests/mediastress/preconditions/Android.mk
@@ -25,7 +25,7 @@
LOCAL_MODULE := compatibility-host-media-preconditions
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/mediastress/preconditions/app/Android.mk b/tests/tests/mediastress/preconditions/app/Android.mk
index 0ef2de4..8630ac1 100644
--- a/tests/tests/mediastress/preconditions/app/Android.mk
+++ b/tests/tests/mediastress/preconditions/app/Android.mk
@@ -30,7 +30,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsMediaPreparerApp
diff --git a/tests/tests/midi/Android.mk b/tests/tests/midi/Android.mk
index eeda8c8..4192e5d 100755
--- a/tests/tests/midi/Android.mk
+++ b/tests/tests/midi/Android.mk
@@ -23,7 +23,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
diff --git a/tests/tests/midi/AndroidTest.xml b/tests/tests/midi/AndroidTest.xml
index ebb2c72..e7e22e8 100644
--- a/tests/tests/midi/AndroidTest.xml
+++ b/tests/tests/midi/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS MIDI test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsMidiTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/multiuser/Android.mk b/tests/tests/multiuser/Android.mk
index 67db1f5..e85fed2 100644
--- a/tests/tests/multiuser/Android.mk
+++ b/tests/tests/multiuser/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/multiuser/AndroidTest.xml b/tests/tests/multiuser/AndroidTest.xml
index d5593627..7c7d938 100644
--- a/tests/tests/multiuser/AndroidTest.xml
+++ b/tests/tests/multiuser/AndroidTest.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
<configuration description="Config for CTS Multiuser test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsMultiUserTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/nativehardware/Android.mk b/tests/tests/nativehardware/Android.mk
index a001387..065f5d2 100644
--- a/tests/tests/nativehardware/Android.mk
+++ b/tests/tests/nativehardware/Android.mk
@@ -71,7 +71,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
diff --git a/tests/tests/nativemedia/aaudio/Android.mk b/tests/tests/nativemedia/aaudio/Android.mk
index f1fc7fd..983a894 100644
--- a/tests/tests/nativemedia/aaudio/Android.mk
+++ b/tests/tests/nativemedia/aaudio/Android.mk
@@ -40,7 +40,7 @@
LOCAL_CTS_TEST_PACKAGE := android.nativemedia.aaudio
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CFLAGS := -Werror -Wall
diff --git a/tests/tests/nativemedia/sl/Android.mk b/tests/tests/nativemedia/sl/Android.mk
index 2c50cd7..2e99354 100644
--- a/tests/tests/nativemedia/sl/Android.mk
+++ b/tests/tests/nativemedia/sl/Android.mk
@@ -42,7 +42,7 @@
LOCAL_CTS_TEST_PACKAGE := android.nativemedia.sl
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CFLAGS := -Werror -Wall
diff --git a/tests/tests/nativemedia/xa/Android.mk b/tests/tests/nativemedia/xa/Android.mk
index 8ea1062..1a9fe43 100644
--- a/tests/tests/nativemedia/xa/Android.mk
+++ b/tests/tests/nativemedia/xa/Android.mk
@@ -41,6 +41,6 @@
LOCAL_CTS_TEST_PACKAGE := android.nativemedia.xa
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_EXECUTABLE)
diff --git a/tests/tests/ndef/Android.mk b/tests/tests/ndef/Android.mk
index bd60a1a..47f45c9 100644
--- a/tests/tests/ndef/Android.mk
+++ b/tests/tests/ndef/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/ndef/AndroidTest.xml b/tests/tests/ndef/AndroidTest.xml
index 5e4de24..10a4095 100644
--- a/tests/tests/ndef/AndroidTest.xml
+++ b/tests/tests/ndef/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS NDEF test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNdefTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/net/Android.mk b/tests/tests/net/Android.mk
index 98cde9b..3493ccb 100644
--- a/tests/tests/net/Android.mk
+++ b/tests/tests/net/Android.mk
@@ -47,7 +47,7 @@
#LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/net/AndroidTest.xml b/tests/tests/net/AndroidTest.xml
index 389b926..fbad739 100644
--- a/tests/tests/net/AndroidTest.xml
+++ b/tests/tests/net/AndroidTest.xml
@@ -13,7 +13,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Net test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetTestCases.apk" />
<option name="test-file-name" value="CtsNetTestAppForApi23.apk" />
diff --git a/tests/tests/net/appForApi23/Android.mk b/tests/tests/net/appForApi23/Android.mk
index f0d3535..ea99684 100644
--- a/tests/tests/net/appForApi23/Android.mk
+++ b/tests/tests/net/appForApi23/Android.mk
@@ -31,7 +31,7 @@
LOCAL_SDK_VERSION := 23
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
index 6dec23f..c206b76 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
@@ -20,9 +20,11 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner \
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
ctstestserver \
- org.apache.http.legacy
+ org.apache.http.legacy \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src common)
@@ -31,7 +33,7 @@
LOCAL_INSTRUMENTATION_FOR := CtsNetSecPolicyUsesCleartextTrafficFalse
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml
index 838367b..73759c5 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecPolicyUsesCleartextTrafficFalse test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficFalse.apk" />
<option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficFalseTestCases.apk" />
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
index 6df748d..ab95129 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
@@ -20,9 +20,11 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner \
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
ctstestserver \
- org.apache.http.legacy
+ org.apache.http.legacy \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src common)
@@ -31,7 +33,7 @@
LOCAL_INSTRUMENTATION_FOR := CtsNetSecPolicyUsesCleartextTrafficTrue
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml
index b30c53f..fa13213 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecPolicyUsesCleartextTrafficTrue test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficTrue.apk" />
<option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficTrueTestCases.apk" />
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
index 6f35027..4e80528 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
@@ -20,9 +20,11 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner \
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
ctstestserver \
- org.apache.http.legacy
+ org.apache.http.legacy \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src common)
@@ -31,7 +33,7 @@
LOCAL_INSTRUMENTATION_FOR := CtsNetSecPolicyUsesCleartextTrafficUnspecified
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml
index 9ede86b..8c1fb4d 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecPolicyUsesCleartextTrafficUnspecified test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficUnspecified.apk" />
<option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficUnspecifiedTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
index 56c5d25..d2ddb27 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
@@ -28,7 +28,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml
index b2c1400..500c481 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigAttributeTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigAttributeTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
index 2b91bc6..716fecf 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
@@ -28,7 +28,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml
index 901022f..6ce0531 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigBasicDomainConfigTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigBasicDomainConfigTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
index df29b5f..928b95d 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
@@ -28,7 +28,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml
index 829899c..1b6578a 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigCleartextTraffic test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigCleartextTrafficTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
index 59e5625..4a55d81 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
@@ -28,7 +28,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml
index 5d12f0a..756f2ab 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigBasicDebugDisabledTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigBasicDebugDisabledTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
index c935486..22ec6c7 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
@@ -28,7 +28,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml
index 38a2d31..febad18 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigBasicDebugEnabledTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigBasicDebugEnabledTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
index 3993d00..f6be2b5 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
@@ -20,7 +20,11 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner org.apache.http.legacy android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
+ org.apache.http.legacy \
+ android-support-test \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
@@ -28,7 +32,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml
index 7ce9f7a..4880161 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigDownloadManagerTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigDownloadManagerTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
index a89bad0..cbfd091 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
@@ -28,7 +28,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml
index 127927f..63faa39 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigInvalidPinTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigInvalidPinTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
index d68073d..2ae8d6c 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
@@ -28,7 +28,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml
index e430dbd..e6bfb52 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigNestedDomainConfigTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigNestedDomainConfigTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
index cace6d0..e99d5c4 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
@@ -20,7 +20,11 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner org.apache.http.legacy android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
+ org.apache.http.legacy \
+ android-support-test \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += $(call all-java-files-under, ../src)
@@ -28,7 +32,7 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res/
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml
index 570160c..e088460 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS CtsNetSecConfigInvalidPinTestCases test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNetSecConfigResourcesSrcTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/opengl/Android.mk b/tests/tests/opengl/Android.mk
index 64f0f79..5558379 100644
--- a/tests/tests/opengl/Android.mk
+++ b/tests/tests/opengl/Android.mk
@@ -29,7 +29,7 @@
LOCAL_JNI_SHARED_LIBRARIES := libopengltest_jni
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -37,7 +37,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/opengl/AndroidTest.xml b/tests/tests/opengl/AndroidTest.xml
index f112f83..0afe39a 100644
--- a/tests/tests/opengl/AndroidTest.xml
+++ b/tests/tests/opengl/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS OpenGL test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsOpenGLTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/openglperf/Android.mk b/tests/tests/openglperf/Android.mk
index 46e316a..fcc2ba6 100644
--- a/tests/tests/openglperf/Android.mk
+++ b/tests/tests/openglperf/Android.mk
@@ -37,7 +37,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/openglperf/AndroidTest.xml b/tests/tests/openglperf/AndroidTest.xml
index 630bd05..2ab322b 100644
--- a/tests/tests/openglperf/AndroidTest.xml
+++ b/tests/tests/openglperf/AndroidTest.xml
@@ -13,7 +13,7 @@
limitations under the License.
-->
<configuration description="Config for CTS OpenGL Performance test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsOpenGlPerfTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index c99e236..ccc72a1 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -44,7 +44,7 @@
LOCAL_PACKAGE_NAME := CtsOsTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# uncomment when b/13282254 is fixed
#LOCAL_SDK_VERSION := current
@@ -66,7 +66,7 @@
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
cts_platform_version_path := cts/tests/tests/os/assets/platform_versions.txt
cts_platform_version_string := $(shell cat $(cts_platform_version_path))
diff --git a/tests/tests/os/AndroidTest.xml b/tests/tests/os/AndroidTest.xml
index fd446c2..e01a734 100644
--- a/tests/tests/os/AndroidTest.xml
+++ b/tests/tests/os/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for OS Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsOsTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/os/assets/platform_versions.txt b/tests/tests/os/assets/platform_versions.txt
index ae9a76b..c47e490 100644
--- a/tests/tests/os/assets/platform_versions.txt
+++ b/tests/tests/os/assets/platform_versions.txt
@@ -1 +1,4 @@
8.0.0
+8.0.1
+OMR1
+P
diff --git a/tests/tests/os/src/android/os/cts/AsyncTaskTest.java b/tests/tests/os/src/android/os/cts/AsyncTaskTest.java
index 335818a..1c2f91e 100644
--- a/tests/tests/os/src/android/os/cts/AsyncTaskTest.java
+++ b/tests/tests/os/src/android/os/cts/AsyncTaskTest.java
@@ -201,7 +201,7 @@
try {
command.run();
fail("Exception not thrown");
- } catch (Throwable tr) {
+ } catch (Exception tr) {
// expected
}
}
diff --git a/tests/tests/os/src/android/os/cts/LooperTest.java b/tests/tests/os/src/android/os/cts/LooperTest.java
index c0a176c..b89f590 100644
--- a/tests/tests/os/src/android/os/cts/LooperTest.java
+++ b/tests/tests/os/src/android/os/cts/LooperTest.java
@@ -97,11 +97,15 @@
public void testMyQueue() throws Throwable {
TestThread t = new TestThread(new Runnable() {
public void run() {
+ boolean didThrow = false;
try {
assertNull(Looper.myQueue());
- fail("should throw exception");
} catch (Throwable e) {
// expected
+ didThrow = true;
+ }
+ if (!didThrow) {
+ fail("should throw exception");
}
Looper.prepare();
MessageQueue mq = Looper.myQueue();
@@ -132,7 +136,7 @@
try {
Looper.prepare();
fail("should throw exception");
- } catch (Throwable e) {
+ } catch (Exception e) {
//expected
}
}
@@ -147,7 +151,7 @@
try {
Looper.prepareMainLooper();
fail("should throw exception because the main thread was already prepared");
- } catch (Throwable e) {
+ } catch (Exception e) {
//expected
}
}
diff --git a/tests/tests/os/src/android/os/cts/WorkSourceTest.java b/tests/tests/os/src/android/os/cts/WorkSourceTest.java
index f3986b1..ff9d693 100644
--- a/tests/tests/os/src/android/os/cts/WorkSourceTest.java
+++ b/tests/tests/os/src/android/os/cts/WorkSourceTest.java
@@ -19,6 +19,8 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.Arrays;
+
import android.os.WorkSource;
import android.test.AndroidTestCase;
@@ -142,7 +144,7 @@
fail(op + ": WorkSource is not null " + ws +", but expected null");
}
if (uids != null) {
- fail(op + "WorkSource is null, but expected non-null: " + uids);
+ fail(op + "WorkSource is null, but expected non-null: " + Arrays.toString(uids));
}
return;
}
@@ -162,7 +164,7 @@
fail(op + ": WorkSource is not null " + ws +", but expected null");
}
if (uids != null) {
- fail(op + "WorkSource is null, but expected non-null: " + uids);
+ fail(op + "WorkSource is null, but expected non-null: " + Arrays.toString(uids));
}
return;
}
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/Android.mk b/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
index a77f0c9..95a607d 100755
--- a/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
+++ b/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
@@ -26,11 +26,15 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator android-support-test android-support-v4
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ub-uiautomator \
+ android-support-test \
+ android-support-v4 \
+ legacy-android-test
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml b/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
index f1cc70a..cf92bc3 100644
--- a/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
+++ b/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
@@ -26,7 +26,7 @@
<option name="push" value="CtsEmptyTestApp.apk->/data/local/tmp/cts/packageinstaller/CtsEmptyTestApp.apk" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="install-arg" value="-t" />
<option name="test-file-name" value="CtsAdminPackageInstallerTestCases.apk" />
diff --git a/tests/tests/packageinstaller/emptytestapp/Android.mk b/tests/tests/packageinstaller/emptytestapp/Android.mk
index c621852..b1171f1 100644
--- a/tests/tests/packageinstaller/emptytestapp/Android.mk
+++ b/tests/tests/packageinstaller/emptytestapp/Android.mk
@@ -25,6 +25,6 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/packageinstaller/externalsources/Android.mk b/tests/tests/packageinstaller/externalsources/Android.mk
index 805385a..ca2fbda 100755
--- a/tests/tests/packageinstaller/externalsources/Android.mk
+++ b/tests/tests/packageinstaller/externalsources/Android.mk
@@ -31,7 +31,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/packageinstaller/externalsources/AndroidTest.xml b/tests/tests/packageinstaller/externalsources/AndroidTest.xml
index 6302be9..136c0fb 100644
--- a/tests/tests/packageinstaller/externalsources/AndroidTest.xml
+++ b/tests/tests/packageinstaller/externalsources/AndroidTest.xml
@@ -26,7 +26,7 @@
<option name="push" value="CtsEmptyTestApp.apk->/data/local/tmp/cts/externalsources/CtsEmptyTestApp.apk" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsExternalSourcesTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/permission/Android.mk b/tests/tests/permission/Android.mk
index 68fa193..a88bb01 100644
--- a/tests/tests/permission/Android.mk
+++ b/tests/tests/permission/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# Include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
diff --git a/tests/tests/permission/AndroidTest.xml b/tests/tests/permission/AndroidTest.xml
index a01352a..c83c5fc 100644
--- a/tests/tests/permission/AndroidTest.xml
+++ b/tests/tests/permission/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Permission test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsPermissionTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/permission2/Android.mk b/tests/tests/permission2/Android.mk
index d4f48f4..be984c5 100755
--- a/tests/tests/permission2/Android.mk
+++ b/tests/tests/permission2/Android.mk
@@ -22,11 +22,14 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_LIBRARIES := telephony-common
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ ctstestrunner \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/permission2/AndroidTest.xml b/tests/tests/permission2/AndroidTest.xml
index b814aa7..7a78d3f 100644
--- a/tests/tests/permission2/AndroidTest.xml
+++ b/tests/tests/permission2/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Permission test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsPermission2TestCases.apk" />
</target_preparer>
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index c51e182..441819c 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -285,6 +285,7 @@
<protected-broadcast android:name="android.btopp.intent.action.STOP_HANDOVER_TRANSFER" />
<protected-broadcast android:name="android.nfc.handover.intent.action.HANDOVER_SEND" />
<protected-broadcast android:name="android.nfc.handover.intent.action.HANDOVER_SEND_MULTIPLE" />
+ <protected-broadcast android:name="com.android.nfc.handover.action.CANCEL_HANDOVER_TRANSFER" />
<protected-broadcast android:name="android.intent.action.CLEAR_DNS_CACHE" />
<protected-broadcast android:name="android.intent.action.PROXY_CHANGE" />
@@ -1676,6 +1677,21 @@
<permission android:name="android.permission.BIND_IMS_SERVICE"
android:protectionLevel="signature|privileged" />
+ <!-- Allows an application to manage embedded subscriptions (those on a eUICC) through
+ EuiccManager APIs.
+ <p>Protection level: signature|privileged|development
+ TODO(b/35851809): Mark this as a SystemApi.
+ @hide -->
+ <permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"
+ android:protectionLevel="signature|privileged|development" />
+
+ <!-- Must be required by an EuiccService to ensure that only the system can bind to it.
+ <p>Protection level: signature
+ TODO(b/35851809): Mark this as a SystemApi.
+ @hide -->
+ <permission android:name="android.permission.BIND_EUICC_SERVICE"
+ android:protectionLevel="signature" />
+
<!-- ================================== -->
<!-- Permissions for sdcard interaction -->
@@ -1902,6 +1918,11 @@
android:protectionLevel="normal" />
+ <!-- @hide Allows an application to set display offsets for the screen.
+ This permission is not available to third party applications. -->
+ <permission android:name="android.permission.SET_DISPLAY_OFFSET"
+ android:protectionLevel="signature|privileged" />
+
<!-- ================================== -->
<!-- Permissions affecting the system wallpaper -->
<!-- ================================== -->
diff --git a/tests/tests/preference/Android.mk b/tests/tests/preference/Android.mk
index fa6f9c9..c56ced8 100644
--- a/tests/tests/preference/Android.mk
+++ b/tests/tests/preference/Android.mk
@@ -21,9 +21,9 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/preference/AndroidTest.xml b/tests/tests/preference/AndroidTest.xml
index 91e2ebe..791d9a87 100644
--- a/tests/tests/preference/AndroidTest.xml
+++ b/tests/tests/preference/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Preference test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsPreferenceTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/preference2/Android.mk b/tests/tests/preference2/Android.mk
index c6dca9e..b5fb0a2 100644
--- a/tests/tests/preference2/Android.mk
+++ b/tests/tests/preference2/Android.mk
@@ -23,13 +23,14 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
ctstestrunner \
compatibility-device-util \
mockito-target-minus-junit4 \
ub-uiautomator \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/preference2/AndroidTest.xml b/tests/tests/preference2/AndroidTest.xml
index 96dfe0e..e57fbce 100644
--- a/tests/tests/preference2/AndroidTest.xml
+++ b/tests/tests/preference2/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Preference test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsPreference2TestCases.apk" />
</target_preparer>
diff --git a/tests/tests/print/Android.mk b/tests/tests/print/Android.mk
index 405c89e..527fe48 100644
--- a/tests/tests/print/Android.mk
+++ b/tests/tests/print/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/print/AndroidTest.xml b/tests/tests/print/AndroidTest.xml
index 9e3e797..95ce5dc 100644
--- a/tests/tests/print/AndroidTest.xml
+++ b/tests/tests/print/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Print test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsPrintTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
index fe6fce1..38ba4dd 100644
--- a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
@@ -54,6 +54,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -595,7 +596,7 @@
WriteResultCallback callback = (WriteResultCallback) args[3];
if (writeCorruptedFile[0]) {
- Log.i(LOG_TAG, "write corrupted file " + pages);
+ Log.i(LOG_TAG, "write corrupted file " + Arrays.toString(pages));
FileOutputStream os = new FileOutputStream(fd.getFileDescriptor());
for (int i = 0; i < 10; i++) {
diff --git a/tests/tests/proto/Android.mk b/tests/tests/proto/Android.mk
index 23dba67..58126e2 100644
--- a/tests/tests/proto/Android.mk
+++ b/tests/tests/proto/Android.mk
@@ -30,7 +30,7 @@
LOCAL_PACKAGE_NAME := CtsProtoTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
#LOCAL_SDK_VERSION := current
LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/proto/AndroidTest.xml b/tests/tests/proto/AndroidTest.xml
index 5bd5c60..e2b98ff 100644
--- a/tests/tests/proto/AndroidTest.xml
+++ b/tests/tests/proto/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for Proto Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsProtoTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/provider/Android.mk b/tests/tests/provider/Android.mk
index 2298378..3b71035 100644
--- a/tests/tests/provider/Android.mk
+++ b/tests/tests/provider/Android.mk
@@ -26,7 +26,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_LIBRARIES := android.test.runner telephony-common
diff --git a/tests/tests/provider/AndroidTest.xml b/tests/tests/provider/AndroidTest.xml
index 4c87f9c..1f42736 100644
--- a/tests/tests/provider/AndroidTest.xml
+++ b/tests/tests/provider/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Provider test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsProviderTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
index 62a041b..b0f5426 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_ThumbnailsTest.java
@@ -125,10 +125,11 @@
fail("There is no sdcard attached! " + e.getMessage());
}
assertNotNull(stringUrl);
- mRowsAdded.add(Uri.parse(stringUrl));
+ Uri stringUri = Uri.parse(stringUrl);
+ mRowsAdded.add(stringUri);
// get the original image id and path
- Cursor c = mContentResolver.query(Uri.parse(stringUrl),
+ Cursor c = mContentResolver.query(stringUri,
new String[]{ Media._ID, Media.DATA }, null, null, null);
c.moveToFirst();
long imageId = c.getLong(c.getColumnIndex(Media._ID));
@@ -165,8 +166,8 @@
// deleting the image from the database also deletes the image file, and the
// corresponding entry in the thumbnail table, which in turn triggers deletion
// of the thumbnail file on disk
- mContentResolver.delete(Uri.parse(stringUrl), null, null);
- mRowsAdded.remove(stringUrl);
+ mContentResolver.delete(stringUri, null, null);
+ mRowsAdded.remove(stringUri);
assertFalse("image file should no longer exist", new File(imagePath).exists());
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_TestDataBuilder.java b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_TestDataBuilder.java
index ffd3406..a923584 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_TestDataBuilder.java
+++ b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_TestDataBuilder.java
@@ -239,7 +239,7 @@
return;
if (expected != null && Arrays.equals(actual, expected))
return;
- throw new ComparisonFailure(message, expected.toString(), actual.toString());
+ throw new ComparisonFailure(message, Arrays.toString(expected), Arrays.toString(actual));
}
private int getColumnIndex(String columnName) {
diff --git a/tests/tests/renderscript/Android.mk b/tests/tests/renderscript/Android.mk
index 00e751a..a4ccf42 100644
--- a/tests/tests/renderscript/Android.mk
+++ b/tests/tests/renderscript/Android.mk
@@ -28,7 +28,10 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner xmp_toolkit
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ ctstestrunner \
+ xmp_toolkit \
+ legacy-android-test
LOCAL_JNI_SHARED_LIBRARIES := libcoremathtestcpp_jni
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
@@ -38,7 +41,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/renderscript/AndroidTest.xml b/tests/tests/renderscript/AndroidTest.xml
index 63bcd88..e7245ab 100644
--- a/tests/tests/renderscript/AndroidTest.xml
+++ b/tests/tests/renderscript/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for Renderscript Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsRenderscriptTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/renderscriptlegacy/Android.mk b/tests/tests/renderscriptlegacy/Android.mk
index f29a290..fb93d05 100644
--- a/tests/tests/renderscriptlegacy/Android.mk
+++ b/tests/tests/renderscriptlegacy/Android.mk
@@ -31,6 +31,6 @@
LOCAL_SDK_VERSION := 19
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/renderscriptlegacy/AndroidTest.xml b/tests/tests/renderscriptlegacy/AndroidTest.xml
index 3523dfe..26ef000 100644
--- a/tests/tests/renderscriptlegacy/AndroidTest.xml
+++ b/tests/tests/renderscriptlegacy/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for Renderscript legacy Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsRenderscriptLegacyTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/rsblas/Android.mk b/tests/tests/rsblas/Android.mk
index 700fba3..d67ba09 100644
--- a/tests/tests/rsblas/Android.mk
+++ b/tests/tests/rsblas/Android.mk
@@ -27,7 +27,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_JNI_SHARED_LIBRARIES := libbnnmdata_jni
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
@@ -35,7 +35,7 @@
LOCAL_RENDERSCRIPT_FLAGS := -Wno-error=deprecated-declarations
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/rsblas/AndroidTest.xml b/tests/tests/rsblas/AndroidTest.xml
index 340ca29..3756e61 100644
--- a/tests/tests/rsblas/AndroidTest.xml
+++ b/tests/tests/rsblas/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS RS BLAS test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsRsBlasTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/rscpp/Android.mk b/tests/tests/rscpp/Android.mk
index bdcf840..e5a7fdc 100644
--- a/tests/tests/rscpp/Android.mk
+++ b/tests/tests/rscpp/Android.mk
@@ -28,7 +28,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_JNI_SHARED_LIBRARIES := librscpptest_jni
LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
@@ -36,7 +36,7 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
include $(LOCAL_PATH)/librscpptest/Android.mk
diff --git a/tests/tests/rscpp/AndroidTest.xml b/tests/tests/rscpp/AndroidTest.xml
index d412054..9014c38 100644
--- a/tests/tests/rscpp/AndroidTest.xml
+++ b/tests/tests/rscpp/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for renderscript cpp Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsRsCppTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/sax/Android.mk b/tests/tests/sax/Android.mk
index 498aa40..cf354df 100644
--- a/tests/tests/sax/Android.mk
+++ b/tests/tests/sax/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -30,6 +30,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/sax/AndroidTest.xml b/tests/tests/sax/AndroidTest.xml
index 84280de..3fd03d2 100644
--- a/tests/tests/sax/AndroidTest.xml
+++ b/tests/tests/sax/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS SAX test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSaxTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/security/Android.mk b/tests/tests/security/Android.mk
index ddd78f1..4fb95ee 100644
--- a/tests/tests/security/Android.mk
+++ b/tests/tests/security/Android.mk
@@ -51,7 +51,7 @@
#LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/security/AndroidTest.xml b/tests/tests/security/AndroidTest.xml
index ab2e57a..4536440 100644
--- a/tests/tests/security/AndroidTest.xml
+++ b/tests/tests/security/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS security test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSecurityTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/security/src/android/security/cts/AslrTest.java b/tests/tests/security/src/android/security/cts/AslrTest.java
index 378aa0f..67bb48f 100644
--- a/tests/tests/security/src/android/security/cts/AslrTest.java
+++ b/tests/tests/security/src/android/security/cts/AslrTest.java
@@ -52,7 +52,7 @@
BufferedReader reader = new BufferedReader(
new InputStreamReader(new FileInputStream(pfd.getFileDescriptor())));
- Pattern p = Pattern.compile("^([a-f0-9]+)\\-.+\\[" + mappingName + "\\]$");
+ Pattern p = Pattern.compile("^([a-f0-9]+).*" + mappingName + ".*");
String line;
while ((line = reader.readLine()) != null) {
@@ -97,7 +97,8 @@
}
public void testRandomization() throws Exception {
- testMappingEntropy("stack");
+ testMappingEntropy("\\[stack\\]");
+ testMappingEntropy("/system/bin/");
}
public void testOneExecutableIsPie() throws IOException {
diff --git a/tests/tests/security/src/android/security/cts/ListeningPortsTest.java b/tests/tests/security/src/android/security/cts/ListeningPortsTest.java
index 84dd7a3..8903aec 100644
--- a/tests/tests/security/src/android/security/cts/ListeningPortsTest.java
+++ b/tests/tests/security/src/android/security/cts/ListeningPortsTest.java
@@ -332,7 +332,8 @@
String[] fields = line.split("\\s+");
final int expectedNumColumns = 12;
assertTrue(procFilePath + " should have at least " + expectedNumColumns
- + " columns of output " + fields, fields.length >= expectedNumColumns);
+ + " columns of output " + Arrays.toString(fields),
+ fields.length >= expectedNumColumns);
String state = fields[3];
int uid = Integer.parseInt(fields[7]);
diff --git a/tests/tests/selinux/selinuxTargetSdk/Android.mk b/tests/tests/selinux/selinuxTargetSdk/Android.mk
index cfbe04c..138da59 100755
--- a/tests/tests/selinux/selinuxTargetSdk/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdk/Android.mk
@@ -17,8 +17,11 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ ctstestrunner \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsSelinuxTargetSdkTestCases
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/selinux/selinuxTargetSdk/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk/AndroidTest.xml
index c29fd6c..1a05aa1 100644
--- a/tests/tests/selinux/selinuxTargetSdk/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Permission Selinux test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSelinuxTargetSdkTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/selinux/selinuxTargetSdk2/Android.mk b/tests/tests/selinux/selinuxTargetSdk2/Android.mk
index 9397f97..49a0868 100755
--- a/tests/tests/selinux/selinuxTargetSdk2/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdk2/Android.mk
@@ -17,8 +17,11 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ ctstestrunner \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsSelinuxTargetSdk2TestCases
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/selinux/selinuxTargetSdk2/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk2/AndroidTest.xml
index fe515f6..6e430e8 100644
--- a/tests/tests/selinux/selinuxTargetSdk2/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk2/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Permission Selinux test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSelinuxTargetSdk2TestCases.apk" />
</target_preparer>
diff --git a/tests/tests/shortcutmanager/Android.mk b/tests/tests/shortcutmanager/Android.mk
index 49a3b70..ec5d89a 100755
--- a/tests/tests/shortcutmanager/Android.mk
+++ b/tests/tests/shortcutmanager/Android.mk
@@ -36,7 +36,7 @@
LOCAL_PACKAGE_NAME := CtsShortcutManagerTestCases
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/shortcutmanager/AndroidTest.xml b/tests/tests/shortcutmanager/AndroidTest.xml
index cbf35ea..4722aeb 100644
--- a/tests/tests/shortcutmanager/AndroidTest.xml
+++ b/tests/tests/shortcutmanager/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for ShortcutManager CTS test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsShortcutManagerTestCases.apk" />
<option name="test-file-name" value="CtsShortcutManagerPackage1.apk" />
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
index a11c978..8c0bdb7 100644
--- a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
+++ b/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
@@ -38,7 +38,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher1
@@ -68,7 +68,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher2
@@ -98,7 +98,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher3
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
index bc4aaa7..509c724 100644
--- a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
+++ b/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
@@ -37,7 +37,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.launcher4
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
index 1103194..1ece5e9 100644
--- a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
+++ b/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
@@ -37,7 +37,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package1
@@ -67,7 +67,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package2
@@ -97,7 +97,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package3
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
index 0b1ff53..f87e2da 100644
--- a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
+++ b/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
@@ -37,7 +37,7 @@
LOCAL_SDK_VERSION := current
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_AAPT_FLAGS += --rename-manifest-package android.content.pm.cts.shortcutmanager.packages.package4
diff --git a/tests/tests/shortcutmanager/throttling/Android.mk b/tests/tests/shortcutmanager/throttling/Android.mk
index 7e6d869..a3794f8 100644
--- a/tests/tests/shortcutmanager/throttling/Android.mk
+++ b/tests/tests/shortcutmanager/throttling/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsShortcutManagerThrottlingTest
diff --git a/tests/tests/simpleperf/Android.mk b/tests/tests/simpleperf/Android.mk
index c7f2afb..80c5e55 100644
--- a/tests/tests/simpleperf/Android.mk
+++ b/tests/tests/simpleperf/Android.mk
@@ -44,7 +44,7 @@
$($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_OBJCOPY) --add-section .testzipdata=$$TMP_FILE $(linked_module) && \
rm -f $$TMP_FILE
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_CTS_TEST_PACKAGE := android.simpleperf
LOCAL_FORCE_STATIC_EXECUTABLE := true
diff --git a/tests/tests/simpleperf/AndroidTest.xml b/tests/tests/simpleperf/AndroidTest.xml
index 098afc4..f8ff36d 100644
--- a/tests/tests/simpleperf/AndroidTest.xml
+++ b/tests/tests/simpleperf/AndroidTest.xml
@@ -19,7 +19,7 @@
<option name="push" value="CtsSimpleperfTestCases->/data/local/tmp/CtsSimpleperfTestCases" />
<option name="append-bitness" value="true" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSimpleperfDebugApp.apk" />
</target_preparer>
diff --git a/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk b/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
index b84be25..1fb26b7 100644
--- a/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
+++ b/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, .)
@@ -30,6 +30,6 @@
LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
-include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
+include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/speech/Android.mk b/tests/tests/speech/Android.mk
index 572871b..3995510 100755
--- a/tests/tests/speech/Android.mk
+++ b/tests/tests/speech/Android.mk
@@ -29,7 +29,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsSpeechTestCases
diff --git a/tests/tests/speech/AndroidTest.xml b/tests/tests/speech/AndroidTest.xml
index be6d08f..2819bd4 100644
--- a/tests/tests/speech/AndroidTest.xml
+++ b/tests/tests/speech/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Speech test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSpeechTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/systemintents/Android.mk b/tests/tests/systemintents/Android.mk
index 1af6702..d75eef6 100644
--- a/tests/tests/systemintents/Android.mk
+++ b/tests/tests/systemintents/Android.mk
@@ -21,13 +21,13 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := CtsSystemIntentTestCases
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/systemintents/AndroidTest.xml b/tests/tests/systemintents/AndroidTest.xml
index eceb909..db41361 100644
--- a/tests/tests/systemintents/AndroidTest.xml
+++ b/tests/tests/systemintents/AndroidTest.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
<configuration description="Config for CTS system intent test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSystemIntentTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/systemui/Android.mk b/tests/tests/systemui/Android.mk
index 6aed2f8..4806f4b 100644
--- a/tests/tests/systemui/Android.mk
+++ b/tests/tests/systemui/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_LIBRARIES := android.test.runner
diff --git a/tests/tests/systemui/AndroidTest.xml b/tests/tests/systemui/AndroidTest.xml
index 61bdae3..314a8e9 100644
--- a/tests/tests/systemui/AndroidTest.xml
+++ b/tests/tests/systemui/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS SystemUI test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSystemUiTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/telecom/Android.mk b/tests/tests/telecom/Android.mk
index c81a811..3b8b683 100644
--- a/tests/tests/telecom/Android.mk
+++ b/tests/tests/telecom/Android.mk
@@ -24,13 +24,17 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ ctstestrunner \
+ android-support-test \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/telecom/AndroidTest.xml b/tests/tests/telecom/AndroidTest.xml
index 7f34c0c..1c42e66 100644
--- a/tests/tests/telecom/AndroidTest.xml
+++ b/tests/tests/telecom/AndroidTest.xml
@@ -17,7 +17,7 @@
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.TokenRequirement">
<option name="token" value="sim-card" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTelecomTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/telecom2/Android.mk b/tests/tests/telecom2/Android.mk
index d839924..5710e93 100644
--- a/tests/tests/telecom2/Android.mk
+++ b/tests/tests/telecom2/Android.mk
@@ -24,7 +24,10 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ ctstestrunner \
+ legacy-android-test
src_dirs := src \
../telecom/src/android/telecom/cts/SelfManagedConnection.java \
@@ -46,6 +49,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/telecom2/AndroidTest.xml b/tests/tests/telecom2/AndroidTest.xml
index e7ae80c..0e26e62 100644
--- a/tests/tests/telecom2/AndroidTest.xml
+++ b/tests/tests/telecom2/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for Telecom2 Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTelecomTestCases2.apk" />
</target_preparer>
diff --git a/tests/tests/telecom3/Android.mk b/tests/tests/telecom3/Android.mk
index 7400fb5..a9afd31 100644
--- a/tests/tests/telecom3/Android.mk
+++ b/tests/tests/telecom3/Android.mk
@@ -45,6 +45,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/telecom3/AndroidTest.xml b/tests/tests/telecom3/AndroidTest.xml
index 7576d62..4e682f6 100644
--- a/tests/tests/telecom3/AndroidTest.xml
+++ b/tests/tests/telecom3/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Configuration for Telecom3 Tests">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTelecomTestCases3.apk" />
</target_preparer>
diff --git a/tests/tests/telephony/Android.mk b/tests/tests/telephony/Android.mk
index e502384..58b6afd 100644
--- a/tests/tests/telephony/Android.mk
+++ b/tests/tests/telephony/Android.mk
@@ -36,7 +36,7 @@
LOCAL_PACKAGE_NAME := CtsTelephonyTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# uncomment when b/13250611 is fixed
#LOCAL_SDK_VERSION := current
diff --git a/tests/tests/telephony/AndroidTest.xml b/tests/tests/telephony/AndroidTest.xml
index 2e6011b..2b436ca 100644
--- a/tests/tests/telephony/AndroidTest.xml
+++ b/tests/tests/telephony/AndroidTest.xml
@@ -14,10 +14,14 @@
limitations under the License.
-->
<configuration description="Config for CTS Telephony test cases">
+ <target_preparer class="android.telephony.cts.preconditions.TelephonyPreparer">
+ <option name="apk" value="CtsTelephonyPreparerApp.apk" />
+ <option name="package" value="android.telephony.cts.preconditions.app" />
+ </target_preparer>
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.TokenRequirement">
<option name="token" value="sim-card" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTelephonyTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/telephony/preconditions/Android.mk b/tests/tests/telephony/preconditions/Android.mk
index 6577932..1b49e7e 100644
--- a/tests/tests/telephony/preconditions/Android.mk
+++ b/tests/tests/telephony/preconditions/Android.mk
@@ -25,7 +25,7 @@
LOCAL_MODULE := compatibility-host-telephony-preconditions
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/telephony/preconditions/app/Android.mk b/tests/tests/telephony/preconditions/app/Android.mk
index 349daed..72cbbce 100644
--- a/tests/tests/telephony/preconditions/app/Android.mk
+++ b/tests/tests/telephony/preconditions/app/Android.mk
@@ -32,7 +32,7 @@
compatibility-device-preconditions
# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsTelephonyPreparerApp
diff --git a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
index 873e496..c8718b6 100644
--- a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
@@ -305,31 +305,6 @@
assertFalse(PhoneNumberUtils.isWellFormedSmsAddress("android"));
}
- public void testIsUriNumber() {
- assertTrue(PhoneNumberUtils.isUriNumber("foo@google.com"));
- assertTrue(PhoneNumberUtils.isUriNumber("xyz@zzz.org"));
- assertFalse(PhoneNumberUtils.isUriNumber("+15103331245"));
- assertFalse(PhoneNumberUtils.isUriNumber("+659231235"));
- }
-
- public void testGetUsernameFromUriNumber() {
- assertEquals("john", PhoneNumberUtils.getUsernameFromUriNumber("john@myorg.com"));
- assertEquals("tim_123", PhoneNumberUtils.getUsernameFromUriNumber("tim_123@zzz.org"));
- assertEquals("5103331245", PhoneNumberUtils.getUsernameFromUriNumber("5103331245"));
- }
-
- public void testConvertAndStrip() {
- // Untouched number.
- assertEquals("123456789", PhoneNumberUtils.convertAndStrip("123456789"));
- // Dashes should be stripped, legal separators (i.e. wild character remain untouched)
- assertEquals("+15103331245*123", PhoneNumberUtils.convertAndStrip("+1-510-333-1245*123"));
- // Arabic digits should be converted
- assertEquals("5567861616", PhoneNumberUtils.convertAndStrip("٥٥٦٧٨٦١٦١٦"));
- // Arabic digits converted and spaces stripped
- assertEquals("5567861616", PhoneNumberUtils.convertAndStrip("٥ ٥٦ ٧ ٨ ٦ ١ ٦ ١ ٦"));
-
- }
-
public void testGetPhoneTtsSpan() {
// Setup: phone number without a country code. Lets keep coverage minimal to avoid
// exercising the underlying PhoneNumberUtil or constraining localization changes.
diff --git a/tests/tests/telephony2/Android.mk b/tests/tests/telephony2/Android.mk
index 3ba6018..bae1dfa 100644
--- a/tests/tests/telephony2/Android.mk
+++ b/tests/tests/telephony2/Android.mk
@@ -32,7 +32,7 @@
LOCAL_PACKAGE_NAME := CtsTelephony2TestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/telephony2/AndroidTest.xml b/tests/tests/telephony2/AndroidTest.xml
index fd07d10..9f4e93c 100644
--- a/tests/tests/telephony2/AndroidTest.xml
+++ b/tests/tests/telephony2/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Telephony test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTelephony2TestCases.apk" />
</target_preparer>
diff --git a/tests/tests/text/Android.mk b/tests/tests/text/Android.mk
index 2210cbd..1243052 100644
--- a/tests/tests/text/Android.mk
+++ b/tests/tests/text/Android.mk
@@ -35,7 +35,7 @@
LOCAL_PACKAGE_NAME := CtsTextTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# uncomment when dalvik.annotation.Test* are removed or part of SDK
#LOCAL_SDK_VERSION := current
diff --git a/tests/tests/text/AndroidTest.xml b/tests/tests/text/AndroidTest.xml
index 3266582..c922301 100644
--- a/tests/tests/text/AndroidTest.xml
+++ b/tests/tests/text/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Text test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTextTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/theme/Android.mk b/tests/tests/theme/Android.mk
index 0f370d0..365f198 100644
--- a/tests/tests/theme/Android.mk
+++ b/tests/tests/theme/Android.mk
@@ -24,12 +24,12 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/theme/AndroidTest.xml b/tests/tests/theme/AndroidTest.xml
index 945c580..a676032 100644
--- a/tests/tests/theme/AndroidTest.xml
+++ b/tests/tests/theme/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Theme test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsThemeDeviceTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/toast/Android.mk b/tests/tests/toast/Android.mk
index d9f15eb..cb8fe99 100644
--- a/tests/tests/toast/Android.mk
+++ b/tests/tests/toast/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
diff --git a/tests/tests/toast/AndroidTest.xml b/tests/tests/toast/AndroidTest.xml
index d0a5eed..bb36b67 100644
--- a/tests/tests/toast/AndroidTest.xml
+++ b/tests/tests/toast/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for Toast test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsToastTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/toastlegacy/Android.mk b/tests/tests/toastlegacy/Android.mk
index ac5825d..96916a3 100644
--- a/tests/tests/toastlegacy/Android.mk
+++ b/tests/tests/toastlegacy/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
diff --git a/tests/tests/toastlegacy/AndroidTest.xml b/tests/tests/toastlegacy/AndroidTest.xml
index a208077..0621bb6 100644
--- a/tests/tests/toastlegacy/AndroidTest.xml
+++ b/tests/tests/toastlegacy/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for Toast legacy test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsToastLegacyTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/transition/Android.mk b/tests/tests/transition/Android.mk
index a80f43c..875f58c 100644
--- a/tests/tests/transition/Android.mk
+++ b/tests/tests/transition/Android.mk
@@ -30,13 +30,14 @@
android-common \
compatibility-device-util \
ctstestrunner \
- platform-test-annotations
+ platform-test-annotations \
+ legacy-android-test
LOCAL_JAVA_LIBRARIES := android.test.runner
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/transition/AndroidTest.xml b/tests/tests/transition/AndroidTest.xml
index 6862679..8bee182 100644
--- a/tests/tests/transition/AndroidTest.xml
+++ b/tests/tests/transition/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Transition test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTransitionTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/tv/Android.mk b/tests/tests/tv/Android.mk
index 640e16e..66b35a1 100644
--- a/tests/tests/tv/Android.mk
+++ b/tests/tests/tv/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/tv/AndroidTest.xml b/tests/tests/tv/AndroidTest.xml
index 1b5621e..72fe942 100644
--- a/tests/tests/tv/AndroidTest.xml
+++ b/tests/tests/tv/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS TV test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTvTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/tv/src/android/media/tv/cts/TvContractTest.java b/tests/tests/tv/src/android/media/tv/cts/TvContractTest.java
index 140e262..0a7f86d 100644
--- a/tests/tests/tv/src/android/media/tv/cts/TvContractTest.java
+++ b/tests/tests/tv/src/android/media/tv/cts/TvContractTest.java
@@ -991,9 +991,12 @@
verifyOverlap(programStartMillis - hour, programStartMillis - hour / 2, 0,
channelId, channelUri);
- // Non-overlap 2: starts too late
+ // Non-overlap 2: starts too late.
verifyOverlap(programEndMillis + hour, programEndMillis + hour * 2, 0,
channelId, channelUri);
+
+ // Non-overlap 3: invalid start and end times.
+ verifyOverlap(programEndMillis, programStartMillis, 0, channelId, channelUri);
}
private void verifyRecordedProgram(Uri recordedProgramUri, ContentValues expectedValues,
diff --git a/tests/tests/uiautomation/Android.mk b/tests/tests/uiautomation/Android.mk
index c595635..d708c67 100644
--- a/tests/tests/uiautomation/Android.mk
+++ b/tests/tests/uiautomation/Android.mk
@@ -21,9 +21,9 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ub-uiautomator legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/uiautomation/AndroidTest.xml b/tests/tests/uiautomation/AndroidTest.xml
index c4f1665..3721a5d 100644
--- a/tests/tests/uiautomation/AndroidTest.xml
+++ b/tests/tests/uiautomation/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS UI Automation test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUiAutomationTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/uidisolation/Android.mk b/tests/tests/uidisolation/Android.mk
index 08b9646..a69de23 100644
--- a/tests/tests/uidisolation/Android.mk
+++ b/tests/tests/uidisolation/Android.mk
@@ -22,9 +22,9 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ctstestserver
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ctstestserver legacy-android-test
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/uidisolation/AndroidTest.xml b/tests/tests/uidisolation/AndroidTest.xml
index 746e756..7e83263 100644
--- a/tests/tests/uidisolation/AndroidTest.xml
+++ b/tests/tests/uidisolation/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS UID Isolation test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUidIsolationTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/uirendering/Android.mk b/tests/tests/uirendering/Android.mk
index 52d8580..06bd748 100644
--- a/tests/tests/uirendering/Android.mk
+++ b/tests/tests/uirendering/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_JAVA_LIBRARIES := android.test.runner
diff --git a/tests/tests/uirendering/AndroidTest.xml b/tests/tests/uirendering/AndroidTest.xml
index c89300b..ac12c3b 100644
--- a/tests/tests/uirendering/AndroidTest.xml
+++ b/tests/tests/uirendering/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS UI Rendering test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUiRenderingTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java
index 2b8f3b3..9820ab2 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/DrawActivity.java
@@ -205,9 +205,15 @@
private class DrawCounterListener implements ViewTreeObserver.OnDrawListener {
private final int[] mLocationOnScreen = new int[2];
+ private static final int DEBUG_REQUIRE_EXTRA_FRAMES = 1;
+ private int mDrawCount = 0;
@Override
public void onDraw() {
+ if (++mDrawCount <= DEBUG_REQUIRE_EXTRA_FRAMES) {
+ mView.postInvalidate();
+ return;
+ }
mView.post(() -> {
Log.d("UiRendering", "notifying capture");
mView.getViewTreeObserver().removeOnDrawListener(this);
diff --git a/tests/tests/util/Android.mk b/tests/tests/util/Android.mk
index 32d4584..3ceeadd 100644
--- a/tests/tests/util/Android.mk
+++ b/tests/tests/util/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
android-support-annotations \
diff --git a/tests/tests/util/AndroidTest.xml b/tests/tests/util/AndroidTest.xml
index c5aa253..27cfc02 100644
--- a/tests/tests/util/AndroidTest.xml
+++ b/tests/tests/util/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Util test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUtilTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/view/Android.mk b/tests/tests/view/Android.mk
index f582b41..a50b42f 100644
--- a/tests/tests/view/Android.mk
+++ b/tests/tests/view/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_MULTILIB := both
diff --git a/tests/tests/view/AndroidTest.xml b/tests/tests/view/AndroidTest.xml
index c818923..0ed2837 100644
--- a/tests/tests/view/AndroidTest.xml
+++ b/tests/tests/view/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS View test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsViewTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java b/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
new file mode 100644
index 0000000..9a960e2
--- /dev/null
+++ b/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+package android.view.cts;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import android.app.Instrumentation;
+import android.hardware.input.InputManager;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+import android.view.InputDevice;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Test {@link android.view.InputDevice} enable/disable functionality.
+ */
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class InputDeviceEnabledTest {
+ private InputManager mInputManager;
+ private Instrumentation mInstrumentation;
+
+ @Before
+ public void setup() {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
+ mInputManager = mInstrumentation.getTargetContext().getSystemService(InputManager.class);
+ assertNotNull(mInputManager);
+ }
+
+ @Test
+ public void testIsEnabled() {
+ final int[] inputDeviceIds = mInputManager.getInputDeviceIds();
+ assertNotNull(inputDeviceIds);
+ for (int inputDeviceId : inputDeviceIds) {
+ final InputDevice inputDevice = mInputManager.getInputDevice(inputDeviceId);
+ // this function call should not produce an error
+ inputDevice.isEnabled(); // output is not checked
+ }
+ }
+
+ @Test
+ public void testEnableDisableException() {
+ // Check that InputDevice.enable() and InputDevice.disable() throw SecurityException
+ final String failMsgNotThrown = "Expected SecurityException not thrown";
+
+ final int[] inputDeviceIds = mInputManager.getInputDeviceIds();
+ for (int inputDeviceId : inputDeviceIds) {
+ final InputDevice inputDevice = mInputManager.getInputDevice(inputDeviceId);
+
+ try {
+ inputDevice.enable();
+ fail(failMsgNotThrown);
+ } catch (SecurityException e) {
+ // Expect to get this exception
+ }
+
+ try {
+ inputDevice.disable();
+ fail(failMsgNotThrown);
+ } catch (SecurityException e) {
+ // Expect to get this exception
+ }
+ }
+ }
+}
diff --git a/tests/tests/view/src/android/view/cts/PointerCaptureGroup.java b/tests/tests/view/src/android/view/cts/PointerCaptureGroup.java
index cb67b92..100ba9d 100644
--- a/tests/tests/view/src/android/view/cts/PointerCaptureGroup.java
+++ b/tests/tests/view/src/android/view/cts/PointerCaptureGroup.java
@@ -16,8 +16,8 @@
package android.view.cts;
-import android.annotation.Nullable;
import android.content.Context;
+import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;
diff --git a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
index acf491f..3dee05f 100644
--- a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
+++ b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
@@ -34,7 +34,6 @@
import static org.mockito.Mockito.verifyNoMoreInteractions;
import android.app.Instrumentation;
-import android.hardware.input.InputManager;
import android.os.SystemClock;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
@@ -122,12 +121,17 @@
view.setOnCapturedPointerListener(null);
}
- private static void injectMotionEvent(MotionEvent event) {
- InputManager.getInstance().injectInputEvent(event,
- InputManager.INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH);
+ private void injectMotionEvent(MotionEvent event) {
+ if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
+ // Regular mouse event.
+ mInstrumentation.sendPointerSync(event);
+ } else {
+ // Relative mouse event belongs to SOURCE_CLASS_TRACKBALL.
+ mInstrumentation.sendTrackballEventSync(event);
+ }
}
- private static void injectRelativeMouseEvent(int action, int x, int y) {
+ private void injectRelativeMouseEvent(int action, int x, int y) {
injectMotionEvent(obtainRelativeMouseEvent(action, x, y));
}
diff --git a/tests/tests/view/src/android/view/cts/PointerCaptureView.java b/tests/tests/view/src/android/view/cts/PointerCaptureView.java
index 4af160b..d273977 100644
--- a/tests/tests/view/src/android/view/cts/PointerCaptureView.java
+++ b/tests/tests/view/src/android/view/cts/PointerCaptureView.java
@@ -16,8 +16,8 @@
package android.view.cts;
-import android.annotation.Nullable;
import android.content.Context;
+import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
diff --git a/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java b/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
index 8e478a8..2c88b25 100644
--- a/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
@@ -77,7 +77,8 @@
vc.getScaledOverscrollDistance();
vc.getScaledPagingTouchSlop();
vc.getScaledScrollBarSize();
- vc.getScaledScrollFactor();
+ vc.getScaledHorizontalScrollFactor();
+ vc.getScaledVerticalScrollFactor();
vc.getScaledTouchSlop();
vc.getScaledWindowTouchSlop();
vc.hasPermanentMenuKey();
diff --git a/tests/tests/view/src/android/view/cts/ViewGroupTest.java b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
index 95b8491..7439ee0 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroupTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
@@ -29,7 +29,6 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import android.annotation.NonNull;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@@ -44,6 +43,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.os.Parcelable;
import android.os.SystemClock;
+import android.support.annotation.NonNull;
import android.support.test.InstrumentationRegistry;
import android.support.test.annotation.UiThreadTest;
import android.support.test.filters.LargeTest;
diff --git a/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java b/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
index e82cf37..8cd0d37 100644
--- a/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
@@ -18,12 +18,12 @@
import static org.junit.Assert.assertEquals;
-import android.annotation.NonNull;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Outline;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
+import android.support.annotation.NonNull;
import android.support.test.InstrumentationRegistry;
import android.support.test.annotation.UiThreadTest;
import android.support.test.filters.SmallTest;
diff --git a/tests/tests/voiceinteraction/Android.mk b/tests/tests/voiceinteraction/Android.mk
index cbb874a..67cbf3d 100644
--- a/tests/tests/voiceinteraction/Android.mk
+++ b/tests/tests/voiceinteraction/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsVoiceInteractionTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/voiceinteraction/AndroidTest.xml b/tests/tests/voiceinteraction/AndroidTest.xml
index 01ea670..96fb0dc 100644
--- a/tests/tests/voiceinteraction/AndroidTest.xml
+++ b/tests/tests/voiceinteraction/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS Voice Interaction test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsVoiceInteractionService.apk" />
<option name="test-file-name" value="CtsVoiceInteractionApp.apk" />
diff --git a/tests/tests/voiceinteraction/service/Android.mk b/tests/tests/voiceinteraction/service/Android.mk
index b8d3aa8..c274e85 100644
--- a/tests/tests/voiceinteraction/service/Android.mk
+++ b/tests/tests/voiceinteraction/service/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsVoiceInteractionService
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/voiceinteraction/testapp/Android.mk b/tests/tests/voiceinteraction/testapp/Android.mk
index aa40e53..79e0fbd 100644
--- a/tests/tests/voiceinteraction/testapp/Android.mk
+++ b/tests/tests/voiceinteraction/testapp/Android.mk
@@ -30,6 +30,6 @@
LOCAL_SDK_VERSION := current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/TestApp.java b/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/TestApp.java
index 1ef6a5c..dbfb031 100644
--- a/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/TestApp.java
+++ b/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/TestApp.java
@@ -34,6 +34,7 @@
import android.util.Log;
import java.util.ArrayList;
+import java.util.Arrays;
import android.voiceinteraction.common.Utils;
@@ -98,7 +99,7 @@
case SUPPORTS_COMMANDS_TEST:
String[] commands = {Utils.TEST_COMMAND};
boolean[] supported = mInteractor.supportsCommands(commands);
- Log.i(TAG, "from supportsCommands: " + supported);
+ Log.i(TAG, "from supportsCommands: " + Arrays.toString(supported));
if (supported.length == 1 && supported[0]) {
addTestResult(Utils.SUPPORTS_COMMANDS_SUCCESS);
} else {
diff --git a/tests/tests/voicesettings/Android.mk b/tests/tests/voicesettings/Android.mk
index c554470..926547b 100644
--- a/tests/tests/voicesettings/Android.mk
+++ b/tests/tests/voicesettings/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsVoiceSettingsTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/voicesettings/AndroidTest.xml b/tests/tests/voicesettings/AndroidTest.xml
index 951ad44..ddfd4c2 100644
--- a/tests/tests/voicesettings/AndroidTest.xml
+++ b/tests/tests/voicesettings/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Voice Settings test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsVoiceSettingsService.apk" />
<option name="test-file-name" value="CtsVoiceSettingsTestCases.apk" />
diff --git a/tests/tests/voicesettings/service/Android.mk b/tests/tests/voicesettings/service/Android.mk
index 6f246bd..ad008a5 100644
--- a/tests/tests/voicesettings/service/Android.mk
+++ b/tests/tests/voicesettings/service/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PACKAGE_NAME := CtsVoiceSettingsService
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/webkit/Android.mk b/tests/tests/webkit/Android.mk
index 2385647..43f1bba 100644
--- a/tests/tests/webkit/Android.mk
+++ b/tests/tests/webkit/Android.mk
@@ -34,7 +34,7 @@
LOCAL_PACKAGE_NAME := CtsWebkitTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
# uncomment when dalvik.annotation.Test* are removed or part of SDK
#LOCAL_SDK_VERSION := current
diff --git a/tests/tests/webkit/AndroidTest.xml b/tests/tests/webkit/AndroidTest.xml
index 7e8ed69..3a2b626 100644
--- a/tests/tests/webkit/AndroidTest.xml
+++ b/tests/tests/webkit/AndroidTest.xml
@@ -15,7 +15,7 @@
-->
<configuration description="Config for CTS Webkit test cases">
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsWebkitTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
index 4ff8eef..2ef274a 100755
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -26,6 +26,7 @@
import android.graphics.Color;
import android.graphics.Picture;
import android.graphics.Rect;
+import android.graphics.pdf.PdfRenderer;
import android.net.Uri;
import android.os.Bundle;
import android.os.CancellationSignal;
@@ -2550,7 +2551,8 @@
// Called on UI thread
@Override
public void onLayoutFinished(PrintDocumentInfo info, boolean changed) {
- savePrintedPage(adapter, descriptor, result);
+ PageRange[] pageRanges = new PageRange[] {PageRange.ALL_PAGES};
+ savePrintedPage(adapter, descriptor, pageRanges, result);
}
});
try {
@@ -2568,6 +2570,57 @@
}
}
+ // Verify Print feature can create a PDF file with correct number of pages.
+ public void testPrintingPagesCount() throws Throwable {
+ if (!NullWebViewUtils.isWebViewAvailable()) {
+ return;
+ }
+ String content = "<html><head></head><body>";
+ for (int i = 0; i < 500; ++i) {
+ content += "<br />abcdefghijk<br />";
+ }
+ content += "</body></html>";
+ mOnUiThread.loadDataAndWaitForCompletion(content, "text/html", null);
+ final PrintDocumentAdapter adapter = mOnUiThread.createPrintDocumentAdapter();
+ printDocumentStart(adapter);
+ PrintAttributes attributes = new PrintAttributes.Builder()
+ .setMediaSize(PrintAttributes.MediaSize.ISO_A4)
+ .setResolution(new PrintAttributes.Resolution("foo", "bar", 300, 300))
+ .setMinMargins(PrintAttributes.Margins.NO_MARGINS)
+ .build();
+ final WebViewCtsActivity activity = getActivity();
+ final File file = activity.getFileStreamPath(PRINTER_TEST_FILE);
+ final ParcelFileDescriptor descriptor = ParcelFileDescriptor.open(file,
+ ParcelFileDescriptor.parseMode("w"));
+ final FutureTask<Boolean> result =
+ new FutureTask<Boolean>(new Callable<Boolean>() {
+ public Boolean call() {
+ return true;
+ }
+ });
+ printDocumentLayout(adapter, null, attributes,
+ new LayoutResultCallback() {
+ // Called on UI thread
+ @Override
+ public void onLayoutFinished(PrintDocumentInfo info, boolean changed) {
+ PageRange[] pageRanges = new PageRange[] {
+ new PageRange(1, 1), new PageRange(4, 7)
+ };
+ savePrintedPage(adapter, descriptor, pageRanges, result);
+ }
+ });
+ try {
+ result.get(TEST_TIMEOUT, TimeUnit.MILLISECONDS);
+ assertTrue(file.length() > 0);
+ PdfRenderer renderer = new PdfRenderer(
+ ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY));
+ assertEquals(5, renderer.getPageCount());
+ } finally {
+ descriptor.close();
+ file.delete();
+ }
+ }
+
public void testVisualStateCallbackCalled() throws Exception {
// Check that the visual state callback is called correctly.
if (!NullWebViewUtils.isWebViewAvailable()) {
@@ -2639,8 +2692,9 @@
}
private void savePrintedPage(final PrintDocumentAdapter adapter,
- final ParcelFileDescriptor descriptor, final FutureTask<Boolean> result) {
- adapter.onWrite(new PageRange[] {PageRange.ALL_PAGES}, descriptor,
+ final ParcelFileDescriptor descriptor, final PageRange[] pageRanges,
+ final FutureTask<Boolean> result) {
+ adapter.onWrite(pageRanges, descriptor,
new CancellationSignal(),
new WriteResultCallback() {
@Override
diff --git a/tests/tests/widget/Android.mk b/tests/tests/widget/Android.mk
index c6d85c6..653ef77 100644
--- a/tests/tests/widget/Android.mk
+++ b/tests/tests/widget/Android.mk
@@ -37,6 +37,6 @@
LOCAL_PACKAGE_NAME := CtsWidgetTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/widget/AndroidTest.xml b/tests/tests/widget/AndroidTest.xml
index d0cb110..d699e9d 100644
--- a/tests/tests/widget/AndroidTest.xml
+++ b/tests/tests/widget/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Widget test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsWidgetTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/wrap/nowrap/Android.mk b/tests/tests/wrap/nowrap/Android.mk
index 81d315f..eb801a1 100644
--- a/tests/tests/wrap/nowrap/Android.mk
+++ b/tests/tests/wrap/nowrap/Android.mk
@@ -21,9 +21,12 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ android-support-test \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
LOCAL_PACKAGE_NAME := CtsWrapNoWrapTestCases
diff --git a/tests/tests/wrap/nowrap/AndroidTest.xml b/tests/tests/wrap/nowrap/AndroidTest.xml
index bc0deb5..54e9bb5 100644
--- a/tests/tests/wrap/nowrap/AndroidTest.xml
+++ b/tests/tests/wrap/nowrap/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS No Wrap test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsWrapNoWrapTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/wrap/wrap_debug/Android.mk b/tests/tests/wrap/wrap_debug/Android.mk
index 2bfb7a5..e955115 100644
--- a/tests/tests/wrap/wrap_debug/Android.mk
+++ b/tests/tests/wrap/wrap_debug/Android.mk
@@ -21,9 +21,12 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ android-support-test \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
LOCAL_PREBUILT_JNI_LIBS_arm := ../wrap.sh
diff --git a/tests/tests/wrap/wrap_debug/AndroidTest.xml b/tests/tests/wrap/wrap_debug/AndroidTest.xml
index 246268b..d036fc3 100644
--- a/tests/tests/wrap/wrap_debug/AndroidTest.xml
+++ b/tests/tests/wrap/wrap_debug/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Debug Wrap test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsWrapWrapDebugTestCases.apk" />
</target_preparer>
diff --git a/tests/tests/wrap/wrap_nodebug/Android.mk b/tests/tests/wrap/wrap_nodebug/Android.mk
index 799030d..c4fb53f 100644
--- a/tests/tests/wrap/wrap_nodebug/Android.mk
+++ b/tests/tests/wrap/wrap_nodebug/Android.mk
@@ -21,9 +21,12 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util \
+ android-support-test \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
LOCAL_PREBUILT_JNI_LIBS_arm := ../wrap.sh
diff --git a/tests/tests/wrap/wrap_nodebug/AndroidTest.xml b/tests/tests/wrap/wrap_nodebug/AndroidTest.xml
index fd18f4c..2b5ed8f 100644
--- a/tests/tests/wrap/wrap_nodebug/AndroidTest.xml
+++ b/tests/tests/wrap/wrap_nodebug/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Wrap test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsWrapWrapNoDebugTestCases.apk" />
</target_preparer>
diff --git a/tests/tvprovider/Android.mk b/tests/tvprovider/Android.mk
index 2ac45a2..8c5aa1e 100644
--- a/tests/tvprovider/Android.mk
+++ b/tests/tvprovider/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PACKAGE_NAME := CtsTvProviderTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/tvprovider/AndroidTest.xml b/tests/tvprovider/AndroidTest.xml
index 633ebef..0d60571 100644
--- a/tests/tvprovider/AndroidTest.xml
+++ b/tests/tvprovider/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS TV Provider test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTvProviderTestCases.apk" />
</target_preparer>
diff --git a/tests/ui/Android.mk b/tests/ui/Android.mk
index 0ad32d1..172f6f5 100644
--- a/tests/ui/Android.mk
+++ b/tests/ui/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsUiDeviceTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := 16
diff --git a/tests/ui/AndroidTest.xml b/tests/ui/AndroidTest.xml
index ca0b63e..220eefd 100644
--- a/tests/ui/AndroidTest.xml
+++ b/tests/ui/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS UI test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsUiDeviceTestCases.apk" />
</target_preparer>
diff --git a/tests/video/Android.mk b/tests/video/Android.mk
index d7b91d9..ca55138 100644
--- a/tests/video/Android.mk
+++ b/tests/video/Android.mk
@@ -32,7 +32,7 @@
LOCAL_PACKAGE_NAME := CtsVideoTestCases
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_SDK_VERSION := current
diff --git a/tests/video/AndroidTest.xml b/tests/video/AndroidTest.xml
index 30b1160..0cb2a19 100644
--- a/tests/video/AndroidTest.xml
+++ b/tests/video/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS Video test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsVideoTestCases.apk" />
</target_preparer>
diff --git a/tests/vm/Android.mk b/tests/vm/Android.mk
index ed28a37..574ad16 100755
--- a/tests/vm/Android.mk
+++ b/tests/vm/Android.mk
@@ -30,7 +30,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsVmTestCases
diff --git a/tests/vm/AndroidTest.xml b/tests/vm/AndroidTest.xml
index fc1098b..8ff0939 100644
--- a/tests/vm/AndroidTest.xml
+++ b/tests/vm/AndroidTest.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<configuration description="Config for CTS VM test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsVmTestCases.apk" />
</target_preparer>
diff --git a/tests/vr/Android.mk b/tests/vr/Android.mk
index 92c99b1..b28b249 100644
--- a/tests/vr/Android.mk
+++ b/tests/vr/Android.mk
@@ -27,13 +27,13 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src) ../../apps/CtsVerifier/src/com/android/cts/verifier/vr/MockVrListenerService.java
LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/vr/AndroidTest.xml b/tests/vr/AndroidTest.xml
index dc6d5fa..4b5d656 100644
--- a/tests/vr/AndroidTest.xml
+++ b/tests/vr/AndroidTest.xml
@@ -14,7 +14,8 @@
limitations under the License.
-->
<configuration description="Config for CTS VR test cases">
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkInstaller">
+ <option name="test-suite-tag" value="cts" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsVrTestCases.apk" />
</target_preparer>
diff --git a/tools/cts-device-info/Android.mk b/tools/cts-device-info/Android.mk
index 81c8caf..d87ca41 100644
--- a/tools/cts-device-info/Android.mk
+++ b/tools/cts-device-info/Android.mk
@@ -36,7 +36,7 @@
LOCAL_PACKAGE_NAME := CtsDeviceInfo
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_CTS_DEVICE_INFO_PACKAGE)
diff --git a/tools/cts-holo-generation/Android.mk b/tools/cts-holo-generation/Android.mk
index 2affc5e..43b346d 100644
--- a/tools/cts-holo-generation/Android.mk
+++ b/tools/cts-holo-generation/Android.mk
@@ -23,7 +23,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tools/cts-preconditions/Android.mk b/tools/cts-preconditions/Android.mk
index 5497dda..8c36c21 100644
--- a/tools/cts-preconditions/Android.mk
+++ b/tools/cts-preconditions/Android.mk
@@ -25,12 +25,15 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-preconditions
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ android-support-test \
+ compatibility-device-preconditions \
+ legacy-android-test
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
LOCAL_PACKAGE_NAME := CtsPreconditions
diff --git a/tools/cts-reference-app-lib/Android.mk b/tools/cts-reference-app-lib/Android.mk
index fae85b4..8f6039d 100644
--- a/tools/cts-reference-app-lib/Android.mk
+++ b/tools/cts-reference-app-lib/Android.mk
@@ -24,6 +24,8 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_STATIC_JAVA_LIBRARIES := legacy-android-test junit
+
LOCAL_SDK_VERSION := current
LOCAL_MODULE := android.cts.refapp
diff --git a/tools/cts-tradefed/Android.mk b/tools/cts-tradefed/Android.mk
index 8a8cabf..179cd0a 100644
--- a/tools/cts-tradefed/Android.mk
+++ b/tools/cts-tradefed/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SUITE_VERSION := 8.0_r1
LOCAL_MODULE := cts-tradefed
-
+include cts/error_prone_rules.mk
include $(BUILD_COMPATIBILITY_SUITE)
# Build all sub-directories
diff --git a/tools/cts-tradefed/res/config/collect-tests-only.xml b/tools/cts-tradefed/res/config/collect-tests-only.xml
index b3a2916..6d179a2 100644
--- a/tools/cts-tradefed/res/config/collect-tests-only.xml
+++ b/tools/cts-tradefed/res/config/collect-tests-only.xml
@@ -26,6 +26,7 @@
<option name="skip-preconditions" value="true" />
<option name="skip-connectivity-check" value="true" />
+ <option name="preparer-whitelist" value="com.android.tradefed.targetprep.suite.SuiteApkInstaller" />
<option name="preparer-whitelist" value="com.android.compatibility.common.tradefed.targetprep.ApkInstaller" />
<option name="preparer-whitelist" value="com.android.compatibility.common.tradefed.targetprep.FilePusher" />
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index aaf1f81..c06384c 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -19,37 +19,13 @@
<!-- <option name="compatibility:exclude-filter" value="MODULE_NAME PACKAGE_NAME.CLASS_NAME" /> Excludes whole class -->
<!-- <option name="compatibility:exclude-filter" value="MODULE_NAME PACKAGE_NAME.CLASS_NAME#TEST_NAME" /> Excludes individual test -->
- <!-- b/35314835 -->
- <option name="compatibility:exclude-filter" value="CtsServicesHostTestCases android.server.cts.ActivityManagerPinnedStackTests#testAlwaysFocusablePipActivity" />
- <option name="compatibility:exclude-filter" value="CtsServicesHostTestCases android.server.cts.ActivityManagerPinnedStackTests#testLaunchIntoPinnedStack" />
-
<!-- b/17595050 -->
<option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityTextTraversalTest#testActionNextAndPreviousAtGranularityPageOverText" />
<option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityTextTraversalTest#testActionNextAndPreviousAtGranularityPageOverTextExtend" />
- <!-- b/17993121 -->
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testAppWidgetProviderCallbacks" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testBindAppWidget" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testCollectionWidgets" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testDeleteHost" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testDeleteHosts" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testGetAppWidgetIds" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testGetAppWidgetInfo" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testGetAppWidgetOptions" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testPartiallyUpdateAppWidgetViaWidgetId" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testPartiallyUpdateAppWidgetViaWidgetIds" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testTwoAppWidgetProviderCallbacks" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testUpdateAppWidgetViaComponentName" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testUpdateAppWidgetViaWidgetId" />
- <option name="compatibility:exclude-filter" value="CtsAppWidgetTestCases android.appwidget.cts.AppWidgetTest#testUpdateAppWidgetViaWidgetIds" />
-
<!-- b/17530117 -->
<option name="compatibility:exclude-filter" value="CtsCameraTestCases android.hardware.camera2.cts.AllocationTest#testBlackWhite" />
<option name="compatibility:exclude-filter" value="CtsCameraTestCases android.hardware.camera2.cts.AllocationTest#testParamSensitivity" />
- <!-- b/17989532 -->
- <option name="compatibility:exclude-filter" value="CtsCameraTestCases android.hardware.camera2.cts.SurfaceViewPreviewTest#testPreparePerformance" />
- <!-- b/23008511 -->
- <option name="compatibility:exclude-filter" value="CtsCameraTestCases android.hardware.cts.CameraTest#testPreviewFpsRange" />
<!-- These test cases are only applicable to Android Auto Embedded targets.-->
<option name="compatibility:exclude-filter" value="CtsCarTestCases" />
@@ -84,23 +60,11 @@
<option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.VirtualMachine.HoldEventsTest#testHoldEvents001" />
<option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.VirtualMachine.ReleaseEventsTest#testReleaseEvents001" />
- <!-- b/18117279 b/21262226 b/23144425 -->
+ <!-- b/21262226 -->
<option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases android.jobscheduler.cts.ConnectivityConstraintTest#testConnectivityConstraintExecutes_withMobile" />
- <option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases android.jobscheduler.cts.ConnectivityConstraintTest#testConnectivityConstraintExecutes_withWifi" />
- <option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases android.jobscheduler.cts.ConnectivityConstraintTest#testUnmeteredConstraintExecutes_withWifi" />
<option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases android.jobscheduler.cts.ConnectivityConstraintTest#testUnmeteredConstraintFails_withMobile" />
- <option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases android.jobscheduler.cts.TimingConstraintsTest#testJobParameters_unexpiredDeadline" />
- <!-- b/17144778 -->
- <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.ImageReaderDecoderTest#testHwAVCDecode360pForFlexibleYuv" />
- <!-- b/23827982 -->
- <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH264FlexArbitraryW" />
- <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH264SurfArbitraryW" />
-
- <!-- b/25651805 -->
- <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.ConnectivityManagerTest#testRestrictedNetworks" />
<!-- b/18682315 -->
- <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.SSLCertificateSocketFactoryTest#testCreateSocket" />
<option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_bind" />
<option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_simple" />
<option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_wrapping" />
@@ -109,15 +73,6 @@
<option name="compatibility:exclude-filter" value="CtsOpenGlPerfTestCases android.openglperf.cts.GlAppSwitchTest#testGlActivitySwitchingFast" />
<option name="compatibility:exclude-filter" value="CtsOpenGlPerfTestCases android.openglperf.cts.GlAppSwitchTest#testGlActivitySwitchingSlow" />
- <!-- b/18091590 -->
- <option name="compatibility:exclude-filter" value="CtsOpenGlPerfTestCases android.openglperf.cts.GlVboPerfTest#testVboWithVaryingIndexBufferNumbers" />
-
- <!-- b/23192492 -->
- <option name="compatibility:exclude-filter" value="CtsPermission2TestCases android.permission2.cts.ProtectedBroadcastsTest#testSendProtectedBroadcasts" />
-
- <option name="compatibility:exclude-filter" value="CtsSampleDeviceTestCases" />
- <option name="compatibility:exclude-filter" value="CtsSampleHostTestCases" />
-
<!-- b/18461670 -->
<option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_getStreamVolumeLeak" />
<option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_isStreamActive" />
@@ -134,21 +89,8 @@
<option name="compatibility:exclude-filter" value="x86_64 CtsRenderscriptLegacyTestCases" />
<option name="compatibility:exclude-filter" value="mips64 CtsRenderscriptLegacyTestCases" />
- <!-- b/23604254 -->
- <option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.ExtendedInCallServiceTest#testAddNewOutgoingCallAndThenDisconnect" />
- <option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.RemoteConferenceTest#testRemoteConferenceCallbacks_ConferenceableConnections" />
-
- <!-- b/23779020 -->
- <option name="compatibility:exclude-filter" value="CtsTransitionTestCases android.transition.cts.ChangeScrollTest#testChangeScroll" />
-
<!-- b/17536113 -->
<option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.UsageStatsTest#testNoAccessSilentlyFails" />
- <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.UsageStatsTest#testOrderedActivityLaunchSequenceInEventLog" />
- <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.UsageStatsTest#testPackageUsageStatsIntervals" />
- <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.UsageStatsTest#testUsageEventsParceling" />
-
- <!-- b/23238984 -->
- <option name="compatibility:exclude-filter" value="CtsVoiceSettingsTestCases android.voicesettings.cts.ZenModeTest#testAll" />
<!-- b/26235244 -->
<option name="compatibility:exclude-filter" value="android.util.cts.EventLogTest#testWriteEventWithOversizeValue" />
diff --git a/tools/cts-tradefed/res/config/cts-suite.xml b/tools/cts-tradefed/res/config/cts-suite.xml
new file mode 100644
index 0000000..c75072c
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-suite.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Runs CTS as a suite">
+ <!-- running config -->
+ <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" />
+ <test class="com.android.compatibility.common.tradefed.testtype.suite.CompatibilityTestSuite" />
+
+ <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:rerun-from-file:true" />
+ <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:fallback-to-serial-rerun:false" />
+
+ <logger class="com.android.tradefed.log.FileLogger">
+ <option name="log-level-display" value="WARN" />
+ </logger>
+ <!-- setup configs -->
+ <include name="cts-preconditions" />
+ <include name="cts-system-checkers" />
+ <include name="cts-known-failures" />
+
+ <option name="plan" value="cts-suite" />
+ <option name="test-tag" value="cts-suite" />
+
+ <option name="enable-root" value="false" />
+
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.PropertyCheck">
+ <option name="property-name" value="ro.build.type" />
+ <option name="expected-value" value="user"/> <!-- Device should have user build -->
+ <option name="throw-error" value="false"/> <!-- Only print warning if not user build -->
+ </target_preparer>
+
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.PropertyCheck">
+ <option name="property-name" value="ro.product.locale" />
+ <option name="expected-value" value="en-US"/> <!-- Device locale should be US English -->
+ <option name="throw-error" value="false"/> <!-- Only print warning if not en-US -->
+ </target_preparer>
+
+ <template-include name="reporters" default="basic-reporters" />
+
+ <result_reporter class="com.android.compatibility.common.tradefed.result.ResultReporter" />
+ <result_reporter class="com.android.tradefed.result.suite.SuiteResultReporter" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/retry.xml b/tools/cts-tradefed/res/config/retry.xml
new file mode 100644
index 0000000..c4a7ced
--- /dev/null
+++ b/tools/cts-tradefed/res/config/retry.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Runs a retry of a previous CTS session.">
+
+ <device_recovery class="com.android.tradefed.device.WaitDeviceRecovery" />
+ <build_provider class="com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider" />
+ <test class="com.android.compatibility.common.tradefed.testtype.retry.RetryFactoryTest" />
+ <logger class="com.android.tradefed.log.FileLogger">
+ <option name="log-level-display" value="WARN" />
+ </logger>
+
+ <include name="cts-preconditions" />
+ <include name="cts-system-checkers" />
+ <include name="cts-known-failures" />
+
+ <option name="plan" value="cts-retry" />
+ <option name="test-tag" value="cts" />
+ <option name="skip-device-info" value="true" />
+ <option name="enable-root" value="false" />
+
+ <result_reporter class="com.android.compatibility.common.tradefed.result.ConsoleReporter" />
+ <result_reporter class="com.android.compatibility.common.tradefed.result.ResultReporter" />
+
+ <template-include name="reporters" default="basic-reporters" />
+
+ <!-- Include additional test metadata output. -->
+ <template-include name="metadata-reporters" default="empty" />
+
+</configuration>
diff --git a/tools/selinux/SELinuxNeverallowTestFrame.py b/tools/selinux/SELinuxNeverallowTestFrame.py
index f84f2ec..20e1ed4 100644
--- a/tools/selinux/SELinuxNeverallowTestFrame.py
+++ b/tools/selinux/SELinuxNeverallowTestFrame.py
@@ -68,10 +68,7 @@
sepolicyAnalyze = buildHelper.getTestFile("sepolicy-analyze");
sepolicyAnalyze.setExecutable(true);
- /* obtain sepolicy file from running device */
- devicePolicyFile = File.createTempFile("sepolicy", ".tmp");
- devicePolicyFile.deleteOnExit();
- mDevice.pullFile("/sys/fs/selinux/policy", devicePolicyFile);
+ devicePolicyFile = android.security.cts.SELinuxHostTest.getDevicePolicyFile(mDevice);
}
private boolean isFullTrebleDevice() throws Exception {
diff --git a/tools/utils/monsoon.py b/tools/utils/monsoon.py
index d13cf3a..6efaf98 100755
--- a/tools/utils/monsoon.py
+++ b/tools/utils/monsoon.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# Copyright (C) 2014 The Android Open Source Project
#
diff --git a/tools/vm-tests-tf/Android.mk b/tools/vm-tests-tf/Android.mk
index 659bf5b..12661f5 100644
--- a/tools/vm-tests-tf/Android.mk
+++ b/tools/vm-tests-tf/Android.mk
@@ -25,7 +25,7 @@
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_TAGS := optional
LOCAL_JAVA_LIBRARIES := junit
-
+-include cts/error_prone_rules_tests.mk
include $(BUILD_JAVA_LIBRARY)
cts-tf-dalvik-lib.jack := $(full_classes_jack)
@@ -68,7 +68,7 @@
LOCAL_MODULE_PATH := $(intermediates)
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_SYSTEM)/base_rules.mk
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/opc_throw/Test_opc_throw.java b/tools/vm-tests-tf/src/dot/junit/opcodes/opc_throw/Test_opc_throw.java
index 7baf67d..df1e017 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/opc_throw/Test_opc_throw.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/opc_throw/Test_opc_throw.java
@@ -47,10 +47,11 @@
T_opc_throw_2 t = new T_opc_throw_2();
try {
t.run();
- fail("must throw a Throwable");
} catch (Throwable e) {
// expected
+ return;
}
+ fail("must throw a Throwable");
}
/**
@@ -60,10 +61,11 @@
T_opc_throw_8 t = new T_opc_throw_8();
try {
t.run();
- fail("must throw a Error");
} catch (Error e) {
// expected
+ return;
}
+ fail("must throw a Error");
}
/**
diff --git a/tools/vm-tests-tf/targetprep/Android.mk b/tools/vm-tests-tf/targetprep/Android.mk
index a05b658..b87b08a 100644
--- a/tools/vm-tests-tf/targetprep/Android.mk
+++ b/tools/vm-tests-tf/targetprep/Android.mk
@@ -25,7 +25,7 @@
LOCAL_MODULE := compatibility-host-vm-targetprep
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
include $(BUILD_HOST_JAVA_LIBRARY)