Merge changes I1bf7eca2,I188aaa30,If633acfe,Ifa9f1b40,I2ad7f7d4
* changes:
Remove unused cts-junit support
Convert some of cts/tools to Android.bp
Remove empty Android.mk files
Remove cts-testng
Remove android.cts.refapp
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java
index 7038685..d2eea34 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java
@@ -152,6 +152,11 @@
return true;
}
+ protected boolean isTelevision() {
+ final PackageManager pm = getInstrumentation().getContext().getPackageManager();
+ return pm.hasSystemFeature("android.hardware.type.television");
+ }
+
protected void assertActivityFailed() {
final Result result = mActivity.getResult();
assertEquals(REQUEST_CODE, result.requestCode);
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java
index 466dabf..dc44bafb 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java
@@ -32,6 +32,7 @@
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
@@ -361,8 +362,10 @@
// Close app screen.
mDevice.pressBack();
- // Close main screen.
- mDevice.pressBack();
+ if (!isTelevision()) {
+ // Close main screen.
+ mDevice.pressBack();
+ }
// Finally, make sure it's reset by requesting it again.
sendOpenExternalDirectoryIntent(volume, dir);
@@ -401,8 +404,10 @@
// Close app screen.
mDevice.pressBack();
- // Close main screen.
- mDevice.pressBack();
+ if (!isTelevision()) {
+ // Close main screen.
+ mDevice.pressBack();
+ }
// Then tries again - should be denied.
sendOpenExternalDirectoryIntent(volume, dir);
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 89f1132..e623635 100644
--- a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
+++ b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
@@ -57,6 +57,12 @@
mandatory = true)
private String mTestApk = null;
+ @Option(name = "hidden-api-checks",
+ description = "If we should enable hidden api checks. Default 'true'. Set to 'false' " +
+ "to disable hiddenapi.",
+ mandatory = false)
+ private String mHiddenApiChecksEnabled = null;
+
private CompatibilityBuildHelper mBuildHelper;
private IAbi mAbi;
@@ -90,6 +96,23 @@
throw new IllegalStateException("Incorrect configuration");
}
+ if (null != mHiddenApiChecksEnabled &&
+ !"false".equals(mHiddenApiChecksEnabled) &&
+ !"true".equals(mHiddenApiChecksEnabled)) {
+ throw new IllegalStateException(
+ "option hidden-api-checks must be 'true' or 'false' if present.");
+ }
+ boolean disable_hidden_api =
+ mHiddenApiChecksEnabled != null && "false".equals(mHiddenApiChecksEnabled);
+ String old_p_apps_setting = null;
+ String old_pre_p_apps_setting = null;
+ if (disable_hidden_api) {
+ old_p_apps_setting = device.getSetting("global", "hidden_api_policy_p_apps");
+ old_pre_p_apps_setting = device.getSetting("global", "hidden_api_policy_pre_p_apps");
+ device.setSetting("global", "hidden_api_policy_p_apps", "1");
+ device.setSetting("global", "hidden_api_policy_pre_p_apps", "1");
+ }
+
RemoteAndroidTestRunner runner = new RemoteAndroidTestRunner(mTestPackageName, RUNNER,
device.getIDevice());
// set a max deadline limit to avoid hanging forever
@@ -103,6 +126,11 @@
assertTrue(tr.getErrors(), tr.hasStarted());
assertFalse(tr.getErrors(), tr.hasFailed());
+
+ if (disable_hidden_api) {
+ device.setSetting("global", "hidden_api_policy_p_apps", old_p_apps_setting);
+ device.setSetting("global", "hidden_api_policy_pre_p_apps", old_pre_p_apps_setting);
+ }
}
private String getDeviceBaseArch(ITestDevice device) throws Exception {
diff --git a/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
index d13dbc9..1227f06 100644
--- a/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
@@ -24,6 +24,7 @@
<option name="jar" value="CtsJvmtiRunTest944HostTestCases.jar" />
<option name="set-option" value="test-file-name:CtsJvmtiRunTest944DeviceApp.apk" />
<option name="set-option" value="package-name:android.jvmti.cts.run_test_944" />
+ <option name="set-option" value="hidden-api-checks:false" />
<option name="runtime-hint" value="8s"/>
</test>
</configuration>
diff --git a/tests/signature/src/android/signature/cts/DexApiDocumentParser.java b/tests/signature/src/android/signature/cts/DexApiDocumentParser.java
index 4f3c6f4..58be322 100644
--- a/tests/signature/src/android/signature/cts/DexApiDocumentParser.java
+++ b/tests/signature/src/android/signature/cts/DexApiDocumentParser.java
@@ -46,6 +46,8 @@
private final BufferedReader mReader;
private int mLineNum;
+ // Regex patterns which match DEX signatures of methods and fields.
+ // See comment by next() for more details.
private static final Pattern REGEX_FIELD = Pattern.compile("^(L[^>]*;)->(.*):(.*)$");
private static final Pattern REGEX_METHOD =
Pattern.compile("^(L[^>]*;)->(.*)(\\(.*\\).*)$");
@@ -86,7 +88,7 @@
}
/**
- * Parses lines of DEX signatures from `mReader`. The following three
+ * Parses lines of DEX signatures from `mReader`. The following two
* line formats are supported:
* 1) [class descriptor]->[field name]:[field type]
* - e.g. Lcom/example/MyClass;->myField:I