Merge "Use new API" into oc-dev
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 63968b6..d9b87d16 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -3018,9 +3018,13 @@
5) In the screen that opens, verify that you are not told that your administrator installed any apps.\n
6) Use the Back button to return to this page.\n
7) Press the Install button.\n
- 8) Repeat steps (4) through (6), verifying that in step (5), you are told now that your administrator installed at least one app.\n
- 9) Press the Uninstall button.\n
- 10) Issue the following command on the host:\n
+ 8) Press the Open Settings button.\n
+ 9) In the screen that opens, verify that you are told now that your administrator installed at least one app.\n
+ 10) Tap on that information. Verify that a list of apps installed shows.\n
+ 11) Verify that the list contains the CTS Robot app.\n
+ 12) Use the Back button to return to this page.\n
+ 13) Press the Uninstall button.\n
+ 14) Issue the following command on the host:\n
adb shell rm /sdcard/NotificationBot.apk
</string>
<string name="enterprise_privacy_install">Install</string>
@@ -3036,7 +3040,7 @@
6) Press the Open Settings button.\n
7) In the screen that opens, verify that you are told now that your administrator has granted location access to at least one app.\n
8) Tap on that information. Verify that a list of apps which have location access shows.\n
- 9) Verify that the list indicates CTS Verifier\'s location access was enabled by your administrator.\n
+ 9) Verify that the list contains the CTS Verifier app.\n
10) Use the Back button to return to this page.\n
11) Press the Reset button.
</string>
@@ -3053,7 +3057,7 @@
6) Press the Open Settings button.\n
7) In the screen that opens, verify that you are told now that your administrator has granted microphone access to at least one app.\n
8) Tap on that information. Verify that a list of apps that have microphone access shows.\n
- 9) Verify that the list indicates CTS Verifier\'s microphone access was enabled by your administrator.\n
+ 9) Verify that the list contains the CTS Verifier app.\n
10) Use the Back button to return to this page.\n
11) Press the Reset button.
</string>
@@ -3068,7 +3072,7 @@
6) Press the Open Settings button.\n
7) In the screen that opens, verify that you are told now that your administrator has granted camera access to at least one app.\n
8) Tap on that information. Verify that a list of apps that have camera access shows.\n
- 9) Verify that the list indicates CTS Verifier\'s camera access was enabled by your administrator.\n
+ 9) Verify that the list contains the CTS Verifier app.\n
10) Use the Back button to return to this page.\n
11) Press the Reset button.
</string>
@@ -3080,8 +3084,12 @@
3) In the screen that opens, verify that you are not told that your administrator set any default apps.\n
4) Use the Back button to return to this page.\n
5) Press the Set Default Apps button.\n
- 6) Repeat steps (2) through (4), verifying that in step (3), you are told now that your administrator has set seven default apps.\n
- 7) Press the Reset button.
+ 6) Press the Open Settings button.\n
+ 7) In the screen that opens, verify that you are now told that your administrator has set 7 default apps.\n
+ 8) Tap on that information. Verify that a list of default apps shows, with 7 elements in it.\n
+ 9) Verify that each element shows the CTS Verifier is the default app.\n
+ 10) Use the Back button to return to this page.\n
+ 11) Press the Reset button.
</string>
<string name="enterprise_privacy_set_default_apps">Set Default Apps</string>
<string name="enterprise_privacy_default_ime">Default keyboard</string>
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BitmapUtils.java b/common/device-side/util/src/com/android/compatibility/common/util/BitmapUtils.java
index 5799e70..7f94d6f 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/BitmapUtils.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BitmapUtils.java
@@ -21,13 +21,19 @@
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Color;
+import android.util.Log;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.lang.reflect.Method;
import java.util.Random;
public class BitmapUtils {
+ private static final String TAG = "BitmapUtils";
+
private BitmapUtils() {}
// Compares two bitmaps by pixels.
@@ -67,11 +73,7 @@
public static Bitmap generateWhiteBitmap(int width, int height) {
final Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- for (int x = 0; x < width; x++) {
- for (int y = 0; y < height; y++) {
- bmp.setPixel(x, y, Color.WHITE);
- }
- }
+ bmp.eraseColor(Color.WHITE);
return bmp;
}
@@ -89,4 +91,38 @@
byte[] bitmapData = bos.toByteArray();
return new ByteArrayInputStream(bitmapData);
}
+
+ private static void logIfBitmapSolidColor(String fileName, Bitmap bitmap) {
+ int firstColor = bitmap.getPixel(0, 0);
+ for (int x = 0; x < bitmap.getWidth(); x++) {
+ for (int y = 0; y < bitmap.getHeight(); y++) {
+ if (bitmap.getPixel(x, y) != firstColor) {
+ return;
+ }
+ }
+ }
+
+ Log.w(TAG, String.format("%s entire bitmap color is %x", fileName, firstColor));
+ }
+
+ public static void saveBitmap(Bitmap bitmap, String directoryName, String fileName) {
+ new File(directoryName).mkdirs(); // create dirs if needed
+
+ Log.d(TAG, "Saving file: " + fileName + " in directory: " + directoryName);
+
+ if (bitmap == null) {
+ Log.d(TAG, "File not saved, bitmap was null");
+ return;
+ }
+
+ logIfBitmapSolidColor(fileName, bitmap);
+
+ File file = new File(directoryName, fileName);
+ try (FileOutputStream fileStream = new FileOutputStream(file)) {
+ bitmap.compress(Bitmap.CompressFormat.PNG, 0 /* ignored for PNG */, fileStream);
+ fileStream.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
}
diff --git a/hostsidetests/compilation/src/android/cts/compilation/AdbRootDependentCompilationTest.java b/hostsidetests/compilation/src/android/cts/compilation/AdbRootDependentCompilationTest.java
index ce8f760..2fc3e1e 100644
--- a/hostsidetests/compilation/src/android/cts/compilation/AdbRootDependentCompilationTest.java
+++ b/hostsidetests/compilation/src/android/cts/compilation/AdbRootDependentCompilationTest.java
@@ -263,7 +263,7 @@
while (owner.startsWith(" ")) {
owner = owner.substring(1);
}
- executePush(localProfileFile.getAbsolutePath(), targetPath);
+ executePush(localProfileFile.getAbsolutePath(), targetPath, targetDir);
executeSuShellAdbCommand(0, "chown", owner, targetPath);
// Verify that the file was written successfully
assertTrue("failed to create profile file", doesFileExist(targetPath));
@@ -352,11 +352,61 @@
return lines;
}
- private void executePush(String hostPath, String targetPath)
+ private String getSelinuxLabel(String path) throws DeviceNotAvailableException {
+ // ls -aZ (-a so it sees directories, -Z so it prints the label).
+ String[] res = executeSuShellAdbCommand(String.format(
+ "ls -aZ '%s'", path));
+
+ if (res.length == 0) {
+ return null;
+ }
+
+ // For directories, it will print many outputs. Filter to first line which contains '.'
+ // The target line will look like
+ // "u:object_r:shell_data_file:s0 /data/local/tmp/android.cts.compilation.primary.prof"
+ // Remove the second word to only return "u:object_r:shell_data_file:s0".
+
+ return res[0].replaceAll("\\s+.*",""); // remove everything following the first whitespace
+ }
+
+ private void checkSelinuxLabelMatches(String a, String b) throws DeviceNotAvailableException {
+ String labelA = getSelinuxLabel(a);
+ String labelB = getSelinuxLabel(b);
+
+ assertEquals("expected the selinux labels to match", labelA, labelB);
+ }
+
+ private void executePush(String hostPath, String targetPath, String targetDirectory)
throws DeviceNotAvailableException {
+ // Cannot push to a privileged directory with one command.
+ // (i.e. there is no single-command equivalent of 'adb root; adb push src dst')
+ //
+ // Push to a tmp directory and then move it to the final destination
+ // after updating the selinux label.
String tmpPath = "/data/local/tmp/" + APPLICATION_PACKAGE + ".push.tmp";
assertTrue(mDevice.pushFile(new File(hostPath), tmpPath));
+
+ // Important: Use "cp" here because it newly copied files will inherit the security context
+ // of the targetDirectory according to the default policy.
+ //
+ // (Other approaches, such as moving the file retain the invalid security context
+ // of the tmp directory - b/37425296)
+ //
+ // This mimics the behavior of 'adb root; adb push $targetPath'.
executeSuShellAdbCommand("mv", tmpPath, targetPath);
+
+ // Important: Use "restorecon" here because the file in tmpPath retains the
+ // incompatible security context of /data/local/tmp.
+ //
+ // This mimics the behavior of 'adb root; adb push $targetPath'.
+ executeSuShellAdbCommand("restorecon", targetPath);
+
+ // Validate that the security context of the file matches the security context
+ // of the directory it was pushed to.
+ //
+ // This is a reasonable default behavior to check because most selinux policies
+ // are configured to behave like this.
+ checkSelinuxLabelMatches(targetDirectory, targetPath);
}
private void executePull(String targetPath, String hostPath)
diff --git a/hostsidetests/devicepolicy/app/Assistant/Android.mk b/hostsidetests/devicepolicy/app/Assistant/Android.mk
new file mode 100644
index 0000000..196f323
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/Assistant/Android.mk
@@ -0,0 +1,39 @@
+# 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
+
+LOCAL_PACKAGE_NAME := CtsDevicePolicyAssistApp
+
+LOCAL_STATIC_JAVA_LIBRARIES = android-support-v4 compatibility-device-util android-support-test
+
+LOCAL_SDK_VERSION := current
+
+# tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml b/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
new file mode 100644
index 0000000..5fc20de
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
@@ -0,0 +1,48 @@
+<?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.assistapp" >
+
+ <application>
+
+ <service android:name=".MyInteractionService"
+ android:label="CTS test voice interaction service"
+ android:permission="android.permission.BIND_VOICE_INTERACTION"
+ android:exported="true">
+ <meta-data android:name="android.voice_interaction"
+ android:resource="@xml/interaction_service" />
+ <intent-filter>
+ <action android:name="android.service.voice.VoiceInteractionService" />
+ </intent-filter>
+ </service>
+
+ <service android:name=".MyInteractionSessionService"
+ android:permission="android.permission.BIND_VOICE_INTERACTION">
+ </service>
+
+ <activity android:name=".SettingsActivity"
+ android:exported="true">
+ </activity>
+ </application>
+
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.cts.devicepolicy.assistapp"
+ android:label="Assistant related device policy CTS" />
+
+</manifest>
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/app/Assistant/res/xml/interaction_service.xml b/hostsidetests/devicepolicy/app/Assistant/res/xml/interaction_service.xml
new file mode 100644
index 0000000..a3fe680
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/Assistant/res/xml/interaction_service.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.
+-->
+
+<voice-interaction-service xmlns:android="http://schemas.android.com/apk/res/android"
+ android:sessionService="com.android.cts.devicepolicy.assistapp.MyInteractionSessionService"
+ android:recognitionService="com.android.cts.devicepolicy.assistapp.MyInteractionService"
+ android:settingsActivity="com.android.cts.devicepolicy.assistapp.SettingsActivity"
+ android:supportsAssist="true" />
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/MyInteractionService.java b/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/MyInteractionService.java
new file mode 100644
index 0000000..e232540
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/MyInteractionService.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.assistapp;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.service.voice.VoiceInteractionService;
+import android.util.Log;
+
+import static android.service.voice.VoiceInteractionSession.SHOW_WITH_ASSIST;
+import static android.service.voice.VoiceInteractionSession.SHOW_WITH_SCREENSHOT;
+
+public class MyInteractionService extends VoiceInteractionService {
+ private static final String TAG = "DevicePolicyAssistTest";
+ private static final String ACTION_CHECK_IS_READY = "voice_interaction_service.is_ready";
+ private static final String ACTION_SHOW_SESSION = "voice_interaction_service.show_session";
+ private AssistReceiver mReceiver;
+ private boolean mReady;
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ mReceiver = new AssistReceiver();
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(ACTION_CHECK_IS_READY);
+ intentFilter.addAction(ACTION_SHOW_SESSION);
+ registerReceiver(mReceiver, intentFilter);
+ }
+
+ @Override
+ public void onReady() {
+ super.onReady();
+ Log.d(TAG, "onReady() called");
+ mReady = true;
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ Log.d(TAG, "onDestroy() called");
+ unregisterReceiver(mReceiver);
+ mReceiver = null;
+ }
+
+ private class AssistReceiver extends BroadcastReceiver {
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d(TAG, "AssistReceiver: " + intent + " mReady: " + mReady);
+ if (ACTION_CHECK_IS_READY.equals(intent.getAction())) {
+ setResultCode(mReady ? Activity.RESULT_OK : Activity.RESULT_CANCELED);
+ } else if (ACTION_SHOW_SESSION.equals(intent.getAction())) {
+ showSession(
+ new Bundle(),
+ SHOW_WITH_ASSIST | SHOW_WITH_SCREENSHOT);
+ }
+ }
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/MyInteractionSessionService.java b/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/MyInteractionSessionService.java
new file mode 100644
index 0000000..5eae4f7
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/MyInteractionSessionService.java
@@ -0,0 +1,54 @@
+/*
+ * 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.assistapp;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.os.Bundle;
+import android.service.voice.VoiceInteractionSession;
+import android.service.voice.VoiceInteractionSessionService;
+import android.util.Log;
+
+public class MyInteractionSessionService extends VoiceInteractionSessionService {
+ private static final String TAG = "DevicePolicyAssistTest";
+ private static final String ACTION_HANDLE_SCREENSHOT =
+ "voice_interaction_session_service.handle_screenshot";
+ private static final String KEY_HAS_SCREENSHOT = "has_screenshot";
+
+ @Override
+ public VoiceInteractionSession onNewSession(Bundle args) {
+ return new MainInteractionSession(this);
+ }
+
+ public static class MainInteractionSession extends VoiceInteractionSession {
+
+ public MainInteractionSession(Context context) {
+ super(context);
+ }
+
+ @Override
+ public void onHandleScreenshot(Bitmap screenshot) {
+ Log.d(TAG, "onHandleScreenshot() called with: screenshot = [" + screenshot + "]");
+ Intent intent = new Intent(ACTION_HANDLE_SCREENSHOT);
+ intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ intent.putExtra(KEY_HAS_SCREENSHOT, screenshot != null);
+ getContext().sendBroadcast(intent);
+ finish();
+ }
+ }
+}
\ No newline at end of file
diff --git a/hostsidetests/jvmti/base/jni/common.h b/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/SettingsActivity.java
similarity index 69%
rename from hostsidetests/jvmti/base/jni/common.h
rename to hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/SettingsActivity.java
index ded4fc5..1f6d34f 100644
--- a/hostsidetests/jvmti/base/jni/common.h
+++ b/hostsidetests/devicepolicy/app/Assistant/src/com/android/cts/devicepolicy/assistapp/SettingsActivity.java
@@ -13,22 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+package com.android.cts.devicepolicy.assistapp;
-#ifndef COMMON_H_
-#define COMMON_H_
+import android.app.Activity;
-#include "jni.h"
-#include "jvmti.h"
-
-namespace cts {
-namespace jvmti {
-
-jvmtiEnv* GetJvmtiEnv();
-
-int JniThrowNullPointerException(JNIEnv* env, const char* msg);
-
-} // namespace jvmti
-} // namespace cts
-
-
-#endif // COMMON_H_
+public class SettingsActivity extends Activity {
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
new file mode 100644
index 0000000..db54ac3
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
@@ -0,0 +1,98 @@
+package com.android.cts.deviceandprofileowner;
+
+import android.app.Activity;
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.os.Handler;
+import android.os.Looper;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+import android.util.Log;
+
+import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Testing
+ * {@link android.app.admin.DevicePolicyManager#setScreenCaptureDisabled(ComponentName, boolean)}
+ * is enforced in {@link android.service.voice.VoiceInteractionSession#onHandleScreenshot(Bitmap)}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class AssistScreenCaptureDisabledTest {
+ private static final String TAG = "DevicePolicyAssistTest";
+
+ private static final String ACTION_CHECK_IS_READY = "voice_interaction_service.is_ready";
+ private static final String ACTION_SHOW_SESSION = "voice_interaction_service.show_session";
+ private static final String ACTION_HANDLE_SCREENSHOT =
+ "voice_interaction_session_service.handle_screenshot";
+ private static final String KEY_HAS_SCREENSHOT = "has_screenshot";
+ private static final String ASSIST_PACKAGE = "com.android.cts.devicepolicy.assistapp";
+
+ private static final int MAX_ATTEMPTS_COUNT = 5;
+ private static final int WAIT_IN_SECOND = 5;
+ private Context mContext;
+
+ @Before
+ public void setup() {
+ mContext = InstrumentationRegistry.getContext();
+ }
+
+ @Test
+ public void testScreenCaptureImpossible_assist() throws Exception {
+ assertScreenCapturePossible(false);
+ }
+
+ @Test
+ public void testScreenCapturePossible_assist() throws Exception {
+ assertScreenCapturePossible(true);
+ }
+
+ private void assertScreenCapturePossible(boolean possible) throws InterruptedException {
+ // Wait until voice interaction service is ready by sending broadcast to ask for status.
+ Intent checkIsReadyIntent = new Intent(ACTION_CHECK_IS_READY);
+ checkIsReadyIntent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ checkIsReadyIntent.setPackage(ASSIST_PACKAGE);
+ boolean isAssistReady = false;
+ for (int i = 0; i < MAX_ATTEMPTS_COUNT && !isAssistReady; i++) {
+ Log.d(TAG, "assertScreenCapturePossible: wait for assist service ready, attempt " + i);
+ final LinkedBlockingQueue<Boolean> q = new LinkedBlockingQueue<>();
+ mContext.sendOrderedBroadcast(checkIsReadyIntent, null, new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ q.offer(getResultCode() == Activity.RESULT_OK);
+ }
+ }, null, Activity.RESULT_CANCELED, null, null);
+ Boolean result = q.poll(WAIT_IN_SECOND, TimeUnit.SECONDS);
+ isAssistReady = result != null && result;
+ }
+ Assert.assertTrue(isAssistReady);
+
+ // Send broadcast to voice interaction service and ask for screnshot.
+ BlockingBroadcastReceiver receiver = new BlockingBroadcastReceiver(
+ mContext, ACTION_HANDLE_SCREENSHOT);
+ try {
+ receiver.register();
+ Intent showSessionIntent = new Intent(ACTION_SHOW_SESSION);
+ showSessionIntent.setPackage(ASSIST_PACKAGE);
+ mContext.sendBroadcast(showSessionIntent);
+ Intent screenShotIntent = receiver.awaitForBroadcast();
+ Assert.assertNotNull(screenShotIntent);
+ Assert.assertTrue(screenShotIntent.hasExtra(KEY_HAS_SCREENSHOT));
+ assertEquals(possible, screenShotIntent.getBooleanExtra(KEY_HAS_SCREENSHOT, false));
+ } finally {
+ receiver.unregisterQuietly();
+ }
+ }
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ScreenCaptureDisabledTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ScreenCaptureDisabledTest.java
index b7f9066..c5b3e96 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ScreenCaptureDisabledTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ScreenCaptureDisabledTest.java
@@ -16,7 +16,7 @@
package com.android.cts.deviceandprofileowner;
import android.app.admin.DevicePolicyManager;
-import android.util.Log;
+import android.support.v4.content.LocalBroadcastManager;
/**
* Tests for {@link DevicePolicyManager#setScreenCaptureDisabled} and
@@ -26,6 +26,12 @@
private static final String TAG = "ScreenCaptureDisabledTest";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
public void testSetScreenCaptureDisabled_false() throws Exception {
mDevicePolicyManager.setScreenCaptureDisabled(ADMIN_RECEIVER_COMPONENT, false);
assertFalse(mDevicePolicyManager.getScreenCaptureDisabled(ADMIN_RECEIVER_COMPONENT));
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
index 031763d..956e03d 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
@@ -25,14 +25,12 @@
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
+import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.UnknownHostException;
import java.net.URL;
-import java.io.IOException;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -127,13 +125,13 @@
mCurrentBatchToken = FAKE_BATCH_TOKEN;
mGenerateNetworkTraffic = true;
// register a receiver that listens for DeviceAdminReceiver#onNetworkLogsAvailable()
- IntentFilter filterNetworkLogsAvailable = new IntentFilter(
+ final IntentFilter filterNetworkLogsAvailable = new IntentFilter(
BaseDeviceOwnerTest.ACTION_NETWORK_LOGS_AVAILABLE);
LocalBroadcastManager.getInstance(mContext).registerReceiver(mNetworkLogsReceiver,
filterNetworkLogsAvailable);
// visit websites that shouldn't be logged as network logging isn't enabled yet
- for (String url : NOT_LOGGED_URLS_LIST) {
+ for (final String url : NOT_LOGGED_URLS_LIST) {
connectToWebsite(url);
}
@@ -146,7 +144,7 @@
// visit websites in a loop to generate enough network traffic
int iterationsDone = 0;
while (mGenerateNetworkTraffic && iterationsDone < MAX_VISITING_WEBPAGES_ITERATIONS) {
- for (String url : LOGGED_URLS_LIST) {
+ for (final String url : LOGGED_URLS_LIST) {
connectToWebsite(url);
}
iterationsDone++;
@@ -162,7 +160,7 @@
}
// retrieve and verify network logs
- List<NetworkEvent> networkEvents = mDevicePolicyManager.retrieveNetworkLogs(getWho(),
+ final List<NetworkEvent> networkEvents = mDevicePolicyManager.retrieveNetworkLogs(getWho(),
mCurrentBatchToken);
if (networkEvents == null) {
fail("Failed to retrieve batch of network logs with batch token " + mCurrentBatchToken);
@@ -176,10 +174,10 @@
int ctsPackageNameCounter = 0;
// allow a small down margin for verification, to avoid flakyness
final int iterationsDoneWithMargin = iterationsDone - 5;
- int[] visitedFrequencies = new int[LOGGED_URLS_LIST.length];
+ final int[] visitedFrequencies = new int[LOGGED_URLS_LIST.length];
for (int i = 0; i < networkEvents.size(); i++) {
- NetworkEvent currentEvent = networkEvents.get(i);
+ final NetworkEvent currentEvent = networkEvents.get(i);
// verify that the events are in chronological order
if (i > 0) {
assertTrue(currentEvent.getTimestamp() >= networkEvents.get(i - 1).getTimestamp());
@@ -188,7 +186,7 @@
if (CTS_APP_PACKAGE_NAME.equals(currentEvent.getPackageName())) {
ctsPackageNameCounter++;
if (currentEvent instanceof DnsEvent) {
- DnsEvent dnsEvent = (DnsEvent) currentEvent;
+ final DnsEvent dnsEvent = (DnsEvent) currentEvent;
// verify that we didn't log a hostname lookup when network logging was disabled
if (dnsEvent.getHostname().contains(NOT_LOGGED_URLS_LIST[0])
|| dnsEvent.getHostname().contains(NOT_LOGGED_URLS_LIST[1])) {
@@ -203,18 +201,19 @@
}
}
// verify that as many IP addresses were logged as were reported (max 10)
- String[] ips = dnsEvent.getIpAddresses();
+ final InetAddress[] ips = dnsEvent.getInetAddresses();
assertTrue(ips.length <= MAX_IP_ADDRESSES_LOGGED);
- assertEquals(Math.min(MAX_IP_ADDRESSES_LOGGED, dnsEvent.getIpAddressesCount()),
- ips.length);
+ final int expectedAddressCount = Math.min(MAX_IP_ADDRESSES_LOGGED,
+ dnsEvent.getTotalResolvedAddressCount());
+ assertEquals(expectedAddressCount, ips.length);
// verify the IP addresses are valid IPv4 or IPv6 addresses
- for (String ipAddress : ips) {
- assertTrue(isValidIpv4OrIpv6Address(ipAddress));
+ for (final InetAddress ipAddress : ips) {
+ assertTrue(isIpv4OrIpv6Address(ipAddress));
}
} else if (currentEvent instanceof ConnectEvent) {
- ConnectEvent connectEvent = (ConnectEvent) currentEvent;
+ final ConnectEvent connectEvent = (ConnectEvent) currentEvent;
// verify the IP address is a valid IPv4 or IPv6 address
- assertTrue(isValidIpv4OrIpv6Address(connectEvent.getIpAddress()));
+ assertTrue(isIpv4OrIpv6Address(connectEvent.getInetAddress()));
// verify that the port is a valid port
assertTrue(connectEvent.getPort() >= 0 && connectEvent.getPort() <= 65535);
} else {
@@ -236,13 +235,11 @@
private void connectToWebsite(String urlString) {
HttpURLConnection urlConnection = null;
try {
- URL url = new URL("http://" + urlString);
+ final URL url = new URL("http://" + urlString);
urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setConnectTimeout(2000);
urlConnection.setReadTimeout(2000);
urlConnection.getResponseCode();
- } catch (MalformedURLException e) {
- Log.w(TAG, "Failed to connect to " + urlString, e);
} catch (IOException e) {
Log.w(TAG, "Failed to connect to " + urlString, e);
} finally {
@@ -252,12 +249,7 @@
}
}
- private boolean isValidIpv4OrIpv6Address(String ipAddress) {
- try {
- InetAddress addr = InetAddress.getByName(ipAddress);
- return (addr instanceof Inet4Address) || (addr instanceof Inet6Address);
- } catch (UnknownHostException e) {
- return false;
- }
+ private boolean isIpv4OrIpv6Address(InetAddress addr) {
+ return ((addr instanceof Inet4Address) || (addr instanceof Inet6Address));
}
}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
index d3cde44..d20d5e4 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
@@ -138,7 +138,7 @@
removeOwners();
removeTestUsers();
// Unlock keyguard before test
- executeShellCommand("wm dismiss-keyguard");
+ wakeupAndDismissKeyguard();
}
@Override
@@ -764,4 +764,9 @@
}
}
}
+
+ protected void wakeupAndDismissKeyguard() throws Exception {
+ executeShellCommand("input keyevent KEYCODE_WAKEUP");
+ executeShellCommand("wm dismiss-keyguard");
+ }
}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
index da902d3..865d785 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
@@ -96,9 +96,15 @@
private static final String AUTOFILL_APP_PKG = "com.android.cts.devicepolicy.autofillapp";
private static final String AUTOFILL_APP_APK = "CtsDevicePolicyAutofillApp.apk";
+ protected static final String ASSIST_APP_PKG = "com.android.cts.devicepolicy.assistapp";
+ protected static final String ASSIST_APP_APK = "CtsDevicePolicyAssistApp.apk";
+
private static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES
= "enabled_notification_policy_access_packages";
+ protected static final String ASSIST_INTERACTION_SERVICE =
+ ASSIST_APP_PKG + "/.MyInteractionService";
+
// ID of the user all tests are run as. For device owner this will be the primary user, for
// profile owner it is the user id of the created profile.
protected int mUserId;
@@ -364,6 +370,21 @@
}
}
+ public void testScreenCaptureDisabled_assist() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+ try {
+ // Install and enable assistant, notice that profile can't have assistant.
+ installAppAsUser(ASSIST_APP_APK, mPrimaryUserId);
+ setVoiceInteractionService(ASSIST_INTERACTION_SERVICE);
+ setScreenCaptureDisabled_assist(mUserId, true /* disabled */);
+ } finally {
+ setScreenCaptureDisabled_assist(mUserId, false /* disabled */);
+ clearVoiceInteractionService();
+ }
+ }
+
public void testSupportMessage() throws Exception {
if (!mHasFeature) {
return;
@@ -773,35 +794,44 @@
*/
protected void startSimpleActivityAsUser(int userId) throws Exception {
installAppAsUser(TEST_APP_APK, userId);
+ wakeupAndDismissKeyguard();
String command = "am start -W --user " + userId + " " + TEST_APP_PKG + "/"
+ TEST_APP_PKG + ".SimpleActivity";
getDevice().executeShellCommand(command);
}
- // TODO: Remove this after investigation in b/28995242 is done
- // So we can check which one is the top window / activity.
- private void runDumpsysWindow() throws Exception {
- String command = "dumpsys window displays";
- CLog.d("Output for command " + command + ": " + getDevice().executeShellCommand(command));
- command = "dumpsys activity a";
- CLog.d("Output for command " + command + ": " + getDevice().executeShellCommand(command));
- }
-
protected void setScreenCaptureDisabled(int userId, boolean disabled) throws Exception {
String testMethodName = disabled
? "testSetScreenCaptureDisabled_true"
: "testSetScreenCaptureDisabled_false";
executeDeviceTestMethod(".ScreenCaptureDisabledTest", testMethodName);
startSimpleActivityAsUser(userId);
- // [b/28995242], dump windows to make sure the top window is
- // ScreenCaptureDisabledActivity.
- runDumpsysWindow();
testMethodName = disabled
? "testScreenCaptureImpossible"
: "testScreenCapturePossible";
executeDeviceTestMethod(".ScreenCaptureDisabledTest", testMethodName);
}
+ protected void setScreenCaptureDisabled_assist(int userId, boolean disabled) throws Exception {
+ // Set the policy.
+ String testMethodName = disabled
+ ? "testSetScreenCaptureDisabled_true"
+ : "testSetScreenCaptureDisabled_false";
+ executeDeviceTestMethod(".ScreenCaptureDisabledTest", testMethodName);
+ // Make sure the foreground activity is from the target user.
+ startSimpleActivityAsUser(userId);
+ // Check whether the VoiceInteractionService can retrieve the screenshot.
+ testMethodName = disabled
+ ? "testScreenCaptureImpossible_assist"
+ : "testScreenCapturePossible_assist";
+ installAppAsUser(DEVICE_ADMIN_APK, mPrimaryUserId);
+ runDeviceTestsAsUser(
+ DEVICE_ADMIN_PKG,
+ ".AssistScreenCaptureDisabledTest",
+ testMethodName,
+ mPrimaryUserId);
+ }
+
/**
* Allows packageName to manage notification policy configuration, which
* includes toggling zen mode.
@@ -843,4 +873,16 @@
}
return new ArrayList<String>(Arrays.asList(settingValue.split(":|\n")));
}
+
+ protected void setVoiceInteractionService(String componentName)
+ throws DeviceNotAvailableException {
+ getDevice().setSetting(
+ mPrimaryUserId, "secure", "voice_interaction_service", componentName);
+ getDevice().setSetting(mPrimaryUserId, "secure", "assist_structure_enabled", "1");
+ getDevice().setSetting(mPrimaryUserId, "secure", "assist_screenshot_enabled", "1");
+ }
+
+ protected void clearVoiceInteractionService() throws DeviceNotAvailableException {
+ getDevice().executeShellCommand("settings delete secure voice_interaction_service");
+ }
}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java
index a2d8057..0022804 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java
@@ -78,6 +78,36 @@
executeDeviceTestMethod(".ScreenCaptureDisabledTest", "testScreenCapturePossible");
}
+ public void testScreenCaptureDisabled_assist_allowedPrimaryUser() throws Exception {
+ if (!mHasFeature) {
+ return;
+ }
+ // disable screen capture in profile
+ executeDeviceTestMethod(".ScreenCaptureDisabledTest", "testSetScreenCaptureDisabled_true");
+ try {
+ // Install and enable assistant in personal side.
+ installAppAsUser(ASSIST_APP_APK, mParentUserId);
+ setVoiceInteractionService(ASSIST_INTERACTION_SERVICE);
+
+ // Start an activity in parent user.
+ installAppAsUser(DEVICE_ADMIN_APK, mParentUserId);
+ startSimpleActivityAsUser(mParentUserId);
+
+ // Verify assistant app can't take a screenshot.
+ runDeviceTestsAsUser(
+ DEVICE_ADMIN_PKG,
+ ".AssistScreenCaptureDisabledTest",
+ "testScreenCapturePossible_assist",
+ mPrimaryUserId);
+ } finally {
+ // enable screen capture in profile
+ executeDeviceTestMethod(
+ ".ScreenCaptureDisabledTest",
+ "testSetScreenCaptureDisabled_false");
+ clearVoiceInteractionService();
+ }
+ }
+
@Override
public void testDisallowSetWallpaper_allowed() throws Exception {
// Managed profile doesn't have wallpaper.
diff --git a/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml b/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml
index fc26aae..84f074d 100644
--- a/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml
+++ b/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml
@@ -21,5 +21,7 @@
</target_preparer>
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CtsJvmtiTrackingHostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiTrackingDeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.tracking" />
</test>
</configuration>
diff --git a/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java b/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java
index 70434d1..7a13e79 100644
--- a/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java
+++ b/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java
@@ -19,6 +19,8 @@
import org.junit.Before;
import org.junit.Test;
+import art.Main;
+
/**
* Check tagging-related functionality.
*/
@@ -27,7 +29,7 @@
@Before
public void setUp() throws Exception {
// Bind our native methods.
- JniBindings.bindAgentJNI("android/jvmti/cts/JvmtiTrackingTest",
+ Main.bindAgentJNI("android/jvmti/cts/JvmtiTrackingTest",
getClass().getClassLoader());
prefetchClassNames();
diff --git a/hostsidetests/jvmti/allocation-tracking/app/src/art/Main.java b/hostsidetests/jvmti/allocation-tracking/app/src/art/Main.java
new file mode 100644
index 0000000..6f569d1
--- /dev/null
+++ b/hostsidetests/jvmti/allocation-tracking/app/src/art/Main.java
@@ -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.
+ */
+
+package art;
+
+/**
+ * This is a definition of generically exposed implementations by the CTS JVMTI agent.
+ */
+public class Main {
+ // Load the given class with the given classloader, and bind all native methods to corresponding
+ // C methods in the agent. Will abort if any of the steps fail.
+ public static native void bindAgentJNI(String className, ClassLoader classLoader);
+ // Same as above, giving the class directly.
+ public static native void bindAgentJNIForClass(Class<?> klass);
+
+ // General functionality shared between tests.
+ public static native void setTag(Object o, long tag);
+
+ public static native long getTag(Object o);
+}
diff --git a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java b/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
index b0c02cf..0b54a93 100644
--- a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
+++ b/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
@@ -15,14 +15,17 @@
*/
package android.jvmti.cts;
-import android.jvmti.JvmtiActivity;
import android.support.test.filters.SmallTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.runner.RunWith;
+import android.jvmti.JvmtiActivity;
+import art.CtsMain;
+
/**
* Base class for JVMTI tests. Ensures that the agent is connected for the tests. If you
* do not subclass this test, make sure that JniBindings.waitFor is appropriately called.
@@ -45,6 +48,6 @@
mActivity = mActivityRule.getActivity();
// Make sure that the agent is ready.
- JniBindings.waitFor();
+ CtsMain.waitFor();
}
}
diff --git a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JniBindings.java b/hostsidetests/jvmti/base/app/src/art/CtsMain.java
similarity index 70%
rename from hostsidetests/jvmti/base/app/src/android/jvmti/cts/JniBindings.java
rename to hostsidetests/jvmti/base/app/src/art/CtsMain.java
index cc473d2..4970c07 100644
--- a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JniBindings.java
+++ b/hostsidetests/jvmti/base/app/src/art/CtsMain.java
@@ -12,15 +12,15 @@
* the License.
*/
-package android.jvmti.cts;
+package art;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
/**
- * A class that contains all bindings to JNI implementations provided by the CTS JVMTI agent.
+ * An entrypoint for the CTS JVMTI agent to signal to the Java side that it has attached.
*/
-public class JniBindings {
+public class CtsMain {
private static CountDownLatch sStartWaiter = new CountDownLatch(1);
@@ -42,13 +42,4 @@
throw new RuntimeException("Got interrupted waiting for agent.");
}
}
-
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
-
- // General functionality shared between tests.
- public static native void setTag(Object o, long tag);
-
- public static native long getTag(Object o);
}
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 326ff96..6894a21 100644
--- a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
+++ b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
@@ -19,6 +19,7 @@
import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.TestIdentifier;
import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.config.Option;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceTestCase;
@@ -41,17 +42,23 @@
*/
public class JvmtiHostTest extends DeviceTestCase implements IBuildReceiver, IAbiReceiver {
private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ // inject these options from HostTest directly using --set-option <option name>:<option value>
+ @Option(name = "package-name",
+ description = "The package name of the device test",
+ mandatory = true)
+ private String mTestPackageName = null;
+
+ @Option(name = "test-file-name",
+ description = "the name of a test zip file to install on device.",
+ mandatory = true)
+ private String mTestApk = null;
private CompatibilityBuildHelper mBuildHelper;
private IAbi mAbi;
- private String mTestPackageName;
- private String mTestApk;
@Override
public void setBuild(IBuildInfo arg0) {
mBuildHelper = new CompatibilityBuildHelper(arg0);
- mTestPackageName = arg0.getBuildAttributes().get(JvmtiPreparer.PACKAGE_NAME_ATTRIBUTE);
- mTestApk = arg0.getBuildAttributes().get(JvmtiPreparer.APK_ATTRIBUTE);
}
@Override
@@ -109,8 +116,8 @@
String agentInDataData = installLibToDataData(pwd, "libctsjvmtiagent.so");
- String attachReply = mDevice
- .executeShellCommand("am attach-agent " + mPkg + " " + agentInDataData);
+ String attachCmd = "cmd activity attach-agent " + mPkg + " " + agentInDataData;
+ String attachReply = mDevice.executeShellCommand(attachCmd);
// Don't try to parse the output. The test will time out anyways if this didn't
// work.
if (attachReply != null && !attachReply.trim().isEmpty()) {
diff --git a/hostsidetests/jvmti/base/jni/Android.mk b/hostsidetests/jvmti/base/jni/Android.mk
index a634c1a..28b7ea3 100644
--- a/hostsidetests/jvmti/base/jni/Android.mk
+++ b/hostsidetests/jvmti/base/jni/Android.mk
@@ -21,9 +21,7 @@
# Don't include this package in any configuration by default.
LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := cts_agent.cpp \
- jni_binder.cpp \
- jvmti_helper.cpp \
+LOCAL_SRC_FILES := cts_agent.cpp
# Tagging.
LOCAL_SRC_FILES += tagging.cpp
@@ -40,13 +38,17 @@
LOCAL_SHARED_LIBRARIES := liblog \
libdl
+# The test implementation. We get this provided by ART.
+# Note: Needs to be "whole" as this exposes JNI functions.
+LOCAL_WHOLE_STATIC_LIBRARIES := libctstiagent
+
# Platform libraries that are not available to apps. Link in statically.
-LOCAL_STATIC_LIBRARIES := libbase
+LOCAL_STATIC_LIBRARIES += libbase
LOCAL_STRIP_MODULE := keep_symbols
# Turn on all warnings.
-LOCAL_C_FLAGS := -fno-rtti \
+LOCAL_CFLAGS := -fno-rtti \
-ggdb3 \
-Wall \
-Wextra \
diff --git a/hostsidetests/jvmti/base/jni/cts_agent.cpp b/hostsidetests/jvmti/base/jni/cts_agent.cpp
index 50f7841..bb1e620 100644
--- a/hostsidetests/jvmti/base/jni/cts_agent.cpp
+++ b/hostsidetests/jvmti/base/jni/cts_agent.cpp
@@ -18,43 +18,33 @@
#include <jvmti.h>
#include "android-base/logging.h"
-#include "common.h"
#include "jni_binder.h"
#include "jvmti_helper.h"
+#include "scoped_local_ref.h"
+#include "test_env.h"
-namespace cts {
-namespace jvmti {
+namespace art {
-static jvmtiEnv* jvmti_env;
+static void InformMainAttach(jvmtiEnv* jenv,
+ JNIEnv* env,
+ const char* class_name,
+ const char* method_name) {
+ // Use JNI to load the class.
+ ScopedLocalRef<jclass> klass(env, FindClass(jenv, env, class_name, nullptr));
+ CHECK(klass.get() != nullptr) << class_name;
-jvmtiEnv* GetJvmtiEnv() {
- return jvmti_env;
+ jmethodID method = env->GetStaticMethodID(klass.get(), method_name, "()V");
+ CHECK(method != nullptr);
+
+ env->CallStaticVoidMethod(klass.get(), method);
}
-int JniThrowNullPointerException(JNIEnv* env, const char* msg) {
- JNIEnv* e = reinterpret_cast<JNIEnv*>(env);
-
- if (env->ExceptionCheck()) {
- env->ExceptionClear();
- }
-
- jclass exc_class = env->FindClass("java/lang/NullPointerException");
- if (exc_class == nullptr) {
- return -1;
- }
-
- bool ok = env->ThrowNew(exc_class, msg) == JNI_OK;
-
- env->DeleteLocalRef(exc_class);
-
- return ok ? 0 : -1;
-}
+static constexpr const char* kMainClass = "art/CtsMain";
+static constexpr const char* kMainClassStartup = "startup";
extern "C" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm,
char* options ATTRIBUTE_UNUSED,
void* reserved ATTRIBUTE_UNUSED) {
- BindOnLoad(vm);
-
if (vm->GetEnv(reinterpret_cast<void**>(&jvmti_env), JVMTI_VERSION_1_0) != 0) {
LOG(FATAL) << "Could not get shared jvmtiEnv";
}
@@ -66,15 +56,17 @@
extern "C" JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM* vm,
char* options ATTRIBUTE_UNUSED,
void* reserved ATTRIBUTE_UNUSED) {
- BindOnAttach(vm);
+ JNIEnv* env;
+ CHECK_EQ(0, vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6))
+ << "Could not get JNIEnv";
if (vm->GetEnv(reinterpret_cast<void**>(&jvmti_env), JVMTI_VERSION_1_0) != 0) {
LOG(FATAL) << "Could not get shared jvmtiEnv";
}
SetAllCapabilities(jvmti_env);
+ InformMainAttach(jvmti_env, env, kMainClass, kMainClassStartup);
return 0;
}
-}
-}
+} // namespace art
diff --git a/hostsidetests/jvmti/base/jni/jni_binder.cpp b/hostsidetests/jvmti/base/jni/jni_binder.cpp
deleted file mode 100644
index 14658a1..0000000
--- a/hostsidetests/jvmti/base/jni/jni_binder.cpp
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "jni_binder.h"
-
-#include <dlfcn.h>
-#include <inttypes.h>
-#include <stdio.h>
-
-#include "android-base/logging.h"
-#include "android-base/stringprintf.h"
-#include "common.h"
-#include "jvmti_helper.h"
-#include "scoped_local_ref.h"
-#include "scoped_utf_chars.h"
-
-namespace cts {
-namespace jvmti {
-
-static constexpr const char* kMainClass = "android/jvmti/cts/JniBindings";
-static constexpr const char* kMainClassStartup = "startup";
-
-size_t CountModifiedUtf8Chars(const char* utf8, size_t byte_count) {
- DCHECK_LE(byte_count, strlen(utf8));
- size_t len = 0;
- const char* end = utf8 + byte_count;
- for (; utf8 < end; ++utf8) {
- int ic = *utf8;
- len++;
- if (LIKELY((ic & 0x80) == 0)) {
- // One-byte encoding.
- continue;
- }
- // Two- or three-byte encoding.
- utf8++;
- if ((ic & 0x20) == 0) {
- // Two-byte encoding.
- continue;
- }
- utf8++;
- if ((ic & 0x10) == 0) {
- // Three-byte encoding.
- continue;
- }
-
- // Four-byte encoding: needs to be converted into a surrogate
- // pair.
- utf8++;
- len++;
- }
- return len;
-}
-
-static uint16_t GetTrailingUtf16Char(uint32_t maybe_pair) {
- return static_cast<uint16_t>(maybe_pair >> 16);
-}
-
-static uint16_t GetLeadingUtf16Char(uint32_t maybe_pair) {
- return static_cast<uint16_t>(maybe_pair & 0x0000FFFF);
-}
-
-static uint32_t GetUtf16FromUtf8(const char** utf8_data_in) {
- const uint8_t one = *(*utf8_data_in)++;
- if ((one & 0x80) == 0) {
- // one-byte encoding
- return one;
- }
-
- const uint8_t two = *(*utf8_data_in)++;
- if ((one & 0x20) == 0) {
- // two-byte encoding
- return ((one & 0x1f) << 6) | (two & 0x3f);
- }
-
- const uint8_t three = *(*utf8_data_in)++;
- if ((one & 0x10) == 0) {
- return ((one & 0x0f) << 12) | ((two & 0x3f) << 6) | (three & 0x3f);
- }
-
- // Four byte encodings need special handling. We'll have
- // to convert them into a surrogate pair.
- const uint8_t four = *(*utf8_data_in)++;
-
- // Since this is a 4 byte UTF-8 sequence, it will lie between
- // U+10000 and U+1FFFFF.
- //
- // TODO: What do we do about values in (U+10FFFF, U+1FFFFF) ? The
- // spec says they're invalid but nobody appears to check for them.
- const uint32_t code_point = ((one & 0x0f) << 18) | ((two & 0x3f) << 12)
- | ((three & 0x3f) << 6) | (four & 0x3f);
-
- uint32_t surrogate_pair = 0;
- // Step two: Write out the high (leading) surrogate to the bottom 16 bits
- // of the of the 32 bit type.
- surrogate_pair |= ((code_point >> 10) + 0xd7c0) & 0xffff;
- // Step three : Write out the low (trailing) surrogate to the top 16 bits.
- surrogate_pair |= ((code_point & 0x03ff) + 0xdc00) << 16;
-
- return surrogate_pair;
-}
-
-static std::string MangleForJni(const std::string& s) {
- std::string result;
- size_t char_count = CountModifiedUtf8Chars(s.c_str(), s.length());
- const char* cp = &s[0];
- for (size_t i = 0; i < char_count; ++i) {
- uint32_t ch = GetUtf16FromUtf8(&cp);
- if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')) {
- result.push_back(ch);
- } else if (ch == '.' || ch == '/') {
- result += "_";
- } else if (ch == '_') {
- result += "_1";
- } else if (ch == ';') {
- result += "_2";
- } else if (ch == '[') {
- result += "_3";
- } else {
- const uint16_t leading = GetLeadingUtf16Char(ch);
- const uint32_t trailing = GetTrailingUtf16Char(ch);
-
- android::base::StringAppendF(&result, "_0%04x", leading);
- if (trailing != 0) {
- android::base::StringAppendF(&result, "_0%04x", trailing);
- }
- }
- }
- return result;
-}
-
-static std::string GetJniShortName(const std::string& class_descriptor, const std::string& method) {
- // Remove the leading 'L' and trailing ';'...
- std::string class_name(class_descriptor);
- CHECK_EQ(class_name[0], 'L') << class_name;
- CHECK_EQ(class_name[class_name.size() - 1], ';') << class_name;
- class_name.erase(0, 1);
- class_name.erase(class_name.size() - 1, 1);
-
- std::string short_name;
- short_name += "Java_";
- short_name += MangleForJni(class_name);
- short_name += "_";
- short_name += MangleForJni(method);
- return short_name;
-}
-
-static void BindMethod(jvmtiEnv* jvmti_env,
- JNIEnv* env,
- jclass klass,
- jmethodID method) {
- std::string name;
- std::string signature;
- std::string mangled_names[2];
- {
- char* name_cstr;
- char* sig_cstr;
- jvmtiError name_result = jvmti_env->GetMethodName(method, &name_cstr, &sig_cstr, nullptr);
- CheckJvmtiError(jvmti_env, name_result);
- CHECK(name_cstr != nullptr);
- CHECK(sig_cstr != nullptr);
- name = name_cstr;
- signature = sig_cstr;
-
- char* klass_name;
- jvmtiError klass_result = jvmti_env->GetClassSignature(klass, &klass_name, nullptr);
- CheckJvmtiError(jvmti_env, klass_result);
-
- mangled_names[0] = GetJniShortName(klass_name, name);
- // TODO: Long JNI name.
-
- CheckJvmtiError(jvmti_env, Deallocate(jvmti_env, name_cstr));
- CheckJvmtiError(jvmti_env, Deallocate(jvmti_env, sig_cstr));
- CheckJvmtiError(jvmti_env, Deallocate(jvmti_env, klass_name));
- }
-
- for (const std::string& mangled_name : mangled_names) {
- if (mangled_name.empty()) {
- continue;
- }
- void* sym = dlsym(RTLD_DEFAULT, mangled_name.c_str());
- if (sym == nullptr) {
- continue;
- }
-
- JNINativeMethod native_method;
- native_method.fnPtr = sym;
- native_method.name = name.c_str();
- native_method.signature = signature.c_str();
-
- env->RegisterNatives(klass, &native_method, 1);
-
- return;
- }
-
- LOG(FATAL) << "Could not find " << mangled_names[0];
-}
-
-static std::string DescriptorToDot(const char* descriptor) {
- size_t length = strlen(descriptor);
- if (length > 1) {
- if (descriptor[0] == 'L' && descriptor[length - 1] == ';') {
- // Descriptors have the leading 'L' and trailing ';' stripped.
- std::string result(descriptor + 1, length - 2);
- std::replace(result.begin(), result.end(), '/', '.');
- return result;
- } else {
- // For arrays the 'L' and ';' remain intact.
- std::string result(descriptor);
- std::replace(result.begin(), result.end(), '/', '.');
- return result;
- }
- }
- // Do nothing for non-class/array descriptors.
- return descriptor;
-}
-
-static jobject GetSystemClassLoader(JNIEnv* env) {
- ScopedLocalRef<jclass> cl_klass(env, env->FindClass("java/lang/ClassLoader"));
- CHECK(cl_klass.get() != nullptr);
- jmethodID getsystemclassloader_method = env->GetStaticMethodID(cl_klass.get(),
- "getSystemClassLoader",
- "()Ljava/lang/ClassLoader;");
- CHECK(getsystemclassloader_method != nullptr);
- return env->CallStaticObjectMethod(cl_klass.get(), getsystemclassloader_method);
-}
-
-static jclass FindClassWithClassLoader(JNIEnv* env, const char* class_name, jobject class_loader) {
- // Create a String of the name.
- std::string descriptor = android::base::StringPrintf("L%s;", class_name);
- std::string dot_name = DescriptorToDot(descriptor.c_str());
- ScopedLocalRef<jstring> name_str(env, env->NewStringUTF(dot_name.c_str()));
-
- // Call Class.forName with it.
- ScopedLocalRef<jclass> c_klass(env, env->FindClass("java/lang/Class"));
- CHECK(c_klass.get() != nullptr);
- jmethodID forname_method = env->GetStaticMethodID(
- c_klass.get(),
- "forName",
- "(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;");
- CHECK(forname_method != nullptr);
-
- return static_cast<jclass>(env->CallStaticObjectMethod(c_klass.get(),
- forname_method,
- name_str.get(),
- JNI_FALSE,
- class_loader));
-}
-
-// Find the given classname. First try the implied classloader, then the system classloader,
-// then use JVMTI to find all classloaders.
-static jclass FindClass(jvmtiEnv* jvmti_env,
- JNIEnv* env,
- const char* class_name,
- jobject class_loader) {
- if (class_loader != nullptr) {
- return FindClassWithClassLoader(env, class_name, class_loader);
- }
-
- jclass from_implied = env->FindClass(class_name);
- if (from_implied != nullptr) {
- return from_implied;
- }
- env->ExceptionClear();
-
- ScopedLocalRef<jobject> system_class_loader(env, GetSystemClassLoader(env));
- CHECK(system_class_loader.get() != nullptr);
- jclass from_system = FindClassWithClassLoader(env, class_name, system_class_loader.get());
- if (from_system != nullptr) {
- return from_system;
- }
- env->ExceptionClear();
-
- // Look at the context classloaders of all threads.
- jint thread_count;
- jthread* threads;
- CheckJvmtiError(jvmti_env, jvmti_env->GetAllThreads(&thread_count, &threads));
- JvmtiUniquePtr threads_uptr = MakeJvmtiUniquePtr(jvmti_env, threads);
-
- jclass result = nullptr;
- for (jint t = 0; t != thread_count; ++t) {
- // Always loop over all elements, as we need to free the local references.
- if (result == nullptr) {
- jvmtiThreadInfo info;
- CheckJvmtiError(jvmti_env, jvmti_env->GetThreadInfo(threads[t], &info));
- CheckJvmtiError(jvmti_env, Deallocate(jvmti_env, info.name));
- if (info.thread_group != nullptr) {
- env->DeleteLocalRef(info.thread_group);
- }
- if (info.context_class_loader != nullptr) {
- result = FindClassWithClassLoader(env, class_name, info.context_class_loader);
- env->ExceptionClear();
- env->DeleteLocalRef(info.context_class_loader);
- }
- }
- env->DeleteLocalRef(threads[t]);
- }
-
- if (result != nullptr) {
- return result;
- }
-
- // TODO: Implement scanning *all* classloaders.
- LOG(FATAL) << "Unimplemented";
-
- return nullptr;
-}
-
-void BindFunctions(jvmtiEnv* jvmti_env, JNIEnv* env, const char* class_name, jobject class_loader) {
- // Use JNI to load the class.
- ScopedLocalRef<jclass> klass(env, FindClass(jvmti_env, env, class_name, class_loader));
- CHECK(klass.get() != nullptr) << class_name;
-
- // Use JVMTI to get the methods.
- jint method_count;
- jmethodID* methods;
- jvmtiError methods_result = jvmti_env->GetClassMethods(klass.get(), &method_count, &methods);
- CheckJvmtiError(jvmti_env, methods_result);
-
- // Check each method.
- for (jint i = 0; i < method_count; ++i) {
- jint modifiers;
- jvmtiError mod_result = jvmti_env->GetMethodModifiers(methods[i], &modifiers);
- CheckJvmtiError(jvmti_env, mod_result);
- constexpr jint kNative = static_cast<jint>(0x0100);
- if ((modifiers & kNative) != 0) {
- BindMethod(jvmti_env, env, klass.get(), methods[i]);
- }
- }
-
- CheckJvmtiError(jvmti_env, Deallocate(jvmti_env, methods));
-}
-
-// Inform the main instrumentation class of our successful attach.
-static void InformMainAttach(jvmtiEnv* jvmti_env,
- JNIEnv* jni_env,
- const char* class_name,
- const char* method_name) {
- // Use JNI to load the class.
- ScopedLocalRef<jclass> klass(jni_env, FindClass(jvmti_env, jni_env, class_name, nullptr));
- CHECK(klass.get() != nullptr) << class_name;
-
- jmethodID method = jni_env->GetStaticMethodID(klass.get(), method_name, "()V");
- CHECK(method != nullptr);
-
- jni_env->CallStaticVoidMethod(klass.get(), method);
-}
-
-// TODO: Check this. This may not work on device. The classloader containing the app's classes
-// may not have been created at this point (i.e., if it's not the system classloader).
-static void JNICALL VMInitCallback(jvmtiEnv* jvmti_env,
- JNIEnv* jni_env,
- jthread thread ATTRIBUTE_UNUSED) {
- // Bind kMainClass native methods.
- BindFunctions(jvmti_env, jni_env, kMainClass);
-
- // And let the test know that we have started up.
- InformMainAttach(jvmti_env, jni_env, kMainClass, kMainClassStartup);
-
- // And delete the jvmtiEnv.
- jvmti_env->DisposeEnvironment();
-}
-
-// Install a phase callback that will bind JNI functions on VMInit.
-void BindOnLoad(JavaVM* vm) {
- // Use a new jvmtiEnv. Otherwise we might collide with table changes.
- jvmtiEnv* install_env;
- if (vm->GetEnv(reinterpret_cast<void**>(&install_env), JVMTI_VERSION_1_0) != 0) {
- LOG(FATAL) << "Could not get jvmtiEnv";
- }
- SetAllCapabilities(install_env);
-
- {
- jvmtiEventCallbacks callbacks;
- memset(&callbacks, 0, sizeof(jvmtiEventCallbacks));
- callbacks.VMInit = VMInitCallback;
-
- CheckJvmtiError(install_env, install_env->SetEventCallbacks(&callbacks, sizeof(callbacks)));
- }
-
- {
- CheckJvmtiError(install_env, install_env->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT,
- nullptr));
- }
-}
-
-// Ensure binding of the Main class when the agent is started through OnAttach.
-void BindOnAttach(JavaVM* vm) {
- // Get a JNIEnv. As the thread is attached, we must not destroy it.
- JNIEnv* env;
- if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != 0) {
- LOG(FATAL) << "Could not get JNIEnv";
- }
-
- jvmtiEnv* jvmti_env;
- if (vm->GetEnv(reinterpret_cast<void**>(&jvmti_env), JVMTI_VERSION_1_0) != 0) {
- LOG(FATAL) << "Could not get jvmtiEnv";
- }
- SetAllCapabilities(jvmti_env);
-
- BindFunctions(jvmti_env, env, kMainClass);
-
- // And let the test know that we have started up.
- InformMainAttach(jvmti_env, env, kMainClass, kMainClassStartup);
-
- if (jvmti_env->DisposeEnvironment() != JVMTI_ERROR_NONE) {
- LOG(FATAL) << "Could not dispose temporary jvmtiEnv";
- }
-}
-
-extern "C" JNIEXPORT void JNICALL Java_android_jvmti_cts_JniBindings_bindAgentJNI(
- JNIEnv* env, jclass klass ATTRIBUTE_UNUSED, jstring className, jobject classLoader) {
- ScopedUtfChars name(env, className);
- BindFunctions(GetJvmtiEnv(), env, name.c_str(), classLoader);
-}
-
-} // namespace jvmti
-} // namespace cts
diff --git a/hostsidetests/jvmti/base/jni/jni_binder.h b/hostsidetests/jvmti/base/jni/jni_binder.h
deleted file mode 100644
index fb311ee..0000000
--- a/hostsidetests/jvmti/base/jni/jni_binder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef JNI_BINDER_H_
-#define JNI_BINDER_H_
-
-#include "jni.h"
-#include "jvmti.h"
-
-namespace cts {
-namespace jvmti {
-
-// Load the class through JNI. Inspect it, find all native methods. Construct the corresponding
-// mangled name, run dlsym and bind the method.
-//
-// This will abort on failure.
-void BindFunctions(jvmtiEnv* jvmti_env,
- JNIEnv* env,
- const char* class_name,
- jobject class_loader = nullptr);
-
-// Ensure binding of the Main class when the agent is started through OnLoad.
-void BindOnLoad(JavaVM* vm);
-
-// Ensure binding of the Main class when the agent is started through OnAttach.
-void BindOnAttach(JavaVM* vm);
-
-} // namespace jvmti
-} // namespace cts
-
-#endif // JNI_BINDER_H_
diff --git a/hostsidetests/jvmti/base/jni/jni_helper.h b/hostsidetests/jvmti/base/jni/jni_helper.h
deleted file mode 100644
index 14aba8b..0000000
--- a/hostsidetests/jvmti/base/jni/jni_helper.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef JNI_HELPER_H_
-#define JNI_HELPER_H_
-
-#include "jni.h"
-#include "scoped_local_ref.h"
-
-namespace cts {
-namespace jvmti {
-
-// Create an object array using a lambda that returns a local ref for each element.
-template <typename T>
-static jobjectArray CreateObjectArray(JNIEnv* env,
- jint length,
- const char* component_type_descriptor,
- T src) {
- if (length < 0) {
- return nullptr;
- }
-
- ScopedLocalRef<jclass> obj_class(env, env->FindClass(component_type_descriptor));
- if (obj_class.get() == nullptr) {
- return nullptr;
- }
-
- ScopedLocalRef<jobjectArray> ret(env, env->NewObjectArray(length, obj_class.get(), nullptr));
- if (ret.get() == nullptr) {
- return nullptr;
- }
-
- for (jint i = 0; i < length; ++i) {
- jobject element = src(i);
- env->SetObjectArrayElement(ret.get(), static_cast<jint>(i), element);
- env->DeleteLocalRef(element);
- if (env->ExceptionCheck()) {
- return nullptr;
- }
- }
-
- return ret.release();
-}
-
-} // namespace jvmti
-} // namespace cts
-
-#endif // JNI_HELPER_H_
diff --git a/hostsidetests/jvmti/base/jni/jvmti_helper.cpp b/hostsidetests/jvmti/base/jni/jvmti_helper.cpp
deleted file mode 100644
index a8a1aec..0000000
--- a/hostsidetests/jvmti/base/jni/jvmti_helper.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "jvmti_helper.h"
-
-#include <algorithm>
-#include <dlfcn.h>
-#include <stdio.h>
-#include <sstream>
-#include <string.h>
-
-#include "android-base/logging.h"
-#include "scoped_local_ref.h"
-
-namespace cts {
-namespace jvmti {
-
-void CheckJvmtiError(jvmtiEnv* env, jvmtiError error) {
- if (error != JVMTI_ERROR_NONE) {
- char* error_name;
- jvmtiError name_error = env->GetErrorName(error, &error_name);
- if (name_error != JVMTI_ERROR_NONE) {
- LOG(FATAL) << "Unable to get error name for " << error;
- }
- LOG(FATAL) << "Unexpected error: " << error_name;
- }
-}
-
-void SetAllCapabilities(jvmtiEnv* env) {
- jvmtiCapabilities caps;
- jvmtiError error1 = env->GetPotentialCapabilities(&caps);
- CheckJvmtiError(env, error1);
- jvmtiError error2 = env->AddCapabilities(&caps);
- CheckJvmtiError(env, error2);
-}
-
-bool JvmtiErrorToException(JNIEnv* env, jvmtiEnv* jvmti_env, jvmtiError error) {
- if (error == JVMTI_ERROR_NONE) {
- return false;
- }
-
- ScopedLocalRef<jclass> rt_exception(env, env->FindClass("java/lang/RuntimeException"));
- if (rt_exception.get() == nullptr) {
- // CNFE should be pending.
- return true;
- }
-
- char* err;
- CheckJvmtiError(jvmti_env, jvmti_env->GetErrorName(error, &err));
-
- env->ThrowNew(rt_exception.get(), err);
-
- Deallocate(jvmti_env, err);
- return true;
-}
-
-std::ostream& operator<<(std::ostream& os, const jvmtiError& rhs) {
- switch (rhs) {
- case JVMTI_ERROR_NONE:
- return os << "NONE";
- case JVMTI_ERROR_INVALID_THREAD:
- return os << "INVALID_THREAD";
- case JVMTI_ERROR_INVALID_THREAD_GROUP:
- return os << "INVALID_THREAD_GROUP";
- case JVMTI_ERROR_INVALID_PRIORITY:
- return os << "INVALID_PRIORITY";
- case JVMTI_ERROR_THREAD_NOT_SUSPENDED:
- return os << "THREAD_NOT_SUSPENDED";
- case JVMTI_ERROR_THREAD_SUSPENDED:
- return os << "THREAD_SUSPENDED";
- case JVMTI_ERROR_THREAD_NOT_ALIVE:
- return os << "THREAD_NOT_ALIVE";
- case JVMTI_ERROR_INVALID_OBJECT:
- return os << "INVALID_OBJECT";
- case JVMTI_ERROR_INVALID_CLASS:
- return os << "INVALID_CLASS";
- case JVMTI_ERROR_CLASS_NOT_PREPARED:
- return os << "CLASS_NOT_PREPARED";
- case JVMTI_ERROR_INVALID_METHODID:
- return os << "INVALID_METHODID";
- case JVMTI_ERROR_INVALID_LOCATION:
- return os << "INVALID_LOCATION";
- case JVMTI_ERROR_INVALID_FIELDID:
- return os << "INVALID_FIELDID";
- case JVMTI_ERROR_NO_MORE_FRAMES:
- return os << "NO_MORE_FRAMES";
- case JVMTI_ERROR_OPAQUE_FRAME:
- return os << "OPAQUE_FRAME";
- case JVMTI_ERROR_TYPE_MISMATCH:
- return os << "TYPE_MISMATCH";
- case JVMTI_ERROR_INVALID_SLOT:
- return os << "INVALID_SLOT";
- case JVMTI_ERROR_DUPLICATE:
- return os << "DUPLICATE";
- case JVMTI_ERROR_NOT_FOUND:
- return os << "NOT_FOUND";
- case JVMTI_ERROR_INVALID_MONITOR:
- return os << "INVALID_MONITOR";
- case JVMTI_ERROR_NOT_MONITOR_OWNER:
- return os << "NOT_MONITOR_OWNER";
- case JVMTI_ERROR_INTERRUPT:
- return os << "INTERRUPT";
- case JVMTI_ERROR_INVALID_CLASS_FORMAT:
- return os << "INVALID_CLASS_FORMAT";
- case JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION:
- return os << "CIRCULAR_CLASS_DEFINITION";
- case JVMTI_ERROR_FAILS_VERIFICATION:
- return os << "FAILS_VERIFICATION";
- case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED:
- return os << "UNSUPPORTED_REDEFINITION_METHOD_ADDED";
- case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED:
- return os << "UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED";
- case JVMTI_ERROR_INVALID_TYPESTATE:
- return os << "INVALID_TYPESTATE";
- case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED:
- return os << "UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED";
- case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED:
- return os << "UNSUPPORTED_REDEFINITION_METHOD_DELETED";
- case JVMTI_ERROR_UNSUPPORTED_VERSION:
- return os << "UNSUPPORTED_VERSION";
- case JVMTI_ERROR_NAMES_DONT_MATCH:
- return os << "NAMES_DONT_MATCH";
- case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED:
- return os << "UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED";
- case JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED:
- return os << "UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED";
- case JVMTI_ERROR_UNMODIFIABLE_CLASS:
- return os << "JVMTI_ERROR_UNMODIFIABLE_CLASS";
- case JVMTI_ERROR_NOT_AVAILABLE:
- return os << "NOT_AVAILABLE";
- case JVMTI_ERROR_MUST_POSSESS_CAPABILITY:
- return os << "MUST_POSSESS_CAPABILITY";
- case JVMTI_ERROR_NULL_POINTER:
- return os << "NULL_POINTER";
- case JVMTI_ERROR_ABSENT_INFORMATION:
- return os << "ABSENT_INFORMATION";
- case JVMTI_ERROR_INVALID_EVENT_TYPE:
- return os << "INVALID_EVENT_TYPE";
- case JVMTI_ERROR_ILLEGAL_ARGUMENT:
- return os << "ILLEGAL_ARGUMENT";
- case JVMTI_ERROR_NATIVE_METHOD:
- return os << "NATIVE_METHOD";
- case JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED:
- return os << "CLASS_LOADER_UNSUPPORTED";
- case JVMTI_ERROR_OUT_OF_MEMORY:
- return os << "OUT_OF_MEMORY";
- case JVMTI_ERROR_ACCESS_DENIED:
- return os << "ACCESS_DENIED";
- case JVMTI_ERROR_WRONG_PHASE:
- return os << "WRONG_PHASE";
- case JVMTI_ERROR_INTERNAL:
- return os << "INTERNAL";
- case JVMTI_ERROR_UNATTACHED_THREAD:
- return os << "UNATTACHED_THREAD";
- case JVMTI_ERROR_INVALID_ENVIRONMENT:
- return os << "INVALID_ENVIRONMENT";
- }
- LOG(FATAL) << "Unexpected error type " << static_cast<int>(rhs);
- __builtin_unreachable();
-}
-
-} // namespace jvmti
-} // namespace cts
diff --git a/hostsidetests/jvmti/base/jni/jvmti_helper.h b/hostsidetests/jvmti/base/jni/jvmti_helper.h
deleted file mode 100644
index 898fa96..0000000
--- a/hostsidetests/jvmti/base/jni/jvmti_helper.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef JVMTI_HELPER_H_
-#define JVMTI_HELPER_H_
-
-#include "jni.h"
-#include "jvmti.h"
-#include <memory>
-#include <ostream>
-
-#include "android-base/logging.h"
-
-namespace cts {
-namespace jvmti {
-
-// Add all capabilities to the given env.
-void SetAllCapabilities(jvmtiEnv* env);
-
-// Check whether the given error is NONE. If not, print out the corresponding error message
-// and abort.
-void CheckJvmtiError(jvmtiEnv* env, jvmtiError error);
-
-// Convert the given error to a RuntimeException with a message derived from the error. Returns
-// true on error, false if error is JVMTI_ERROR_NONE.
-bool JvmtiErrorToException(JNIEnv* env, jvmtiEnv* jvmti_env, jvmtiError error);
-
-class JvmtiDeleter {
- public:
- JvmtiDeleter() : env_(nullptr) {}
- explicit JvmtiDeleter(jvmtiEnv* env) : env_(env) {}
-
- JvmtiDeleter(JvmtiDeleter&) = default;
- JvmtiDeleter(JvmtiDeleter&&) = default;
- JvmtiDeleter& operator=(const JvmtiDeleter&) = default;
-
- void operator()(unsigned char* ptr) const {
- CHECK(env_ != nullptr);
- jvmtiError ret = env_->Deallocate(ptr);
- CheckJvmtiError(env_, ret);
- }
-
- private:
- mutable jvmtiEnv* env_;
-};
-
-using JvmtiUniquePtr = std::unique_ptr<unsigned char, JvmtiDeleter>;
-
-template <typename T>
-static inline JvmtiUniquePtr MakeJvmtiUniquePtr(jvmtiEnv* env, T* mem) {
- return JvmtiUniquePtr(reinterpret_cast<unsigned char*>(mem), JvmtiDeleter(env));
-}
-
-template <typename T>
-static inline jvmtiError Deallocate(jvmtiEnv* env, T* mem) {
- return env->Deallocate(reinterpret_cast<unsigned char*>(mem));
-}
-
-// To print jvmtiError. Does not rely on GetErrorName, so is an approximation.
-std::ostream& operator<<(std::ostream& os, const jvmtiError& rhs);
-
-} // namespace jvmti
-} // namespace cts
-
-#endif // JVMTI_HELPER_H_
diff --git a/hostsidetests/jvmti/base/jni/redefine.cpp b/hostsidetests/jvmti/base/jni/redefine.cpp
index d948b2c..c6e8726 100644
--- a/hostsidetests/jvmti/base/jni/redefine.cpp
+++ b/hostsidetests/jvmti/base/jni/redefine.cpp
@@ -23,15 +23,13 @@
#include "android-base/logging.h"
#include "android-base/macros.h"
-#include "common.h"
#include "jni_helper.h"
#include "jvmti_helper.h"
#include "jvmti.h"
#include "scoped_primitive_array.h"
+#include "test_env.h"
-namespace cts {
-namespace jvmti {
-namespace redefine {
+namespace art {
extern "C" JNIEXPORT jint JNICALL Java_android_jvmti_cts_JvmtiRedefineClassesTest_redefineClass(
JNIEnv* env, jclass klass ATTRIBUTE_UNUSED, jclass target, jbyteArray dex_bytes) {
@@ -39,21 +37,21 @@
def.klass = target;
def.class_byte_count = static_cast<jint>(env->GetArrayLength(dex_bytes));
signed char* redef_bytes = env->GetByteArrayElements(dex_bytes, nullptr);
- jvmtiError res = GetJvmtiEnv()->Allocate(def.class_byte_count,
- const_cast<unsigned char**>(&def.class_bytes));
+ jvmtiError res =jvmti_env->Allocate(def.class_byte_count,
+ const_cast<unsigned char**>(&def.class_bytes));
if (res != JVMTI_ERROR_NONE) {
return static_cast<jint>(res);
}
memcpy(const_cast<unsigned char*>(def.class_bytes), redef_bytes, def.class_byte_count);
env->ReleaseByteArrayElements(dex_bytes, redef_bytes, 0);
// Do the redefinition.
- res = GetJvmtiEnv()->RedefineClasses(1, &def);
+ res = jvmti_env->RedefineClasses(1, &def);
return static_cast<jint>(res);
}
extern "C" JNIEXPORT jint JNICALL Java_android_jvmti_cts_JvmtiRedefineClassesTest_retransformClass(
JNIEnv* env ATTRIBUTE_UNUSED, jclass klass ATTRIBUTE_UNUSED, jclass target) {
- return GetJvmtiEnv()->RetransformClasses(1, &target);
+ return jvmti_env->RetransformClasses(1, &target);
}
class TransformationData {
@@ -105,7 +103,7 @@
static TransformationData data;
// The hook we are using.
-void JNICALL CommonClassFileLoadHookRetransformable(jvmtiEnv* jvmti_env,
+void JNICALL CommonClassFileLoadHookRetransformable(jvmtiEnv* local_jvmti_env,
JNIEnv* jni_env ATTRIBUTE_UNUSED,
jclass class_being_redefined ATTRIBUTE_UNUSED,
jobject loader ATTRIBUTE_UNUSED,
@@ -119,7 +117,7 @@
std::vector<unsigned char> dex_data;
if (data.RetrieveRedefinition(name_str, &dex_data)) {
unsigned char* jvmti_dex_data;
- if (JVMTI_ERROR_NONE != jvmti_env->Allocate(dex_data.size(), &jvmti_dex_data)) {
+ if (JVMTI_ERROR_NONE != local_jvmti_env->Allocate(dex_data.size(), &jvmti_dex_data)) {
LOG(FATAL) << "Unable to allocate output buffer for " << name;
return;
}
@@ -136,12 +134,12 @@
jvmtiEventCallbacks cb;
memset(&cb, 0, sizeof(cb));
cb.ClassFileLoadHook = CommonClassFileLoadHookRetransformable;
- if (JvmtiErrorToException(env, GetJvmtiEnv(),
- GetJvmtiEnv()->SetEventCallbacks(&cb, sizeof(cb)))) {
+ if (JvmtiErrorToException(env, jvmti_env, jvmti_env->SetEventCallbacks(&cb, sizeof(cb)))) {
return;
}
- JvmtiErrorToException(env, GetJvmtiEnv(),
- GetJvmtiEnv()->SetEventNotificationMode(
+ JvmtiErrorToException(env,
+ jvmti_env,
+ jvmti_env->SetEventNotificationMode(
enable == JNI_TRUE ? JVMTI_ENABLE : JVMTI_DISABLE,
JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
nullptr));
@@ -174,7 +172,5 @@
env->ReleaseByteArrayElements(dex_bytes, redef_bytes, 0);
}
-} // namespace redefine
-} // namespace jvmti
-} // namespace cts
+} // namespace art
diff --git a/hostsidetests/jvmti/base/jni/scoped_local_ref.h b/hostsidetests/jvmti/base/jni/scoped_local_ref.h
deleted file mode 100644
index 4622480..0000000
--- a/hostsidetests/jvmti/base/jni/scoped_local_ref.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef SCOPED_LOCAL_REF_H_
-#define SCOPED_LOCAL_REF_H_
-
-#include "jni.h"
-
-#include <stddef.h>
-
-#include "android-base/macros.h"
-
-namespace cts {
-namespace jvmti {
-
-template<typename T>
-class ScopedLocalRef {
-public:
- ScopedLocalRef(JNIEnv* env, T localRef) : mEnv(env), mLocalRef(localRef) {
- }
-
- ~ScopedLocalRef() {
- reset();
- }
-
- void reset(T ptr = NULL) {
- if (ptr != mLocalRef) {
- if (mLocalRef != NULL) {
- mEnv->DeleteLocalRef(mLocalRef);
- }
- mLocalRef = ptr;
- }
- }
-
- T release() __attribute__((warn_unused_result)) {
- T localRef = mLocalRef;
- mLocalRef = NULL;
- return localRef;
- }
-
- T get() const {
- return mLocalRef;
- }
-
-private:
- JNIEnv* const mEnv;
- T mLocalRef;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedLocalRef);
-};
-
-}
-}
-
-#endif // SCOPED_LOCAL_REF_H_
diff --git a/hostsidetests/jvmti/base/jni/scoped_primitive_array.h b/hostsidetests/jvmti/base/jni/scoped_primitive_array.h
deleted file mode 100644
index c030b7d..0000000
--- a/hostsidetests/jvmti/base/jni/scoped_primitive_array.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef SCOPED_PRIMITIVE_ARRAY_H_
-#define SCOPED_PRIMITIVE_ARRAY_H_
-
-#include "jni.h"
-
-#include "android-base/macros.h"
-#include "common.h"
-
-namespace cts {
-namespace jvmti {
-
-#ifdef POINTER_TYPE
-#error POINTER_TYPE is defined.
-#else
-#define POINTER_TYPE(T) T* /* NOLINT */
-#endif
-
-#ifdef REFERENCE_TYPE
-#error REFERENCE_TYPE is defined.
-#else
-#define REFERENCE_TYPE(T) T& /* NOLINT */
-#endif
-
-// ScopedBooleanArrayRO, ScopedByteArrayRO, ScopedCharArrayRO, ScopedDoubleArrayRO,
-// ScopedFloatArrayRO, ScopedIntArrayRO, ScopedLongArrayRO, and ScopedShortArrayRO provide
-// convenient read-only access to Java arrays from JNI code. This is cheaper than read-write
-// access and should be used by default.
-#define INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(PRIMITIVE_TYPE, NAME) \
- class Scoped ## NAME ## ArrayRO { \
- public: \
- explicit Scoped ## NAME ## ArrayRO(JNIEnv* env) \
- : mEnv(env), mJavaArray(nullptr), mRawArray(nullptr), mSize(0) {} \
- Scoped ## NAME ## ArrayRO(JNIEnv* env, PRIMITIVE_TYPE ## Array javaArray) \
- : mEnv(env) { \
- if (javaArray == nullptr) { \
- mJavaArray = nullptr; \
- mSize = 0; \
- mRawArray = nullptr; \
- JniThrowNullPointerException(env, nullptr); \
- } else { \
- reset(javaArray); \
- } \
- } \
- ~Scoped ## NAME ## ArrayRO() { \
- if (mRawArray != nullptr && mRawArray != mBuffer) { \
- mEnv->Release ## NAME ## ArrayElements(mJavaArray, mRawArray, JNI_ABORT); \
- } \
- } \
- void reset(PRIMITIVE_TYPE ## Array javaArray) { \
- mJavaArray = javaArray; \
- mSize = mEnv->GetArrayLength(mJavaArray); \
- if (mSize <= buffer_size) { \
- mEnv->Get ## NAME ## ArrayRegion(mJavaArray, 0, mSize, mBuffer); \
- mRawArray = mBuffer; \
- } else { \
- mRawArray = mEnv->Get ## NAME ## ArrayElements(mJavaArray, nullptr); \
- } \
- } \
- const PRIMITIVE_TYPE* get() const { return mRawArray; } \
- PRIMITIVE_TYPE ## Array getJavaArray() const { return mJavaArray; } \
- const PRIMITIVE_TYPE& operator[](size_t n) const { return mRawArray[n]; } \
- size_t size() const { return mSize; } \
- private: \
- static const jsize buffer_size = 1024; \
- JNIEnv* const mEnv; \
- PRIMITIVE_TYPE ## Array mJavaArray; \
- POINTER_TYPE(PRIMITIVE_TYPE) mRawArray; \
- jsize mSize; \
- PRIMITIVE_TYPE mBuffer[buffer_size]; \
- DISALLOW_COPY_AND_ASSIGN(Scoped ## NAME ## ArrayRO); \
- }
-
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jboolean, Boolean);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jbyte, Byte);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jchar, Char);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jdouble, Double);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jfloat, Float);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jint, Int);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jlong, Long);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO(jshort, Short);
-
-#undef INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RO
-
-// ScopedBooleanArrayRW, ScopedByteArrayRW, ScopedCharArrayRW, ScopedDoubleArrayRW,
-// ScopedFloatArrayRW, ScopedIntArrayRW, ScopedLongArrayRW, and ScopedShortArrayRW provide
-// convenient read-write access to Java arrays from JNI code. These are more expensive,
-// since they entail a copy back onto the Java heap, and should only be used when necessary.
-#define INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(PRIMITIVE_TYPE, NAME) \
- class Scoped ## NAME ## ArrayRW { \
- public: \
- explicit Scoped ## NAME ## ArrayRW(JNIEnv* env) \
- : mEnv(env), mJavaArray(nullptr), mRawArray(nullptr) {} \
- Scoped ## NAME ## ArrayRW(JNIEnv* env, PRIMITIVE_TYPE ## Array javaArray) \
- : mEnv(env), mJavaArray(javaArray), mRawArray(nullptr) { \
- if (mJavaArray == nullptr) { \
- JniThrowNullPointerException(env, nullptr); \
- } else { \
- mRawArray = mEnv->Get ## NAME ## ArrayElements(mJavaArray, nullptr); \
- } \
- } \
- ~Scoped ## NAME ## ArrayRW() { \
- if (mRawArray) { \
- mEnv->Release ## NAME ## ArrayElements(mJavaArray, mRawArray, 0); \
- } \
- } \
- void reset(PRIMITIVE_TYPE ## Array javaArray) { \
- mJavaArray = javaArray; \
- mRawArray = mEnv->Get ## NAME ## ArrayElements(mJavaArray, nullptr); \
- } \
- const PRIMITIVE_TYPE* get() const { return mRawArray; } \
- PRIMITIVE_TYPE ## Array getJavaArray() const { return mJavaArray; } \
- const PRIMITIVE_TYPE& operator[](size_t n) const { return mRawArray[n]; } \
- POINTER_TYPE(PRIMITIVE_TYPE) get() { return mRawArray; } \
- REFERENCE_TYPE(PRIMITIVE_TYPE) operator[](size_t n) { return mRawArray[n]; } \
- size_t size() const { return mEnv->GetArrayLength(mJavaArray); } \
- private: \
- JNIEnv* const mEnv; \
- PRIMITIVE_TYPE ## Array mJavaArray; \
- POINTER_TYPE(PRIMITIVE_TYPE) mRawArray; \
- DISALLOW_COPY_AND_ASSIGN(Scoped ## NAME ## ArrayRW); \
- }
-
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jboolean, Boolean);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jbyte, Byte);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jchar, Char);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jdouble, Double);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jfloat, Float);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jint, Int);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jlong, Long);
-INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW(jshort, Short);
-
-#undef INSTANTIATE_SCOPED_PRIMITIVE_ARRAY_RW
-#undef POINTER_TYPE
-#undef REFERENCE_TYPE
-
-}
-}
-
-#endif // SCOPED_PRIMITIVE_ARRAY_H_
diff --git a/hostsidetests/jvmti/base/jni/scoped_utf_chars.h b/hostsidetests/jvmti/base/jni/scoped_utf_chars.h
deleted file mode 100644
index 8d28a7a..0000000
--- a/hostsidetests/jvmti/base/jni/scoped_utf_chars.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-
-#ifndef SCOPED_UTF_CHARS_H_
-#define SCOPED_UTF_CHARS_H_
-
-#include "jni.h"
-
-#include <string.h>
-
-#include "android-base/macros.h"
-#include "common.h"
-
-namespace cts {
-namespace jvmti {
-
-class ScopedUtfChars {
- public:
- ScopedUtfChars(JNIEnv* env, jstring s) : env_(env), string_(s) {
- if (s == nullptr) {
- utf_chars_ = nullptr;
- JniThrowNullPointerException(env, nullptr);
- } else {
- utf_chars_ = env->GetStringUTFChars(s, nullptr);
- }
- }
-
- ScopedUtfChars(ScopedUtfChars&& rhs) :
- env_(rhs.env_), string_(rhs.string_), utf_chars_(rhs.utf_chars_) {
- rhs.env_ = nullptr;
- rhs.string_ = nullptr;
- rhs.utf_chars_ = nullptr;
- }
-
- ~ScopedUtfChars() {
- if (utf_chars_) {
- env_->ReleaseStringUTFChars(string_, utf_chars_);
- }
- }
-
- ScopedUtfChars& operator=(ScopedUtfChars&& rhs) {
- if (this != &rhs) {
- // Delete the currently owned UTF chars.
- this->~ScopedUtfChars();
-
- // Move the rhs ScopedUtfChars and zero it out.
- env_ = rhs.env_;
- string_ = rhs.string_;
- utf_chars_ = rhs.utf_chars_;
- rhs.env_ = nullptr;
- rhs.string_ = nullptr;
- rhs.utf_chars_ = nullptr;
- }
- return *this;
- }
-
- const char* c_str() const {
- return utf_chars_;
- }
-
- size_t size() const {
- return strlen(utf_chars_);
- }
-
- const char& operator[](size_t n) const {
- return utf_chars_[n];
- }
-
- private:
- JNIEnv* env_;
- jstring string_;
- const char* utf_chars_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedUtfChars);
-};
-
-}
-}
-
-#endif // SCOPED_UTF_CHARS_H_
diff --git a/hostsidetests/jvmti/base/jni/tagging.cpp b/hostsidetests/jvmti/base/jni/tagging.cpp
index 1e59e13..372805b 100644
--- a/hostsidetests/jvmti/base/jni/tagging.cpp
+++ b/hostsidetests/jvmti/base/jni/tagging.cpp
@@ -18,26 +18,22 @@
#include "android-base/logging.h"
#include "android-base/macros.h"
-#include "common.h"
#include "jni_helper.h"
#include "jvmti_helper.h"
#include "jvmti.h"
#include "scoped_primitive_array.h"
+#include "test_env.h"
-namespace cts {
-namespace jvmti {
-namespace tagging {
+namespace art {
extern "C" JNIEXPORT void JNICALL Java_android_jvmti_cts_JniBindings_setTag(
JNIEnv* env, jclass klass ATTRIBUTE_UNUSED, jobject obj, jlong tag) {
- jvmtiEnv* jvmti_env = GetJvmtiEnv();
jvmtiError ret = jvmti_env->SetTag(obj, tag);
JvmtiErrorToException(env, jvmti_env, ret);
}
extern "C" JNIEXPORT jlong JNICALL Java_android_jvmti_cts_JniBindings_getTag(
JNIEnv* env, jclass klass ATTRIBUTE_UNUSED, jobject obj) {
- jvmtiEnv* jvmti_env = GetJvmtiEnv();
jlong tag = 0;
jvmtiError ret = jvmti_env->GetTag(obj, &tag);
if (JvmtiErrorToException(env, jvmti_env, ret)) {
@@ -52,7 +48,6 @@
jlongArray searchTags,
jboolean returnObjects,
jboolean returnTags) {
- jvmtiEnv* jvmti_env = GetJvmtiEnv();
ScopedLongArrayRO scoped_array(env);
if (searchTags != nullptr) {
scoped_array.reset(searchTags);
@@ -132,7 +127,5 @@
return CreateObjectArray(env, 3, "java/lang/Object", callback);
}
-} // namespace tagging
-} // namespace jvmti
-} // namespace cts
+} // namespace art
diff --git a/hostsidetests/jvmti/base/jni/tracking.cpp b/hostsidetests/jvmti/base/jni/tracking.cpp
index a46f491..a07d653 100644
--- a/hostsidetests/jvmti/base/jni/tracking.cpp
+++ b/hostsidetests/jvmti/base/jni/tracking.cpp
@@ -21,14 +21,12 @@
#include "android-base/logging.h"
#include "android-base/stringprintf.h"
-#include "common.h"
#include "jvmti_helper.h"
#include "scoped_local_ref.h"
#include "scoped_utf_chars.h"
+#include "test_env.h"
-namespace cts {
-namespace jvmti {
-namespace allocation_tracking {
+namespace art {
static std::string GetClassName(JNIEnv* jni_env, jclass cls) {
ScopedLocalRef<jclass> class_class(jni_env, jni_env->GetObjectClass(cls));
@@ -65,17 +63,17 @@
memset(&callbacks, 0, sizeof(jvmtiEventCallbacks));
callbacks.VMObjectAlloc = enable ? ObjectAllocated : nullptr;
- jvmtiError ret = GetJvmtiEnv()->SetEventCallbacks(&callbacks, sizeof(callbacks));
- JvmtiErrorToException(env, GetJvmtiEnv(), ret);
+ jvmtiError ret = jvmti_env->SetEventCallbacks(&callbacks, sizeof(callbacks));
+ JvmtiErrorToException(env, jvmti_env, ret);
}
extern "C" JNIEXPORT void JNICALL Java_android_jvmti_cts_JvmtiTrackingTest_enableAllocationTracking(
JNIEnv* env, jclass klass ATTRIBUTE_UNUSED, jthread thread, jboolean enable) {
- jvmtiError ret = GetJvmtiEnv()->SetEventNotificationMode(
+ jvmtiError ret = jvmti_env->SetEventNotificationMode(
enable ? JVMTI_ENABLE : JVMTI_DISABLE,
JVMTI_EVENT_VM_OBJECT_ALLOC,
thread);
- JvmtiErrorToException(env, GetJvmtiEnv(), ret);
+ JvmtiErrorToException(env, jvmti_env, ret);
}
extern "C" JNIEXPORT
@@ -95,6 +93,4 @@
return env->NewStringUTF(result.c_str());
}
-} // namespace allocation_tracking
-} // namespace jvmti
-} // namespace cts
+} // namespace art
diff --git a/hostsidetests/jvmti/base/run-test-based-app/Android.mk b/hostsidetests/jvmti/base/run-test-based-app/Android.mk
new file mode 100644
index 0000000..7c8b417
--- /dev/null
+++ b/hostsidetests/jvmti/base/run-test-based-app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_TAGS := optional
+LOCAL_MODULE := CtsJvmtiDeviceRunTestAppBase
+
+# We explicitly enumerate, as we have a definition of art.Main to simplify development
+# in an IDE (but want the implementation of said class to come from the ART run-tests).
+LOCAL_SRC_FILES := \
+ src/android/jvmti/cts/JvmtiRunTestBasedTest.java \
+
+LOCAL_SDK_VERSION := current
+LOCAL_DEX_PREOPT := false
+LOCAL_JAVA_LIBRARIES := android.test.runner cts-junit
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceAppBase
+LOCAL_STATIC_JAVA_LIBRARIES += run-test-jvmti-java
+LOCAL_PROGUARD_ENABLED := disabled
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/base/run-test-based-app/AndroidManifest.xml b/hostsidetests/jvmti/base/run-test-based-app/AndroidManifest.xml
new file mode 100644
index 0000000..a2d6ca6
--- /dev/null
+++ b/hostsidetests/jvmti/base/run-test-based-app/AndroidManifest.xml
@@ -0,0 +1,39 @@
+<?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.
+ -->
+
+<!--
+ * This is a sample of how to create an app for a run-test-based JVMTI
+ * test.
+ -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_{NR}">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="{NR}" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_{NR}" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/base/run-test-based-app/src/android/jvmti/cts/JvmtiRunTestBasedTest.java b/hostsidetests/jvmti/base/run-test-based-app/src/android/jvmti/cts/JvmtiRunTestBasedTest.java
new file mode 100644
index 0000000..312a882
--- /dev/null
+++ b/hostsidetests/jvmti/base/run-test-based-app/src/android/jvmti/cts/JvmtiRunTestBasedTest.java
@@ -0,0 +1,119 @@
+/*
+ * 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.jvmti.cts;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.lang.reflect.Method;
+
+import android.content.pm.PackageManager;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Check redefineClasses-related functionality.
+ */
+public class JvmtiRunTestBasedTest extends JvmtiTestBase {
+
+ private PrintStream oldOut, oldErr;
+ private ByteArrayOutputStream bufferedOut, bufferedErr;
+
+ @Before
+ public void setUp() throws Exception {
+ oldOut = System.out;
+ oldErr = System.err;
+
+ System.setOut(new PrintStream(bufferedOut = new ByteArrayOutputStream(), true));
+ System.setErr(new PrintStream(bufferedErr = new ByteArrayOutputStream(), true));
+ }
+
+ @After
+ public void tearDown() {
+ System.setOut(oldOut);
+ System.setErr(oldErr);
+ }
+
+ protected int getTestNumber() throws Exception {
+ return mActivity.getPackageManager().getApplicationInfo(mActivity.getPackageName(),
+ PackageManager.GET_META_DATA).metaData.getInt("android.jvmti.cts.run_test_nr");
+ }
+
+ @Test
+ public void testRunTest() throws Exception {
+ final int nr = getTestNumber();
+
+ // Load the test class.
+ Class<?> testClass = Class.forName("art.Test" + nr);
+ Method runMethod = testClass.getDeclaredMethod("run");
+ runMethod.invoke(null);
+
+ // Load the expected txt file.
+ InputStream expectedStream = getClass().getClassLoader()
+ .getResourceAsStream("results." + nr + ".expected.txt");
+ compare(expectedStream, bufferedOut);
+
+ if (bufferedErr.size() > 0) {
+ throw new IllegalStateException(
+ "Did not expect System.err output: " + bufferedErr.toString());
+ }
+ }
+
+ // Very primitive diff. Doesn't do any smart things...
+ private void compare(InputStream expectedStream, ByteArrayOutputStream resultStream)
+ throws Exception {
+ // This isn't really optimal in any way.
+ BufferedReader expectedReader = new BufferedReader(new InputStreamReader(expectedStream));
+ BufferedReader resultReader = new BufferedReader(
+ new InputStreamReader(new ByteArrayInputStream(resultStream.toByteArray())));
+ StringBuilder resultBuilder = new StringBuilder();
+ boolean failed = false;
+ for (;;) {
+ String expString = expectedReader.readLine();
+ String resString = resultReader.readLine();
+
+ if (expString == null && resString == null) {
+ // Done.
+ break;
+ }
+
+ if (expString != null && resString != null && expString.equals(resString)) {
+ resultBuilder.append(" ");
+ resultBuilder.append(expString);
+ resultBuilder.append('\n');
+ continue;
+ }
+
+ failed = true;
+ if (expString != null) {
+ resultBuilder.append("- ");
+ resultBuilder.append(expString);
+ resultBuilder.append('\n');
+ }
+ if (resString != null) {
+ resultBuilder.append("+ ");
+ resultBuilder.append(resString);
+ resultBuilder.append('\n');
+ }
+ }
+ if (failed) {
+ throw new IllegalStateException(resultBuilder.toString());
+ }
+ }
+}
diff --git a/hostsidetests/jvmti/base/run-test-based-app/src/art/Main.java b/hostsidetests/jvmti/base/run-test-based-app/src/art/Main.java
new file mode 100644
index 0000000..493c709
--- /dev/null
+++ b/hostsidetests/jvmti/base/run-test-based-app/src/art/Main.java
@@ -0,0 +1,26 @@
+/*
+ * 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 art;
+
+/**
+ * This is class is only provided to make development in an IDE easier. The art.Main version
+ * out of the ART run-tests will be used when building.
+ */
+public class Main {
+ // General functionality shared between tests.
+ public static native void setTag(Object o, long tag);
+
+ public static native long getTag(Object o);
+}
diff --git a/hostsidetests/jvmti/redefining/AndroidTest.xml b/hostsidetests/jvmti/redefining/AndroidTest.xml
index f2c20ed..3bc93a2 100644
--- a/hostsidetests/jvmti/redefining/AndroidTest.xml
+++ b/hostsidetests/jvmti/redefining/AndroidTest.xml
@@ -21,5 +21,7 @@
</target_preparer>
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CtsJvmtiRedefineClassesHostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRedefineClassesDeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.redefine" />
</test>
</configuration>
diff --git a/hostsidetests/jvmti/redefining/app/src/android/jvmti/cts/JvmtiRedefineClassesTest.java b/hostsidetests/jvmti/redefining/app/src/android/jvmti/cts/JvmtiRedefineClassesTest.java
index 169afe2..d68d1dd 100644
--- a/hostsidetests/jvmti/redefining/app/src/android/jvmti/cts/JvmtiRedefineClassesTest.java
+++ b/hostsidetests/jvmti/redefining/app/src/android/jvmti/cts/JvmtiRedefineClassesTest.java
@@ -34,6 +34,8 @@
import org.junit.BeforeClass;
import org.junit.Test;
+import art.Main;
+
/**
* Check redefineClasses-related functionality.
*/
@@ -41,8 +43,6 @@
@Before
public void setUp() throws Exception {
- JniBindings.bindAgentJNI("android/jvmti/cts/JvmtiRedefineClassesTest",
- getClass().getClassLoader());
// make sure everything is cleared.
setTransformationEvent(false);
setPopTransformations(true);
diff --git a/hostsidetests/jvmti/redefining/app/src/art/Main.java b/hostsidetests/jvmti/redefining/app/src/art/Main.java
new file mode 100644
index 0000000..6f569d1
--- /dev/null
+++ b/hostsidetests/jvmti/redefining/app/src/art/Main.java
@@ -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.
+ */
+
+package art;
+
+/**
+ * This is a definition of generically exposed implementations by the CTS JVMTI agent.
+ */
+public class Main {
+ // Load the given class with the given classloader, and bind all native methods to corresponding
+ // C methods in the agent. Will abort if any of the steps fail.
+ public static native void bindAgentJNI(String className, ClassLoader classLoader);
+ // Same as above, giving the class directly.
+ public static native void bindAgentJNIForClass(Class<?> klass);
+
+ // General functionality shared between tests.
+ public static native void setTag(Object o, long tag);
+
+ public static native long getTag(Object o);
+}
diff --git a/hostsidetests/jvmti/run-tests/Android.mk b/hostsidetests/jvmti/run-tests/Android.mk
new file mode 100644
index 0000000..64fe597
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/Android.mk
@@ -0,0 +1,17 @@
+# Copyright (C) 2014 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 $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-902/Android.mk b/hostsidetests/jvmti/run-tests/test-902/Android.mk
new file mode 100644
index 0000000..7479ad8
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-902/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest902HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-902/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-902/AndroidTest.xml
new file mode 100644
index 0000000..ade4fac
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-902/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest902DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_902" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest902HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest902DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_902" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-902/app/Android.mk b/hostsidetests/jvmti/run-tests/test-902/app/Android.mk
new file mode 100644
index 0000000..3fd9dc9
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-902/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest902DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
new file mode 100644
index 0000000..6a2edd6
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_902">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="902" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_902" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-903/Android.mk b/hostsidetests/jvmti/run-tests/test-903/Android.mk
new file mode 100644
index 0000000..1b67da1
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-903/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest903HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-903/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-903/AndroidTest.xml
new file mode 100644
index 0000000..1390840
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-903/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest903DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_903" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest903HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest903DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_903" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-903/app/Android.mk b/hostsidetests/jvmti/run-tests/test-903/app/Android.mk
new file mode 100644
index 0000000..a501186
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-903/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest903DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
new file mode 100644
index 0000000..4823c99
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_903">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="903" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_903" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-904/Android.mk b/hostsidetests/jvmti/run-tests/test-904/Android.mk
new file mode 100644
index 0000000..b814acb
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-904/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest904HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-904/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-904/AndroidTest.xml
new file mode 100644
index 0000000..f16ce94
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-904/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest904DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_904" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest904HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest904DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_904" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-904/app/Android.mk b/hostsidetests/jvmti/run-tests/test-904/app/Android.mk
new file mode 100644
index 0000000..83f0efc
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-904/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest904DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
new file mode 100644
index 0000000..59ef42c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_904">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="904" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_904" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-905/Android.mk b/hostsidetests/jvmti/run-tests/test-905/Android.mk
new file mode 100644
index 0000000..9e58b9b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-905/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest905HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-905/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-905/AndroidTest.xml
new file mode 100644
index 0000000..c337e82
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-905/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest905DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_905" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest905HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest905DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_905" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-905/app/Android.mk b/hostsidetests/jvmti/run-tests/test-905/app/Android.mk
new file mode 100644
index 0000000..662ea5f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-905/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest905DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
new file mode 100644
index 0000000..9092bf7
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_905">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="905" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_905" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-906/Android.mk b/hostsidetests/jvmti/run-tests/test-906/Android.mk
new file mode 100644
index 0000000..553b898
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-906/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest906HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-906/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-906/AndroidTest.xml
new file mode 100644
index 0000000..dbd74f6
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-906/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest906DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_906" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest906HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest906DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_906" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-906/app/Android.mk b/hostsidetests/jvmti/run-tests/test-906/app/Android.mk
new file mode 100644
index 0000000..f383007
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-906/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest906DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
new file mode 100644
index 0000000..c06dc7e
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_906">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="906" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_906" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-907/Android.mk b/hostsidetests/jvmti/run-tests/test-907/Android.mk
new file mode 100644
index 0000000..cf79d0b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-907/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest907HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-907/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-907/AndroidTest.xml
new file mode 100644
index 0000000..99cd40d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-907/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest907DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_907" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest907HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest907DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_907" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-907/app/Android.mk b/hostsidetests/jvmti/run-tests/test-907/app/Android.mk
new file mode 100644
index 0000000..3ecb219
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-907/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest907DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
new file mode 100644
index 0000000..0e96029
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_907">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="907" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_907" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-908/Android.mk b/hostsidetests/jvmti/run-tests/test-908/Android.mk
new file mode 100644
index 0000000..40ef837
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-908/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest908HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-908/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-908/AndroidTest.xml
new file mode 100644
index 0000000..fca6567
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-908/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest908DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_908" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest908HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest908DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_908" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-908/app/Android.mk b/hostsidetests/jvmti/run-tests/test-908/app/Android.mk
new file mode 100644
index 0000000..c4eea2e
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-908/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest908DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
new file mode 100644
index 0000000..2dddb65
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_908">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="908" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_908" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-910/Android.mk b/hostsidetests/jvmti/run-tests/test-910/Android.mk
new file mode 100644
index 0000000..8cfe0a5
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-910/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest910HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-910/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-910/AndroidTest.xml
new file mode 100644
index 0000000..a947621
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-910/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest910DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_910" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest910HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest910DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_910" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-910/app/Android.mk b/hostsidetests/jvmti/run-tests/test-910/app/Android.mk
new file mode 100644
index 0000000..108682a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-910/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest910DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
new file mode 100644
index 0000000..6fbbb29
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_910">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="910" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_910" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-911/Android.mk b/hostsidetests/jvmti/run-tests/test-911/Android.mk
new file mode 100644
index 0000000..0906b99
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-911/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest911HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-911/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-911/AndroidTest.xml
new file mode 100644
index 0000000..fb06812
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-911/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest911DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_911" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest911HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest911DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_911" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-911/app/Android.mk b/hostsidetests/jvmti/run-tests/test-911/app/Android.mk
new file mode 100644
index 0000000..d5d70d2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-911/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest911DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
new file mode 100644
index 0000000..1284b25
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_911">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="911" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_911" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-913/Android.mk b/hostsidetests/jvmti/run-tests/test-913/Android.mk
new file mode 100644
index 0000000..8075fe2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-913/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest913HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-913/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-913/AndroidTest.xml
new file mode 100644
index 0000000..a019d07
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-913/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest913DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_913" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest913HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest913DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_913" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-913/app/Android.mk b/hostsidetests/jvmti/run-tests/test-913/app/Android.mk
new file mode 100644
index 0000000..03cb328
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-913/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest913DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
new file mode 100644
index 0000000..bd183b8
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_913">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="913" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_913" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-914/Android.mk b/hostsidetests/jvmti/run-tests/test-914/Android.mk
new file mode 100644
index 0000000..5f7ddee
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-914/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest914HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-914/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-914/AndroidTest.xml
new file mode 100644
index 0000000..b70869e
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-914/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest914DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_914" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest914HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest914DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_914" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-914/app/Android.mk b/hostsidetests/jvmti/run-tests/test-914/app/Android.mk
new file mode 100644
index 0000000..c294d56
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-914/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest914DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
new file mode 100644
index 0000000..5d6869c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_914">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="914" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_914" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-915/Android.mk b/hostsidetests/jvmti/run-tests/test-915/Android.mk
new file mode 100644
index 0000000..2e2e438
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-915/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest915HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-915/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-915/AndroidTest.xml
new file mode 100644
index 0000000..35f9903
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-915/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest915DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_915" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest915HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest915DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_915" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-915/app/Android.mk b/hostsidetests/jvmti/run-tests/test-915/app/Android.mk
new file mode 100644
index 0000000..d712a74
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-915/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest915DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
new file mode 100644
index 0000000..12c417e
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_915">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="915" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_915" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-917/Android.mk b/hostsidetests/jvmti/run-tests/test-917/Android.mk
new file mode 100644
index 0000000..1e84675
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-917/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest917HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-917/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-917/AndroidTest.xml
new file mode 100644
index 0000000..ad988af
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-917/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest917DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_917" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest917HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest917DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_917" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-917/app/Android.mk b/hostsidetests/jvmti/run-tests/test-917/app/Android.mk
new file mode 100644
index 0000000..8b87082
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-917/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest917DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
new file mode 100644
index 0000000..114aa4c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_917">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="917" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_917" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-918/Android.mk b/hostsidetests/jvmti/run-tests/test-918/Android.mk
new file mode 100644
index 0000000..5d6f8d0
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-918/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest918HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-918/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-918/AndroidTest.xml
new file mode 100644
index 0000000..4a3feb1
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-918/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest918DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_918" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest918HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest918DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_918" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-918/app/Android.mk b/hostsidetests/jvmti/run-tests/test-918/app/Android.mk
new file mode 100644
index 0000000..30f9597
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-918/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest918DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
new file mode 100644
index 0000000..96ce8aa
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_918">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="918" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_918" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-919/Android.mk b/hostsidetests/jvmti/run-tests/test-919/Android.mk
new file mode 100644
index 0000000..8916d6e
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-919/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest919HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-919/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-919/AndroidTest.xml
new file mode 100644
index 0000000..3183ad3
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-919/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest919DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_919" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest919HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest919DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_919" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-919/app/Android.mk b/hostsidetests/jvmti/run-tests/test-919/app/Android.mk
new file mode 100644
index 0000000..a9b7089
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-919/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest919DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
new file mode 100644
index 0000000..7ce0424
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_919">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="919" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_919" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-920/Android.mk b/hostsidetests/jvmti/run-tests/test-920/Android.mk
new file mode 100644
index 0000000..f92ed94
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-920/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest920HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-920/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-920/AndroidTest.xml
new file mode 100644
index 0000000..ba53a64
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-920/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest920DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_920" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest920HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest920DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_920" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-920/app/Android.mk b/hostsidetests/jvmti/run-tests/test-920/app/Android.mk
new file mode 100644
index 0000000..a24d668
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-920/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest920DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
new file mode 100644
index 0000000..1c85104
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_920">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="920" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_920" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-922/Android.mk b/hostsidetests/jvmti/run-tests/test-922/Android.mk
new file mode 100644
index 0000000..2de665a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-922/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest922HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-922/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-922/AndroidTest.xml
new file mode 100644
index 0000000..2b74f07
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-922/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest922DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_922" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest922HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest922DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_922" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-922/app/Android.mk b/hostsidetests/jvmti/run-tests/test-922/app/Android.mk
new file mode 100644
index 0000000..ada0edc
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-922/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest922DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
new file mode 100644
index 0000000..985352d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_922">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="922" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_922" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-923/Android.mk b/hostsidetests/jvmti/run-tests/test-923/Android.mk
new file mode 100644
index 0000000..dd1de3c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-923/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest923HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-923/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-923/AndroidTest.xml
new file mode 100644
index 0000000..9c8aa21
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-923/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest923DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_923" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest923HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest923DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_923" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-923/app/Android.mk b/hostsidetests/jvmti/run-tests/test-923/app/Android.mk
new file mode 100644
index 0000000..c94d431
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-923/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest923DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
new file mode 100644
index 0000000..3c8bced
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_923">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="923" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_923" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-924/Android.mk b/hostsidetests/jvmti/run-tests/test-924/Android.mk
new file mode 100644
index 0000000..28c4b89
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-924/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest924HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-924/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-924/AndroidTest.xml
new file mode 100644
index 0000000..5a2b567
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-924/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest924DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_924" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest924HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest924DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_924" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-924/app/Android.mk b/hostsidetests/jvmti/run-tests/test-924/app/Android.mk
new file mode 100644
index 0000000..f1acfd0
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-924/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest924DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
new file mode 100644
index 0000000..bcc74c3
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_924">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="924" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_924" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-926/Android.mk b/hostsidetests/jvmti/run-tests/test-926/Android.mk
new file mode 100644
index 0000000..fcd46ad
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-926/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest926HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-926/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-926/AndroidTest.xml
new file mode 100644
index 0000000..eea4602
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-926/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest926DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_926" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest926HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest926DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_926" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-926/app/Android.mk b/hostsidetests/jvmti/run-tests/test-926/app/Android.mk
new file mode 100644
index 0000000..a597fb1
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-926/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest926DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
new file mode 100644
index 0000000..b2a855a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_926">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="926" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_926" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-927/Android.mk b/hostsidetests/jvmti/run-tests/test-927/Android.mk
new file mode 100644
index 0000000..939601c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-927/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest927HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-927/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-927/AndroidTest.xml
new file mode 100644
index 0000000..71d452d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-927/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest927DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_927" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest927HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest927DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_927" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-927/app/Android.mk b/hostsidetests/jvmti/run-tests/test-927/app/Android.mk
new file mode 100644
index 0000000..9c71950
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-927/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest927DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
new file mode 100644
index 0000000..966014a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_927">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="927" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_927" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-928/Android.mk b/hostsidetests/jvmti/run-tests/test-928/Android.mk
new file mode 100644
index 0000000..2eac8f9
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-928/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest928HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-928/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-928/AndroidTest.xml
new file mode 100644
index 0000000..b7c59de
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-928/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest928DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_928" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest928HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest928DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_928" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-928/app/Android.mk b/hostsidetests/jvmti/run-tests/test-928/app/Android.mk
new file mode 100644
index 0000000..2eb3612
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-928/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest928DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
new file mode 100644
index 0000000..1a4d25b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_928">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="928" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_928" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-930/Android.mk b/hostsidetests/jvmti/run-tests/test-930/Android.mk
new file mode 100644
index 0000000..2ac9ae2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-930/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest930HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-930/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-930/AndroidTest.xml
new file mode 100644
index 0000000..3b241b2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-930/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest930DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_930" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest930HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest930DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_930" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-930/app/Android.mk b/hostsidetests/jvmti/run-tests/test-930/app/Android.mk
new file mode 100644
index 0000000..873b273
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-930/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest930DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
new file mode 100644
index 0000000..505448f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_930">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="930" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_930" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-931/Android.mk b/hostsidetests/jvmti/run-tests/test-931/Android.mk
new file mode 100644
index 0000000..ae04387
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-931/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest931HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-931/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-931/AndroidTest.xml
new file mode 100644
index 0000000..4944067
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-931/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest931DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_931" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest931HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest931DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_931" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-931/app/Android.mk b/hostsidetests/jvmti/run-tests/test-931/app/Android.mk
new file mode 100644
index 0000000..c03028a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-931/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest931DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
new file mode 100644
index 0000000..710e208
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_931">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="931" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_931" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-932/Android.mk b/hostsidetests/jvmti/run-tests/test-932/Android.mk
new file mode 100644
index 0000000..c952c86
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-932/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest932HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-932/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-932/AndroidTest.xml
new file mode 100644
index 0000000..b6b1574
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-932/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest932DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_932" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest932HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest932DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_932" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-932/app/Android.mk b/hostsidetests/jvmti/run-tests/test-932/app/Android.mk
new file mode 100644
index 0000000..651a9ee
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-932/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest932DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
new file mode 100644
index 0000000..6c4affd
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_932">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="932" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_932" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-940/Android.mk b/hostsidetests/jvmti/run-tests/test-940/Android.mk
new file mode 100644
index 0000000..4ed5dec
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-940/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest940HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-940/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-940/AndroidTest.xml
new file mode 100644
index 0000000..56ebc24
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-940/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest940DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_940" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest940HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest940DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_940" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-940/app/Android.mk b/hostsidetests/jvmti/run-tests/test-940/app/Android.mk
new file mode 100644
index 0000000..c2121eb
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-940/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest940DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
new file mode 100644
index 0000000..227e058
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_940">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="940" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_940" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-942/Android.mk b/hostsidetests/jvmti/run-tests/test-942/Android.mk
new file mode 100644
index 0000000..d2605b7
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-942/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest942HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-942/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-942/AndroidTest.xml
new file mode 100644
index 0000000..ffe2bf4
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-942/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest942DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_942" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest942HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest942DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_942" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-942/app/Android.mk b/hostsidetests/jvmti/run-tests/test-942/app/Android.mk
new file mode 100644
index 0000000..82d3b6a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-942/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest942DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
new file mode 100644
index 0000000..c40171f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_942">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="942" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_942" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-944/Android.mk b/hostsidetests/jvmti/run-tests/test-944/Android.mk
new file mode 100644
index 0000000..16f9c7f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-944/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest944HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
new file mode 100644
index 0000000..c772bfb
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest944DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_944" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <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" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-944/app/Android.mk b/hostsidetests/jvmti/run-tests/test-944/app/Android.mk
new file mode 100644
index 0000000..c820284
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-944/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest944DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
new file mode 100644
index 0000000..2492237
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_944">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="944" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_944" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-945/Android.mk b/hostsidetests/jvmti/run-tests/test-945/Android.mk
new file mode 100644
index 0000000..e86d85e
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-945/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest945HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-945/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-945/AndroidTest.xml
new file mode 100644
index 0000000..431c5e6
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-945/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest945DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_945" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest945HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest945DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_945" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-945/app/Android.mk b/hostsidetests/jvmti/run-tests/test-945/app/Android.mk
new file mode 100644
index 0000000..b704807
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-945/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest945DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
new file mode 100644
index 0000000..bfe5f24
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_945">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="945" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_945" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-947/Android.mk b/hostsidetests/jvmti/run-tests/test-947/Android.mk
new file mode 100644
index 0000000..4b4cead
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-947/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest947HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-947/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-947/AndroidTest.xml
new file mode 100644
index 0000000..4ab0c9a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-947/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest947DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_947" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest947HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest947DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_947" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-947/app/Android.mk b/hostsidetests/jvmti/run-tests/test-947/app/Android.mk
new file mode 100644
index 0000000..42cc459
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-947/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest947DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
new file mode 100644
index 0000000..36a85ef
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_947">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="947" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_947" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-951/Android.mk b/hostsidetests/jvmti/run-tests/test-951/Android.mk
new file mode 100644
index 0000000..ba45b86
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-951/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest951HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-951/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-951/AndroidTest.xml
new file mode 100644
index 0000000..b489635
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-951/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest951DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_951" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest951HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest951DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_951" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-951/app/Android.mk b/hostsidetests/jvmti/run-tests/test-951/app/Android.mk
new file mode 100644
index 0000000..6b22274
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-951/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest951DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
new file mode 100644
index 0000000..be50d55
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_951">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="951" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_951" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-981/Android.mk b/hostsidetests/jvmti/run-tests/test-981/Android.mk
new file mode 100644
index 0000000..4bbc20a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-981/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest981HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-981/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-981/AndroidTest.xml
new file mode 100644
index 0000000..3e2bb67
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-981/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest981DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_981" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest981HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest981DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_981" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-981/app/Android.mk b/hostsidetests/jvmti/run-tests/test-981/app/Android.mk
new file mode 100644
index 0000000..ec8f7aa
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-981/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest981DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-981/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-981/app/AndroidManifest.xml
new file mode 100644
index 0000000..a0e898a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-981/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_981">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="981" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_981" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-982/Android.mk b/hostsidetests/jvmti/run-tests/test-982/Android.mk
new file mode 100644
index 0000000..908adaf
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-982/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest982HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-982/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-982/AndroidTest.xml
new file mode 100644
index 0000000..7c4833f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-982/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest982DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_982" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest982HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest982DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_982" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-982/app/Android.mk b/hostsidetests/jvmti/run-tests/test-982/app/Android.mk
new file mode 100644
index 0000000..a06c76d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-982/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest982DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
new file mode 100644
index 0000000..d1cc7b1
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_982">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="982" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_982" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-984/Android.mk b/hostsidetests/jvmti/run-tests/test-984/Android.mk
new file mode 100644
index 0000000..3ddb2ad
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-984/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest984HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-984/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-984/AndroidTest.xml
new file mode 100644
index 0000000..7ba284c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-984/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest984DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_984" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest984HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest984DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_984" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-984/app/Android.mk b/hostsidetests/jvmti/run-tests/test-984/app/Android.mk
new file mode 100644
index 0000000..b30ff35
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-984/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest984DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
new file mode 100644
index 0000000..963cd51
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_984">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="984" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_984" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-985/Android.mk b/hostsidetests/jvmti/run-tests/test-985/Android.mk
new file mode 100644
index 0000000..0ed12de
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-985/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest985HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-985/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-985/AndroidTest.xml
new file mode 100644
index 0000000..ba21091
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-985/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest985DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_985" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest985HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest985DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_985" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-985/app/Android.mk b/hostsidetests/jvmti/run-tests/test-985/app/Android.mk
new file mode 100644
index 0000000..e092712
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-985/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest985DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
new file mode 100644
index 0000000..4b0ffa5
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_985">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="985" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_985" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-986/Android.mk b/hostsidetests/jvmti/run-tests/test-986/Android.mk
new file mode 100644
index 0000000..8e6ec6f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-986/Android.mk
@@ -0,0 +1,26 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsJvmtiRunTest986HostTestCases
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiHostTestBase
+LOCAL_MODULE_TAGS := tests
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_HOST_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/jvmti/run-tests/test-986/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-986/AndroidTest.xml
new file mode 100644
index 0000000..4bc581f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-986/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 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.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <target_preparer class="android.jvmti.cts.JvmtiPreparer">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest986DeviceApp.apk" />
+ <option name="package-name" value="android.jvmti.cts.run_test_986" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest986HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest986DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_986" />
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-986/app/Android.mk b/hostsidetests/jvmti/run-tests/test-986/app/Android.mk
new file mode 100644
index 0000000..6914162
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-986/app/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2017 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_DEX_PREOPT := false
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_SRC_FILES :=
+LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_STATIC_JAVA_LIBRARIES := CtsJvmtiDeviceRunTestAppBase
+LOCAL_JNI_SHARED_LIBRARIES := libctsjvmtiagent
+LOCAL_MULTILIB := both
+LOCAL_SDK_VERSION := current
+
+# TODO: Refactor. This is the only thing every changing.
+LOCAL_PACKAGE_NAME := CtsJvmtiRunTest986DeviceApp
+
+include $(BUILD_PACKAGE)
diff --git a/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
new file mode 100644
index 0000000..4c12d93
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?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.jvmti.cts.run_test_986">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="986" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_986" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/tagging/AndroidTest.xml b/hostsidetests/jvmti/tagging/AndroidTest.xml
index 6d76722..2cee989 100644
--- a/hostsidetests/jvmti/tagging/AndroidTest.xml
+++ b/hostsidetests/jvmti/tagging/AndroidTest.xml
@@ -21,5 +21,7 @@
</target_preparer>
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CtsJvmtiTaggingHostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiTaggingDeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.tagging" />
</test>
</configuration>
diff --git a/hostsidetests/jvmti/tagging/app/src/android/jvmti/cts/JvmtiTaggingTest.java b/hostsidetests/jvmti/tagging/app/src/android/jvmti/cts/JvmtiTaggingTest.java
index 6ba9376..d695f9f 100644
--- a/hostsidetests/jvmti/tagging/app/src/android/jvmti/cts/JvmtiTaggingTest.java
+++ b/hostsidetests/jvmti/tagging/app/src/android/jvmti/cts/JvmtiTaggingTest.java
@@ -24,41 +24,37 @@
import org.junit.Before;
import org.junit.Test;
+import art.Main;
+
/**
* Check tagging-related functionality.
*/
public class JvmtiTaggingTest extends JvmtiTestBase {
- @Before
- public void setUp() throws Exception {
- // Bind our native methods.
- JniBindings.bindAgentJNI("android/jvmti/cts/JvmtiTaggingTest", getClass().getClassLoader());
- }
-
private static WeakReference<Object> test() {
Object o1 = new Object();
- JniBindings.setTag(o1, 1);
+ Main.setTag(o1, 1);
Object o2 = new Object();
- JniBindings.setTag(o2, 2);
+ Main.setTag(o2, 2);
- assertEquals(1, JniBindings.getTag(o1));
- assertEquals(2, JniBindings.getTag(o2));
+ assertEquals(1, Main.getTag(o1));
+ assertEquals(2, Main.getTag(o2));
Runtime.getRuntime().gc();
Runtime.getRuntime().gc();
- assertEquals(1, JniBindings.getTag(o1));
- assertEquals(2, JniBindings.getTag(o2));
+ assertEquals(1, Main.getTag(o1));
+ assertEquals(2, Main.getTag(o2));
Runtime.getRuntime().gc();
Runtime.getRuntime().gc();
- JniBindings.setTag(o1, 10);
- JniBindings.setTag(o2, 20);
+ Main.setTag(o1, 10);
+ Main.setTag(o2, 20);
- assertEquals(10, JniBindings.getTag(o1));
- assertEquals(20, JniBindings.getTag(o2));
+ assertEquals(10, Main.getTag(o1));
+ assertEquals(20, Main.getTag(o2));
return new WeakReference<Object>(o1);
}
@@ -93,7 +89,7 @@
Integer o = new Integer(i);
l.add(o);
if (i % 10 != 0) {
- JniBindings.setTag(o, i % 10);
+ Main.setTag(o, i % 10);
}
}
diff --git a/hostsidetests/jvmti/tagging/app/src/art/Main.java b/hostsidetests/jvmti/tagging/app/src/art/Main.java
new file mode 100644
index 0000000..6f569d1
--- /dev/null
+++ b/hostsidetests/jvmti/tagging/app/src/art/Main.java
@@ -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.
+ */
+
+package art;
+
+/**
+ * This is a definition of generically exposed implementations by the CTS JVMTI agent.
+ */
+public class Main {
+ // Load the given class with the given classloader, and bind all native methods to corresponding
+ // C methods in the agent. Will abort if any of the steps fail.
+ public static native void bindAgentJNI(String className, ClassLoader classLoader);
+ // Same as above, giving the class directly.
+ public static native void bindAgentJNIForClass(Class<?> klass);
+
+ // General functionality shared between tests.
+ public static native void setTag(Object o, long tag);
+
+ public static native long getTag(Object o);
+}
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/AbstractLifecycleLogActivity.java b/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/AbstractLifecycleLogActivity.java
index 7b8a695..1a0a0ea 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/AbstractLifecycleLogActivity.java
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/AbstractLifecycleLogActivity.java
@@ -27,12 +27,6 @@
public abstract class AbstractLifecycleLogActivity extends Activity {
- /**
- * Used to check if we report same configurations in Activity#onMovedToDisplay and
- * Activity#onConfigurationChanged.
- */
- private Configuration mConfigFromMoveToDisplay;
-
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -49,23 +43,6 @@
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Log.i(getTag(), "onConfigurationChanged");
-
- // If there was a move to different display - check that we're reporting same config here.
- if (mConfigFromMoveToDisplay != null) {
- if (!mConfigFromMoveToDisplay.equals(newConfig)) {
- throw new IllegalArgumentException(
- "Configuration reported in onConfigurationChanged() differs from one"
- + " reported in onMovedToDisplay()");
- }
- mConfigFromMoveToDisplay = null;
- }
- }
-
- @Override
- public void onMovedToDisplay(int displayId, Configuration config) {
- super.onMovedToDisplay(displayId, config);
- Log.i(getTag(), "onMovedToDisplay");
- mConfigFromMoveToDisplay = config;
}
@Override
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/LifecycleLogView.java b/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/LifecycleLogView.java
index f06def5..66e0cf2 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/LifecycleLogView.java
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/app/src/android/server/cts/LifecycleLogView.java
@@ -25,12 +25,6 @@
public class LifecycleLogView extends View {
private final String TAG = "LifecycleLogView";
- /**
- * Used to check if we report same configurations in View#onMovedToDisplay and
- * View#onConfigurationChanged.
- */
- private Configuration mConfigFromMoveToDisplay;
-
public LifecycleLogView(Context context) {
super(context);
}
@@ -52,22 +46,5 @@
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Log.i(TAG, "onConfigurationChanged");
-
- // If there was a move to different display - check that we're reporting same config here.
- if (mConfigFromMoveToDisplay != null) {
- if (!mConfigFromMoveToDisplay.equals(newConfig)) {
- throw new IllegalArgumentException(
- "Configuration reported in onConfigurationChanged() differs from one"
- + " reported in onMovedToDisplay()");
- }
- mConfigFromMoveToDisplay = null;
- }
- }
-
- @Override
- public void onMovedToDisplay(int displayId, Configuration config) {
- super.onMovedToDisplay(displayId, config);
- Log.i(TAG, "onMovedToDisplay");
- mConfigFromMoveToDisplay = config;
}
}
diff --git a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java
index f40ea04..9ad9d29 100644
--- a/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java
+++ b/hostsidetests/services/activityandwindowmanager/activitymanager/src/android/server/cts/ActivityManagerDisplayTests.java
@@ -1126,36 +1126,6 @@
}
/**
- * Tests that when activities that handle configuration changes are moved between displays,
- * they receive onMovedToDisplay and onConfigurationChanged callbacks.
- */
- @Presubmit
- public void testOnMovedToDisplayCallback() throws Exception {
- if (!supportsMultiDisplay()) { return; }
-
- // Create new virtual display.
- final DisplayState newDisplay = new VirtualDisplayBuilder(this).build();
- mAmWmState.assertVisibility(VIRTUAL_DISPLAY_ACTIVITY, true /* visible */);
-
- // Launch activity on new secondary display.
- launchActivityOnDisplay(RESIZEABLE_ACTIVITY_NAME, newDisplay.mDisplayId);
- mAmWmState.assertFocusedActivity("Focus must be on secondary display",
- RESIZEABLE_ACTIVITY_NAME);
-
- final String logSeparator = clearLogcat();
- moveActivityToStack(RESIZEABLE_ACTIVITY_NAME, FULLSCREEN_WORKSPACE_STACK_ID);
- mAmWmState.waitForFocusedStack(mDevice, FULLSCREEN_WORKSPACE_STACK_ID);
- mAmWmState.assertFocusedActivity("Focus must be on moved activity",
- RESIZEABLE_ACTIVITY_NAME);
- mAmWmState.assertFocusedStack("Focus must return to primary display",
- FULLSCREEN_WORKSPACE_STACK_ID);
-
- // Check if client received the callbacks.
- assertMovedToDisplay(RESIZEABLE_ACTIVITY_NAME, logSeparator);
- assertMovedToDisplay("LifecycleLogView", logSeparator);
- }
-
- /**
* Tests that when an activity is launched with displayId specified and there is an existing
* matching task on some other display - that task will moved to the target display.
*/
diff --git a/tests/app/src/android/app/cts/ActivityManagerTest.java b/tests/app/src/android/app/cts/ActivityManagerTest.java
index f29ae1e..045301d 100644
--- a/tests/app/src/android/app/cts/ActivityManagerTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerTest.java
@@ -329,12 +329,18 @@
for (RunningAppProcessInfo ra : list) {
if (ra.processName.equals(SYSTEM_PROCESS)) {
hasSystemProcess = true;
+
+ // Make sure the importance is a sane value.
+ assertTrue(ra.importance >= RunningAppProcessInfo.IMPORTANCE_FOREGROUND);
+ assertTrue(ra.importance < RunningAppProcessInfo.IMPORTANCE_GONE);
} else if (ra.processName.equals(TEST_PROCESS)) {
hasTestProcess = true;
}
}
+
// For security reasons the system process is not exposed.
- assertTrue(!hasSystemProcess && hasTestProcess);
+ assertFalse(hasSystemProcess);
+ assertTrue(hasTestProcess);
for (RunningAppProcessInfo ra : list) {
if (ra.processName.equals("android.app.stubs:remote")) {
@@ -359,6 +365,17 @@
fail("android.app.stubs:remote process should be available");
}
+ public void testGetMyMemoryState() {
+ final RunningAppProcessInfo ra = new RunningAppProcessInfo();
+ ActivityManager.getMyMemoryState(ra);
+
+ assertEquals(mContext.getApplicationInfo().processName, ra.processName);
+ assertEquals(android.os.Process.myUid(), ra.uid);
+
+ // When an instrumentation test is running, the importance is high.
+ assertEquals(RunningAppProcessInfo.IMPORTANCE_FOREGROUND, ra.importance);
+ }
+
public void testGetProcessInErrorState() throws Exception {
List<ActivityManager.ProcessErrorStateInfo> errList = null;
errList = mActivityManager.getProcessesInErrorState();
diff --git a/tests/app/src/android/app/cts/AlertWindowsTests.java b/tests/app/src/android/app/cts/AlertWindowsTests.java
index f7c8ff8..bd97727 100644
--- a/tests/app/src/android/app/cts/AlertWindowsTests.java
+++ b/tests/app/src/android/app/cts/AlertWindowsTests.java
@@ -17,7 +17,7 @@
package android.app.cts;
import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE;
-import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE_DEPRECATED;
+import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_PERCEPTIBLE_PRE_26;
import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_VISIBLE;
import static android.content.Context.BIND_ALLOW_OOM_MANAGEMENT;
import static android.content.Context.BIND_AUTO_CREATE;
@@ -31,8 +31,10 @@
import static com.android.app2.AlertWindowService.NOTIFICATION_MESSENGER_EXTRA;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import android.app.ActivityManager;
+import android.app.ActivityManager.RunningAppProcessInfo;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -44,6 +46,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.Messenger;
+import android.os.SystemClock;
import android.platform.test.annotations.Presubmit;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
@@ -57,6 +60,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.concurrent.TimeUnit;
import java.util.function.Function;
/**
@@ -127,34 +131,38 @@
public void testAlertWindowOomAdj() throws Exception {
setAlertWindowPermission(true /* allow */);
- assertPackageImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_DEPRECATED);
- assertUidImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_DEPRECATED);
+ assertPackageImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_PRE_26);
+ assertUidImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_PRE_26);
addAlertWindow();
// Process importance should be increased to visible when the service has an alert window.
assertPackageImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
-
- // TODO: Somehow getUidImportance still returns 230 (IMPORTANCE_PERCEPTIBLE) instead of
- // IMPORTANCE_VISIBLE(200)
- // assertUidImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
+ assertUidImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
addAlertWindow();
assertPackageImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
+ assertUidImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
setAlertWindowPermission(false /* allow */);
// Process importance should no longer be visible since its alert windows are not allowed to
// be visible.
- assertPackageImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_DEPRECATED);
+ assertPackageImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_PRE_26);
+ assertUidImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_PRE_26);
+
setAlertWindowPermission(true /* allow */);
// They can show again so importance should be visible again.
assertPackageImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
+ assertUidImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
removeAlertWindow();
assertPackageImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
+ assertUidImportance(IMPORTANCE_VISIBLE, IMPORTANCE_VISIBLE);
+
removeAlertWindow();
// Process importance should no longer be visible when the service no longer as alert
// windows.
- assertPackageImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_DEPRECATED);
+ assertPackageImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_PRE_26);
+ assertUidImportance(IMPORTANCE_PERCEPTIBLE, IMPORTANCE_PERCEPTIBLE_PRE_26);
}
private void addAlertWindow() throws Exception {
@@ -181,7 +189,7 @@
private void assertImportance(Function<ActivityManager, Integer> apiCaller,
int expectedForO, int expectedForPreO) throws Exception {
- int retry = 3;
+ final long TIMEOUT = SystemClock.uptimeMillis() + TimeUnit.SECONDS.toMillis(30);
int actual;
do {
@@ -190,7 +198,7 @@
// doesn't really work for this use case right now...
Thread.sleep(500);
actual = apiCaller.apply(mAm);
- } while (actual != expectedForO && --retry > 0);
+ } while (actual != expectedForO && (SystemClock.uptimeMillis() < TIMEOUT));
assertEquals(expectedForO, actual);
diff --git a/tests/app/src/android/app/cts/Instrumentation_ActivityMonitorTest.java b/tests/app/src/android/app/cts/Instrumentation_ActivityMonitorTest.java
index 8ffb136..a8d16b7 100644
--- a/tests/app/src/android/app/cts/Instrumentation_ActivityMonitorTest.java
+++ b/tests/app/src/android/app/cts/Instrumentation_ActivityMonitorTest.java
@@ -86,17 +86,17 @@
/**
* Verifies that
- * - when ActivityMonitor.onMatchIntent returs non-null, then there is monitor hit.
- * - when ActivityMonitor.onMatchIntent returns null, then the activity start is not blocked.
+ * - when ActivityMonitor.onStartActivity returs non-null, then there is monitor hit.
+ * - when ActivityMonitor.onStartActivity returns null, then the activity start is not blocked.
*/
- public void testActivityMonitor_onMatchIntent() throws Exception {
+ public void testActivityMonitor_onStartActivity() throws Exception {
final ActivityResult result = new ActivityResult(Activity.RESULT_OK, new Intent());
final Instrumentation instrumentation = getInstrumentation();
final Context context = instrumentation.getTargetContext();
final Intent intent = new Intent(context, InstrumentationTestActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- // Verify when ActivityMonitor.onMatchIntent returns non-null, then there is a monitor hit.
+ // Verify when ActivityMonitor.onStartActivity returns non-null, then there is a monitor hit.
final CustomActivityMonitor cam1 = new CustomActivityMonitor(result);
instrumentation.addMonitor(cam1);
context.startActivity(intent);
@@ -109,7 +109,7 @@
instrumentation.removeMonitor(cam1);
}
- // Verify when ActivityMonitor.onMatchIntent returns null, then activity start is not
+ // Verify when ActivityMonitor.onStartActivity returns null, then activity start is not
// blocked and there is no monitor hit.
final CustomActivityMonitor cam2 = new CustomActivityMonitor(null);
instrumentation.addMonitor(cam2);
@@ -128,9 +128,9 @@
}
/**
- * Verifies that when ActivityMonitor.onMatchIntent returns non-null, activity start is blocked.
+ * Verifies that when ActivityMonitor.onStartActivity returns non-null, activity start is blocked.
*/
- public void testActivityMonitor_onMatchIntentBlocks() throws Exception {
+ public void testActivityMonitor_onStartActivityBlocks() throws Exception {
final Instrumentation instrumentation = getInstrumentation();
final Context context = instrumentation.getTargetContext();
@@ -141,13 +141,13 @@
// Initialize and set activity monitor.
final int expectedResultCode = 1111;
- final String expectedAction = "matched_using_onMatchIntent";
+ final String expectedAction = "matched_using_onStartActivity";
final CustomActivityMonitor cam = new CustomActivityMonitor(
new ActivityResult(expectedResultCode, new Intent(expectedAction)));
instrumentation.addMonitor(cam);
// Start InstrumentationTestActivity from ActivityMonitorTestActivity and verify
- // it is intercepted using onMatchIntent as expected.
+ // it is intercepted using onStartActivity as expected.
try {
final CountDownLatch latch = new CountDownLatch(1);
amTestActivity.setOnActivityResultListener(
@@ -176,9 +176,9 @@
/**
* Verifies that when the activity monitor is created using by passing IntentFilter,
- * then onMatchIntent return value is ignored.
+ * then onStartActivity return value is ignored.
*/
- public void testActivityMonitor_onMatchIntentAndIntentFilter() throws Exception {
+ public void testActivityMonitor_onStartActivityAndIntentFilter() throws Exception {
final Instrumentation instrumentation = getInstrumentation();
final Context context = instrumentation.getTargetContext();
@@ -194,7 +194,7 @@
new IntentFilter(InstrumentationTestActivity.START_INTENT),
new ActivityResult(expectedResultCode, new Intent(expectedAction)),
true);
- cam.setResultToReturn(new ActivityResult(1111, new Intent("matched_using_onMatchIntent")));
+ cam.setResultToReturn(new ActivityResult(1111, new Intent("matched_using_onStartActivity")));
instrumentation.addMonitor(cam);
// Start explicit InstrumentationTestActivity from ActivityMonitorTestActivity and verify
@@ -227,9 +227,9 @@
/**
* Verifies that when the activity monitor is created using by passing activity class,
- * then onMatchIntent return value is ignored.
+ * then onStartActivity return value is ignored.
*/
- public void testActivityMonitor_onMatchIntentAndActivityClass() throws Exception {
+ public void testActivityMonitor_onStartActivityAndActivityClass() throws Exception {
final Instrumentation instrumentation = getInstrumentation();
final Context context = instrumentation.getTargetContext();
@@ -245,7 +245,7 @@
InstrumentationTestActivity.class.getName(),
new ActivityResult(expectedResultCode, new Intent(expectedAction)),
true);
- cam.setResultToReturn(new ActivityResult(2222, new Intent("matched_using_onMatchIntent")));
+ cam.setResultToReturn(new ActivityResult(2222, new Intent("matched_using_onStartActivity")));
instrumentation.addMonitor(cam);
// Start implicit InstrumentationTestActivity from ActivityMonitorTestActivity and verify
@@ -299,7 +299,7 @@
}
@Override
- public ActivityResult onMatchIntent(Intent intent) {
+ public ActivityResult onStartActivity(Intent intent) {
final boolean implicitInstrumentationTestActivity = intent.getAction() != null &&
InstrumentationTestActivity.START_INTENT.equals(intent.getAction());
final boolean explicitInstrumentationTestActivity = intent.getComponent() != null &&
diff --git a/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java b/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
index dba0c07..67f90b4 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
@@ -101,9 +101,9 @@
}
// Ensure that showing and popping a Fragment uses the enter and popExit animators
- // This tests optimized transactions
+ // This tests reordered transactions
@Test
- public void showAnimatorsOptimized() throws Throwable {
+ public void showAnimatorsReordered() throws Throwable {
final FragmentManager fm = mActivityRule.getActivity().getFragmentManager();
// One fragment with a view
@@ -133,9 +133,9 @@
}
// Ensure that showing and popping a Fragment uses the enter and popExit animators
- // This tests unoptimized transactions
+ // This tests ordered transactions
@Test
- public void showAnimatorsUnoptimized() throws Throwable {
+ public void showAnimatorsOrdered() throws Throwable {
final FragmentManager fm = mActivityRule.getActivity().getFragmentManager();
// One fragment with a view
@@ -143,7 +143,7 @@
fm.beginTransaction()
.add(R.id.fragmentContainer, fragment)
.hide(fragment)
- .setAllowOptimization(false)
+ .setReorderingAllowed(false)
.commit();
FragmentTestUtil.waitForExecution(mActivityRule);
@@ -154,7 +154,7 @@
fm.beginTransaction()
.setCustomAnimations(ENTER, EXIT, POP_ENTER, POP_EXIT)
.show(fragment)
- .setAllowOptimization(false)
+ .setReorderingAllowed(false)
.addToBackStack(null)
.commit();
FragmentTestUtil.waitForExecution(mActivityRule);
diff --git a/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java b/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
index abf7fd8..ed48c82 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
@@ -884,11 +884,11 @@
StrictFragment fragment2 = new StrictFragment();
fm.beginTransaction()
.add(fragment1, "1")
- .setAllowOptimization(false)
+ .setReorderingAllowed(false)
.commit();
fm.beginTransaction()
.add(fragment2, "Hello")
- .setAllowOptimization(false)
+ .setReorderingAllowed(false)
.commit();
fm.executePendingTransactions();
diff --git a/tests/fragment/src/android/fragment/cts/FragmentOptimizationTest.java b/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
similarity index 95%
rename from tests/fragment/src/android/fragment/cts/FragmentOptimizationTest.java
rename to tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
index bbd8d10..f1c6b9f 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentOptimizationTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
@@ -32,7 +32,7 @@
@MediumTest
@RunWith(AndroidJUnit4.class)
-public class FragmentOptimizationTest {
+public class FragmentReorderingTest {
@Rule
public ActivityTestRule<FragmentTestActivity> mActivityRule =
new ActivityTestRule<FragmentTestActivity>(FragmentTestActivity.class);
@@ -141,7 +141,7 @@
// ensure that removing a view after adding it is optimized into no
// View being created. Hide still gets notified.
@Test
- public void optimizeRemove() throws Throwable {
+ public void removeRedundantRemove() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
final int[] id = new int[1];
mActivityRule.runOnUiThread(new Runnable() {
@@ -175,7 +175,7 @@
// Ensure that removing and adding the same view results in no operation
@Test
- public void optimizeAdd() throws Throwable {
+ public void removeRedundantAdd() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
int id = mFM.beginTransaction()
.add(R.id.fragmentContainer, fragment1)
@@ -212,7 +212,7 @@
// detaching, then attaching results in on change. Hide still functions
@Test
- public void optimizeAttach() throws Throwable {
+ public void removeRedundantAttach() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
int id = mFM.beginTransaction()
.add(R.id.fragmentContainer, fragment1)
@@ -256,7 +256,7 @@
// attaching, then detaching shouldn't result in a View being created
@Test
- public void optimizeDetach() throws Throwable {
+ public void removeRedundantDetach() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
int id = mFM.beginTransaction()
.add(R.id.fragmentContainer, fragment1)
@@ -304,7 +304,7 @@
// show, then hide should optimize out
@Test
- public void optimizeHide() throws Throwable {
+ public void removeRedundantHide() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
int id = mFM.beginTransaction()
.add(R.id.fragmentContainer, fragment1)
@@ -395,7 +395,7 @@
// hiding and showing the same view should optimize out
@Test
- public void optimizeShow() throws Throwable {
+ public void removeRedundantShow() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
int id = mFM.beginTransaction()
.add(R.id.fragmentContainer, fragment1)
@@ -428,7 +428,7 @@
assertEquals(0, fragment1.onHideCount);
}
- // The View order shouldn't be messed up by optimization -- a view that
+ // The View order shouldn't be messed up by reordering -- a view that
// is optimized to not remove/add should be in its correct position after
// the transaction completes.
@Test
@@ -486,7 +486,7 @@
}
// A non-back-stack transaction doesn't interfere with back stack add/pop
- // optimization.
+ // reodering/removing of redundant operations.
@Test
public void popNonBackStack() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
@@ -511,10 +511,10 @@
assertEquals(0, fragment1.onCreateViewCount);
}
- // When optimization is disabled, the transaction prior to the disabled optimization
- // transaction should all be run prior to running the non-optimized transaction.
+ // When reordering is disabled, the transaction prior to the disabled reordering
+ // transaction should all be run prior to running the ordered transaction.
@Test
- public void noOptimization() throws Throwable {
+ public void noReordering() throws Throwable {
final CountCallsFragment fragment1 = new CountCallsFragment();
final CountCallsFragment fragment2 = new CountCallsFragment();
mActivityRule.runOnUiThread(new Runnable() {
@@ -527,14 +527,14 @@
mFM.beginTransaction()
.replace(R.id.fragmentContainer, fragment2)
.addToBackStack(null)
- .setAllowOptimization(false)
+ .setReorderingAllowed(false)
.commit();
mFM.executePendingTransactions();
}
});
FragmentTestUtil.assertChildren(mContainer, fragment2);
- // No optimization, so fragment1 should have created its View
+ // No reordering, so fragment1 should have created its View
assertEquals(1, fragment1.onCreateViewCount);
}
diff --git a/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java b/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
index 7421377..7a73046 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
@@ -54,7 +54,7 @@
@MediumTest
@RunWith(Parameterized.class)
public class FragmentTransitionTest {
- private final boolean mOptimize;
+ private final boolean mReordered;
@Parameterized.Parameters
public static Object[] data() {
@@ -69,8 +69,8 @@
private FragmentManager mFragmentManager;
- public FragmentTransitionTest(final boolean optimize) {
- mOptimize = optimize;
+ public FragmentTransitionTest(final boolean reordered) {
+ mReordered = reordered;
}
@Before
@@ -90,7 +90,7 @@
// exit transition
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.remove(fragment)
.addToBackStack(null)
.commit();
@@ -164,7 +164,7 @@
@Override
public void run() {
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.replace(R.id.fragmentContainer, fragment2)
.replace(R.id.fragmentContainer, fragment1)
.replace(R.id.fragmentContainer, fragment2)
@@ -175,7 +175,10 @@
FragmentTestUtil.waitForExecution(mActivityRule);
// should be a normal transition from fragment1 to fragment2
+ fragment1.waitForTransition();
fragment2.waitForTransition();
+ FragmentTestUtil.waitForExecution(mActivityRule);
+
final View endBlue = findBlue();
final View endGreen = findGreen();
verifyAndClearTransition(fragment1.exitTransition, null, startBlue, startGreen);
@@ -187,6 +190,9 @@
FragmentTestUtil.popBackStackImmediate(mActivityRule);
fragment1.waitForTransition();
+ fragment2.waitForTransition();
+ FragmentTestUtil.waitForExecution(mActivityRule);
+
final View popBlue = findBlue();
final View popGreen = findGreen();
verifyAndClearTransition(fragment1.reenterTransition, null, popBlue, popGreen);
@@ -204,7 +210,7 @@
TransitionFragment fragment2 = new TransitionFragment();
fragment2.setLayoutId(R.layout.scene1);
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.add(R.id.fragmentContainer1, fragment1)
.add(R.id.fragmentContainer2, fragment2)
.addToBackStack(null)
@@ -320,7 +326,7 @@
mFragmentManager.beginTransaction()
.addSharedElement(startBlue, "blueSquare")
.replace(R.id.fragmentContainer, fragment2)
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.addToBackStack(null)
.commit();
FragmentTestUtil.waitForExecution(mActivityRule);
@@ -387,7 +393,7 @@
mFragmentManager.beginTransaction()
.addSharedElement(startBlue, "blueSquare")
.replace(R.id.fragmentContainer, fragment2)
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.addToBackStack(null)
.commit();
FragmentTestUtil.waitForExecution(mActivityRule);
@@ -512,7 +518,7 @@
final View startGreen = findGreen();
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.add(R.id.fragmentContainer, fragment2)
.hide(fragment1)
.addToBackStack(null)
@@ -563,7 +569,7 @@
final View startGreen = findGreen();
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.add(R.id.fragmentContainer, fragment2)
.detach(fragment1)
.addToBackStack(null)
@@ -610,7 +616,7 @@
mFragmentManager.beginTransaction()
.addSharedElement(startBlue, "fooSquare")
.replace(R.id.fragmentContainer, fragment2)
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.addToBackStack(null)
.commit();
FragmentTestUtil.waitForExecution(mActivityRule);
@@ -621,7 +627,7 @@
final View endBlue = findBlue();
final View endGreen = findGreen();
- if (mOptimize) {
+ if (mReordered) {
verifyAndClearTransition(fragment1.exitTransition, null, startGreen, startBlue);
} else {
verifyAndClearTransition(fragment1.exitTransition, startBlueBounds, startGreen);
@@ -661,14 +667,14 @@
// Test that invisible fragment views don't participate in transitions
@Test
public void invisibleNoTransitions() throws Throwable {
- if (!mOptimize) {
- return; // only optimized transitions can avoid interaction
+ if (!mReordered) {
+ return; // only reordered transitions can avoid interaction
}
// enter transition
TransitionFragment fragment = new InvisibleFragment();
fragment.setLayoutId(R.layout.scene1);
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.add(R.id.fragmentContainer, fragment)
.addToBackStack(null)
.commit();
@@ -678,7 +684,7 @@
// exit transition
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.remove(fragment)
.addToBackStack(null)
.commit();
@@ -710,7 +716,7 @@
fragment2.setLayoutId(R.layout.scene2);
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.addSharedElement(startBlue, "blueSquare")
.replace(R.id.fragmentContainer, fragment2)
.addToBackStack(null)
@@ -735,7 +741,7 @@
public void run() {
mFragmentManager.popBackStack();
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.replace(R.id.fragmentContainer, fragment3)
.addToBackStack(null)
.commit();
@@ -746,8 +752,8 @@
FragmentTestUtil.executePendingTransactions(mActivityRule);
fragment2.waitForTransition();
- // It does not transition properly for unoptimized transactions, though.
- if (mOptimize) {
+ // It does not transition properly for ordered transactions, though.
+ if (mReordered) {
verifyAndClearTransition(fragment2.returnTransition, null, midGreen, midBlue);
final View endGreen = findGreen();
final View endBlue = findBlue();
@@ -758,7 +764,7 @@
} else {
// fragment3 doesn't get a transition since it conflicts with the pop transition
verifyNoOtherTransitions(fragment3);
- // Everything else is just doing its best. Unoptimized transactions can't handle
+ // Everything else is just doing its best. Reordered transactions can't handle
// multiple transitions acting together except for popping multiple together.
}
}
@@ -767,7 +773,7 @@
TransitionFragment fragment1 = new TransitionFragment();
fragment1.setLayoutId(R.layout.scene1);
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.add(R.id.fragmentContainer, fragment1)
.addToBackStack(null)
.commit();
@@ -834,7 +840,7 @@
final Rect startBlueRect = getBoundsOnScreen(startBlue);
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.addSharedElement(startBlue, sharedElementName)
.replace(R.id.fragmentContainer, to)
.addToBackStack(null)
@@ -886,13 +892,13 @@
mActivityRule.runOnUiThread(() -> {
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.addSharedElement(fromShared1, "blueSquare")
.replace(R.id.fragmentContainer1, to1)
.addToBackStack(null)
.commit();
mFragmentManager.beginTransaction()
- .setAllowOptimization(mOptimize)
+ .setReorderingAllowed(mReordered)
.addSharedElement(fromShared2, sharedElementName)
.replace(R.id.fragmentContainer2, to2)
.addToBackStack(null)
diff --git a/tests/fragment/src/android/fragment/cts/FragmentViewTests.java b/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
index e9c80e0..f0d5947 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
@@ -23,9 +23,7 @@
import android.app.Fragment;
import android.app.FragmentManager;
-import android.app.Instrumentation;
import android.os.Bundle;
-import android.os.Debug;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.MediumTest;
import android.support.test.rule.ActivityTestRule;
@@ -34,7 +32,6 @@
import android.view.View;
import android.view.ViewGroup;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -930,11 +927,11 @@
FragmentTestUtil.assertChildren(container, fragment3);
}
- // Ensure that non-optimized transactions are executed individually rather than together.
+ // Ensure that ordered transactions are executed individually rather than together.
// This forces references from one fragment to another that should be executed earlier
// to work.
@Test
- public void nonOptimizeTogether() throws Throwable {
+ public void orderedOperationsTogether() throws Throwable {
FragmentTestUtil.setContentView(mActivityRule, R.layout.simple_container);
ViewGroup container = (ViewGroup)
mActivityRule.getActivity().findViewById(R.id.fragmentContainer);
@@ -950,12 +947,12 @@
public void run() {
fm.beginTransaction()
.add(R.id.fragmentContainer, fragment1)
- .setAllowOptimization(false)
+ .setReorderingAllowed(false)
.addToBackStack(null)
.commit();
fm.beginTransaction()
.add(R.id.squareContainer, fragment2)
- .setAllowOptimization(false)
+ .setReorderingAllowed(false)
.addToBackStack(null)
.commit();
fm.executePendingTransactions();
@@ -992,7 +989,7 @@
FragmentTestUtil.assertChildren(innerContainer, fragment2);
}
- // Popping the backstack with non-optimized fragments should execute the operations together.
+ // Popping the backstack with ordered fragments should execute the operations together.
// When a non-backstack fragment will be raised, it should not be destroyed.
@Test
public void popToNonBackStackFragment() throws Throwable {
diff --git a/tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_2_golden_pressed.png b/tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_2_pressed_golden.png
similarity index 100%
rename from tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_2_golden_pressed.png
rename to tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_2_pressed_golden.png
Binary files differ
diff --git a/tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_golden_pressed.png b/tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_golden_pressed.png
deleted file mode 100644
index c5d06f6..0000000
--- a/tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_golden_pressed.png
+++ /dev/null
Binary files differ
diff --git a/tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_2_golden_pressed.png b/tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_pressed_golden.png
similarity index 100%
copy from tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_2_golden_pressed.png
copy to tests/tests/graphics/res/drawable-nodpi/vector_icon_state_list_pressed_golden.png
Binary files differ
diff --git a/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java b/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
index 74f4549..52db21f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
@@ -70,14 +70,6 @@
private final static int BITMAP_HEIGHT = 28;
private final static int FLOAT_ARRAY_LEN = 9;
- private final Rect mRect = new Rect(0, 0, 10, 31);
- private final Rect mInRect = new Rect(0, 0, 20, 10);
- private final Rect mOutRect = new Rect(10, 31, 11, 32);
-
- private final RectF mRectF = new RectF(0, 0, 10, 31);
- private final RectF mInRectF = new RectF(0, 0, 20, 10);
- private final RectF mOutRectF = new RectF(10, 31, 11, 32);
-
// used for save related methods tests
private final float[] values1 = {
1, 2, 3, 4, 5, 6, 7, 8, 9
@@ -1037,7 +1029,7 @@
}
@Test
- public void testClipRect4F() {
+ public void testClipRect4I() {
// intersect with clip larger than canvas
assertTrue(mCanvas.clipRect(0, 0, 10, 31, Op.INTERSECT));
// intersect with clip outside of canvas bounds
@@ -1053,6 +1045,58 @@
}
@Test
+ public void testClipRect4F() {
+ // intersect with clip larger than canvas
+ assertTrue(mCanvas.clipRect(0f, 0f, 10f, 31f, Op.INTERSECT));
+ // intersect with clip outside of canvas bounds
+ assertFalse(mCanvas.clipRect(10f, 31f, 11f, 32f, Op.INTERSECT));
+ // replace with clip that is larger than canvas
+ assertTrue(mCanvas.clipRect(0f, 0f, 10f, 31f, Op.REPLACE));
+ // intersect with clip that covers top portion of canvas
+ assertTrue(mCanvas.clipRect(0f, 0f, 20f, 10f, Op.INTERSECT));
+ // intersect with clip that covers bottom portion of canvas
+ assertFalse(mCanvas.clipRect(0f, 10f, 20f, 32f, Op.INTERSECT));
+ // ensure that difference doesn't widen already closed clip
+ assertFalse(mCanvas.clipRect(0f, 0f, 10f, 31f, Op.DIFFERENCE));
+ }
+
+ @Test
+ public void testClipOutRectF() {
+ // remove center, clip not empty
+ assertTrue(mCanvas.clipOutRect(new RectF(1, 1, 9, 27)));
+ // replace clip, verify difference doesn't widen
+ assertFalse(mCanvas.clipRect(new RectF(0, 0, 0, 0), Op.REPLACE));
+ assertFalse(mCanvas.clipOutRect(new RectF(0, 0, 100, 100)));
+ }
+
+ @Test
+ public void testClipOutRect() {
+ // remove center, clip not empty
+ assertTrue(mCanvas.clipOutRect(new Rect(1, 1, 9, 27)));
+ // replace clip, verify difference doesn't widen
+ assertFalse(mCanvas.clipRect(new Rect(0, 0, 0, 0), Op.REPLACE));
+ assertFalse(mCanvas.clipOutRect(new Rect(0, 0, 100, 100)));
+ }
+
+ @Test
+ public void testClipOutRect4I() {
+ // remove center, clip not empty
+ assertTrue(mCanvas.clipOutRect(1, 1, 9, 27));
+ // replace clip, verify difference doesn't widen
+ assertFalse(mCanvas.clipRect(0, 0, 0, 0, Op.REPLACE));
+ assertFalse(mCanvas.clipOutRect(0, 0, 100, 100));
+ }
+
+ @Test
+ public void testClipOutRect4F() {
+ // remove center, clip not empty
+ assertTrue(mCanvas.clipOutRect(1f, 1f, 9f, 27f));
+ // replace clip, verify difference doesn't widen
+ assertFalse(mCanvas.clipRect(0f, 0f, 0f, 0f, Op.REPLACE));
+ assertFalse(mCanvas.clipOutRect(0f, 0f, 100f, 100f));
+ }
+
+ @Test
public void testIntersectClipRectF() {
// intersect with clip larger than canvas
assertTrue(mCanvas.clipRect(new RectF(0, 0, 10, 31)));
@@ -1077,14 +1121,9 @@
}
@Test
- public void testClipRect7() {
- assertTrue(mCanvas.clipRect(0, 0, 10, 31));
- }
-
- @Test
public void testClipPath1() {
final Path p = new Path();
- p.addRect(mRectF, Direction.CCW);
+ p.addRect(new RectF(0, 0, 10, 31), Direction.CCW);
assertTrue(mCanvas.clipPath(p));
}
@@ -1137,14 +1176,14 @@
@Test
public void testQuickReject1() {
- assertFalse(mCanvas.quickReject(mRectF, EdgeType.AA));
- assertFalse(mCanvas.quickReject(mRectF, EdgeType.BW));
+ assertFalse(mCanvas.quickReject(new RectF(0, 0, 10, 31), EdgeType.AA));
+ assertFalse(mCanvas.quickReject(new RectF(0, 0, 10, 31), EdgeType.BW));
}
@Test
public void testQuickReject2() {
final Path p = new Path();
- p.addRect(mRectF, Direction.CCW);
+ p.addRect(new RectF(0, 0, 10, 31), Direction.CCW);
assertFalse(mCanvas.quickReject(p, EdgeType.AA));
assertFalse(mCanvas.quickReject(p, EdgeType.BW));
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
index fdbf92e..952f7e3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
@@ -588,6 +588,12 @@
};
assertArrayEquals(sRGBD50, ((ColorSpace.Rgb) adapted).getTransform(), 1e-7f);
+
+ adapted = ColorSpace.adapt(
+ ColorSpace.get(ColorSpace.Named.SRGB),
+ ColorSpace.ILLUMINANT_D50,
+ ColorSpace.Adaptation.BRADFORD);
+ assertArrayEquals(sRGBD50, ((ColorSpace.Rgb) adapted).getTransform(), 1e-7f);
}
@Test
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 29da030..0788c0d 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
@@ -150,9 +150,11 @@
counter++;
boolean isIdentical = isAlmostIdenticalInRect(screenShot, lastScreenShot, imageViewRect);
if (isIdentical) {
- DrawableTestUtils.saveVectorDrawableIntoPNG(screenShot, "screenshot_" + counter);
- DrawableTestUtils.saveVectorDrawableIntoPNG(lastScreenShot, "screenshot_"
- + (counter - 1));
+ String outputFolder = mActivity.getExternalFilesDir(null).getAbsolutePath();
+ DrawableTestUtils.saveVectorDrawableIntoPNG(screenShot, outputFolder,
+ "screenshot_" + counter);
+ DrawableTestUtils.saveVectorDrawableIntoPNG(lastScreenShot, outputFolder,
+ "screenshot_" + (counter - 1));
fail("Two consecutive screenshots of AVD are identical, AVD is "
+ "likely not animating");
}
@@ -292,10 +294,11 @@
.takeScreenshot();
boolean isIdentical = isAlmostIdenticalInRect(screenShot, lastScreenShot, imageViewRect);
if (isIdentical) {
- DrawableTestUtils.saveVectorDrawableIntoPNG(screenShot, "inf_avd_screenshot_"
- + mLayerType + "_" + counter);
- DrawableTestUtils.saveVectorDrawableIntoPNG(lastScreenShot, "inf_avd_screenshot_"
- + mLayerType + "_" + (counter - 1));
+ String outputFolder = mActivity.getExternalFilesDir(null).getAbsolutePath();
+ DrawableTestUtils.saveVectorDrawableIntoPNG(screenShot, outputFolder,
+ "inf_avd_screenshot_" + mLayerType + "_" + counter);
+ DrawableTestUtils.saveVectorDrawableIntoPNG(lastScreenShot, outputFolder,
+ "inf_avd_screenshot_" + mLayerType + "_" + (counter - 1));
fail("Two consecutive screenshots of AVD are identical, AVD is "
+ "likely not animating");
}
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
index d1f6282..990a8fb 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
@@ -105,7 +105,7 @@
assertTrue(earthColor == 0xFF5656EA);
if (DBG_DUMP_PNG) {
- DrawableTestUtils.saveVectorDrawableIntoPNG(bitmap, mResId, mResources);
+ DrawableTestUtils.saveAutoNamedVectorDrawableIntoPNG(mActivity, bitmap, mResId, null);
}
}
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTestUtils.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTestUtils.java
index f91be12..077836c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTestUtils.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTestUtils.java
@@ -16,6 +16,7 @@
package android.graphics.drawable.cts;
+import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
@@ -23,6 +24,9 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
+import android.support.annotation.IntegerRes;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
@@ -206,34 +210,40 @@
return pixel;
}
-
/**
* Save a bitmap for debugging or golden image (re)generation purpose.
- * The file name will be referred from the resource id and added "_golden".
+ * The file name will be referred from the resource id, plus optionally {@code extras}, and
+ * "_golden"
*/
- static void saveVectorDrawableIntoPNG(Bitmap bitmap, int resId, Resources res) throws
- IOException {
- String originalFilePath = res.getString(resId);
+ static void saveAutoNamedVectorDrawableIntoPNG(@NonNull Context context, @NonNull Bitmap bitmap,
+ @IntegerRes int resId, @Nullable String extras)
+ throws IOException {
+ String originalFilePath = context.getResources().getString(resId);
File originalFile = new File(originalFilePath);
String fileFullName = originalFile.getName();
String fileTitle = fileFullName.substring(0, fileFullName.lastIndexOf("."));
- saveVectorDrawableIntoPNG(bitmap, fileTitle);
+ String outputFolder = context.getExternalFilesDir(null).getAbsolutePath();
+ if (extras != null) {
+ fileTitle += "_" + extras;
+ }
+ saveVectorDrawableIntoPNG(bitmap, outputFolder, fileTitle);
}
/**
- * Save a bitmap to the given name plus "_golden" under /sdcard/temp/
+ * Save a {@code bitmap} to the {@code fileFullName} plus "_golden".
*/
- static void saveVectorDrawableIntoPNG(Bitmap bitmap, String fileFullName)
+ static void saveVectorDrawableIntoPNG(@NonNull Bitmap bitmap, @NonNull String outputFolder,
+ @NonNull String fileFullName)
throws IOException {
// Save the image to the disk.
FileOutputStream out = null;
try {
- String outputFolder = "/sdcard/temp/";
File folder = new File(outputFolder);
if (!folder.exists()) {
folder.mkdir();
}
- String outputFilename = outputFolder + fileFullName + "_golden.png";
+ String outputFilename = outputFolder + "/" + fileFullName + "_golden";
+ outputFilename +=".png";
File outputFile = new File(outputFilename);
if (!outputFile.exists()) {
outputFile.createNewFile();
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
index e7daf65..4e5fb15 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
@@ -71,7 +71,8 @@
screenShot = takeScreenshot(srcRect);
if (DBG_SCREENSHOT) {
- DrawableTestUtils.saveVectorDrawableIntoPNG(screenShot, "scale");
+ String outputFolder = mActivity.getExternalFilesDir(null).getAbsolutePath();
+ DrawableTestUtils.saveVectorDrawableIntoPNG(screenShot, outputFolder, "scale");
}
Bitmap golden = BitmapFactory.decodeResource(mResources,
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
index 276bf50..c09a139 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
@@ -19,6 +19,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import android.content.Context;
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.XmlResourceParser;
@@ -32,6 +33,7 @@
import android.graphics.cts.R;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.VectorDrawable;
+import android.support.annotation.Nullable;
import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
@@ -170,9 +172,9 @@
R.drawable.vector_icon_state_list_2_golden
},
{
- R.drawable.vector_icon_state_list_golden_pressed,
- R.drawable.vector_icon_state_list_golden_pressed,
- R.drawable.vector_icon_state_list_2_golden_pressed
+ R.drawable.vector_icon_state_list_pressed_golden,
+ R.drawable.vector_icon_state_list_pressed_golden,
+ R.drawable.vector_icon_state_list_2_pressed_golden
}
};
@@ -189,6 +191,7 @@
private Resources mResources;
private Bitmap mBitmap;
private Canvas mCanvas;
+ private Context mContext;
@Before
public void setup() {
@@ -197,7 +200,8 @@
mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap);
- mResources = InstrumentationRegistry.getTargetContext().getResources();
+ mContext = InstrumentationRegistry.getTargetContext();
+ mResources = mContext.getResources();
}
@Test
@@ -234,7 +238,6 @@
VectorDrawable vectorDrawable = new VectorDrawable();
vectorDrawable.setBounds(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
-
// Setup VectorDrawable from xml file and draw into the bitmap.
XmlPullParser parser = mResources.getXml(resIds[i]);
AttributeSet attrs = Xml.asAttributeSet(parser);
@@ -261,7 +264,9 @@
vectorDrawable.draw(mCanvas);
if (DBG_DUMP_PNG) {
- saveVectorDrawableIntoPNG(mBitmap, resIds, i, stateSet);
+ String stateSetTitle = getTitleForStateSet(stateSet);
+ DrawableTestUtils.saveAutoNamedVectorDrawableIntoPNG(mContext, mBitmap, resIds[i],
+ stateSetTitle);
} else {
// Start to compare
Bitmap golden = BitmapFactory.decodeResource(mResources, goldenImages[i]);
@@ -274,59 +279,23 @@
}
}
- // This is only for debugging or golden image (re)generation purpose.
- private void saveVectorDrawableIntoPNG(Bitmap bitmap, int[] resIds, int index, int[] stateSet)
- throws IOException {
- // Save the image to the disk.
- FileOutputStream out = null;
- try {
- String outputFolder = "/sdcard/temp/";
- File folder = new File(outputFolder);
- if (!folder.exists()) {
- folder.mkdir();
- }
- String originalFilePath = mResources.getString(resIds[index]);
- File originalFile = new File(originalFilePath);
- String fileFullName = originalFile.getName();
- String fileTitle = fileFullName.substring(0, fileFullName.lastIndexOf("."));
- String stateSetTitle = getTitleForStateSet(stateSet);
- String outputFilename = outputFolder + fileTitle + "_golden" + stateSetTitle + ".png";
- File outputFile = new File(outputFilename);
- if (!outputFile.exists()) {
- outputFile.createNewFile();
- }
-
- out = new FileOutputStream(outputFile, false);
- bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
- Log.v(LOGTAG, "Write test No." + index + " to file successfully.");
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (out != null) {
- out.close();
- }
- }
- }
-
/**
* Generates an underline-delimited list of states in a given state set.
* <p>
* For example, the array {@code {R.attr.state_pressed}} would return
- * {@code "_pressed"}.
+ * {@code "pressed"}.
*
* @param stateSet a state set
- * @return a string representing the state set, or the empty string if the
- * state set is empty or {@code null}
+ * @return a string representing the state set, or {@code null} if the state set is empty or
+ * {@code null}
*/
- private String getTitleForStateSet(int[] stateSet) {
+ private @Nullable String getTitleForStateSet(int[] stateSet) {
if (stateSet == null || stateSet.length == 0) {
- return "";
+ return null;
}
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < stateSet.length; i++) {
- builder.append('_');
-
final String state = mResources.getResourceName(stateSet[i]);
final int stateIndex = state.indexOf("state_");
if (stateIndex >= 0) {
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/NativeMediaTest.java b/tests/tests/mediastress/src/android/mediastress/cts/NativeMediaTest.java
index 192f213..5e77162 100644
--- a/tests/tests/mediastress/src/android/mediastress/cts/NativeMediaTest.java
+++ b/tests/tests/mediastress/src/android/mediastress/cts/NativeMediaTest.java
@@ -70,10 +70,14 @@
waitForNativeMediaLifeCycle(activity, true);
Thread.sleep(PLAY_WAIT_TIME_MS); // let it play for some time
for (int i = 0; i < NUMBER_PLAY_PAUSE_REPEATITIONS; i++) {
- instrumentation.callActivityOnPause(activity);
+ instrumentation.runOnMainSync(() -> {
+ instrumentation.callActivityOnPause(activity);
+ });
instrumentation.waitForIdleSync();
waitForNativeMediaLifeCycle(activity, false);
- instrumentation.callActivityOnResume(activity);
+ instrumentation.runOnMainSync(() -> {
+ instrumentation.callActivityOnResume(activity);
+ });
waitForNativeMediaLifeCycle(activity, true);
Thread.sleep(PLAY_WAIT_TIME_MS); // let it play for some time
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RSBase.java b/tests/tests/renderscript/src/android/renderscript/cts/RSBase.java
index 2ca4f13..ec5e781 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/RSBase.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSBase.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.content.res.Resources;
+import android.os.StrictMode;
import android.renderscript.RenderScript.RSErrorHandler;
import android.renderscript.RenderScript.RSMessageHandler;
import android.renderscript.RSRuntimeException;
@@ -80,6 +81,12 @@
@Override
protected void setUp() throws Exception {
super.setUp();
+
+ StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
+ .detectLeakedClosableObjects()
+ .penaltyLog()
+ .build());
+
result = 0;
msgHandled = false;
mCtx = getContext();
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/ImageBuffersForRenderScript.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/ImageBuffersForRenderScript.java
index 9078764..fa7def6 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/ImageBuffersForRenderScript.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/ImageBuffersForRenderScript.java
@@ -56,4 +56,9 @@
imageWidthPadded = inputImage.getWidth() + 2 * margin;
imageHeightPadded = inputImage.getHeight() + 2 * margin;
}
+
+ public void destroy() {
+ inAllocation.destroy();
+ outAllocation.destroy();
+ }
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/RenderScriptTask.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/RenderScriptTask.java
index 29436c6..1f812a1 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/RenderScriptTask.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/RenderScriptTask.java
@@ -105,11 +105,13 @@
RefocusFilterF32 rfFilterF32 = new RefocusFilterF32(renderScript);
outputImage =
rfFilterF32.compute(rgbdImage, blurStack);
+ rfFilterF32.destroy();
break;
case d1new:
RefocusFilterd1new rfFilterd1new = new RefocusFilterd1new(renderScript);
outputImage =
rfFilterd1new.compute(rgbdImage, blurStack);
+ rfFilterd1new.destroy();
break;
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/ImageBuffersForRenderScriptd1new.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/ImageBuffersForRenderScriptd1new.java
index ac67ef6..4068d1e 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/ImageBuffersForRenderScriptd1new.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/ImageBuffersForRenderScriptd1new.java
@@ -47,6 +47,17 @@
public Allocation sharpActiveAllocation;
public Allocation sharpMatteAllocation;
+ public void destroy() {
+ super.destroy();
+ sharpRGBAAllocation.destroy();
+ fuzzyRGBAAllocation.destroy();
+ integralRGBAAllocation.destroy();
+ sharpActualDepthAllocation.destroy();
+ sharpDilatedDepthAllocation.destroy();
+ sharpActiveAllocation.destroy();
+ sharpMatteAllocation.destroy();
+ }
+
/**
* A constructor that allocates memory buffers in Java and binds the buffers
* with the global pointers in the Render Script.
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java
index 52bc4de..0981a54 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/d1new/RefocusFilterd1new.java
@@ -48,11 +48,19 @@
private static final float MIN_DISC_RADIUS_FOR_FAST_FILTER = 3;
boolean useFastFilterForCurrentLayer = false;
ImageBuffersForRenderScriptd1new buffers;
+ Allocation kernelInfo, kernelStack;
public RefocusFilterd1new(RenderScript rs) {
super(rs);
}
+ public void destroy() {
+ buffers.destroy();
+ kernelInfo.destroy();
+ kernelStack.destroy();
+ scriptC.destroy();
+ }
+
@Override
protected void initializeScriptAndBuffers(Bitmap inputImage,
LayerInfo focalLayer) {
@@ -93,6 +101,7 @@
scriptC.forEach_PackSharpImage(mAllocation);
mAllocation.copyTo(mBitmap);
+ mAllocation.destroy();
MediaStoreSaver.savePNG(mBitmap, "sharpd1new", name, renderScript.getApplicationContext());
}
/*
@@ -106,6 +115,7 @@
scriptC.forEach_PackFuzzyImage(mAllocation);
mAllocation.copyTo(mBitmap);
+ mAllocation.destroy();
MediaStoreSaver.savePNG(mBitmap, "fuzzyd1new", name, renderScript.getApplicationContext());
}
@@ -132,6 +142,14 @@
}
scriptC.set_g_kernel_stack(kernelData.stackAllocation);
scriptC.set_galloc_kernel_info(kernelData.infoAllocation);
+ if (kernelInfo != null) {
+ kernelInfo.destroy();
+ }
+ kernelInfo = kernelData.infoAllocation;
+ if (kernelStack != null) {
+ kernelStack.destroy();
+ }
+ kernelStack = kernelData.stackAllocation;
}
@Override
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/ImageBuffersForRenderScriptF32.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/ImageBuffersForRenderScriptF32.java
index 53e6e55..33c4d21 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/ImageBuffersForRenderScriptF32.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/ImageBuffersForRenderScriptF32.java
@@ -41,6 +41,12 @@
public Allocation fuzzyImageAllocation;
public Allocation integralImageAllocation;
+ public void destroy() {
+ sharpImageAllocation.destroy();
+ fuzzyImageAllocation.destroy();
+ integralImageAllocation.destroy();
+ }
+
/**
* A constructor that allocates memory buffers in Java and binds the buffers
* with the global pointers in the Render Script.
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/RefocusFilterF32.java b/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/RefocusFilterF32.java
index f819a72..e4f8ff9 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/RefocusFilterF32.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/refocus/f32/RefocusFilterF32.java
@@ -56,6 +56,11 @@
super(rs);
}
+ public void destroy() {
+ buffers.destroy();
+ scriptC.destroy();
+ }
+
@Override
protected void initializeScriptAndBuffers(Bitmap inputImage,
LayerInfo focalLayer) {
@@ -96,6 +101,7 @@
scriptC.forEach_PackSharpImage(mAllocation);
mAllocation.copyTo(mBitmap);
+ mAllocation.destroy();
MediaStoreSaver.savePNG(mBitmap, "sharpF32", name, renderScript.getApplicationContext());
mAllocation.destroy();
}
@@ -110,6 +116,7 @@
scriptC.forEach_PackFuzzyImage(mAllocation);
mAllocation.copyTo(mBitmap);
+ mAllocation.destroy();
MediaStoreSaver.savePNG(mBitmap, "fuzzyF32", name, renderScript.getApplicationContext());
mAllocation.destroy();
}
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 c5a4bc5..140e262 100644
--- a/tests/tests/tv/src/android/media/tv/cts/TvContractTest.java
+++ b/tests/tests/tv/src/android/media/tv/cts/TvContractTest.java
@@ -411,12 +411,24 @@
Uri rowUri = mContentResolver.insert(Channels.CONTENT_URI, values);
assertNull(rowUri);
- // Preview channels can be inserted without input ID
+ // Non-preview channels should not be inserted with null input ID
+ values.putNull(Channels.COLUMN_INPUT_ID);
+ rowUri = mContentResolver.insert(Channels.CONTENT_URI, values);
+ assertNull(rowUri);
+
+ // Preview channels can be inserted with null input ID
values.put(Channels.COLUMN_TYPE, Channels.TYPE_PREVIEW);
rowUri = mContentResolver.insert(Channels.CONTENT_URI, values);
long channelId = ContentUris.parseId(rowUri);
Uri channelUri = TvContract.buildChannelUri(channelId);
verifyChannel(channelUri, values, channelId, false);
+
+ // Preview channels can be inserted without input ID
+ values.remove(Channels.COLUMN_INPUT_ID);
+ rowUri = mContentResolver.insert(Channels.CONTENT_URI, values);
+ channelId = ContentUris.parseId(rowUri);
+ channelUri = TvContract.buildChannelUri(channelId);
+ verifyChannel(channelUri, values, channelId, false);
}
public void testChannelsTableForModifyIdAndPackageName() throws Exception {
@@ -459,7 +471,6 @@
ContentValues baseValues = createDummyChannelValues(mInputId, false);
Uri channelUri = mContentResolver.insert(mChannelsUri, baseValues);
-
// Test: insert
ContentValues values = new ContentValues(baseValues);
values.put(Channels.COLUMN_BROWSABLE, 1);
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java b/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
index 8dd98b0..e96fe0b 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
@@ -16,15 +16,14 @@
package android.uirendering.cts.util;
import android.graphics.Bitmap;
+import android.os.Environment;
+import android.support.test.InstrumentationRegistry;
import android.uirendering.cts.differencevisualizers.DifferenceVisualizer;
import android.util.Log;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
+import com.android.compatibility.common.util.BitmapUtils;
-import libcore.io.IoUtils;
+import java.io.File;
/**
* A utility class that will allow the user to save bitmaps to the sdcard on the device.
@@ -35,7 +34,8 @@
private final static String TESTED_RENDERING_FILE_NAME = "testedCapture.png";
private final static String VISUALIZER_RENDERING_FILE_NAME = "visualizer.png";
private final static String SINGULAR_FILE_NAME = "capture.png";
- private final static String CAPTURE_SUB_DIRECTORY = "/sdcard/UiRenderingCaptures/";
+ private final static String CAPTURE_SUB_DIRECTORY = Environment.getExternalStorageDirectory()
+ + "/UiRenderingCaptures/";
private BitmapDumper() {}
@@ -99,38 +99,8 @@
saveFile(className, testName, SINGULAR_FILE_NAME, bitmap);
}
- private static void logIfBitmapSolidColor(String bitmapName, Bitmap bitmap) {
- int firstColor = bitmap.getPixel(0, 0);
- for (int x = 0; x < bitmap.getWidth(); x++) {
- for (int y = 0; y < bitmap.getHeight(); y++) {
- if (bitmap.getPixel(x, y) != firstColor) {
- return;
- }
- }
- }
-
- Log.w(TAG, String.format("%s entire bitmap color is %x", bitmapName, firstColor));
- }
-
private static void saveFile(String className, String testName, String fileName, Bitmap bitmap) {
- String bitmapName = testName + "_" + fileName;
- Log.d(TAG, "Saving file : " + bitmapName + " in directory : " + className);
- logIfBitmapSolidColor(bitmapName, bitmap);
-
- File file = new File(CAPTURE_SUB_DIRECTORY + className, bitmapName);
- FileOutputStream fileStream = null;
- try {
- fileStream = new FileOutputStream(file);
- bitmap.compress(Bitmap.CompressFormat.PNG, 85, fileStream);
- fileStream.flush();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (fileStream != null) {
- IoUtils.closeQuietly(fileStream);
- }
- }
+ BitmapUtils.saveBitmap(bitmap, CAPTURE_SUB_DIRECTORY + className,
+ testName + "_" + fileName);
}
}