Merge "Remove setWifiEnabled from CTS Multinetwork test"
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 4d46518..0d685f8 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -54,6 +54,7 @@
<uses-feature android:name="android.hardware.vr.high_performance" android:required="false"/>
<uses-feature android:name="android.software.companion_device_setup" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
@@ -1732,6 +1733,8 @@
<meta-data android:name="test_category" android:value="@string/test_category_sensors"/>
<meta-data android:name="test_required_features"
android:value="android.hardware.sensor.accelerometer"/>
+ <meta-data android:name="test_excluded_features"
+ android:value="android.hardware.type.automotive"/>
</activity>
<activity android:name=".sensors.GyroscopeMeasurementTestActivity"
@@ -1744,6 +1747,8 @@
<meta-data android:name="test_category" android:value="@string/test_category_sensors"/>
<meta-data android:name="test_required_features"
android:value="android.hardware.sensor.gyroscope"/>
+ <meta-data android:name="test_excluded_features"
+ android:value="android.hardware.type.automotive"/>
</activity>
<activity android:name=".sensors.HeartRateMonitorTestActivity"
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 615aa7f..e41b23a 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1319,6 +1319,13 @@
4. Pass button will light up if intent and URI trigger were NOT received.\n
5. Click "Pass" if possible, otherwise open settings app, allow location again and click "Fail".
</string>
+ <string name="ci_instruction_text_intent_picture_secure_label">\n
+ 1. Click Start Test.\n
+ 2. Camera app will launch, prompting to take photo.\n
+ 3. Capture/confirm photo using camera app controls within 1 minute.\n
+ 4. Pass button will light up if intent and URI trigger were NOT received.\n
+ 5. Click "Pass" if possible, otherwise open settings app, allow location again and click "Fail".
+ </string>
<string name="ci_instruction_text_intent_video_label">\n
1. Click Start Test.\n
2. Camera app will launch, prompting to take video.\n
@@ -2943,8 +2950,9 @@
<string name="provisioning_byod_personal_ringtones_instruction">
This test verifies that personal ringtones can be changed independently of work profile ringtones.\n
1. Press the go button to go to the sound settings page. Under \"Work profile sounds\" turn off the \"use personal profile sounds\" switch.\n
- 2. Change the personal \"Phone ringtone\", \"Default notification sound\", and \"Default alarm sound\" settings to different values.\n
- 3. Read the values displayed under \"Work phone ringtone\", \"Default work notification sound\", and \"Default work alarm sound\".\n
+ 2. Change the personal \"Phone ringtone\", \"Default notification sound\", and \"Default alarm sound\" settings to different values. Skip any of these settings that do not exist.\n
+ 3. Read the values displayed under \"Work phone ringtone\", \"Default work notification sound\", and \"Default work alarm sound\". If any of the settings in #2 did not exist, skip the\n
+ corresponding work profile setting."\n
4. Verify that the work sounds are different to the personal values just set.\n
5. Go back to the cts-verifier tests using the back button, then mark the test accordingly.\n
</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioAEC.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioAEC.java
index 636dc2b..24e273c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioAEC.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioAEC.java
@@ -16,6 +16,7 @@
package com.android.cts.verifier.audio;
+import android.content.Context;
import android.media.*;
import android.media.audiofx.AcousticEchoCanceler;
import android.os.Bundle;
@@ -61,8 +62,10 @@
private final int CORRELATION_DURATION_MS = TEST_DURATION_MS - 3000;
private final int SHOT_COUNT_CORRELATION = CORRELATION_DURATION_MS/SHOT_FREQUENCY_MS;
private final int SHOT_COUNT = TEST_DURATION_MS/SHOT_FREQUENCY_MS;
+ private final float MIN_RMS_DB = -60.0f; //dB
+ private final float MIN_RMS_VAL = (float)Math.pow(10,(MIN_RMS_DB/20));
- private final double TEST_THRESHOLD_AEC_ON = 0.4; //From SoloTester
+ private final double TEST_THRESHOLD_AEC_ON = 0.5;
private final double TEST_THRESHOLD_AEC_OFF = 0.6;
private RmsHelper mRMSRecorder1 = new RmsHelper(mBlockSizeSamples, SHOT_COUNT);
private RmsHelper mRMSRecorder2 = new RmsHelper(mBlockSizeSamples, SHOT_COUNT);
@@ -131,6 +134,9 @@
count++;
}
float rms = count > 0 ? (float)Math.sqrt(rmsTempSum / count) : 0f;
+ if (rms < MIN_RMS_VAL) {
+ rms = MIN_RMS_VAL;
+ }
double alpha = 0.9;
double total_rms = rms * alpha + mRmsCurrent * (1.0f - alpha);
@@ -162,9 +168,10 @@
DspBufferDouble crossCorr = new DspBufferDouble(actualLen);
for (int i = firstShot, index = 0; i <= lastShot; ++i, ++index) {
- double valPlayerdB = Math.max(20 * Math.log10(buffRmsPlayer.mData[i]), -120);
+ double valPlayerdB = Math.max(20 * Math.log10(buffRmsPlayer.mData[i]), MIN_RMS_DB);
rmsPlayerdB.setValue(index, valPlayerdB);
- double valRecorderdB = Math.max(20 * Math.log10(buffRmsRecorder.mData[i]), -120);
+ double valRecorderdB = Math.max(20 * Math.log10(buffRmsRecorder.mData[i]),
+ MIN_RMS_DB);
rmsRecorderdB.setValue(index, valRecorderdB);
}
@@ -288,20 +295,37 @@
return;
}
- int playbackStreamType = AudioManager.STREAM_MUSIC;
+ //Step 0. Prepare system
+ AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
+ int targetMode = AudioManager.MODE_IN_COMMUNICATION;
+ int originalMode = am.getMode();
+ am.setMode(targetMode);
+
+ if (am.getMode() != targetMode) {
+ sendMessage(AudioTestRunner.TEST_ENDED_ERROR,
+ "Couldn't set mode to MODE_IN_COMMUNICATION.");
+ return;
+ }
+
+ int playbackStreamType = AudioManager.STREAM_VOICE_CALL;
int maxLevel = getMaxLevelForStream(playbackStreamType);
int desiredLevel = maxLevel - 1;
setLevelForStream(playbackStreamType, desiredLevel);
int currentLevel = getLevelForStream(playbackStreamType);
if (currentLevel != desiredLevel) {
+ am.setMode(originalMode);
sendMessage(AudioTestRunner.TEST_ENDED_ERROR,
- "Couldn't set level for STREAM_MUSIC. Expected " +
+ "Couldn't set level for STREAM_VOICE_CALL. Expected " +
desiredLevel +" got: " + currentLevel);
return;
}
+ boolean originalSpeakerPhone = am.isSpeakerphoneOn();
+ am.setSpeakerphoneOn(true);
+
//Step 1. With AEC (on by Default when using VOICE_COMMUNICATION audio source).
+ mSPlayer.setStreamType(playbackStreamType);
mSPlayer.setSoundWithResId(getApplicationContext(), R.raw.speech);
mSRecorder.startRecording();
@@ -316,16 +340,20 @@
} catch (Exception e) {
mSRecorder.stopRecording();
String msg = "Could not create AEC Effect. " + e.toString();
- sendMessage(AudioTestRunner.TEST_ENDED_ERROR, msg);
recordTestResults(mMandatory, 0, 0, msg);
+ am.setSpeakerphoneOn(originalSpeakerPhone);
+ am.setMode(originalMode);
+ sendMessage(AudioTestRunner.TEST_ENDED_ERROR, msg);
return;
}
if (mAec == null) {
mSRecorder.stopRecording();
String msg = "Could not create AEC Effect (AEC Null)";
- sendMessage(AudioTestRunner.TEST_ENDED_ERROR, msg);
recordTestResults(mMandatory,0, 0, msg);
+ am.setSpeakerphoneOn(originalSpeakerPhone);
+ am.setMode(originalMode);
+ sendMessage(AudioTestRunner.TEST_ENDED_ERROR, msg);
return;
}
@@ -333,8 +361,10 @@
String msg = "AEC is not enabled by default.";
if (mMandatory) {
mSRecorder.stopRecording();
- sendMessage(AudioTestRunner.TEST_ENDED_ERROR, msg);
recordTestResults(mMandatory,0, 0, msg);
+ am.setSpeakerphoneOn(originalSpeakerPhone);
+ am.setMode(originalMode);
+ sendMessage(AudioTestRunner.TEST_ENDED_ERROR, msg);
return;
} else {
sb.append("Warning. " + msg + "\n");
@@ -358,9 +388,9 @@
20 * Math.log10(mRMSPlayer1.getRmsCurrent())));
}
- mSPlayer.play(false);
mRMSPlayer1.setRunning(false);
mRMSRecorder1.setRunning(false);
+ mSPlayer.play(false);
int lastShot = SHOT_COUNT - 1;
int firstShot = SHOT_COUNT - SHOT_COUNT_CORRELATION;
@@ -397,10 +427,13 @@
20 * Math.log10(mRMSPlayer2.getRmsCurrent())));
}
- mSRecorder.stopRecording();
- mSPlayer.play(false);
mRMSPlayer2.setRunning(false);
mRMSRecorder2.setRunning(false);
+ mSRecorder.stopRecording();
+ mSPlayer.play(false);
+
+ am.setSpeakerphoneOn(originalSpeakerPhone);
+ am.setMode(originalMode);
double maxNoAEC = computeAcousticCouplingFactor(mRMSPlayer2.getRmsSnapshots(),
mRMSRecorder2.getRmsSnapshots(), firstShot, lastShot);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/biometrics/BiometricTest.java b/apps/CtsVerifier/src/com/android/cts/verifier/biometrics/BiometricTest.java
index 26597c3..3298e84 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/biometrics/BiometricTest.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/biometrics/BiometricTest.java
@@ -234,6 +234,9 @@
} else if (testType == TEST_AUTHENTICATE) {
if (result == BiometricManager.BIOMETRIC_SUCCESS) {
showBiometricPrompt(false /* allowCredential */);
+ } else if (result == BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE) {
+ showToastAndLog("No biometric features, test passed.");
+ getPassButton().setEnabled(true);
} else {
showToastAndLog("Error: " + result +
" Please ensure at least one biometric is enrolled and try again");
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/intents/CameraIntentsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/intents/CameraIntentsActivity.java
index 2757237..ed711de 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/intents/CameraIntentsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/intents/CameraIntentsActivity.java
@@ -26,6 +26,7 @@
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
import android.hardware.Camera;
+import android.media.ExifInterface;
import android.media.MediaMetadataRetriever;
import android.net.Uri;
import android.os.AsyncTask;
@@ -51,6 +52,8 @@
import static android.media.MediaMetadataRetriever.METADATA_KEY_LOCATION;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.util.TreeSet;
import java.util.Date;
import java.text.SimpleDateFormat;
@@ -88,14 +91,16 @@
private static final int STAGE_APP_PICTURE = 0;
private static final int STAGE_APP_VIDEO = 1;
private static final int STAGE_INTENT_PICTURE = 2;
- private static final int STAGE_INTENT_VIDEO = 3;
- private static final int NUM_STAGES = 4;
+ private static final int STAGE_INTENT_PICTURE_SECURE = 3;
+ private static final int STAGE_INTENT_VIDEO = 4;
+ private static final int NUM_STAGES = 5;
private static final String STAGE_INDEX_EXTRA = "stageIndex";
private static String[] EXPECTED_INTENTS = new String[] {
Camera.ACTION_NEW_PICTURE,
Camera.ACTION_NEW_VIDEO,
null,
+ null,
Camera.ACTION_NEW_VIDEO
};
@@ -103,7 +108,8 @@
private ImageButton mFailButton;
private Button mStartTestButton;
private Button mSettingsButton;
- private File mVideoTargetDir = null;
+ private File mDebugFolder = null;
+ private File mImageTarget = null;
private File mVideoTarget = null;
private int mState = STATE_OFF;
// MediaStore.Images.Media.EXTERNAL_CONTENT_URI or
@@ -132,6 +138,7 @@
JOB_TYPE_IMAGE,
JOB_TYPE_VIDEO,
JOB_TYPE_IMAGE,
+ JOB_TYPE_IMAGE,
JOB_TYPE_VIDEO
};
@@ -226,6 +233,9 @@
if (stageIndex == STAGE_INTENT_PICTURE) {
return "Intent Picture";
}
+ if (stageIndex == STAGE_INTENT_PICTURE_SECURE) {
+ return "Intent Picture Secure";
+ }
if (stageIndex == STAGE_INTENT_VIDEO) {
return "Intent Video";
}
@@ -244,6 +254,9 @@
if (stageIndex == STAGE_INTENT_PICTURE) {
return android.hardware.Camera.ACTION_NEW_PICTURE;
}
+ if (stageIndex == STAGE_INTENT_PICTURE_SECURE) {
+ return android.hardware.Camera.ACTION_NEW_PICTURE + " (Secure)";
+ }
if (stageIndex == STAGE_INTENT_VIDEO) {
return android.hardware.Camera.ACTION_NEW_VIDEO;
}
@@ -262,6 +275,9 @@
if (stageIndex == STAGE_INTENT_PICTURE) {
return getString(R.string.ci_instruction_text_intent_picture_label);
}
+ if (stageIndex == STAGE_INTENT_PICTURE_SECURE) {
+ return getString(R.string.ci_instruction_text_intent_picture_secure_label);
+ }
if (stageIndex == STAGE_INTENT_VIDEO) {
return getString(R.string.ci_instruction_text_intent_video_label);
}
@@ -401,6 +417,7 @@
the intents by taking a photo/video
*/
if (getStageIndex() == STAGE_INTENT_PICTURE ||
+ getStageIndex() == STAGE_INTENT_PICTURE_SECURE ||
getStageIndex() == STAGE_INTENT_VIDEO) {
if (mActivityResult && mState == STATE_STARTED) {
@@ -420,49 +437,91 @@
mActivityResult = true;
synchronized(mLock) {
if (mState != STATE_FAILED) {
- /**
- * For images, we don't need to do more checks, since location in image exif is
- * checked by cts test: MediaStoreUiTest .
- */
- if (stageIndex == STAGE_INTENT_PICTURE) {
- mActionSuccess = true;
- // Set UriSuccess to true to avoid long wait in WaitForTriggerTask
- mUriSuccess = true;
- updateSuccessState();
- return;
+ switch (stageIndex) {
+ case STAGE_INTENT_PICTURE:
+ case STAGE_INTENT_PICTURE_SECURE:
+ handleIntentPictureResult();
+ break;
+ case STAGE_INTENT_VIDEO:
+ handleIntentVideoResult();
+ break;
+ default:
+ return;
}
- if (stageIndex != STAGE_INTENT_VIDEO) {
- return;
- }
-
- if (mVideoTarget == null) {
- Log.d(TAG, "Video target was not set");
- return;
- }
- /**
- * Check that there is no location data in video.
- */
- MediaMetadataRetriever mediaRetriever = new MediaMetadataRetriever();
- mediaRetriever.setDataSource(mVideoTarget.toString());
- if (mediaRetriever.extractMetadata(METADATA_KEY_HAS_VIDEO) == null ||
- mediaRetriever.extractMetadata(METADATA_KEY_LOCATION) != null) {
- mState = STATE_FAILED;
- } else {
- mVideoTarget.delete();
- }
- Log.d(TAG, "METADATA_KEY_HAS_VIDEO: " +
- mediaRetriever.extractMetadata(METADATA_KEY_HAS_VIDEO) +
- " METADATA_KEY_LOCATION: " +
- mediaRetriever.extractMetadata(METADATA_KEY_LOCATION));
- mediaRetriever.release();
- /* successful, unless we get the URI trigger back
- at some point later on */
- mActionSuccess = true;
}
}
}
}
+ private void handleIntentPictureResult() {
+ if (mImageTarget == null) {
+ Log.d(TAG, "Image target was not set");
+ return;
+ }
+ try {
+ if (!mImageTarget.exists() || mImageTarget.length() == 0) {
+ Log.d(TAG, "Image target does not exist or is empty");
+ mState = STATE_FAILED;
+ return;
+ }
+
+ try {
+ final ExifInterface exif = new ExifInterface(new FileInputStream(mImageTarget));
+ if (!checkExifAttribute(exif, ExifInterface.TAG_MAKE)
+ || !checkExifAttribute(exif, ExifInterface.TAG_MODEL)
+ || !checkExifAttribute(exif, ExifInterface.TAG_DATETIME)) {
+ Log.d(TAG, "The required tag does not appear in the exif");
+ mState = STATE_FAILED;
+ return;
+ }
+
+ float[] latLong = new float[2];
+ if (exif.getLatLong(latLong)) {
+ Log.d(TAG, "Should not contain location information");
+ mState = STATE_FAILED;
+ return;
+ }
+ mActionSuccess = true;
+ } catch (IOException ex) {
+ Log.e(TAG, "Failed to verify Exif", ex);
+ mState = STATE_FAILED;
+ return;
+ }
+ } finally {
+ mImageTarget.delete();
+ }
+ }
+
+ private void handleIntentVideoResult() {
+ if (mVideoTarget == null) {
+ Log.d(TAG, "Video target was not set");
+ return;
+ }
+ /**
+ * Check that there is no location data in video.
+ */
+ MediaMetadataRetriever mediaRetriever = new MediaMetadataRetriever();
+ mediaRetriever.setDataSource(mVideoTarget.toString());
+ if (mediaRetriever.extractMetadata(METADATA_KEY_HAS_VIDEO) == null ||
+ mediaRetriever.extractMetadata(METADATA_KEY_LOCATION) != null) {
+ mState = STATE_FAILED;
+ } else {
+ mVideoTarget.delete();
+ }
+ Log.d(TAG, "METADATA_KEY_HAS_VIDEO: " +
+ mediaRetriever.extractMetadata(METADATA_KEY_HAS_VIDEO) +
+ " METADATA_KEY_LOCATION: " +
+ mediaRetriever.extractMetadata(METADATA_KEY_LOCATION));
+ mediaRetriever.release();
+ /* successful, unless we get the URI trigger back at some point later on. */
+ mActionSuccess = true;
+ }
+
+ private boolean checkExifAttribute(ExifInterface exif, String tag) {
+ final String res = exif.getAttribute(tag);
+ return res != null && res.length() > 0;
+ }
+
@Override
public String getTestDetails() {
return mReportBuilder.toString();
@@ -487,8 +546,9 @@
// For STAGE_INTENT_PICTURE test, if EXTRA_OUTPUT is not assigned in intent,
// file should NOT be saved so triggering this is a test failure.
- if (getStageIndex() == STAGE_INTENT_PICTURE) {
- Log.e(TAG, "FAIL: STAGE_INTENT_PICTURE test should not create file");
+ if (getStageIndex() == STAGE_INTENT_PICTURE ||
+ getStageIndex() == STAGE_INTENT_PICTURE_SECURE) {
+ Log.e(TAG, "FAIL: STAGE_INTENT_PICTURE or STAGE_INTENT_PICTURE_SECURE test should not create file");
mState = STATE_FAILED;
}
@@ -503,8 +563,9 @@
e.printStackTrace();
}
- if (getStageIndex() == STAGE_INTENT_PICTURE) {
- // STAGE_INTENT_PICTURE should timeout
+ if (getStageIndex() == STAGE_INTENT_PICTURE ||
+ getStageIndex() == STAGE_INTENT_PICTURE_SECURE) {
+ // STAGE_INTENT_PICTURE or STAGE_INTENT_PICTURE_SECURE should timeout
return true;
} else {
Log.e(TAG, "FAIL: timeout waiting for URI trigger");
@@ -549,7 +610,9 @@
* Video intents do not need to wait on a ContentProvider broadcast since we're starting
* the intent activity with EXTRA_OUTPUT set
*/
- if (stageIndex != STAGE_INTENT_VIDEO) {
+ if (stageIndex != STAGE_INTENT_VIDEO &&
+ stageIndex != STAGE_INTENT_PICTURE &&
+ stageIndex != STAGE_INTENT_PICTURE_SECURE) {
JobInfo job = makeJobInfo(TEST_JOB_TYPES[stageIndex]);
jobScheduler.schedule(job);
new WaitForTriggerTask().execute();
@@ -569,27 +632,43 @@
if (stageIndex == STAGE_INTENT_PICTURE) {
intentStr = android.provider.MediaStore.ACTION_IMAGE_CAPTURE;
}
+ else if (stageIndex == STAGE_INTENT_PICTURE_SECURE) {
+ intentStr = android.provider.MediaStore.ACTION_IMAGE_CAPTURE_SECURE;
+ }
else if (stageIndex == STAGE_INTENT_VIDEO) {
intentStr = android.provider.MediaStore.ACTION_VIDEO_CAPTURE;
}
if (intentStr != null) {
cameraIntent = new Intent(intentStr);
- if (stageIndex == STAGE_INTENT_VIDEO) {
- String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
- mVideoTargetDir = new File(this.getFilesDir(), "debug");
- mVideoTarget = new File(mVideoTargetDir, timeStamp + "video.mp4");
- mVideoTargetDir.mkdirs();
- if (!mVideoTargetDir.exists()) {
- Toast.makeText(this, R.string.ci_directory_creation_error,
- Toast.LENGTH_SHORT).show();
- Log.v(TAG, "Could not create directory");
- return;
- }
- cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(this,
- "com.android.cts.verifier.managedprovisioning.fileprovider",
- mVideoTarget));
+ mDebugFolder = new File(this.getFilesDir(), "debug");
+ mDebugFolder.mkdirs();
+ if (!mDebugFolder.exists()) {
+ Toast.makeText(this, R.string.ci_directory_creation_error,
+ Toast.LENGTH_SHORT).show();
+ Log.v(TAG, "Could not create directory");
+ return;
}
+
+ File targetFile;
+ String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
+ switch (stageIndex) {
+ case STAGE_INTENT_PICTURE:
+ case STAGE_INTENT_PICTURE_SECURE:
+ mImageTarget = new File(mDebugFolder, timeStamp + "capture.jpg");
+ targetFile = mImageTarget;
+ break;
+ case STAGE_INTENT_VIDEO:
+ mVideoTarget = new File(mDebugFolder, timeStamp + "video.mp4");
+ targetFile = mVideoTarget;
+ break;
+ default:
+ Log.wtf(TAG, "Unexpected stage index to send intent with extras");
+ return;
+ }
+ cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, FileProvider.getUriForFile(this,
+ "com.android.cts.verifier.managedprovisioning.fileprovider",
+ targetFile));
startActivityForResult(cameraIntent, 1337 + getStageIndex());
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
index 7d2f25d..27b9b79 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
@@ -349,6 +349,7 @@
+ e, Toast.LENGTH_SHORT).show();
}
+ super.onCreate(savedInstanceState);
if (mToBeTestedCameraIds.size() == 0) {
showToast(R.string.all_exempted_devices);
ItsTestActivity.this.getReportLog().setSummary(
@@ -356,7 +357,6 @@
, 1.0, ResultType.NEUTRAL, ResultUnit.NONE);
setTestResultAndFinish(true);
}
- super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MagneticFieldMeasurementTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MagneticFieldMeasurementTestActivity.java
index d98b3df..1625dd3 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MagneticFieldMeasurementTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MagneticFieldMeasurementTestActivity.java
@@ -107,6 +107,8 @@
* - the values representing the expectation of the test
* - the values sampled from the sensor
*/
+// TODO: Re-enable when b/146757096 is fixed
+/*
@SuppressWarnings("unused")
public String testOffset() throws Throwable {
getTestLogger().logMessage(R.string.snsr_mag_verify_offset);
@@ -116,12 +118,13 @@
Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED,
SensorManager.SENSOR_DELAY_FASTEST);
TestSensorOperation verifyOffset =
- TestSensorOperation.createOperation(environment, 100 /* event count */);
+ TestSensorOperation.createOperation(environment, 100 /* event count );
verifyOffset.addVerification(OffsetVerification.getDefault(environment));
verifyOffset.execute(getCurrentTestNode());
return null;
}
+*/
/**
* This test verifies that the standard deviation of a set of sampled data from a particular
diff --git a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/LocaleDeviceInfo.java b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/LocaleDeviceInfo.java
index e7cb095..7a5dfb8 100644
--- a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/LocaleDeviceInfo.java
+++ b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/LocaleDeviceInfo.java
@@ -15,15 +15,28 @@
*/
package com.android.compatibility.common.deviceinfo;
+import android.icu.util.ULocale;
+import android.util.Log;
+import androidx.annotation.Nullable;
import com.android.compatibility.common.util.DeviceInfoStore;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.stream.Collectors;
/**
* Locale device info collector.
*/
public final class LocaleDeviceInfo extends DeviceInfo {
+ private static final String TAG = "LocaleDeviceInfo";
@Override
protected void collectDeviceInfo(DeviceInfoStore store) throws Exception {
@@ -34,5 +47,78 @@
locales.add("en_US");
}
store.addListResult("locale", locales);
+
+ List<String> icuLocales = Arrays.stream(ULocale.getAvailableLocales())
+ .map((uLocale -> uLocale.toLanguageTag()))
+ .collect(Collectors.toList());
+ if (icuLocales.isEmpty()) {
+ // default locale
+ icuLocales.add(ULocale.US.toLanguageTag());
+ }
+ store.addListResult("icu_locale", icuLocales);
+
+ collectLocaleDataFilesInfo(store);
+ }
+
+ /**
+ * Collect the fingerprints of ICU data files. On AOSP build, there are only 2 data files.
+ * The example paths are /apex/com.android.tzdata/etc/icu/icu_tzdata.dat and
+ * /apex/com.android.i18n/etc/icu/icudt65l.dat
+ */
+ private void collectLocaleDataFilesInfo(DeviceInfoStore store) throws IOException {
+ String prop = System.getProperty("android.icu.impl.ICUBinary.dataPath");
+ store.startArray("icu_data_file_info");
+ if (prop != null) {
+ String[] dataDirs = prop.split(":");
+ // List all readable ".dat" files in the directories.
+ List<File> datFiles = Arrays.stream(dataDirs)
+ .filter((dir) -> dir != null && !dir.isEmpty())
+ .map((dir) -> new File(dir))
+ .filter((f) -> f.canRead() && f.isDirectory())
+ .map((f) -> f.listFiles())
+ .filter((files) -> files != null)
+ .map((files) -> Arrays.asList(files))
+ .reduce(new ArrayList<>(), (l1, l2) -> {
+ l1.addAll(l2);
+ return l1;
+ })
+ .stream()
+ .filter((f) -> f != null && f.canRead() && f.getName().endsWith(".dat"))
+ .collect(Collectors.toList());
+
+ for (File datFile : datFiles) {
+ String sha256Hash = sha256(datFile);
+
+ store.startGroup();
+ store.addResult("file_path", datFile.getPath());
+ // Still store the null hash to indicate an error occurring when obtaining the hash.
+ store.addResult("file_sha256", sha256Hash);
+ store.endGroup();
+ }
+ }
+ store.endArray();
+ }
+
+ public static @Nullable String sha256(File file) {
+ try (FileInputStream in = new FileInputStream(file);
+ FileChannel fileChannel = in.getChannel()) {
+
+ MappedByteBuffer mappedByteBuffer = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0,
+ fileChannel.size());
+
+ MessageDigest md = MessageDigest.getInstance("SHA-256");
+ md.update(mappedByteBuffer);
+
+ byte[] digest = md.digest();
+ StringBuilder sb = new StringBuilder(digest.length * 2);
+ for(int i = 0; i < digest.length; i++){
+ sb.append(Character.forDigit((digest[i] >> 4) & 0xF, 16));
+ sb.append(Character.forDigit((digest[i] & 0xF), 16));
+ }
+ return sb.toString();
+ } catch (IOException | NoSuchAlgorithmException e) {
+ Log.w(TAG, String.format("Can't obtain the hash of file: %s", file), e);
+ return null;
+ }
}
}
diff --git a/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java b/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java
index 5373a3b..b3715c3 100644
--- a/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java
+++ b/hostsidetests/angle/src/android/angle/cts/CtsAngleDeveloperOptionHostTest.java
@@ -20,7 +20,6 @@
import com.android.ddmlib.Log.LogLevel;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.IDeviceTest;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
import org.junit.After;
@@ -34,7 +33,7 @@
* Tests ANGLE Developer Option Opt-In/Out functionality.
*/
@RunWith(DeviceJUnit4ClassRunner.class)
-public class CtsAngleDeveloperOptionHostTest extends BaseHostJUnit4Test implements IDeviceTest {
+public class CtsAngleDeveloperOptionHostTest extends BaseHostJUnit4Test {
private static final String TAG = CtsAngleDeveloperOptionHostTest.class.getSimpleName();
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/appcompat/host/lib/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/appcompat/host/lib/Android.bp
index 9ad6c7f..80be793 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/appcompat/host/lib/Android.bp
@@ -12,19 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
+java_library_host {
+ name: "CompatChangeGatingTestBase",
+ srcs: ["**/*.java"],
+ libs: [
+ "cts-tradefed",
+ "tradefed",
+ "compatibility-host-util",
+ "host-libprotobuf-java-full",
+ "platformprotos",
],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
- test_suites: [
- "cts",
- "mts",
- "general-tests",
- ],
- sdk_version: "system_current",
+
}
diff --git a/hostsidetests/appcompat/host/lib/src/android/compat/cts/CompatChangeGatingTestCase.java b/hostsidetests/appcompat/host/lib/src/android/compat/cts/CompatChangeGatingTestCase.java
new file mode 100644
index 0000000..9a464b7
--- /dev/null
+++ b/hostsidetests/appcompat/host/lib/src/android/compat/cts/CompatChangeGatingTestCase.java
@@ -0,0 +1,327 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.compat.cts;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
+import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
+import com.android.ddmlib.testrunner.TestResult.TestStatus;
+import com.android.internal.os.StatsdConfigProto;
+import com.android.os.AtomsProto;
+import com.android.os.AtomsProto.Atom;
+import com.android.os.StatsLog.ConfigMetricsReport;
+import com.android.os.StatsLog.ConfigMetricsReportList;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.device.CollectingByteOutputReceiver;
+import com.android.tradefed.device.CollectingOutputReceiver;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.result.CollectingTestListener;
+import com.android.tradefed.result.TestDescription;
+import com.android.tradefed.result.TestResult;
+import com.android.tradefed.result.TestRunResult;
+import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IBuildReceiver;
+
+import com.google.common.io.Files;
+import com.google.protobuf.InvalidProtocolBufferException;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nonnull;
+
+// Shamelessly plagiarised from incident's ProtoDumpTestCase and statsd's BaseTestCase family
+public class CompatChangeGatingTestCase extends DeviceTestCase implements IBuildReceiver {
+ protected IBuildInfo mCtsBuild;
+
+ private static final String UPDATE_CONFIG_CMD = "cat %s | cmd stats config update %d";
+ private static final String DUMP_REPORT_CMD =
+ "cmd stats dump-report %d --include_current_bucket --proto";
+ private static final String REMOVE_CONFIG_CMD = "cmd stats config remove %d";
+
+ private static final String TEST_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ assertThat(mCtsBuild).isNotNull();
+ }
+
+ @Override
+ public void setBuild(IBuildInfo buildInfo) {
+ mCtsBuild = buildInfo;
+ }
+
+ /**
+ * Install a device side test package.
+ *
+ * @param appFileName Apk file name, such as "CtsNetStatsApp.apk".
+ * @param grantPermissions whether to give runtime permissions.
+ */
+ protected void installPackage(String appFileName, boolean grantPermissions)
+ throws FileNotFoundException, DeviceNotAvailableException {
+ CLog.d("Installing app " + appFileName);
+ CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(mCtsBuild);
+ final String result = getDevice().installPackage(buildHelper.getTestFile(appFileName), true,
+ grantPermissions);
+ assertWithMessage("Failed to install %s: %s", appFileName, result).that(result).isNull();
+ }
+
+ /**
+ * Uninstall a device side test package.
+ *
+ * @param appFileName Apk file name, such as "CtsNetStatsApp.apk".
+ * @param shouldSucceed Whether to assert on failure.
+ */
+ protected void uninstallPackage(String packageName, boolean shouldSucceed)
+ throws DeviceNotAvailableException {
+ final String result = getDevice().uninstallPackage(packageName);
+ if (shouldSucceed) {
+ assertWithMessage("uninstallPackage(%s) failed: %s", packageName, result)
+ .that(result).isNull();
+ }
+ }
+
+ /**
+ * Run a device side compat test.
+ *
+ * @param pkgName Test package name, such as
+ * "com.android.server.cts.netstats".
+ * @param testClassName Test class name; either a fully qualified name, or "."
+ * + a class name.
+ * @param testMethodName Test method name.
+ */
+ protected void runDeviceCompatTest(@Nonnull String pkgName, @Nonnull String testClassName,
+ @Nonnull String testMethodName,
+ Set<Long> enabledChanges, Set<Long> disabledChanges)
+ throws DeviceNotAvailableException {
+
+ // Set compat overrides
+ setCompatConfig(enabledChanges, disabledChanges, pkgName);
+
+ // Send statsd config
+ final long configId = getClass().getCanonicalName().hashCode();
+ createAndUploadStatsdConfig(configId, pkgName);
+
+ // Run device-side test
+ if (testClassName.startsWith(".")) {
+ testClassName = pkgName + testClassName;
+ }
+ RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(pkgName, TEST_RUNNER,
+ getDevice().getIDevice());
+ testRunner.setMethodName(testClassName, testMethodName);
+ CollectingTestListener listener = new CollectingTestListener();
+ assertThat(getDevice().runInstrumentationTests(testRunner, listener)).isTrue();
+
+ // Clear overrides.
+ resetCompatChanges(enabledChanges, pkgName);
+ resetCompatChanges(disabledChanges, pkgName);
+
+ // Clear statsd report data and remove config
+ Map<Long, Boolean> reportedChanges = getReportedChanges(configId, pkgName);
+ removeStatsdConfig(configId);
+
+ // Check that device side test occurred as expected
+ final TestRunResult result = listener.getCurrentRunResults();
+ assertWithMessage("Failed to successfully run device tests for %s: %s",
+ result.getName(), result.getRunFailureMessage())
+ .that(result.isRunFailure()).isFalse();
+ assertWithMessage("Should run only exactly one test method!")
+ .that(result.getNumTests()).isEqualTo(1);
+ if (result.hasFailedTests()) {
+ // build a meaningful error message
+ StringBuilder errorBuilder = new StringBuilder("On-device test failed:\n");
+ for (Map.Entry<TestDescription, TestResult> resultEntry :
+ result.getTestResults().entrySet()) {
+ if (!resultEntry.getValue().getStatus().equals(TestStatus.PASSED)) {
+ errorBuilder.append(resultEntry.getKey().toString());
+ errorBuilder.append(":\n");
+ errorBuilder.append(resultEntry.getValue().getStackTrace());
+ }
+ }
+ throw new AssertionError(errorBuilder.toString());
+ }
+
+ // Validate statsd report
+ validatePostRunStatsdReport(reportedChanges, enabledChanges, disabledChanges);
+ }
+
+ /**
+ * Gets the statsd report. Note that this also deletes that report from statsd.
+ */
+ private List<ConfigMetricsReport> getReportList(long configId) throws DeviceNotAvailableException {
+ try {
+ final CollectingByteOutputReceiver receiver = new CollectingByteOutputReceiver();
+ getDevice().executeShellCommand(String.format(DUMP_REPORT_CMD, configId), receiver);
+ return ConfigMetricsReportList.parser()
+ .parseFrom(receiver.getOutput())
+ .getReportsList();
+ } catch (InvalidProtocolBufferException e) {
+ throw new IllegalStateException("Failed to fetch and parse the statsd output report.",
+ e);
+ }
+ }
+
+ /**
+ * Creates and uploads a statsd config that matches the AppCompatibilityChangeReported atom
+ * logged by a given package name.
+ *
+ * @param configId A unique config id.
+ * @param pkgName The package name of the app that is expected to report the atom. It will be
+ * the only allowed log source.
+ */
+ private void createAndUploadStatsdConfig(long configId, String pkgName)
+ throws DeviceNotAvailableException {
+ final String atomName = "Atom" + System.nanoTime();
+ final String eventName = "Event" + System.nanoTime();
+ final ITestDevice device = getDevice();
+
+ StatsdConfigProto.StatsdConfig.Builder configBuilder =
+ StatsdConfigProto.StatsdConfig.newBuilder()
+ .setId(configId)
+ .addAllowedLogSource(pkgName);
+ StatsdConfigProto.SimpleAtomMatcher.Builder simpleAtomMatcherBuilder =
+ StatsdConfigProto.SimpleAtomMatcher
+ .newBuilder().setAtomId(
+ Atom.APP_COMPATIBILITY_CHANGE_REPORTED_FIELD_NUMBER);
+ configBuilder.addAtomMatcher(
+ StatsdConfigProto.AtomMatcher.newBuilder()
+ .setId(atomName.hashCode())
+ .setSimpleAtomMatcher(simpleAtomMatcherBuilder));
+ configBuilder.addEventMetric(
+ StatsdConfigProto.EventMetric.newBuilder()
+ .setId(eventName.hashCode())
+ .setWhat(atomName.hashCode()));
+ StatsdConfigProto.StatsdConfig config = configBuilder.build();
+ try {
+ File configFile = File.createTempFile("statsdconfig", ".config");
+ configFile.deleteOnExit();
+ Files.write(config.toByteArray(), configFile);
+ String remotePath = "/data/local/tmp/" + configFile.getName();
+ device.pushFile(configFile, remotePath);
+ device.executeShellCommand(String.format(UPDATE_CONFIG_CMD, remotePath, configId));
+ device.executeShellCommand("rm " + remotePath);
+ } catch (IOException e) {
+ throw new RuntimeException("IO error when writing to temp file.", e);
+ }
+ }
+
+ /**
+ * Gets the uid of the test app.
+ */
+ protected int getUid(@Nonnull String packageName) throws DeviceNotAvailableException {
+ int currentUser = getDevice().getCurrentUser();
+ String uidLine = getDevice()
+ .executeShellCommand(
+ "cmd package list packages -U --user " + currentUser + " "
+ + packageName);
+ String[] uidLineParts = uidLine.split(":");
+ // 3rd entry is package uid
+ assertThat(uidLineParts.length).isGreaterThan(2);
+ int uid = Integer.parseInt(uidLineParts[2].trim());
+ assertThat(uid).isGreaterThan(10000);
+ return uid;
+ }
+
+ /**
+ * Set the compat config using adb.
+ *
+ * @param enabledChanges Changes to be enabled.
+ * @param disabledChanges Changes to be disabled.
+ * @param packageName Package name for the app whose config is being changed.
+ */
+ private void setCompatConfig(Set<Long> enabledChanges, Set<Long> disabledChanges,
+ @Nonnull String packageName) throws DeviceNotAvailableException {
+ for (Long enabledChange : enabledChanges) {
+ runCommand("am compat enable " + enabledChange + " " + packageName);
+ }
+ for (Long disabledChange : disabledChanges) {
+ runCommand("am compat disable " + disabledChange + " " + packageName);
+ }
+ }
+
+ /**
+ * Reset changes to default for a package.
+ */
+ private void resetCompatChanges(Set<Long> changes, @Nonnull String packageName)
+ throws DeviceNotAvailableException {
+ for (Long change : changes) {
+ runCommand("am compat reset " + change + " " + packageName);
+ }
+ }
+
+ /**
+ * Remove statsd config for a given id.
+ */
+ private void removeStatsdConfig(long configId) throws DeviceNotAvailableException {
+ getDevice().executeShellCommand(
+ String.join(" ", REMOVE_CONFIG_CMD, String.valueOf(configId)));
+ }
+
+ /**
+ * Get the compat changes that were logged.
+ */
+ private Map<Long, Boolean> getReportedChanges(long configId, String pkgName)
+ throws DeviceNotAvailableException {
+ final int packageUid = getUid(pkgName);
+ return getReportList(configId).stream()
+ .flatMap(report -> report.getMetricsList().stream())
+ .flatMap(metric -> metric.getEventMetrics().getDataList().stream())
+ .filter(eventMetricData -> eventMetricData.hasAtom())
+ .map(eventMetricData -> eventMetricData.getAtom())
+ .map(atom -> atom.getAppCompatibilityChangeReported())
+ .filter(atom -> atom != null && atom.getUid() == packageUid) // Should be redundant
+ .collect(Collectors.toMap(
+ atom -> atom.getChangeId(), // Key
+ atom -> atom.getState() == // Value
+ AtomsProto.AppCompatibilityChangeReported.State.ENABLED));
+ }
+
+ /**
+ * Validate that all overridden changes were logged while running the test.
+ */
+ private void validatePostRunStatsdReport(Map<Long, Boolean> reportedChanges,
+ Set<Long> enabledChanges, Set<Long> disabledChanges)
+ throws DeviceNotAvailableException {
+ for (Long enabledChange : enabledChanges) {
+ assertThat(reportedChanges)
+ .containsEntry(enabledChange, true);
+ }
+ for (Long disabledChange : disabledChanges) {
+ assertThat(reportedChanges)
+ .containsEntry(disabledChange, false);
+ }
+ }
+
+ /**
+ * Execute the given command, and returns the output.
+ */
+ protected String runCommand(String command) throws DeviceNotAvailableException {
+ final CollectingOutputReceiver receiver = new CollectingOutputReceiver();
+ getDevice().executeShellCommand(command, receiver);
+ return receiver.getOutput();
+ }
+}
diff --git a/hostsidetests/appsecurity/AndroidTest.xml b/hostsidetests/appsecurity/AndroidTest.xml
index 4b220d4..2952ca7 100644
--- a/hostsidetests/appsecurity/AndroidTest.xml
+++ b/hostsidetests/appsecurity/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="android.appsecurity.cts.AppSecurityPreparer" />
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CtsAppSecurityHostTestCases.jar" />
diff --git a/hostsidetests/appsecurity/OWNERS b/hostsidetests/appsecurity/OWNERS
index fc0a238..5031616 100644
--- a/hostsidetests/appsecurity/OWNERS
+++ b/hostsidetests/appsecurity/OWNERS
@@ -1,6 +1,7 @@
# Bug component: 533114
toddke@google.com
per-file AccessSerialNumberTest.java = moltmann@google.com
+per-file AdoptableFeatureConsistentTest.java = jsharkey@google.com
per-file AdoptableHostTest.java = jsharkey@google.com
per-file ApexSignatureVerificationTest.java = dariofreni@google.com
per-file ApplicationVisibilityTest.java = toddke@google.com
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
index 2392069..e9ab634 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
@@ -19,6 +19,8 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
+import android.platform.test.annotations.RestrictedBuildTest;
+
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
@@ -129,9 +131,18 @@
}
}
+ /**
+ * Assert that the preloaded apexes are secure, not signed with wellknown keys.
+ *
+ * Debuggable aosp or gsi rom could not preload official apexes module allowing.
+ *
+ * Note: This test will fail on userdebug / eng devices, but should pass
+ * on production (user) builds.
+ */
+ @SuppressWarnings("productionOnly")
+ @RestrictedBuildTest
@Test
public void testApexPubKeyIsNotWellKnownKey() {
-
for (Map.Entry<String, File> entry : mExtractedTestDirMap.entrySet()) {
final File pubKeyFile = FileUtil.findFile(entry.getValue(), APEX_PUB_KEY_NAME);
final Iterator it = mWellKnownKeyFileList.iterator();
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java
index 8f9b9b5..346b521 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java
@@ -126,7 +126,7 @@
protected void assertPasswordSufficiency(boolean expectPasswordSufficient) {
waitUntilUserUnlocked();
- int retries = 15;
+ int retries = 100;
// isActivePasswordSufficient() gets the result asynchronously so let's retry a few times
while (retries >= 0
&& mDevicePolicyManager.isActivePasswordSufficient() != expectPasswordSufficient) {
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
index 932943a..58a14e6 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
@@ -35,10 +35,6 @@
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
/**
* Test class that is meant to be driven from the host and can't be run alone, which is required
* for tests that include rebooting or other connection-breaking steps. For this reason, this class
@@ -46,7 +42,6 @@
* device. Therefore, the host is responsible for making sure the tests leave the device in a clean
* state after running.
*/
-@RunWith(AndroidJUnit4.class)
public class LockTaskHostDrivenTest extends BaseDeviceAdminTest {
private static final String TAG = LockTaskHostDrivenTest.class.getName();
@@ -62,7 +57,6 @@
private TelecomManager mTelcomManager;
private DevicePolicyManager mDevicePolicyManager;
- @Before
public void setUp() {
mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
mContext = InstrumentationRegistry.getContext();
@@ -72,7 +66,6 @@
mDevicePolicyManager = mContext.getSystemService(DevicePolicyManager.class);
}
- @Test
public void startLockTask() throws Exception {
Log.d(TAG, "startLockTask on host-driven test (no cleanup)");
setLockTaskPackages(mContext.getPackageName());
@@ -81,7 +74,6 @@
mUiDevice.waitForIdle();
}
- @Test
public void cleanupLockTask() {
Log.d(TAG, "cleanupLockTask on host-driven test");
mDevicePolicyManager.clearPackagePersistentPreferredActivities(
@@ -97,7 +89,6 @@
* On low-RAM devices, this test can take too long to finish, so the test runner can incorrectly
* assume it's finished. Therefore, only use it once in a given test.
*/
- @Test
public void testLockTaskIsActiveAndCantBeInterrupted() throws Exception {
Log.d(TAG, "testLockTaskIsActiveAndCantBeInterrupted on host-driven test");
waitAndCheckLockedActivityIsResumed();
@@ -118,7 +109,6 @@
mUiDevice.waitForIdle();
}
- @Test
public void testLockTaskIsExitedIfNotWhitelisted() throws Exception {
Log.d(TAG, "testLockTaskIsExitedIfNotWhitelisted on host-driven test");
@@ -141,7 +131,6 @@
assertEquals(ActivityManager.LOCK_TASK_MODE_NONE, mActivityManager.getLockTaskModeState());
}
- @Test
public void testLockTaskCanLaunchDefaultDialer() throws Exception {
if (!hasTelephonyFeature()) {
Log.d(TAG, "testLockTaskCanLaunchDefaultDialer skipped");
@@ -178,7 +167,6 @@
mActivityManager.getLockTaskModeState());
}
- @Test
public void testLockTaskCanLaunchEmergencyDialer() throws Exception {
if (!hasTelephonyFeature()) {
Log.d(TAG, "testLockTaskCanLaunchEmergencyDialer skipped");
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskTest.java
index 37f1be3..2f9bc37 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskTest.java
@@ -40,14 +40,8 @@
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import java.util.concurrent.TimeUnit;
-@RunWith(AndroidJUnit4.class)
public class LockTaskTest extends BaseDeviceAdminTest {
private static final String TAG = "LockTaskTest";
@@ -143,7 +137,6 @@
private ActivityManager mActivityManager;
private DevicePolicyManager mDevicePolicyManager;
- @Before
public void setUp() {
mContext = InstrumentationRegistry.getContext();
@@ -161,14 +154,12 @@
mContext.registerReceiver(mReceiver, filter);
}
- @After
public void tearDown() {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[0]);
mContext.unregisterReceiver(mReceiver);
}
// Setting and unsetting the lock task packages.
- @Test
public void testSetLockTaskPackages() {
final String[] packages = new String[] { TEST_PACKAGE, "some.other.package" };
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, packages);
@@ -182,7 +173,6 @@
// Setting and unsetting the lock task features. The actual UI behavior is tested with CTS
// verifier.
- @Test
public void testSetLockTaskFeatures() {
final int[] flags = new int[] {
LOCK_TASK_FEATURE_SYSTEM_INFO,
@@ -216,7 +206,6 @@
}
// Start lock task, verify that ActivityManager knows thats what is going on.
- @Test
public void testStartLockTask() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startLockTask(UTILITY_ACTIVITY);
@@ -232,7 +221,6 @@
// Verifies that the act of finishing is blocked by ActivityManager in lock task.
// This results in onDestroy not being called until stopLockTask is called before finish.
- @Test
public void testCannotFinish() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startLockTask(UTILITY_ACTIVITY);
@@ -246,7 +234,6 @@
}
// Verifies that updating the whitelisting during lock task mode finishes the locked task.
- @Test
public void testUpdateWhitelisting() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startLockTask(UTILITY_ACTIVITY);
@@ -264,7 +251,6 @@
// Verifies that removing the whitelist authorization immediately finishes the corresponding
// locked task. The other locked task(s) should remain locked.
- @Test
public void testUpdateWhitelisting_twoTasks() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME,
RECEIVER_ACTIVITY_PACKAGE_NAME});
@@ -298,7 +284,6 @@
// This launches an activity that is in the current task.
// This should always be permitted as a part of lock task (since it isn't a new task).
- @Test
public void testStartActivity_withinTask() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startLockTask(UTILITY_ACTIVITY);
@@ -319,7 +304,6 @@
// This launches a whitelisted activity that is not part of the current task.
// This should be permitted as a part of lock task.
- @Test
public void testStartActivity_outsideTaskWhitelisted() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME,
RECEIVER_ACTIVITY_PACKAGE_NAME});
@@ -338,7 +322,6 @@
// This launches a non-whitelisted activity that is not part of the current task.
// This should be blocked.
- @Test
public void testStartActivity_outsideTaskNonWhitelisted() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startLockTask(UTILITY_ACTIVITY);
@@ -355,7 +338,6 @@
// Test the lockTaskMode flag for an activity declaring if_whitelisted.
// Whitelist the activity and verify that lock task mode is started.
- @Test
public void testManifestArgument_whitelisted() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startAndWait(getLockTaskUtility(UTILITY_ACTIVITY_IF_WHITELISTED));
@@ -370,7 +352,6 @@
// Test the lockTaskMode flag for an activity declaring if_whitelisted.
// Don't whitelist the activity and verify that lock task mode is not started.
- @Test
public void testManifestArgument_nonWhitelisted() throws Exception {
startAndWait(getLockTaskUtility(UTILITY_ACTIVITY_IF_WHITELISTED));
waitForResume();
@@ -384,7 +365,6 @@
// Test the lockTaskMode flag for an activity declaring if_whitelisted.
// An activity locked via manifest argument cannot finish without calling stopLockTask.
- @Test
public void testManifestArgument_cannotFinish() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startAndWait(getLockTaskUtility(UTILITY_ACTIVITY_IF_WHITELISTED));
@@ -400,7 +380,6 @@
// Test the lockTaskMode flag for an activity declaring if_whitelisted.
// Verifies that updating the whitelisting during lock task mode finishes the locked task.
- @Test
public void testManifestArgument_updateWhitelisting() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startAndWait(getLockTaskUtility(UTILITY_ACTIVITY_IF_WHITELISTED));
@@ -418,7 +397,6 @@
}
// Start lock task with ActivityOptions
- @Test
public void testActivityOptions_whitelisted() throws Exception {
mDevicePolicyManager.setLockTaskPackages(ADMIN_COMPONENT, new String[] { PACKAGE_NAME });
startLockTaskWithOptions(UTILITY_ACTIVITY);
@@ -433,9 +411,13 @@
}
// Starting a non-whitelisted activity with ActivityOptions is not allowed
- @Test(expected = SecurityException.class)
public void testActivityOptions_nonWhitelisted() throws Exception {
- startLockTaskWithOptions(UTILITY_ACTIVITY);
+ try {
+ startLockTaskWithOptions(UTILITY_ACTIVITY);
+ fail();
+ } catch (SecurityException e) {
+ // pass
+ }
}
/**
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
index f39dbbe..65c952f 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
@@ -38,7 +38,7 @@
assertEquals(Collections.singletonList("test.package"),
mDevicePolicyManager.getKeepUninstalledPackages(mIncomingComponentName));
assertEquals(123, mDevicePolicyManager.getPasswordMinimumLength(mIncomingComponentName));
- assertSystemPoliciesEqual(SystemUpdatePolicy.createWindowedInstallPolicy(123, 456),
+ assertSystemPoliciesEqual(SystemUpdatePolicy.createPostponeInstallPolicy(),
mDevicePolicyManager.getSystemUpdatePolicy());
assertThrows(SecurityException.class, () -> {
mDevicePolicyManager.getParentProfileInstance(mIncomingComponentName);
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
index b42b2bd..ce8736f 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
@@ -47,7 +47,7 @@
mDevicePolicyManager.setKeepUninstalledPackages(mOutgoingComponentName,
Collections.singletonList("test.package"));
mDevicePolicyManager.setSystemUpdatePolicy(mOutgoingComponentName,
- SystemUpdatePolicy.createWindowedInstallPolicy(123, 456));
+ SystemUpdatePolicy.createPostponeInstallPolicy());
PersistableBundle b = new PersistableBundle();
mDevicePolicyManager.transferOwnership(mOutgoingComponentName, INCOMING_COMPONENT_NAME, b);
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
index 7c335c2..d2f5a08 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
@@ -577,13 +577,16 @@
if (!mHasFeature) {
return;
}
- executeDeviceOwnerTest("SystemUpdatePolicyTest");
+ // Disabled due to 145932189
+ // executeDeviceOwnerTest("SystemUpdatePolicyTest");
}
public void testSetSystemUpdatePolicyLogged() throws Exception {
if (!mHasFeature) {
return;
}
+ // Disabled due to 145932189
+ /*
assertMetricsLogged(getDevice(), () -> {
executeDeviceTestMethod(".SystemUpdatePolicyTest", "testSetAutomaticInstallPolicy");
}, new DevicePolicyEventWrapper.Builder(EventId.SET_SYSTEM_UPDATE_POLICY_VALUE)
@@ -608,6 +611,7 @@
.setAdminPackageName(DEVICE_OWNER_PKG)
.setInt(TYPE_NONE)
.build());
+ */
}
public void testWifiConfigLockdown() throws Exception {
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
index 3f7bd9d..71e9670 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
@@ -1406,6 +1406,7 @@
try {
rebootAndWaitUntilReady();
verifyUserCredential(password, mPrimaryUserId);
+ waitForUserUnlock();
installAppAsUser(SIMPLE_APP_APK, mProfileUserId);
runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".SanityTest", mProfileUserId);
} finally {
diff --git a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
index 6b5c645..506cbd2 100644
--- a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
+++ b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
@@ -17,7 +17,6 @@
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.IDeviceTest;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
import java.util.Scanner;
@@ -32,7 +31,7 @@
* Tests that exercise Rootless GPU Debug functionality supported by the loader.
*/
@RunWith(DeviceJUnit4ClassRunner.class)
-public class CtsRootlessGpuDebugHostTest extends BaseHostJUnit4Test implements IDeviceTest {
+public class CtsRootlessGpuDebugHostTest extends BaseHostJUnit4Test {
public static final String TAG = "RootlessGpuDebugDeviceActivity";
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/CecDevice.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/CecDevice.java
index 723b447..57e1782 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/CecDevice.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/CecDevice.java
@@ -25,8 +25,7 @@
PLAYBACK_1(0x4),
AUDIO_SYSTEM(0x5),
PLAYBACK_2(0x8),
- PLAYBACK_3(0x9),
- PLAYBACK_4(0xb),
+ PLAYBACK_3(0xb),
BROADCAST(0xf);
private final int playerId;
@@ -48,7 +47,6 @@
case PLAYBACK_1:
case PLAYBACK_2:
case PLAYBACK_3:
- case PLAYBACK_4:
return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_PLAYBACK_DEVICE);
case TV:
return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_TV);
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecConstants.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecConstants.java
index e65660d..343828b 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecConstants.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecConstants.java
@@ -16,34 +16,34 @@
package android.hdmicec.cts;
-final class HdmiCecConstants {
+public final class HdmiCecConstants {
private HdmiCecConstants() {}
- static final int REBOOT_TIMEOUT = 60000;
+ public static final int REBOOT_TIMEOUT = 60000;
- static final int PHYSICAL_ADDRESS = 0x1000;
- static final int PHYSICAL_ADDRESS_LENGTH = 4; /* Num nibbles in CEC message */
+ public static final int PHYSICAL_ADDRESS = 0x1000;
+ public static final int PHYSICAL_ADDRESS_LENGTH = 4; /* Num nibbles in CEC message */
- static final int PLAYBACK_DEVICE_TYPE = 0x04;
+ public static final int PLAYBACK_DEVICE_TYPE = 0x04;
- static final int CEC_CONTROL_SELECT = 0x0;
- static final int CEC_CONTROL_UP = 0x1;
- static final int CEC_CONTROL_DOWN = 0x2;
- static final int CEC_CONTROL_LEFT = 0x3;
- static final int CEC_CONTROL_RIGHT = 0x4;
- static final int CEC_CONTROL_BACK = 0xd;
- static final int CEC_CONTROL_VOLUME_UP = 0x41;
- static final int CEC_CONTROL_VOLUME_DOWN = 0x42;
- static final int CEC_CONTROL_MUTE = 0x43;
+ public static final int CEC_CONTROL_SELECT = 0x0;
+ public static final int CEC_CONTROL_UP = 0x1;
+ public static final int CEC_CONTROL_DOWN = 0x2;
+ public static final int CEC_CONTROL_LEFT = 0x3;
+ public static final int CEC_CONTROL_RIGHT = 0x4;
+ public static final int CEC_CONTROL_BACK = 0xd;
+ public static final int CEC_CONTROL_VOLUME_UP = 0x41;
+ public static final int CEC_CONTROL_VOLUME_DOWN = 0x42;
+ public static final int CEC_CONTROL_MUTE = 0x43;
- static final int UNRECOGNIZED_OPCODE = 0x0;
+ public static final int UNRECOGNIZED_OPCODE = 0x0;
- static final int CEC_DEVICE_TYPE_TV = 0;
- static final int CEC_DEVICE_TYPE_RECORDING_DEVICE = 1;
- static final int CEC_DEVICE_TYPE_RESERVED = 2;
- static final int CEC_DEVICE_TYPE_TUNER = 3;
- static final int CEC_DEVICE_TYPE_PLAYBACK_DEVICE = 4;
- static final int CEC_DEVICE_TYPE_AUDIO_SYSTEM = 5;
+ public static final int CEC_DEVICE_TYPE_TV = 0;
+ public static final int CEC_DEVICE_TYPE_RECORDING_DEVICE = 1;
+ public static final int CEC_DEVICE_TYPE_RESERVED = 2;
+ public static final int CEC_DEVICE_TYPE_TUNER = 3;
+ public static final int CEC_DEVICE_TYPE_PLAYBACK_DEVICE = 4;
+ public static final int CEC_DEVICE_TYPE_AUDIO_SYSTEM = 5;
}
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecDeviceOsdNameTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecDeviceOsdNameTest.java
similarity index 95%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecDeviceOsdNameTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecDeviceOsdNameTest.java
index 46306f1..cda2951 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecDeviceOsdNameTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecDeviceOsdNameTest.java
@@ -14,10 +14,14 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecLogicalAddressTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecLogicalAddressTest.java
similarity index 89%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecLogicalAddressTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecLogicalAddressTest.java
index 97c03d1..83c9120 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecLogicalAddressTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecLogicalAddressTest.java
@@ -14,10 +14,15 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecOneTouchPlayTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecOneTouchPlayTest.java
similarity index 91%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecOneTouchPlayTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecOneTouchPlayTest.java
index d54f0c7..a4ca3d2 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecOneTouchPlayTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecOneTouchPlayTest.java
@@ -14,10 +14,14 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecPhysicalAddressTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPhysicalAddressTest.java
similarity index 90%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecPhysicalAddressTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPhysicalAddressTest.java
index e7ba389..91280e7 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecPhysicalAddressTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPhysicalAddressTest.java
@@ -14,10 +14,15 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecPowerStatusTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPowerStatusTest.java
similarity index 93%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecPowerStatusTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPowerStatusTest.java
index 136c8da..911d233 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecPowerStatusTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecPowerStatusTest.java
@@ -14,10 +14,15 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecRemoteControlPassThroughTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRemoteControlPassThroughTest.java
similarity index 96%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecRemoteControlPassThroughTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRemoteControlPassThroughTest.java
index aa47adf..c2d77a1 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecRemoteControlPassThroughTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRemoteControlPassThroughTest.java
@@ -14,10 +14,14 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecRoutingControlTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRoutingControlTest.java
similarity index 94%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecRoutingControlTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRoutingControlTest.java
index cb6b536..4fd2a89 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecRoutingControlTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRoutingControlTest.java
@@ -14,10 +14,15 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemAudioControlTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
similarity index 94%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemAudioControlTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
index c2b4678..3ac2e5f 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemAudioControlTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemAudioControlTest.java
@@ -14,10 +14,14 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemInformationTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemInformationTest.java
similarity index 96%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemInformationTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemInformationTest.java
index 8bd7262..e5ab1d9 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemInformationTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemInformationTest.java
@@ -14,11 +14,17 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
+import android.hdmicec.cts.CecClientMessage;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemStandbyTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemStandbyTest.java
similarity index 96%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemStandbyTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemStandbyTest.java
index 787ea24..3f51843 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecSystemStandbyTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemStandbyTest.java
@@ -14,10 +14,15 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.device.TestDeviceState;
import com.android.tradefed.log.LogUtil.CLog;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecVendorCommandsTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecVendorCommandsTest.java
similarity index 91%
rename from hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecVendorCommandsTest.java
rename to hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecVendorCommandsTest.java
index 49c5b3b..df9bc5a 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecVendorCommandsTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecVendorCommandsTest.java
@@ -14,10 +14,15 @@
* limitations under the License.
*/
-package android.hdmicec.cts;
+package android.hdmicec.cts.playback;
import static org.junit.Assert.assertNotEquals;
+import android.hdmicec.cts.CecDevice;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.HdmiCecClientWrapper;
+import android.hdmicec.cts.HdmiCecConstants;
+
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
@@ -52,7 +57,7 @@
/**
* Test 11.2.9-2
- * Tests that the device broadcasts a <DEVICE_VENDOR_ID> message after successfull
+ * Tests that the device broadcasts a <DEVICE_VENDOR_ID> message after successful
* initialisation and address allocation.
*/
@Test
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java
index 65fd3ff..1bbc601 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java
+++ b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java
@@ -123,6 +123,7 @@
}
private void scheduleDraw() {
+ mColorView.invalidate();
mChoreographer.postFrameCallback((long timestamp) -> {
setupFrame();
jankIf(FRAME_JANK_ANIMATION);
diff --git a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
index 90b78fc..1356600 100644
--- a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
@@ -126,8 +126,8 @@
assertTrue(jankyDelta < 25);
int gt150msDelta = countFramesAbove(statsAfter, 150) - countFramesAbove(statsBefore, 150);
- assertTrue(gt150msDelta >= 20); // 10 davey jrs + 10 daveys + maybe first frame
- assertTrue(gt150msDelta <= 21);
+ assertTrue(gt150msDelta >= 20); // 10 davey jrs + 10 daveys + maybe first 2 frames
+ assertTrue(gt150msDelta <= 22);
int gt700msDelta = countFramesAbove(statsAfter, 700) - countFramesAbove(statsBefore, 700);
assertEquals(10, gt700msDelta); // 10 daveys
}
diff --git a/hostsidetests/inputmethodservice/hostside/AndroidTest.xml b/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
index 169d7ec..7c8132a 100644
--- a/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
+++ b/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
@@ -20,6 +20,7 @@
<option name="config-descriptor:metadata" key="component" value="inputmethod" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
<option name="run-command" value="wm dismiss-keyguard" />
diff --git a/hostsidetests/jvmti/TEST_MAPPING b/hostsidetests/jvmti/TEST_MAPPING
index 43f24b1..70ece58 100644
--- a/hostsidetests/jvmti/TEST_MAPPING
+++ b/hostsidetests/jvmti/TEST_MAPPING
@@ -265,10 +265,106 @@
"name": "CtsJvmtiRunTest1958HostTestCases"
},
{
+ "name": "CtsJvmtiRunTest1962HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1967HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1968HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1969HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1970HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1971HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1974HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1975HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1976HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1977HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1978HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1979HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1982HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1984HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1988HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1989HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1990HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1991HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1992HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1994HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1995HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1996HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1997HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1998HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest1999HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest2001HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest2002HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest2003HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest2004HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest2005HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest2006HostTestCases"
+ },
+ {
+ "name": "CtsJvmtiRunTest2007HostTestCases"
+ },
+ {
"name": "CtsJvmtiTaggingHostTestCases"
},
{
"name": "CtsJvmtiTrackingHostTestCases"
}
]
-}
+}
\ No newline at end of file
diff --git a/hostsidetests/jvmti/base/run-test-based-app/Android.bp b/hostsidetests/jvmti/base/run-test-based-app/Android.bp
index 2894435..d2f9d09 100644
--- a/hostsidetests/jvmti/base/run-test-based-app/Android.bp
+++ b/hostsidetests/jvmti/base/run-test-based-app/Android.bp
@@ -21,6 +21,12 @@
"src/android/jvmti/cts/JvmtiRunTestBasedTest.java",
":art_cts_jvmti_test_library",
],
+ // Allow sun.misc.Unsafe.
+ target: {
+ android: {
+ libs: ["libcore_private.stubs"],
+ },
+ },
sdk_version: "test_current",
dex_preopt: {
enabled: false,
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1962/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1962/Android.bp
index 9ad6c7f..97f9dc5 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1962/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1962HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1962DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1962/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1962/AndroidTest.xml
new file mode 100644
index 0000000..32ddfc9
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1962/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1962DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1962HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1962DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1962" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1962/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1962/app/Android.bp
new file mode 100644
index 0000000..3790fdd
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1962/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1962DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1962/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1962/app/AndroidManifest.xml
new file mode 100644
index 0000000..aa29470
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1962/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1962">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1962" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1962" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1962/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1962/jarjar-rules.txt
new file mode 100644
index 0000000..ee95ad8
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1962/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1962@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1967/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1967/Android.bp
index 9ad6c7f..71cace5 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1967/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1967HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1967DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1967/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1967/AndroidTest.xml
new file mode 100644
index 0000000..ee555ef4
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1967/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1967DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1967HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1967DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1967" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1967/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1967/app/Android.bp
new file mode 100644
index 0000000..b3e1d87
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1967/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1967DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1967/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1967/app/AndroidManifest.xml
new file mode 100644
index 0000000..74e0455
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1967/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1967">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1967" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1967" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1967/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1967/jarjar-rules.txt
new file mode 100644
index 0000000..7d05607
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1967/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1967@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1968/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1968/Android.bp
index 9ad6c7f..a5166fd 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1968/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1968HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1968DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1968/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1968/AndroidTest.xml
new file mode 100644
index 0000000..35f5d65
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1968/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1968DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1968HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1968DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1968" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1968/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1968/app/Android.bp
new file mode 100644
index 0000000..5a0a713
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1968/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1968DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1968/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1968/app/AndroidManifest.xml
new file mode 100644
index 0000000..d7e7bf0
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1968/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1968">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1968" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1968" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1968/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1968/jarjar-rules.txt
new file mode 100644
index 0000000..57e816b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1968/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1968@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1969/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1969/Android.bp
index 9ad6c7f..d04b251 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1969/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1969HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1969DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1969/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1969/AndroidTest.xml
new file mode 100644
index 0000000..aa2c833
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1969/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1969DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1969HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1969DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1969" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1969/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1969/app/Android.bp
new file mode 100644
index 0000000..b78ee72
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1969/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1969DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1969/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1969/app/AndroidManifest.xml
new file mode 100644
index 0000000..62ea888
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1969/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1969">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1969" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1969" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1969/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1969/jarjar-rules.txt
new file mode 100644
index 0000000..dbfdf6b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1969/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1969@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1970/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1970/Android.bp
index 9ad6c7f..c0839ff 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1970/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1970HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1970DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1970/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1970/AndroidTest.xml
new file mode 100644
index 0000000..113185d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1970/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1970DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1970HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1970DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1970" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1970/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1970/app/Android.bp
new file mode 100644
index 0000000..4f0651f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1970/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1970DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1970/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1970/app/AndroidManifest.xml
new file mode 100644
index 0000000..f71451f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1970/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1970">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1970" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1970" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1970/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1970/jarjar-rules.txt
new file mode 100644
index 0000000..2215e37
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1970/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1970@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1971/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1971/Android.bp
index 9ad6c7f..13d2ced 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1971/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1971HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1971DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1971/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1971/AndroidTest.xml
new file mode 100644
index 0000000..edeaa3a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1971/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1971DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1971HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1971DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1971" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1971/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1971/app/Android.bp
new file mode 100644
index 0000000..bb4dfed
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1971/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1971DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1971/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1971/app/AndroidManifest.xml
new file mode 100644
index 0000000..70ad005
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1971/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1971">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1971" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1971" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1971/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1971/jarjar-rules.txt
new file mode 100644
index 0000000..458909d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1971/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1971@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1974/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1974/Android.bp
index 9ad6c7f..d15a1e9 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1974/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1974HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1974DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1974/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1974/AndroidTest.xml
new file mode 100644
index 0000000..7556216
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1974/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1974DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1974HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1974DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1974" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1974/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1974/app/Android.bp
new file mode 100644
index 0000000..da977ea
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1974/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1974DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1974/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1974/app/AndroidManifest.xml
new file mode 100644
index 0000000..5b543e4
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1974/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1974">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1974" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1974" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1974/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1974/jarjar-rules.txt
new file mode 100644
index 0000000..327b89d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1974/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1974@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1975/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1975/Android.bp
index 9ad6c7f..335aa16 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1975/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1975HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1975DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1975/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1975/AndroidTest.xml
new file mode 100644
index 0000000..af530e3
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1975/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1975DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1975HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1975DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1975" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1975/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1975/app/Android.bp
new file mode 100644
index 0000000..345a252
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1975/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1975DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1975/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1975/app/AndroidManifest.xml
new file mode 100644
index 0000000..00dbc76
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1975/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1975">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1975" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1975" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1975/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1975/jarjar-rules.txt
new file mode 100644
index 0000000..503675b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1975/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1975@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1976/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1976/Android.bp
index 9ad6c7f..0c1fdda 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1976/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1976HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1976DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1976/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1976/AndroidTest.xml
new file mode 100644
index 0000000..37d2ef3
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1976/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1976DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1976HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1976DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1976" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1976/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1976/app/Android.bp
new file mode 100644
index 0000000..ae91ef2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1976/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1976DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1976/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1976/app/AndroidManifest.xml
new file mode 100644
index 0000000..92f997f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1976/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1976">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1976" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1976" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1976/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1976/jarjar-rules.txt
new file mode 100644
index 0000000..061eeba
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1976/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1976@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1977/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1977/Android.bp
index 9ad6c7f..99f10e2 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1977/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1977HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1977DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1977/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1977/AndroidTest.xml
new file mode 100644
index 0000000..b15fdaf
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1977/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1977DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1977HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1977DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1977" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1977/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1977/app/Android.bp
new file mode 100644
index 0000000..e5c0251
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1977/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1977DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1977/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1977/app/AndroidManifest.xml
new file mode 100644
index 0000000..7953380
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1977/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1977">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1977" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1977" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1977/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1977/jarjar-rules.txt
new file mode 100644
index 0000000..f574da8
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1977/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1977@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1978/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1978/Android.bp
index 9ad6c7f..581b406 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1978/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1978HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1978DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1978/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1978/AndroidTest.xml
new file mode 100644
index 0000000..5ca5ec4
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1978/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1978DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1978HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1978DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1978" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1978/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1978/app/Android.bp
new file mode 100644
index 0000000..523da34
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1978/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1978DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1978/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1978/app/AndroidManifest.xml
new file mode 100644
index 0000000..c3bb77d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1978/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1978">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1978" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1978" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1978/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1978/jarjar-rules.txt
new file mode 100644
index 0000000..979aacb
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1978/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1978@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1979/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1979/Android.bp
index 9ad6c7f..26d590f 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1979/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1979HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1979DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1979/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1979/AndroidTest.xml
new file mode 100644
index 0000000..8ff1f00
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1979/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1979DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1979HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1979DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1979" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1979/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1979/app/Android.bp
new file mode 100644
index 0000000..a3c6ec5
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1979/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1979DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1979/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1979/app/AndroidManifest.xml
new file mode 100644
index 0000000..0738db6
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1979/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1979">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1979" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1979" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1979/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1979/jarjar-rules.txt
new file mode 100644
index 0000000..2d82356
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1979/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1979@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1981/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1981/Android.bp
index 9ad6c7f..ab0d946 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1981/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// 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.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1981HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1981DeviceApp"],
}
diff --git a/tests/tests/sdkext/CtsSdkExtTestCases.xml b/hostsidetests/jvmti/run-tests/test-1981/AndroidTest.xml
similarity index 61%
copy from tests/tests/sdkext/CtsSdkExtTestCases.xml
copy to hostsidetests/jvmti/run-tests/test-1981/AndroidTest.xml
index b22653c..c38520a 100644
--- a/tests/tests/sdkext/CtsSdkExtTestCases.xml
+++ b/hostsidetests/jvmti/run-tests/test-1981/AndroidTest.xml
@@ -13,16 +13,21 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<configuration description="Configuration for SdkExt Tests">
+<configuration description="Config for CTS JVMTI test cases">
<option name="test-suite-tag" value="cts" />
- <option name="config-descriptor:metadata" key="component" value="framework" />
- <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
- <option name="test-file-name" value="CtsSdkExtTestCases.apk" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1981DeviceApp.apk" />
</target_preparer>
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="package" value="android.os.ext.cts" />
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1981HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1981DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1981" />
+ <option name="runtime-hint" value="8s"/>
</test>
</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1981/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1981/app/Android.bp
new file mode 100644
index 0000000..98e452b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1981/app/Android.bp
@@ -0,0 +1,19 @@
+// 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.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1981DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1981/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1981/app/AndroidManifest.xml
new file mode 100644
index 0000000..053d66b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1981/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_1981">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1981" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1981" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1981/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1981/jarjar-rules.txt
new file mode 100644
index 0000000..c96a357
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1981/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1981@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1982/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1982/Android.bp
index 9ad6c7f..6656637 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1982/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1982HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1982DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1982/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1982/AndroidTest.xml
new file mode 100644
index 0000000..f6a0132
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1982/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1982DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1982HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1982DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1982" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1982/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1982/app/Android.bp
new file mode 100644
index 0000000..496e7ab
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1982/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1982DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1982/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1982/app/AndroidManifest.xml
new file mode 100644
index 0000000..1bed7f1
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1982/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1982">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1982" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1982" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1982/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1982/jarjar-rules.txt
new file mode 100644
index 0000000..4db74a9
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1982/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1982@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1983/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1983/Android.bp
index 9ad6c7f..994b62f 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1983/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// 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.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1983HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1983DeviceApp"],
}
diff --git a/tests/tests/sdkext/CtsSdkExtTestCases.xml b/hostsidetests/jvmti/run-tests/test-1983/AndroidTest.xml
similarity index 61%
copy from tests/tests/sdkext/CtsSdkExtTestCases.xml
copy to hostsidetests/jvmti/run-tests/test-1983/AndroidTest.xml
index b22653c..ee4a547 100644
--- a/tests/tests/sdkext/CtsSdkExtTestCases.xml
+++ b/hostsidetests/jvmti/run-tests/test-1983/AndroidTest.xml
@@ -13,16 +13,21 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<configuration description="Configuration for SdkExt Tests">
+<configuration description="Config for CTS JVMTI test cases">
<option name="test-suite-tag" value="cts" />
- <option name="config-descriptor:metadata" key="component" value="framework" />
- <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
- <option name="test-file-name" value="CtsSdkExtTestCases.apk" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1983DeviceApp.apk" />
</target_preparer>
- <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="package" value="android.os.ext.cts" />
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1983HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1983DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1983" />
+ <option name="runtime-hint" value="8s"/>
</test>
</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1983/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1983/app/Android.bp
new file mode 100644
index 0000000..7645be6
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1983/app/Android.bp
@@ -0,0 +1,19 @@
+// 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.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1983DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1983/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1983/app/AndroidManifest.xml
new file mode 100644
index 0000000..732c921
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1983/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_1983">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1983" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1983" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1983/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1983/jarjar-rules.txt
new file mode 100644
index 0000000..35d6e39
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1983/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1983@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1984/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1984/Android.bp
index 9ad6c7f..f23c878 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1984/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1984HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1984DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1984/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1984/AndroidTest.xml
new file mode 100644
index 0000000..e917c90
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1984/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1984DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1984HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1984DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1984" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1984/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1984/app/Android.bp
new file mode 100644
index 0000000..f378084
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1984/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1984DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1984/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1984/app/AndroidManifest.xml
new file mode 100644
index 0000000..8c9a5f2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1984/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1984">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1984" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1984" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1984/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1984/jarjar-rules.txt
new file mode 100644
index 0000000..ca06a6e
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1984/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1984@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1988/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1988/Android.bp
index 9ad6c7f..8042eaa 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1988/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1988HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1988DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1988/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1988/AndroidTest.xml
new file mode 100644
index 0000000..b9bd31a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1988/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1988DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1988HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1988DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1988" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1988/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1988/app/Android.bp
new file mode 100644
index 0000000..f86f27b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1988/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1988DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1988/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1988/app/AndroidManifest.xml
new file mode 100644
index 0000000..293cd5c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1988/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1988">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1988" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1988" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1988/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1988/jarjar-rules.txt
new file mode 100644
index 0000000..868cd44
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1988/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1988@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1989/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1989/Android.bp
index 9ad6c7f..ea9c10a 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1989/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1989HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1989DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1989/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1989/AndroidTest.xml
new file mode 100644
index 0000000..26f310a
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1989/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1989DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1989HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1989DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1989" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1989/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1989/app/Android.bp
new file mode 100644
index 0000000..5c61276
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1989/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1989DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1989/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1989/app/AndroidManifest.xml
new file mode 100644
index 0000000..0a38447
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1989/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1989">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1989" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1989" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1989/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1989/jarjar-rules.txt
new file mode 100644
index 0000000..50b2329
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1989/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1989@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1990/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1990/Android.bp
index 9ad6c7f..7a8b0f2 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1990/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1990HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1990DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1990/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1990/AndroidTest.xml
new file mode 100644
index 0000000..a48573b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1990/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1990DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1990HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1990DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1990" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1990/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1990/app/Android.bp
new file mode 100644
index 0000000..67cdde3
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1990/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1990DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1990/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1990/app/AndroidManifest.xml
new file mode 100644
index 0000000..dfac677
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1990/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1990">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1990" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1990" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1990/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1990/jarjar-rules.txt
new file mode 100644
index 0000000..ca97218
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1990/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1990@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1991/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1991/Android.bp
index 9ad6c7f..0accac1 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1991/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1991HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1991DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1991/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1991/AndroidTest.xml
new file mode 100644
index 0000000..198c85c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1991/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1991DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1991HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1991DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1991" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1991/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1991/app/Android.bp
new file mode 100644
index 0000000..9287347
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1991/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1991DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1991/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1991/app/AndroidManifest.xml
new file mode 100644
index 0000000..282448d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1991/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1991">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1991" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1991" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1991/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1991/jarjar-rules.txt
new file mode 100644
index 0000000..a2ee619
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1991/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1991@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1992/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1992/Android.bp
index 9ad6c7f..61f112c 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1992/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1992HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1992DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1992/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1992/AndroidTest.xml
new file mode 100644
index 0000000..18bc104
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1992/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1992DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1992HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1992DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1992" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1992/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1992/app/Android.bp
new file mode 100644
index 0000000..9f033af
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1992/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1992DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1992/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1992/app/AndroidManifest.xml
new file mode 100644
index 0000000..274fd37
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1992/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1992">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1992" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1992" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1992/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1992/jarjar-rules.txt
new file mode 100644
index 0000000..2023bb8
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1992/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1992@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1994/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1994/Android.bp
index 9ad6c7f..79de6f0 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1994/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1994HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1994DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1994/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1994/AndroidTest.xml
new file mode 100644
index 0000000..dcfac58
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1994/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1994DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1994HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1994DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1994" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1994/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1994/app/Android.bp
new file mode 100644
index 0000000..0554ed3
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1994/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1994DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1994/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1994/app/AndroidManifest.xml
new file mode 100644
index 0000000..0e421ed
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1994/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1994">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1994" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1994" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1994/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1994/jarjar-rules.txt
new file mode 100644
index 0000000..2631e23
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1994/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1994@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1995/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1995/Android.bp
index 9ad6c7f..fe2b24b 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1995/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1995HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1995DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1995/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1995/AndroidTest.xml
new file mode 100644
index 0000000..df666bd
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1995/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1995DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1995HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1995DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1995" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1995/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1995/app/Android.bp
new file mode 100644
index 0000000..39e1f1c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1995/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1995DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1995/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1995/app/AndroidManifest.xml
new file mode 100644
index 0000000..6f1d556
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1995/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1995">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1995" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1995" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1995/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1995/jarjar-rules.txt
new file mode 100644
index 0000000..548c135
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1995/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1995@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1996/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1996/Android.bp
index 9ad6c7f..1470ef4 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1996/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1996HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1996DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1996/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1996/AndroidTest.xml
new file mode 100644
index 0000000..51240d4
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1996/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1996DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1996HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1996DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1996" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1996/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1996/app/Android.bp
new file mode 100644
index 0000000..38948d1
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1996/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1996DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1996/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1996/app/AndroidManifest.xml
new file mode 100644
index 0000000..322dcae
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1996/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1996">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1996" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1996" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1996/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1996/jarjar-rules.txt
new file mode 100644
index 0000000..0800a6b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1996/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1996@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1997/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1997/Android.bp
index 9ad6c7f..3493cd0 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1997/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1997HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1997DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1997/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1997/AndroidTest.xml
new file mode 100644
index 0000000..a4484e0
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1997/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1997DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1997HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1997DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1997" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1997/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1997/app/Android.bp
new file mode 100644
index 0000000..d00d04b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1997/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1997DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1997/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1997/app/AndroidManifest.xml
new file mode 100644
index 0000000..af46a86
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1997/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1997">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1997" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1997" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1997/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1997/jarjar-rules.txt
new file mode 100644
index 0000000..fa953ba
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1997/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1997@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1998/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1998/Android.bp
index 9ad6c7f..63ce180 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1998/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1998HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1998DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1998/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1998/AndroidTest.xml
new file mode 100644
index 0000000..4fb6d4f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1998/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1998DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1998HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1998DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1998" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1998/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1998/app/Android.bp
new file mode 100644
index 0000000..080b99b
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1998/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1998DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1998/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1998/app/AndroidManifest.xml
new file mode 100644
index 0000000..800cd32
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1998/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1998">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1998" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1998" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1998/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1998/jarjar-rules.txt
new file mode 100644
index 0000000..c54e23d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1998/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1998@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-1999/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-1999/Android.bp
index 9ad6c7f..8e28df9 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-1999/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest1999HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest1999DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-1999/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1999/AndroidTest.xml
new file mode 100644
index 0000000..f7e1329
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1999/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest1999DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest1999HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest1999DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_1999" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-1999/app/Android.bp b/hostsidetests/jvmti/run-tests/test-1999/app/Android.bp
new file mode 100644
index 0000000..ebab8d8
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1999/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest1999DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-1999/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1999/app/AndroidManifest.xml
new file mode 100644
index 0000000..73fe69d
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1999/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_1999">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="1999" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_1999" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-1999/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-1999/jarjar-rules.txt
new file mode 100644
index 0000000..1d59a10
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-1999/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest1999@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-2001/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-2001/Android.bp
index 9ad6c7f..7f7775d 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-2001/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest2001HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest2001DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-2001/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2001/AndroidTest.xml
new file mode 100644
index 0000000..297b835
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2001/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest2001DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest2001HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest2001DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_2001" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-2001/app/Android.bp b/hostsidetests/jvmti/run-tests/test-2001/app/Android.bp
new file mode 100644
index 0000000..fa64b10
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2001/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest2001DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-2001/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-2001/app/AndroidManifest.xml
new file mode 100644
index 0000000..2ab52a0
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2001/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_2001">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="2001" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_2001" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-2001/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-2001/jarjar-rules.txt
new file mode 100644
index 0000000..447d8b5
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2001/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest2001@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-2002/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-2002/Android.bp
index 9ad6c7f..2c0dd1e 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-2002/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest2002HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest2002DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-2002/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2002/AndroidTest.xml
new file mode 100644
index 0000000..e1c5372
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2002/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest2002DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest2002HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest2002DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_2002" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-2002/app/Android.bp b/hostsidetests/jvmti/run-tests/test-2002/app/Android.bp
new file mode 100644
index 0000000..695244f
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2002/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest2002DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-2002/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-2002/app/AndroidManifest.xml
new file mode 100644
index 0000000..09b1ba8
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2002/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_2002">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="2002" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_2002" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-2002/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-2002/jarjar-rules.txt
new file mode 100644
index 0000000..f1744ee2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2002/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest2002@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-2003/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-2003/Android.bp
index 9ad6c7f..d206018 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-2003/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest2003HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest2003DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-2003/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2003/AndroidTest.xml
new file mode 100644
index 0000000..a0da7d0
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2003/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest2003DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest2003HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest2003DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_2003" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-2003/app/Android.bp b/hostsidetests/jvmti/run-tests/test-2003/app/Android.bp
new file mode 100644
index 0000000..0b7dc79
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2003/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest2003DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-2003/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-2003/app/AndroidManifest.xml
new file mode 100644
index 0000000..53ba610
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2003/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_2003">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="2003" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_2003" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-2003/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-2003/jarjar-rules.txt
new file mode 100644
index 0000000..5c1fff2
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2003/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest2003@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-2004/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-2004/Android.bp
index 9ad6c7f..d7a9848 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-2004/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest2004HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest2004DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-2004/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2004/AndroidTest.xml
new file mode 100644
index 0000000..f414196
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2004/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest2004DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest2004HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest2004DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_2004" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-2004/app/Android.bp b/hostsidetests/jvmti/run-tests/test-2004/app/Android.bp
new file mode 100644
index 0000000..507c430
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2004/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest2004DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-2004/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-2004/app/AndroidManifest.xml
new file mode 100644
index 0000000..c5ecaec
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2004/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_2004">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="2004" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_2004" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-2004/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-2004/jarjar-rules.txt
new file mode 100644
index 0000000..a42bf37
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2004/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest2004@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-2005/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-2005/Android.bp
index 9ad6c7f..df0bf81 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-2005/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest2005HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest2005DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-2005/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2005/AndroidTest.xml
new file mode 100644
index 0000000..2339521
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2005/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest2005DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest2005HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest2005DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_2005" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-2005/app/Android.bp b/hostsidetests/jvmti/run-tests/test-2005/app/Android.bp
new file mode 100644
index 0000000..a8b75b7
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2005/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest2005DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-2005/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-2005/app/AndroidManifest.xml
new file mode 100644
index 0000000..8eb1762
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2005/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_2005">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="2005" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_2005" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-2005/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-2005/jarjar-rules.txt
new file mode 100644
index 0000000..e345844
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2005/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest2005@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-2006/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-2006/Android.bp
index 9ad6c7f..9f2807b 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-2006/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest2006HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest2006DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-2006/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2006/AndroidTest.xml
new file mode 100644
index 0000000..c761a7c
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2006/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest2006DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest2006HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest2006DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_2006" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-2006/app/Android.bp b/hostsidetests/jvmti/run-tests/test-2006/app/Android.bp
new file mode 100644
index 0000000..2d6cc38
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2006/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest2006DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-2006/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-2006/app/AndroidManifest.xml
new file mode 100644
index 0000000..47966a4
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2006/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_2006">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="2006" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_2006" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-2006/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-2006/jarjar-rules.txt
new file mode 100644
index 0000000..0d5cd95
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2006/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest2006@1
diff --git a/tests/tests/sdkext/Android.bp b/hostsidetests/jvmti/run-tests/test-2007/Android.bp
similarity index 64%
copy from tests/tests/sdkext/Android.bp
copy to hostsidetests/jvmti/run-tests/test-2007/Android.bp
index 9ad6c7f..f6cd80c 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/hostsidetests/jvmti/run-tests/test-2007/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2019 The Android Open Source Project
+// Copyright (C) 2020 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,19 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-android_test {
- name: "CtsSdkExtTestCases",
- defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
- ],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+java_test_host {
+ name: "CtsJvmtiRunTest2007HostTestCases",
+ static_libs: ["CtsJvmtiHostTestBase"],
+ jarjar_rules: "jarjar-rules.txt",
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
],
- sdk_version: "system_current",
+ data: [":CtsJvmtiRunTest2007DeviceApp"],
}
diff --git a/hostsidetests/jvmti/run-tests/test-2007/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2007/AndroidTest.xml
new file mode 100644
index 0000000..a688bc5
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2007/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Config for CTS JVMTI test cases">
+ <option name="test-suite-tag" value="cts" />
+ <!-- Requires debuggable -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="config-descriptor:metadata" key="component" value="art" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsJvmtiRunTest2007DeviceApp.apk" />
+ </target_preparer>
+ <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+ <option name="jar" value="CtsJvmtiRunTest2007HostTestCases.jar" />
+ <option name="set-option" value="test-file-name:CtsJvmtiRunTest2007DeviceApp.apk" />
+ <option name="set-option" value="package-name:android.jvmti.cts.run_test_2007" />
+ <option name="runtime-hint" value="8s"/>
+ </test>
+</configuration>
diff --git a/hostsidetests/jvmti/run-tests/test-2007/app/Android.bp b/hostsidetests/jvmti/run-tests/test-2007/app/Android.bp
new file mode 100644
index 0000000..72acfa6
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2007/app/Android.bp
@@ -0,0 +1,19 @@
+// Copyright (C) 2020 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test_helper_app {
+ name: "CtsJvmtiRunTest2007DeviceApp",
+ defaults: ["cts-run-jvmti-defaults"],
+ manifest: "AndroidManifest.xml",
+}
diff --git a/hostsidetests/jvmti/run-tests/test-2007/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-2007/app/AndroidManifest.xml
new file mode 100644
index 0000000..dd85194
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2007/app/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.jvmti.cts.run_test_2007">
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ <meta-data android:name="android.jvmti.cts.run_test_nr" android:value="2007" />
+ <activity android:name="android.jvmti.JvmtiActivity" >
+ </activity>
+ </application>
+
+ <!-- self-instrumenting test package. -->
+ <instrumentation
+ android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:label="CTS tests for JVMTI"
+ android:targetPackage="android.jvmti.cts.run_test_2007" >
+ </instrumentation>
+</manifest>
+
diff --git a/hostsidetests/jvmti/run-tests/test-2007/jarjar-rules.txt b/hostsidetests/jvmti/run-tests/test-2007/jarjar-rules.txt
new file mode 100644
index 0000000..4f0c569
--- /dev/null
+++ b/hostsidetests/jvmti/run-tests/test-2007/jarjar-rules.txt
@@ -0,0 +1 @@
+rule android.jvmti.cts.JvmtiHostTest** android.jvmti.cts.JvmtiHostTest2007@1
diff --git a/hostsidetests/media/bitstreams/AndroidTest.xml b/hostsidetests/media/bitstreams/AndroidTest.xml
index cd716d5..070b44d 100644
--- a/hostsidetests/media/bitstreams/AndroidTest.xml
+++ b/hostsidetests/media/bitstreams/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="media" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
<option name="target" value="host" />
<option name="config-filename" value="cts" />
diff --git a/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java b/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
index 1bf1aef..12b2dca 100644
--- a/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
+++ b/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
@@ -27,6 +27,8 @@
import com.android.tradefed.testtype.IBuildReceiver;
import java.io.File;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Multi-user tests for number blocking.
@@ -237,15 +239,15 @@
// TODO: Replace this with API in ITestDevice once it is available.
private int getUserSerialNumber(int userId) throws DeviceNotAvailableException {
+ Pattern pattern = Pattern.compile("^.*UserInfo\\{" + userId + "\\:.*serialNo=(\\d+).*$");
// dumpsys user return lines like "UserInfo{0:Owner:13} serialNo=0"
String commandOutput = getDevice().executeShellCommand("dumpsys user");
String[] tokens = commandOutput.split("\\n");
for (String token : tokens) {
token = token.trim();
- if (token.contains("UserInfo{" + userId + ":")) {
- String[] split = token.split("serialNo=");
- assertTrue(split.length == 2);
- int serialNumber = Integer.parseInt(split[1]);
+ Matcher matcher = pattern.matcher(token);
+ if (matcher.matches()) {
+ int serialNumber = Integer.parseInt(matcher.group(1));
LogUtil.CLog.logAndDisplay(
Log.LogLevel.INFO,
String.format("Serial number of user %d : %d", userId, serialNumber));
diff --git a/hostsidetests/os/OWNERS b/hostsidetests/os/OWNERS
index ca737ac..9abffa5 100644
--- a/hostsidetests/os/OWNERS
+++ b/hostsidetests/os/OWNERS
@@ -2,3 +2,5 @@
michaelwr@google.com
santoscordon@google.com
per-file InattentiveSleepTests.java=rgl@google.com, robhor@google.com
+per-file QuiescentBootTests.java=rgl@google.com, robhor@google.com
+
diff --git a/hostsidetests/rollback/AndroidTest.xml b/hostsidetests/rollback/AndroidTest.xml
index 9f0ae07..6ebd7c2 100644
--- a/hostsidetests/rollback/AndroidTest.xml
+++ b/hostsidetests/rollback/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsRollbackManagerHostTestHelperApp.apk" />
diff --git a/hostsidetests/seccomp/AndroidTest.xml b/hostsidetests/seccomp/AndroidTest.xml
index 9f7b1e6..d302c1c 100644
--- a/hostsidetests/seccomp/AndroidTest.xml
+++ b/hostsidetests/seccomp/AndroidTest.xml
@@ -21,6 +21,7 @@
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<!-- Do test multiple ABIs, because the seccomp filter differs per ABI -->
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSeccompDeviceApp.apk" />
diff --git a/hostsidetests/security/src/android/cts/security/KernelConfigTest.java b/hostsidetests/security/src/android/cts/security/KernelConfigTest.java
index 3b30513..719a90e 100644
--- a/hostsidetests/security/src/android/cts/security/KernelConfigTest.java
+++ b/hostsidetests/security/src/android/cts/security/KernelConfigTest.java
@@ -201,17 +201,31 @@
private Map<String, String[]> hardwareMitigations = new HashMap<String, String[]>() {
{
+ put("EXYNOS990", null);
+ put("EXYNOS980", null);
+ put("EXYNOS850", null);
+ put("EXYNOS3830", null);
+ put("EXYNOS9630", null);
+ put("EXYNOS9830", null);
+ put("EXYNOS7870", null);
+ put("EXYNOS7880", null);
+ put("EXYNOS7570", null);
+ put("EXYNOS7872", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+ put("EXYNOS7885", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+ put("EXYNOS9610", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
put("Kirin980", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
put("Kirin970", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
put("Kirin810", null);
put("Kirin710", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
- put("SDMMAGPIE", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
put("SM6150", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
put("SM7150", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
- put("SM7250", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+ put("LITO", null);
put("SM8150", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
put("SM8150P", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
- put("SM8250", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+ put("KONA", null);
+ put("SDM429", null);
+ put("SDM439", null);
+ put("QM215", null);
put("DEFAULT", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y",
"CONFIG_UNMAP_KERNEL_AT_EL0=y"});
}};
diff --git a/hostsidetests/security/src/android/cts/security/PerfEventParanoidTest.java b/hostsidetests/security/src/android/cts/security/PerfEventParanoidTest.java
index b581dbe..7ede5a7 100644
--- a/hostsidetests/security/src/android/cts/security/PerfEventParanoidTest.java
+++ b/hostsidetests/security/src/android/cts/security/PerfEventParanoidTest.java
@@ -27,6 +27,7 @@
private ITestDevice mDevice;
private static final String PERF_EVENT_PARANOID_PATH = "/proc/sys/kernel/perf_event_paranoid";
+ private static final String PERF_EVENT_LSM_SYSPROP = "sys.init.perf_lsm_hooks";
@Override
protected void setUp() throws Exception {
@@ -35,13 +36,22 @@
}
public void testPerfEventRestricted() throws DeviceNotAvailableException {
- String cmd = "cat " + PERF_EVENT_PARANOID_PATH;
- String output = mDevice.executeShellCommand(cmd);
- assertTrue("\n/proc/sys/kernel/perf_event_paranoid=3 is required.\n"
- + "Please add CONFIG_SECURITY_PERF_EVENTS_RESTRICT=y\n"
- + "to your device kernel's defconfig and apply the\n"
- + "appropriate patches for your kernel located here:\n"
- + "https://android-review.googlesource.com/#/q/topic:CONFIG_SECURITY_PERF_EVENTS_RESTRICT",
- output.equals("3\n"));
+ // Property set to "1" if init detected that the kernel has the perf_event_open SELinux hooks,
+ // otherwise left unset.
+ long lsmHookPropValue = mDevice.getIntProperty(PERF_EVENT_LSM_SYSPROP, 0);
+
+ String paranoidCmd = "cat " + PERF_EVENT_PARANOID_PATH;
+ String paranoidOut = mDevice.executeShellCommand(paranoidCmd);
+
+ if (lsmHookPropValue != 1 && !paranoidOut.equals("3\n")) {
+ fail("\nDevice required to have either:\n"
+ + " (a) SELinux hooks for the perf_event_open(2) syscall\n"
+ + " (b) /proc/sys/kernel/perf_event_paranoid=3\n"
+ + "For (a), apply the relevant patch for your kernel located here:\n"
+ + "https://android-review.googlesource.com/q/hashtag:perf_event_lsm\n"
+ + "For (b), apply the relevant patch for your kernel located here:\n"
+ + "https://android-review.googlesource.com/#/q/topic:CONFIG_SECURITY_PERF_EVENTS_RESTRICT\n"
+ + "Device values: SELinux=" + lsmHookPropValue + ", paranoid=" + paranoidOut);
+ }
}
}
diff --git a/hostsidetests/security/src/android/cts/security/SELinuxHostTest.java b/hostsidetests/security/src/android/cts/security/SELinuxHostTest.java
index b2f5895..3a441e1 100644
--- a/hostsidetests/security/src/android/cts/security/SELinuxHostTest.java
+++ b/hostsidetests/security/src/android/cts/security/SELinuxHostTest.java
@@ -149,7 +149,8 @@
protected void setUp() throws Exception {
super.setUp();
CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(mBuild);
- sepolicyAnalyze = buildHelper.getTestFile("sepolicy-analyze");
+ File sepolicyAnalyzeDir = buildHelper.getTestFile("sepolicy-analyze");
+ sepolicyAnalyze = new File(sepolicyAnalyzeDir, "sepolicy-analyze");
sepolicyAnalyze.setExecutable(true);
devicePolicyFile = getDevicePolicyFile(mDevice);
@@ -1123,7 +1124,7 @@
* @param domains
* The list of allowed domains.
*/
- private void assertExecutableHasDomain(String executable, String... domains)
+ private void assertExecutableExistsAndHasDomain(String executable, String... domains)
throws DeviceNotAvailableException {
List<ProcessDetails> exeProcs = ProcessDetails.getExeMap(mDevice).get(executable);
Set<String> domainList = new HashSet<String>(Arrays.asList(domains));
@@ -1138,12 +1139,34 @@
}
}
+ /**
+ * Asserts that an executable, if it exists, is only running in the listed domains.
+ *
+ * @param executable
+ * The path of the executable to check.
+ * @param domains
+ * The list of allowed domains.
+ */
+ private void assertExecutableHasDomain(String executable, String... domains)
+ throws DeviceNotAvailableException {
+ List<ProcessDetails> exeProcs = ProcessDetails.getExeMap(mDevice).get(executable);
+ Set<String> domainList = new HashSet<String>(Arrays.asList(domains));
+
+ if (exeProcs != null) {
+ for (ProcessDetails p : exeProcs) {
+ String msg = "Expected one of \"" + domainList + "\" for executable \"" + executable
+ + "\"" + " Found: \"" + p.label + "\"";
+ assertTrue(msg, domainList.contains(p.label));
+ }
+ }
+ }
+
/* Init is always there */
@CddTest(requirement="9.7")
public void testInitDomain() throws DeviceNotAvailableException {
assertDomainHasExecutable("u:r:init:s0", "/system/bin/init");
assertDomainHasExecutable("u:r:vendor_init:s0", "/system/bin/init");
- assertExecutableHasDomain("/system/bin/init", "u:r:init:s0", "u:r:vendor_init:s0");
+ assertExecutableExistsAndHasDomain("/system/bin/init", "u:r:init:s0", "u:r:vendor_init:s0");
}
/* Ueventd is always there */
@@ -1242,6 +1265,21 @@
assertDomainZeroOrOne("u:r:permissioncontroller_app:s0", "com.google.android.permissioncontroller");
}
+ /* vzwomatrigger may or may not be running */
+ @CddTest(requirement="9.7")
+ public void testVzwOmaTriggerDomain() throws DeviceNotAvailableException {
+ assertDomainZeroOrOne("u:r:vzwomatrigger_app:s0", "com.android.vzwomatrigger");
+ }
+
+ /* gmscore, if running, always runs in gmscore_app */
+ @CddTest(requirement="9.7")
+ public void testGMSCoreDomain() throws DeviceNotAvailableException {
+ assertExecutableHasDomain("com.google.android.gms", "u:r:gmscore_app:s0");
+ assertExecutableHasDomain("com.google.android.gms.ui", "u:r:gmscore_app:s0");
+ assertExecutableHasDomain("com.google.android.gms.persistent", "u:r:gmscore_app:s0");
+ assertExecutableHasDomain("com.google.android.gms:snet", "u:r:gmscore_app:s0");
+ }
+
/*
* Nothing should be running in this domain, cardinality test is all thats
* needed
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/Android.bp
index e811dd3..2604551 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/Android.bp
@@ -22,5 +22,6 @@
"libbinder",
"libandroid",
"libaudioclient",
+ "libaudiofoundation",
],
}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp
index 3fc6329..0c64210 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp
@@ -75,10 +75,11 @@
gEffect = NULL;
pthread_t pt;
const sp<IAudioFlinger> &audioFlinger = AudioSystem::get_audio_flinger();
+ AudioDeviceTypeAddr device;
for (i=0; i<100; i++) {
gEffect = audioFlinger->createEffect(&descriptor, effectClient, priority,
- io, sessionId, opPackageName, getpid(),
+ io, sessionId, device, opPackageName, getpid(),
&err, &id, &enabled);
if (gEffect == NULL || err != NO_ERROR) {
return -1;
diff --git a/hostsidetests/securitybulletin/securityPatch/pac/Android.mk b/hostsidetests/securitybulletin/securityPatch/pac/Android.mk
index bd9c07d..1960664 100644
--- a/hostsidetests/securitybulletin/securityPatch/pac/Android.mk
+++ b/hostsidetests/securitybulletin/securityPatch/pac/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SHARED_LIBRARIES := \
libpac \
-LOCAL_COMPATIBILITY_SUITE := cts sts
+LOCAL_COMPATIBILITY_SUITE := cts sts vts
LOCAL_CTS_TEST_PACKAGE := android.security.cts
LOCAL_ARM_MODE := arm
diff --git a/hostsidetests/stagedinstall/Android.bp b/hostsidetests/stagedinstall/Android.bp
index b777cc3..91ccdd5 100644
--- a/hostsidetests/stagedinstall/Android.bp
+++ b/hostsidetests/stagedinstall/Android.bp
@@ -49,6 +49,7 @@
":StagedInstallTestApexV2",
":StagedInstallTestApexV2_AdditionalFile",
":StagedInstallTestApexV2_AdditionalFolder",
+ ":StagedInstallTestApexV2_NoHashtree",
":StagedInstallTestApexV2_WithPostInstallHook",
":StagedInstallTestApexV2_WithPreInstallHook",
":StagedInstallTestApexV2_WrongSha",
@@ -129,3 +130,10 @@
filename: "com.android.apex.cts.shim_not_pre_installed.apex",
installable: false,
}
+
+prebuilt_apex {
+ name: "StagedInstallTestApexV2_NoHashtree",
+ src: "testdata/apex/com.android.apex.cts.shim.v2_no_hashtree.apex",
+ filename: "com.android.apex.cts.shim.v2_no_hashtree.apex",
+ installable: false,
+}
diff --git a/hostsidetests/stagedinstall/AndroidTest.xml b/hostsidetests/stagedinstall/AndroidTest.xml
index 64d7495..3acf716 100644
--- a/hostsidetests/stagedinstall/AndroidTest.xml
+++ b/hostsidetests/stagedinstall/AndroidTest.xml
@@ -19,6 +19,11 @@
<!-- Instant apps can't have INSTALL_PACKAGES permission. -->
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+
+ <!-- Module reboots the device making it inelligible for running in secondary users. -->
+ <!-- TODO: Revisit secondary user eligibility once b/137885984 is resolved. -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="StagedInstallTest.apk" />
diff --git a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
index 6aa8be6..d849742 100644
--- a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
@@ -56,7 +56,12 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.nio.file.FileVisitResult;
import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributes;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
@@ -644,6 +649,45 @@
assertThat(getInstalledVersion(TestApp.Apex)).isEqualTo(2);
}
+ @Test
+ public void testInstallStagedNoHashtreeApex_Commit() throws Exception {
+ assertThat(getInstalledVersion(TestApp.Apex)).isEqualTo(1);
+ int sessionId = stageSingleApk(TestApp.ApexNoHashtree2).assertSuccessful().getSessionId();
+ waitForIsReadyBroadcast(sessionId);
+ assertSessionReady(sessionId);
+ storeSessionId(sessionId);
+ // Version shouldn't change before reboot.
+ assertThat(getInstalledVersion(TestApp.Apex)).isEqualTo(1);
+ }
+
+ @Test
+ public void testInstallStagedNoHashtreeApex_VerifyPostReboot() throws Exception {
+ int sessionId = retrieveLastSessionId();
+ assertSessionApplied(sessionId);
+ assertThat(getInstalledVersion(TestApp.Apex)).isEqualTo(2);
+ // Read all files under /apex/com.android.apex.cts.shim to somewhat verify that hashtree
+ // is not corrupted
+ Files.walkFileTree(Paths.get("/apex/com.android.apex.cts.shim"),
+ new SimpleFileVisitor<Path>() {
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+ throws IOException {
+ Files.readAllBytes(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc)
+ throws IOException {
+ if (file.endsWith("lost+found")) {
+ return FileVisitResult.CONTINUE;
+ }
+ throw exc;
+ }
+ });
+ }
+
private static long getInstalledVersion(String packageName) {
Context context = InstrumentationRegistry.getInstrumentation().getContext();
PackageManager pm = context.getPackageManager();
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
index 094fd8d..07313bb 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
@@ -23,6 +23,7 @@
import android.platform.test.annotations.LargeTest;
+import com.android.tradefed.device.PackageInfo;
import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
@@ -48,6 +49,8 @@
public class ApexShimValidationTest extends BaseHostJUnit4Test {
private static final String SHIM_APEX_PACKAGE_NAME = "com.android.apex.cts.shim";
+ private static final String SHIM_APK_PACKAGE_NAME = "com.android.cts.ctsshim";
+ private static final String SHIM_PRIV_APK_PACKAGE_NAME = "com.android.cts.priv.ctsshim";
/**
* Runs the given phase of a test by calling into the device.
@@ -89,6 +92,26 @@
}
@Test
+ public void testShimApkIsPreInstalledInShimApex() throws Exception {
+ PackageInfo shimApkPackageInfo = getDevice().getAppPackageInfo(SHIM_APK_PACKAGE_NAME);
+ assertWithMessage("CTSShim APK is not pre-installed").that(
+ shimApkPackageInfo).isNotNull();
+ boolean isShimApkInShimApex = shimApkPackageInfo.getCodePath()
+ .startsWith("/apex/" + SHIM_APEX_PACKAGE_NAME + "/app/");
+ assertWithMessage("The active version of CTSShim APK does not come from "
+ + "Shim APEX").that(isShimApkInShimApex).isTrue();
+
+ PackageInfo shimPrivApkPackageInfo = getDevice()
+ .getAppPackageInfo(SHIM_PRIV_APK_PACKAGE_NAME);
+ assertWithMessage("CTSPrivShim APK is not pre-installed").that(
+ shimPrivApkPackageInfo).isNotNull();
+ boolean isPrivShimApkInShimApex = shimPrivApkPackageInfo.getCodePath()
+ .startsWith("/apex/" + SHIM_APEX_PACKAGE_NAME + "/priv-app/");
+ assertWithMessage("The active version of CTSPrivShim APK does not come "
+ + "from Shim APEX").that(isPrivShimApkInShimApex).isTrue();
+ }
+
+ @Test
@LargeTest
public void testRejectsApexWithAdditionalFile() throws Exception {
runPhase("testRejectsApexWithAdditionalFile_Commit");
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
index 6bb1d6f..10511de 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
@@ -315,6 +315,16 @@
runPhase("testInstallStagedApexWithoutApexSuffix_VerifyPostReboot");
}
+ @Test
+ @LargeTest
+ public void testInstallStagedNoHashtreeApex() throws Exception {
+ assumeTrue("Device does not support updating APEX", isUpdatingApexSupported());
+
+ runPhase("testInstallStagedNoHashtreeApex_Commit");
+ getDevice().reboot();
+ runPhase("testInstallStagedNoHashtreeApex_VerifyPostReboot");
+ }
+
/**
* Uninstalls a shim apex only if it's latest version is installed on /data partition (i.e.
* it has a version higher than {@code 1}).
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v1.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v1.apex
index 6b838dd..d703580 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v1.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v1.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2.apex
index 91096d5..412a584 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_file.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_file.apex
index 23ae628..6b9d9af 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_file.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_file.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_folder.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_folder.apex
index 0438269..df05d31 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_folder.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_additional_folder.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_different_certificate.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_different_certificate.apex
index 8f38f3f..b26a754 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_different_certificate.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_different_certificate.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_no_hashtree.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_no_hashtree.apex
new file mode 100644
index 0000000..92c6348
--- /dev/null
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_no_hashtree.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob.apex
index b43ad69..ebb7ba0 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot.apex
index 81f0ee9..2310823 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
index 4b7ae32..f94a486 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob_rot_rollback.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_post_install_hook.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_post_install_hook.apex
index 1bc260d..93cfa49 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_post_install_hook.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_post_install_hook.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_pre_install_hook.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
index 0066f3a..c58736a 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_with_pre_install_hook.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_wrong_sha.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_wrong_sha.apex
index afd33f9..5282c4f 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_wrong_sha.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_wrong_sha.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3.apex
index 71fa484..597acfa 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob.apex
index 77c5679..18a687b 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob_rot.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob_rot.apex
index 124f769..f0073b4 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob_rot.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v3_signed_bob_rot.apex
Binary files differ
diff --git a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim_not_pre_installed.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim_not_pre_installed.apex
index b9abc3d..6e5b1c6 100644
--- a/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim_not_pre_installed.apex
+++ b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim_not_pre_installed.apex
Binary files differ
diff --git a/hostsidetests/statsd/AndroidTest.xml b/hostsidetests/statsd/AndroidTest.xml
index 764e80f..2da1662 100644
--- a/hostsidetests/statsd/AndroidTest.xml
+++ b/hostsidetests/statsd/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="statsd" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CtsStatsdHostTestCases.jar" />
</test>
diff --git a/hostsidetests/statsd/src/android/cts/statsd/validation/BatteryStatsValidationTests.java b/hostsidetests/statsd/src/android/cts/statsd/validation/BatteryStatsValidationTests.java
index 2d09a0d..6369470 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/validation/BatteryStatsValidationTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/validation/BatteryStatsValidationTests.java
@@ -53,6 +53,7 @@
plugInUsb();
}
+ /*
public void testConnectivityStateChange() throws Exception {
if (!hasFeature(FEATURE_WIFI, true)) return;
if (!hasFeature(FEATURE_WATCH, false)) return;
@@ -77,6 +78,7 @@
assertEquals(batterystatsProto.getSystem().getMisc().getNumConnectivityChanges(),
countMetricData.get(0).getBucketInfo(0).getCount());
}
+ */
public void testPowerUse() throws Exception {
if (statsdDisabled()) {
diff --git a/hostsidetests/theme/app/src/android/theme/app/AssetBucketVerifier.java b/hostsidetests/theme/app/src/android/theme/app/AssetBucketVerifier.java
new file mode 100644
index 0000000..09875b1
--- /dev/null
+++ b/hostsidetests/theme/app/src/android/theme/app/AssetBucketVerifier.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.theme.app;
+
+import android.content.Context;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+class AssetBucketVerifier {
+ /** Asset file to verify. */
+ private static final String ASSET_NAME = "ic_star_black_16dp.png";
+
+ /** Densities at which {@link #ASSET_NAME} may be defined. */
+ private static final int[] DENSITIES_DPI = new int[] {
+ 160, // mdpi
+ 240, // hdpi
+ 320, // xhdpi
+ 480, // xxhdpi
+ 640, // xxxhdpi
+ };
+
+ /** Bucket names corresponding to {@link #DENSITIES_DPI} entries. */
+ private static final String[] DENSITIES_NAME = new String[] {
+ "mdpi",
+ "hdpi",
+ "xhdpi",
+ "xxhdpi",
+ "xxxhdpi"
+ };
+
+ static class Result {
+ String expectedAtDensity;
+ List<String> foundAtDensity;
+ }
+
+ static Result verifyAssetBucket(Context context) {
+ List<String> foundAtDensity = new ArrayList<>();
+ String expectedAtDensity = null;
+
+ int deviceDensityDpi = context.getResources().getConfiguration().densityDpi;
+ for (int i = 0; i < DENSITIES_DPI.length; i++) {
+ // Find the matching or next-highest density bucket.
+ if (expectedAtDensity == null && DENSITIES_DPI[i] >= deviceDensityDpi) {
+ expectedAtDensity = DENSITIES_NAME[i];
+ }
+
+ // Try to load and close the asset from the current density.
+ try {
+ context.getAssets().openNonAssetFd(1,
+ "res/drawable-" + DENSITIES_NAME[i] + "-v4/" + ASSET_NAME).close();
+ foundAtDensity.add(DENSITIES_NAME[i]);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ if (expectedAtDensity == null) {
+ expectedAtDensity = DENSITIES_NAME[DENSITIES_NAME.length - 1];
+ }
+
+ Result result = new Result();
+ result.expectedAtDensity = expectedAtDensity;
+ result.foundAtDensity = foundAtDensity;
+ return result;
+ }
+}
diff --git a/hostsidetests/theme/app/src/android/theme/app/GenerateImagesActivity.java b/hostsidetests/theme/app/src/android/theme/app/GenerateImagesActivity.java
index a41e426..9ee5a65 100644
--- a/hostsidetests/theme/app/src/android/theme/app/GenerateImagesActivity.java
+++ b/hostsidetests/theme/app/src/android/theme/app/GenerateImagesActivity.java
@@ -59,14 +59,41 @@
// Useful for local testing. Not required for CTS harness.
getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);
- mOutputDir = setupOutputDirectory();
- if (mOutputDir == null) {
- finish("Failed to create output directory " + mOutputDir.getAbsolutePath(), false);
+ // Make sure the device has reasonable assets.
+ String assetDensityFailureMsg = checkAssetDensity();
+ if (assetDensityFailureMsg != null) {
+ finish("Failed to verify device assets: "+ assetDensityFailureMsg, false);
} else {
- generateNextImage();
+ mOutputDir = setupOutputDirectory();
+ if (mOutputDir == null) {
+ finish("Failed to create output directory: " + OUT_DIR, false);
+ } else {
+ generateNextImage();
+ }
}
}
+ private String checkAssetDensity() {
+ AssetBucketVerifier.Result result = AssetBucketVerifier.verifyAssetBucket(this);
+
+ String message;
+ if (result.foundAtDensity.contains(result.expectedAtDensity)) {
+ message = null;
+ } else if (result.foundAtDensity.isEmpty()) {
+ message = "Failed to find expected device assets at any density";
+ } else {
+ StringBuilder foundAtDensityStr = new StringBuilder(result.foundAtDensity.get(0));
+ for (int i = 1; i < result.foundAtDensity.size(); i++) {
+ foundAtDensityStr.append(", ");
+ foundAtDensityStr.append(result.foundAtDensity.get(i));
+ }
+ message = "Failed to find device assets at expected density ("
+ + result.expectedAtDensity + "), but found at " + foundAtDensityStr;
+ }
+
+ return message;
+ }
+
private File setupOutputDirectory() {
mOutputDir = new File(Environment.getExternalStorageDirectory(), OUT_DIR);
ThemeTestUtils.deleteDirectory(mOutputDir);
@@ -99,8 +126,9 @@
private void generateNextImage() {
// Keep trying themes until one works.
boolean success = false;
- while (++mCurrentTheme < THEMES.length && !success) {
+ while (mCurrentTheme < THEMES.length && !success) {
success = launchThemeDeviceActivity();
+ mCurrentTheme++;
}
// If we ran out of themes, we're done.
diff --git a/hostsidetests/userspacereboot/Android.bp b/hostsidetests/userspacereboot/Android.bp
new file mode 100644
index 0000000..c3eb8b7
--- /dev/null
+++ b/hostsidetests/userspacereboot/Android.bp
@@ -0,0 +1,46 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+java_test_host {
+ name: "CtsUserspaceRebootHostSideTestCases",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "cts-tradefed",
+ "tradefed",
+ "truth-prebuilt",
+ "hamcrest",
+ "hamcrest-library",
+ ],
+ data: [
+ ":UserspaceRebootTest",
+ ],
+ test_suites: [
+ "cts",
+ "general-tests",
+ ],
+}
+
+android_test_helper_app {
+ name: "UserspaceRebootTest",
+ srcs: ["app/src/**/*.java"],
+ manifest : "app/AndroidManifest.xml",
+ static_libs: [
+ "androidx.test.runner",
+ "androidx.test.core",
+ "testng",
+ "truth-prebuilt",
+ ],
+ sdk_version: "test_current",
+}
\ No newline at end of file
diff --git a/hostsidetests/userspacereboot/AndroidTest.xml b/hostsidetests/userspacereboot/AndroidTest.xml
new file mode 100644
index 0000000..d62eb03
--- /dev/null
+++ b/hostsidetests/userspacereboot/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<configuration description="Runs userspace reboot CTS tests">
+ <option name="test-suite-tag" value="cts" />
+ <option name="config-descriptor:metadata" key="component" value="framework" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="UserspaceRebootTest.apk" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.HostTest" >
+ <option name="class" value="com.android.cts.userspacereboot.host.UserspaceRebootHostTest" />
+ </test>
+</configuration>
diff --git a/hostsidetests/userspacereboot/OWNERS b/hostsidetests/userspacereboot/OWNERS
new file mode 100644
index 0000000..8b2fa8c
--- /dev/null
+++ b/hostsidetests/userspacereboot/OWNERS
@@ -0,0 +1,2 @@
+ioffe@google.com
+tomcherry@google.com
\ No newline at end of file
diff --git a/hostsidetests/userspacereboot/app/AndroidManifest.xml b/hostsidetests/userspacereboot/app/AndroidManifest.xml
new file mode 100644
index 0000000..7eb103d
--- /dev/null
+++ b/hostsidetests/userspacereboot/app/AndroidManifest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.userspacereboot" >
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="com.android.cts.userspacereboot"
+ android:label="UserspaceReboot device side tests"/>
+</manifest>
diff --git a/hostsidetests/userspacereboot/app/src/com/android/cts/userspacereboot/UserspaceRebootTest.java b/hostsidetests/userspacereboot/app/src/com/android/cts/userspacereboot/UserspaceRebootTest.java
new file mode 100644
index 0000000..341ab1c
--- /dev/null
+++ b/hostsidetests/userspacereboot/app/src/com/android/cts/userspacereboot/UserspaceRebootTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.cts.userspacereboot;
+
+import static com.google.common.truth.Truth.assertThat;
+
+
+import static org.testng.Assert.assertThrows;
+
+import android.content.Context;
+import android.os.PowerManager;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class UserspaceRebootTest {
+
+ private final Context mContext = InstrumentationRegistry.getInstrumentation().getContext();
+
+ @Test
+ public void testUserspaceRebootIsSupported() {
+ PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
+ assertThat(powerManager.isRebootingUserspaceSupported()).isTrue();
+ }
+
+ @Test
+ public void testUserspaceRebootIsNotSupported() {
+ PowerManager powerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
+ assertThat(powerManager.isRebootingUserspaceSupported()).isFalse();
+ assertThrows(UnsupportedOperationException.class,
+ () -> powerManager.reboot("userspace"));
+ }
+}
diff --git a/hostsidetests/userspacereboot/src/com/android/cts/userspacereboot/host/UserspaceRebootHostTest.java b/hostsidetests/userspacereboot/src/com/android/cts/userspacereboot/host/UserspaceRebootHostTest.java
new file mode 100644
index 0000000..25231b9b
--- /dev/null
+++ b/hostsidetests/userspacereboot/src/com/android/cts/userspacereboot/host/UserspaceRebootHostTest.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.cts.userspacereboot.host;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
+
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.util.CommandResult;
+import com.android.tradefed.util.CommandStatus;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.time.Duration;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class UserspaceRebootHostTest extends BaseHostJUnit4Test {
+
+ private static final String USERSPACE_REBOOT_SUPPORTED_PROP =
+ "ro.init.userspace_reboot.is_supported";
+
+ /**
+ * Runs the given {@code testName} of
+ * {@link com.android.cts.userspacereboot.UserspaceRebootTest}.
+ *
+ * @throws Exception if test phase fails.
+ */
+ private void runDeviceTest(String testName) throws Exception {
+ assertThat(runDeviceTests("com.android.cts.userspacereboot",
+ "com.android.cts.userspacereboot.UserspaceRebootTest",
+ testName)).isTrue();
+ }
+
+ @Test
+ public void testOnlyFbeDevicesSupportUserspaceReboot() throws Exception {
+ assumeTrue("Userspace reboot not supported on the device",
+ getDevice().getBooleanProperty(USERSPACE_REBOOT_SUPPORTED_PROP, false));
+ assertThat(getDevice().getProperty("ro.crypto.state")).isEqualTo("encrypted");
+ assertThat(getDevice().getProperty("ro.crypto.type")).isEqualTo("file");
+ // Also verify that PowerManager.isRebootingUserspaceSupported will return true
+ runDeviceTest("testUserspaceRebootIsSupported");
+ }
+
+ @Test
+ public void testDeviceDoesNotSupportUserspaceReboot() throws Exception {
+ assumeFalse("Userspace reboot supported on the device",
+ getDevice().getBooleanProperty(USERSPACE_REBOOT_SUPPORTED_PROP, false));
+ // Also verify that PowerManager.isRebootingUserspaceSupported will return true
+ runDeviceTest("testUserspaceRebootIsNotSupported");
+ }
+
+ @Test
+ public void testUserspaceReboot() throws Exception {
+ assumeTrue("Userspace reboot not supported on the device",
+ getDevice().getBooleanProperty(USERSPACE_REBOOT_SUPPORTED_PROP, false));
+ getDevice().rebootUserspace();
+ assertWithMessage("Device did not boot within 2 minutes").that(
+ getDevice().waitForBootComplete(Duration.ofMinutes(2).toMillis())).isTrue();
+ // If userspace reboot fails and fallback to hard reboot is triggered then
+ // sys.init.userspace_reboot.last_finished won't be set.
+ assertWithMessage("Userspace reboot failed and fallback to full reboot was triggered").that(
+ getDevice().getProperty("sys.init.userspace_reboot.last_finished")).isNotEmpty();
+ }
+
+ @Test
+ public void testUserspaceRebootWithCheckpoint() throws Exception {
+ assumeTrue("Userspace reboot not supported on the device",
+ getDevice().getBooleanProperty(USERSPACE_REBOOT_SUPPORTED_PROP, false));
+ assumeTrue("Device doesn't support fs checkpointing", isFsCheckpointingSupported());
+ CommandResult result = getDevice().executeShellV2Command("sm start-checkpoint 1");
+ Thread.sleep(500);
+ assertWithMessage("Failed to start checkpoint : %s", result.getStderr()).that(
+ result.getStatus()).isEqualTo(CommandStatus.SUCCESS);
+ getDevice().rebootUserspace();
+ assertWithMessage("Device did not boot withing 2 minutes").that(
+ getDevice().waitForBootComplete(Duration.ofMinutes(2).toMillis())).isTrue();
+ // If userspace reboot fails and fallback to hard reboot is triggered then
+ // sys.init.userspace_reboot.last_finished won't be set.
+ assertWithMessage("Userspace reboot failed and fallback to full reboot was triggered").that(
+ getDevice().getProperty("sys.init.userspace_reboot.last_finished")).isNotEmpty();
+ }
+
+ // TODO(b/135984674): add test case that forces unmount of f2fs userdata.
+
+ private boolean isFsCheckpointingSupported() throws Exception {
+ CommandResult result = getDevice().executeShellV2Command("sm supports-checkpoint");
+ assertWithMessage("Failed to check if fs checkpointing is supported : %s",
+ result.getStderr()).that(result.getStatus()).isEqualTo(CommandStatus.SUCCESS);
+ return "true".equals(result.getStdout().trim());
+ }
+}
diff --git a/libs/install/src/com/android/cts/install/lib/TestApp.java b/libs/install/src/com/android/cts/install/lib/TestApp.java
index 95acb95..1361ff2 100644
--- a/libs/install/src/com/android/cts/install/lib/TestApp.java
+++ b/libs/install/src/com/android/cts/install/lib/TestApp.java
@@ -50,6 +50,9 @@
public static final TestApp Apex2 =
new TestApp("Apex2", Apex, 2, /*isApex*/true,
"com.android.apex.cts.shim.v2.apex");
+ public static final TestApp ApexNoHashtree2 =
+ new TestApp("Apex2", Apex, 2, /*isApex*/true,
+ "com.android.apex.cts.shim.v2_no_hashtree.apex");
public static final TestApp ApexWrongSha2 = new TestApp(
"ApexWrongSha2", Apex, 2, /*isApex*/true,
"com.android.apex.cts.shim.v2_wrong_sha.apex");
diff --git a/tests/JobScheduler/AndroidTest.xml b/tests/JobScheduler/AndroidTest.xml
index 076e04b..6c487be 100644
--- a/tests/JobScheduler/AndroidTest.xml
+++ b/tests/JobScheduler/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsJobSchedulerTestCases.apk" />
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
index 60ef850..4e45f3c 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
@@ -119,10 +119,10 @@
private static final String LOG_TAG = "AccessibilityEndToEndTest";
private static final String GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND =
- "appwidget grantbind --package android.accessibilityservice.cts --user 0";
+ "appwidget grantbind --package android.accessibilityservice.cts --user ";
private static final String REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND =
- "appwidget revokebind --package android.accessibilityservice.cts --user 0";
+ "appwidget revokebind --package android.accessibilityservice.cts --user ";
private static final String APP_WIDGET_PROVIDER_PACKAGE = "foo.bar.baz";
@@ -1053,12 +1053,12 @@
private void grantBindAppWidgetPermission() throws Exception {
ShellCommandBuilder.execShellCommand(sUiAutomation,
- GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND);
+ GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND + getCurrentUser());
}
private void revokeBindAppWidgetPermission() throws Exception {
ShellCommandBuilder.execShellCommand(sUiAutomation,
- REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND);
+ REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND + getCurrentUser());
}
private AppWidgetManager getAppWidgetManager() {
@@ -1142,4 +1142,8 @@
return (tooltipView != null) && (tooltipView.getParent() != null);
});
}
+
+ private static int getCurrentUser() {
+ return android.os.Process.myUserHandle().getIdentifier();
+ }
}
diff --git a/tests/app/DownloadManagerApi28Test/AndroidTest.xml b/tests/app/DownloadManagerApi28Test/AndroidTest.xml
index c07caaa..fe1b573 100644
--- a/tests/app/DownloadManagerApi28Test/AndroidTest.xml
+++ b/tests/app/DownloadManagerApi28Test/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDownloadManagerApi28.apk" />
@@ -27,4 +28,4 @@
<option name="package" value="android.app.cts.downloads.api28" />
</test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/tests/app/DownloadManagerLegacyTest/AndroidTest.xml b/tests/app/DownloadManagerLegacyTest/AndroidTest.xml
index ae9708d..768e537 100644
--- a/tests/app/DownloadManagerLegacyTest/AndroidTest.xml
+++ b/tests/app/DownloadManagerLegacyTest/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsDownloadManagerLegacy.apk" />
diff --git a/tests/app/src/android/app/cts/NotificationChannelTest.java b/tests/app/src/android/app/cts/NotificationChannelTest.java
index cff8dcb..3db2967 100644
--- a/tests/app/src/android/app/cts/NotificationChannelTest.java
+++ b/tests/app/src/android/app/cts/NotificationChannelTest.java
@@ -166,6 +166,13 @@
assertEquals(false, channel.canBubble());
}
+ public void testIsBlockableSystem() {
+ NotificationChannel channel =
+ new NotificationChannel("1", "one", IMPORTANCE_DEFAULT);
+ channel.setBlockableSystem(true);
+ assertTrue(channel.isBlockableSystem());
+ }
+
public void testIsImportanceLockedByOEM() {
NotificationChannel channel =
new NotificationChannel("1", "one", IMPORTANCE_DEFAULT);
diff --git a/tests/app/src/android/app/cts/StatusBarManagerTest.java b/tests/app/src/android/app/cts/StatusBarManagerTest.java
index 11eb922..241ee12 100644
--- a/tests/app/src/android/app/cts/StatusBarManagerTest.java
+++ b/tests/app/src/android/app/cts/StatusBarManagerTest.java
@@ -96,4 +96,22 @@
assertTrue("Invalid disableFlags", info.areAllComponentsEnabled());
}
+
+ @Test
+ public void testDisableForSimLock_setDisabledTrue() throws Exception {
+ mStatusBarManager.setDisabledForSimNetworkLock(true);
+
+ // Check for the default set of disable flags
+ assertTrue(mStatusBarManager.getDisableInfo().isStatusBarExpansionDisabled());
+ }
+
+ @Test
+ public void testDisableForSimLock_setDisabledFalse() throws Exception {
+ // First disable, then re-enable
+ mStatusBarManager.setDisabledForSimNetworkLock(true);
+ mStatusBarManager.setDisabledForSimNetworkLock(false);
+
+ DisableInfo info = mStatusBarManager.getDisableInfo();
+ assertTrue("Invalid disableFlags", info.areAllComponentsEnabled());
+ }
}
diff --git a/tests/autofillservice/AndroidTest.xml b/tests/autofillservice/AndroidTest.xml
index 66992f6..288ddba 100644
--- a/tests/autofillservice/AndroidTest.xml
+++ b/tests/autofillservice/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="autofill" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/camera/AndroidTest.xml b/tests/camera/AndroidTest.xml
index 9cf73b8..3238ffa 100644
--- a/tests/camera/AndroidTest.xml
+++ b/tests/camera/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="camera" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsCameraTestCases.apk" />
diff --git a/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
index e8d2812..f28e50c 100644
--- a/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
@@ -1030,6 +1030,9 @@
// stopPreview must be called here to make sure next time a preview stream
// is created with new size.
stopPreview();
+ // Drain the results after each combination. Depending on the device the results
+ // can be relatively big and could accumulate fairly quickly after many iterations.
+ resultListener.drain();
}
}
diff --git a/tests/framework/base/windowmanager/AndroidTest.xml b/tests/framework/base/windowmanager/AndroidTest.xml
index fed61d7..e92c412 100644
--- a/tests/framework/base/windowmanager/AndroidTest.xml
+++ b/tests/framework/base/windowmanager/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework"/>
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck"/>
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true"/>
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java b/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
index 98669b7..dbbc682 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
@@ -22,6 +22,7 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
+import static android.content.pm.PackageManager.FEATURE_LEANBACK;
import static android.server.wm.ActivityManagerState.STATE_RESUMED;
import static android.server.wm.ActivityManagerState.STATE_STOPPED;
import static android.server.wm.ComponentNameUtils.getActivityName;
@@ -73,6 +74,7 @@
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
import android.content.ComponentName;
@@ -190,6 +192,7 @@
@Test
public void testNonTappablePipActivity() throws Exception {
+ assumeFalse(hasDeviceFeature(FEATURE_LEANBACK));
// Launch the tap-to-finish activity at a specific place
launchActivity(PIP_ACTIVITY,
EXTRA_ENTER_PIP, "true",
diff --git a/tests/inputmethod/AndroidTest.xml b/tests/inputmethod/AndroidTest.xml
index f64bd17..ce5e679 100644
--- a/tests/inputmethod/AndroidTest.xml
+++ b/tests/inputmethod/AndroidTest.xml
@@ -20,6 +20,7 @@
<option name="config-descriptor:metadata" key="component" value="inputmethod" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<!--
TODO(yukawa): come up with a proper way to take care of devices that do not support
installable IMEs. Ideally target_preparer should have an option to annotate required
diff --git a/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/LibcoreTest.java b/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/LibcoreTest.java
index 980315a..12131e5 100644
--- a/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/LibcoreTest.java
+++ b/tests/jdwp/runner/host-side/src/com/android/compatibility/testtype/LibcoreTest.java
@@ -20,6 +20,7 @@
import com.android.tradefed.config.Option;
import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.invoker.TestInformation;
import com.android.tradefed.log.LogUtil.CLog;
import com.android.tradefed.result.ITestInvocationListener;
import com.android.tradefed.testtype.AndroidJUnitTest;
@@ -55,7 +56,7 @@
* {@inheritDoc}
*/
@Override
- public void run(ITestInvocationListener listener) throws DeviceNotAvailableException {
+ public void run(TestInformation testInfo, ITestInvocationListener listener) throws DeviceNotAvailableException {
List<String> coreExpectations = getCoreExpectations();
if (!coreExpectations.isEmpty()) {
addInstrumentationArg(INSTRUMENTATION_ARG_NAME, ArrayUtil.join(",", coreExpectations));
@@ -70,7 +71,7 @@
"Setting --class and --method to null to avoid conflict with --test-package "
+ "option.");
}
- super.run(listener);
+ super.run(testInfo, listener);
}
private List<String> getCoreExpectations() throws DeviceNotAvailableException {
diff --git a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
index 47ae1ed..eaeb029 100644
--- a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
+++ b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
@@ -72,7 +72,7 @@
intent.putExtra(IntentKeys.SCROLL_DELAY, PRE_SCROLL_DELAY_MILLIS);
intent.putExtra(IntentKeys.SCROLL_COUNT, SCROLL_COUNT);
intent.putExtra(IntentKeys.SCROLL_INTERVAL, SCROLL_INTERVAL_MILLIS);
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
getInstrumentation().getTargetContext().startActivity(intent);
if (!getUiDevice().wait(Until.hasObject(By.pkg(APP_PACKAGE)), WAIT_TIMEOUT)) {
fail("Test helper app package not found on device");
diff --git a/tests/openglperf2/AndroidTest.xml b/tests/openglperf2/AndroidTest.xml
index c2fa3a6..fdc373f 100644
--- a/tests/openglperf2/AndroidTest.xml
+++ b/tests/openglperf2/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="graphics" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java b/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java
index de946b3..0dfad93 100644
--- a/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java
+++ b/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java
@@ -16,20 +16,9 @@
package android.providerui.cts;
-import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION;
-import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
-import static android.Manifest.permission.ACCESS_FINE_LOCATION;
-import static android.Manifest.permission.ACCESS_MEDIA_LOCATION;
-import static android.Manifest.permission.CAMERA;
-import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
-import static android.Manifest.permission.RECORD_AUDIO;
-import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
-
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import android.app.Activity;
@@ -39,18 +28,13 @@
import android.content.Context;
import android.content.Intent;
import android.content.UriPermission;
-import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.PermissionInfo;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
-import android.media.ExifInterface;
import android.net.Uri;
import android.os.Environment;
import android.os.FileUtils;
import android.os.ParcelFileDescriptor;
-import android.os.SystemClock;
import android.os.storage.StorageManager;
import android.os.storage.StorageVolume;
import android.os.UserManager;
@@ -60,14 +44,11 @@
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.UiSelector;
import android.support.test.uiautomator.Until;
import android.system.Os;
import android.text.format.DateUtils;
import android.util.Log;
-import android.view.KeyEvent;
-import androidx.core.content.FileProvider;
import androidx.test.InstrumentationRegistry;
import org.junit.After;
@@ -88,12 +69,6 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
-import java.text.SimpleDateFormat;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
@RunWith(Parameterized.class)
public class MediaStoreUiTest {
@@ -211,177 +186,6 @@
assertEquals(mMediaStoreUri, mediaUri);
}
- private void maybeClick(UiSelector sel) {
- try { mDevice.findObject(sel).click(); } catch (Throwable ignored) { }
- }
-
- private void maybeClick(BySelector sel) {
- try { mDevice.findObject(sel).click(); } catch (Throwable ignored) { }
- }
-
- private void maybeGrantRuntimePermission(String pkg, Set<String> requested, String permission)
- throws NameNotFoundException {
- // We only need to grant dangerous permissions
- if ((mContext.getPackageManager().getPermissionInfo(permission, 0).getProtection()
- & PermissionInfo.PROTECTION_DANGEROUS) == 0) {
- return;
- }
-
- if (requested.contains(permission)) {
- InstrumentationRegistry.getInstrumentation().getUiAutomation()
- .grantRuntimePermission(pkg, permission);
- }
- }
-
- /**
- * Verify that whoever handles {@link MediaStore#ACTION_IMAGE_CAPTURE} can
- * correctly write the contents into a passed {@code content://} Uri.
- */
- @Test
- public void testImageCaptureWithInadequeteLocationPermissions() throws Exception {
- Set<String> perms = new HashSet<>();
- perms.add(ACCESS_COARSE_LOCATION);
- perms.add(ACCESS_BACKGROUND_LOCATION);
- perms.add(ACCESS_MEDIA_LOCATION);
- testImageCaptureWithoutLocation(perms, MediaStore.ACTION_IMAGE_CAPTURE);
- testImageCaptureWithoutLocation(perms, MediaStore.ACTION_IMAGE_CAPTURE_SECURE);
- }
- /**
- * Helper function to verify that whoever handles {@link MediaStore#ACTION_IMAGE_CAPTURE} can
- * correctly write the contents into a passed {@code content://} Uri, without location
- * information, necessarily, when ACCESS_FINE_LOCATION permissions aren't given.
- */
- private void testImageCaptureWithoutLocation(Set<String> locationPermissions, String intentStr)
- throws Exception {
- assertFalse("testImageCaptureWithoutLocation should not be passed ACCESS_FINE_LOCATION",
- locationPermissions.contains(ACCESS_FINE_LOCATION));
- if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
- Log.d(TAG, "Skipping due to lack of camera");
- return;
- }
-
- String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
-
- final File targetDir = new File(mContext.getFilesDir(), "debug");
- final File target = new File(targetDir, timeStamp + "capture.jpg");
-
- targetDir.mkdirs();
- assertFalse(target.exists());
-
- final Intent intent = new Intent(intentStr);
- intent.putExtra(MediaStore.EXTRA_OUTPUT,
- FileProvider.getUriForFile(mContext, "android.providerui.cts.fileprovider", target));
-
- // Figure out who is going to answer the phone
- final ResolveInfo ri = mContext.getPackageManager().resolveActivity(intent, 0);
- final String answeringPkg = ri.activityInfo.packageName;
- Log.d(TAG, "We're probably launching " + ri);
-
- final PackageInfo pi = mContext.getPackageManager().getPackageInfo(answeringPkg,
- PackageManager.GET_PERMISSIONS);
- final Set<String> answeringReq = new HashSet<>();
- answeringReq.addAll(Arrays.asList(pi.requestedPermissions));
- // Grant the 'answering' app all the permissions they might want.
- maybeGrantRuntimePermission(answeringPkg, answeringReq, CAMERA);
- maybeGrantRuntimePermission(answeringPkg, answeringReq, ACCESS_FINE_LOCATION);
- maybeGrantRuntimePermission(answeringPkg, answeringReq, ACCESS_COARSE_LOCATION);
- maybeGrantRuntimePermission(answeringPkg, answeringReq, ACCESS_BACKGROUND_LOCATION);
- maybeGrantRuntimePermission(answeringPkg, answeringReq, RECORD_AUDIO);
- maybeGrantRuntimePermission(answeringPkg, answeringReq, READ_EXTERNAL_STORAGE);
- maybeGrantRuntimePermission(answeringPkg, answeringReq, WRITE_EXTERNAL_STORAGE);
- SystemClock.sleep(DateUtils.SECOND_IN_MILLIS);
-
- grantSelfRequisitePermissions(locationPermissions);
-
- Result result = getImageCaptureIntentResult(intent, answeringPkg);
-
- assertTrue("exists", target.exists());
- assertTrue("has data", target.length() > 65536);
-
- // At the very least we expect photos generated by the device to have
- // sane baseline EXIF data
- final ExifInterface exif = new ExifInterface(new FileInputStream(target));
- assertAttribute(exif, ExifInterface.TAG_MAKE);
- assertAttribute(exif, ExifInterface.TAG_MODEL);
- assertAttribute(exif, ExifInterface.TAG_DATETIME);
- float[] latLong = new float[2];
- Boolean hasLocation = exif.getLatLong(latLong);
- assertTrue("Should not contain location information latitude: " + latLong[0] +
- " longitude: " + latLong[1], !hasLocation);
- }
-
- private void grantSelfRequisitePermissions(Set<String> locationPermissions)
- throws Exception {
- String selfPkg = mContext.getPackageName();
- for (String perm : locationPermissions) {
- InstrumentationRegistry.getInstrumentation().getUiAutomation()
- .grantRuntimePermission(selfPkg, perm);
- assertTrue("Permission " + perm + "could not be granted",
- mContext.checkSelfPermission(perm) == PackageManager.PERMISSION_GRANTED);
- }
- }
-
- private Result getImageCaptureIntentResult(Intent intent, String answeringPkg)
- throws Exception {
-
- mActivity.startActivityForResult(intent, REQUEST_CODE);
- mDevice.waitForIdle();
-
- // To ensure camera app is launched
- SystemClock.sleep(5 * DateUtils.SECOND_IN_MILLIS);
-
- // Try a couple different strategies for taking a photo / capturing a video: first capture
- // and confirm using hardware keys.
- mDevice.pressKeyCode(KeyEvent.KEYCODE_CAMERA);
- mDevice.waitForIdle();
- SystemClock.sleep(5 * DateUtils.SECOND_IN_MILLIS);
- // We're done.
- mDevice.pressKeyCode(KeyEvent.KEYCODE_DPAD_CENTER);
- mDevice.waitForIdle();
-
- // Maybe that gave us a result?
- Result result = mActivity.getResult(15, TimeUnit.SECONDS);
- Log.d(TAG, "First pass result was " + result);
-
- // Hrm, that didn't work; let's try an alternative approach of digging
- // around for a shutter button
- if (result == null) {
- maybeClick(new UiSelector().resourceId(answeringPkg + ":id/shutter_button"));
- mDevice.waitForIdle();
- SystemClock.sleep(5 * DateUtils.SECOND_IN_MILLIS);
- maybeClick(new UiSelector().resourceId(answeringPkg + ":id/shutter_button"));
- mDevice.waitForIdle();
- maybeClick(new UiSelector().resourceId(answeringPkg + ":id/done_button"));
- mDevice.waitForIdle();
-
- result = mActivity.getResult(15, TimeUnit.SECONDS);
- Log.d(TAG, "Second pass result was " + result);
- }
-
- // Grr, let's try hunting around even more
- if (result == null) {
- maybeClick(By.pkg(answeringPkg).descContains("Capture"));
- mDevice.waitForIdle();
- SystemClock.sleep(5 * DateUtils.SECOND_IN_MILLIS);
- maybeClick(By.pkg(answeringPkg).descContains("Done"));
- mDevice.waitForIdle();
-
- result = mActivity.getResult(15, TimeUnit.SECONDS);
- Log.d(TAG, "Third pass result was " + result);
- }
-
- assertNotNull("Expected to get a IMAGE_CAPTURE result; your camera app should "
- + "respond to the CAMERA and DPAD_CENTER keycodes", result);
- return result;
- }
-
- private static void assertAttribute(ExifInterface exif, String tag) {
- final String res = exif.getAttribute(tag);
- if (res == null || res.length() == 0) {
- Log.d(TAG, "Expected valid EXIF tag for tag " + tag);
- }
- }
-
private boolean supportsHardware() {
final PackageManager pm = mContext.getPackageManager();
return !pm.hasSystemFeature("android.hardware.type.television")
diff --git a/tests/signature/TEST_MAPPING b/tests/signature/TEST_MAPPING
index 810f3f7..c1c9d61 100644
--- a/tests/signature/TEST_MAPPING
+++ b/tests/signature/TEST_MAPPING
@@ -37,9 +37,6 @@
"name": "CtsHiddenApiKillswitchWildcardTestCases"
},
{
- "name": "CtsSystemApiAnnotationTestCases"
- },
- {
"name": "CtsSystemApiSignatureTestCases"
},
{
diff --git a/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml b/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
index f45d52c..0c75fa6 100644
--- a/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
+++ b/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="systems" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsApacheHttpLegacyUsesLibraryApiSignatureTestCases.apk" />
diff --git a/tests/simplecpu/AndroidTest.xml b/tests/simplecpu/AndroidTest.xml
index f7f614a..f2fc57e 100644
--- a/tests/simplecpu/AndroidTest.xml
+++ b/tests/simplecpu/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="systems" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSimpleCpuTestCases.apk" />
diff --git a/tests/tests/appwidget/AndroidTest.xml b/tests/tests/appwidget/AndroidTest.xml
index 8b193fb..57c09a7 100644
--- a/tests/tests/appwidget/AndroidTest.xml
+++ b/tests/tests/appwidget/AndroidTest.xml
@@ -17,6 +17,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAppWidgetLauncher1.apk" />
diff --git a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
index 733a444..c4d4fcd 100644
--- a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
+++ b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
@@ -51,10 +51,10 @@
"android.appwidget.cts.provider.SecondAppWidgetConfigureActivity";
private static final String GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND =
- "appwidget grantbind --package android.appwidget.cts --user 0";
+ "appwidget grantbind --package android.appwidget.cts --user ";
private static final String REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND =
- "appwidget revokebind --package android.appwidget.cts --user 0";
+ "appwidget revokebind --package android.appwidget.cts --user ";
@Before
public void assumeHasWidgets() {
@@ -204,10 +204,14 @@
}
protected void grantBindAppWidgetPermission() throws Exception {
- runShellCommand(GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND);
+ runShellCommand(GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND + getCurrentUser());
}
protected void revokeBindAppWidgetPermission() throws Exception {
- runShellCommand(REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND);
+ runShellCommand(REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND + getCurrentUser());
+ }
+
+ private static int getCurrentUser() {
+ return android.os.Process.myUserHandle().getIdentifier();
}
}
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
index e2cf479..1bcd6e8 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
@@ -56,6 +56,7 @@
runCommandAndPrintOnLogcat(TAG, "dumpsys alarm");
runCommandAndPrintOnLogcat(TAG, "dumpsys jobscheduler");
runCommandAndPrintOnLogcat(TAG, "dumpsys content");
+ runCommandAndPrintOnLogcat(TAG, "dumpsys battery");
}
};
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp b/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
index ad6a1c9..036853e 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
@@ -97,6 +97,7 @@
"test_ibinder_jni.cpp",
"test_native_aidl_client.cpp",
"test_parcel.cpp",
+ "test_parcel_jni.cpp",
"test_status.cpp",
],
shared_libs: [
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ITest.aidl
index 72d5985..887cbe0 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ITest.aidl
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ITest.aidl
@@ -27,6 +27,7 @@
String RepeatString(String value);
@nullable String RepeatNullableString(@nullable String value);
test_package.RegularPolygon RepeatPolygon(in test_package.RegularPolygon value);
+ @nullable test_package.RegularPolygon RepeatNullablePolygon(in @nullable test_package.RegularPolygon value);
void RenamePolygon(inout test_package.RegularPolygon value, String newName);
boolean[] RepeatBooleanArray(in boolean[] input, out boolean[] repeated);
byte[] RepeatByteArray(in byte[] input, out byte[] repeated);
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ITest.aidl
index 891cf0b..c489e56 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ITest.aidl
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ITest.aidl
@@ -27,6 +27,7 @@
String RepeatString(String value);
@nullable String RepeatNullableString(@nullable String value);
test_package.RegularPolygon RepeatPolygon(in test_package.RegularPolygon value);
+ @nullable test_package.RegularPolygon RepeatNullablePolygon(in @nullable test_package.RegularPolygon value);
void RenamePolygon(inout test_package.RegularPolygon value, String newName);
boolean[] RepeatBooleanArray(in boolean[] input, out boolean[] repeated);
byte[] RepeatByteArray(in byte[] input, out byte[] repeated);
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/android_binder_cts_NativeService.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/android_binder_cts_NativeService.cpp
index 1656b46..7d78a973 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/android_binder_cts_NativeService.cpp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/android_binder_cts_NativeService.cpp
@@ -16,6 +16,7 @@
#define LOG_TAG "Cts-NdkBinderTest"
#include <android/binder_ibinder_jni.h>
+#include <android/log.h>
#include "itest_impl.h"
@@ -34,7 +35,7 @@
binder_status_t ret = AIBinder_setExtension(binder.get(), extBinder.get());
if (ret != STATUS_OK) {
- std::cout << "Could not set local extension" << std::endl;
+ __android_log_write(ANDROID_LOG_ERROR, LOG_TAG, "Could not set local extension");
}
// And the Java object owns the binder
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h b/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h
index 812eb04..a8c30ba 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h
@@ -207,6 +207,11 @@
*_aidl_return = in_value;
return ::ndk::ScopedAStatus(AStatus_newOk());
}
+ ::ndk::ScopedAStatus RepeatNullablePolygon(const std::optional<RegularPolygon>& in_value,
+ std::optional<RegularPolygon>* _aidl_return) override {
+ *_aidl_return = in_value;
+ return ::ndk::ScopedAStatus(AStatus_newOk());
+ }
::ndk::ScopedAStatus RenamePolygon(RegularPolygon* value,
const std::string& newName) override {
value->name = newName;
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp
index d15ec1d..1b31a8c 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp
@@ -23,6 +23,7 @@
#include <aidl/test_package/LongEnum.h>
#include <aidl/test_package/RegularPolygon.h>
#include <android/binder_ibinder_jni.h>
+#include <android/log.h>
#include <gtest/gtest.h>
#include "itest_impl.h"
@@ -247,6 +248,14 @@
EXPECT_EQ(toString(static_cast<IntEnum>(-1)), "-1");
}
+TEST_P(NdkBinderTest_Aidl, EnumValues) {
+ auto range = ::ndk::enum_range<ByteEnum>();
+ auto iter = range.begin();
+ EXPECT_EQ(ByteEnum::FOO, *iter++);
+ EXPECT_EQ(ByteEnum::BAR, *iter++);
+ EXPECT_EQ(range.end(), iter);
+}
+
TEST_P(NdkBinderTest_Aidl, RepeatBinder) {
SpAIBinder binder = iface->asBinder();
SpAIBinder ret;
@@ -393,9 +402,22 @@
RegularPolygon defaultPolygon = {"hexagon", 6, 2.0f};
RegularPolygon outputPolygon;
ASSERT_OK(iface->RepeatPolygon(defaultPolygon, &outputPolygon));
- EXPECT_EQ("hexagon", outputPolygon.name);
- EXPECT_EQ(defaultPolygon.numSides, outputPolygon.numSides);
- EXPECT_EQ(defaultPolygon.sideLength, outputPolygon.sideLength);
+ EXPECT_EQ(defaultPolygon, outputPolygon);
+}
+
+TEST_P(NdkBinderTest_Aidl, RepeatNullNullablePolygon) {
+ std::optional<RegularPolygon> defaultPolygon;
+ std::optional<RegularPolygon> outputPolygon;
+ ASSERT_OK(iface->RepeatNullablePolygon(defaultPolygon, &outputPolygon));
+ EXPECT_EQ(defaultPolygon, outputPolygon);
+}
+
+TEST_P(NdkBinderTest_Aidl, RepeatPresentNullablePolygon) {
+ std::optional<RegularPolygon> defaultPolygon =
+ std::optional<RegularPolygon>({"septagon", 7, 3.0f});
+ std::optional<RegularPolygon> outputPolygon;
+ ASSERT_OK(iface->RepeatNullablePolygon(defaultPolygon, &outputPolygon));
+ EXPECT_EQ(defaultPolygon, outputPolygon);
}
TEST_P(NdkBinderTest_Aidl, InsAndOuts) {
@@ -791,7 +813,7 @@
binder_status_t ret = AIBinder_setExtension(binder.get(), extBinder.get());
if (ret != STATUS_OK) {
- std::cout << "Could not set local extension" << std::endl;
+ __android_log_write(ANDROID_LOG_ERROR, LOG_TAG, "Could not set local extension");
}
// BpTest -> AIBinder -> test
@@ -804,28 +826,12 @@
std::shared_ptr<ITest> getNdkBinderTestJavaService(const std::string& method) {
JNIEnv* env = GetEnv();
if (env == nullptr) {
- std::cout << "No environment" << std::endl;
+ __android_log_write(ANDROID_LOG_ERROR, LOG_TAG, "No environment");
return nullptr;
}
- jclass cl = env->FindClass("android/binder/cts/NdkBinderTest");
- if (cl == nullptr) {
- std::cout << "No class" << std::endl;
- return nullptr;
- }
-
- jmethodID mid =
- env->GetStaticMethodID(cl, method.c_str(), "()Landroid/os/IBinder;");
- if (mid == nullptr) {
- std::cout << "No method id" << std::endl;
- return nullptr;
- }
-
- jobject object = env->CallStaticObjectMethod(cl, mid);
- if (object == nullptr) {
- std::cout << "Got null service from Java" << std::endl;
- return nullptr;
- }
+ jobject object = callStaticJavaMethodForObject(env, "android/binder/cts/NdkBinderTest", method,
+ "()Landroid/os/IBinder;");
SpAIBinder binder = SpAIBinder(AIBinder_fromJavaBinder(env, object));
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl
index 669f683..8166e87 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl
@@ -71,6 +71,7 @@
@nullable String RepeatNullableString(@nullable String value);
RegularPolygon RepeatPolygon(in RegularPolygon value);
+ @nullable RegularPolygon RepeatNullablePolygon(in @nullable RegularPolygon value);
// Testing inout
void RenamePolygon(inout RegularPolygon value, String newName);
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_parcel_jni.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/test_parcel_jni.cpp
new file mode 100644
index 0000000..6753cb5
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_parcel_jni.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#define LOG_TAG "Cts-NdkBinderTest"
+
+#include <android/binder_parcel.h>
+#include <android/binder_parcel_jni.h>
+#include <gtest/gtest.h>
+#include <nativetesthelper_jni/utils.h>
+
+#include "utilities.h"
+
+using ndk::ScopedAParcel;
+
+TEST(NdkBinderTest_Parcel_Jni, ConvertJni) {
+ JNIEnv* env = GetEnv();
+ ASSERT_NE(nullptr, env);
+
+ jobject object = callStaticJavaMethodForObject(env, "android/binder/cts/NdkBinderTest",
+ "getEmptyParcel", "()Landroid/os/Parcel;");
+ ASSERT_NE(nullptr, object);
+
+ ScopedAParcel parcel = ScopedAParcel(AParcel_fromJavaParcel(env, object));
+ ASSERT_NE(nullptr, parcel.get());
+
+ ASSERT_EQ(0, AParcel_getDataPosition(parcel.get()));
+ env->DeleteLocalRef(object);
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_status.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/test_status.cpp
index 7a7e536..ef3ad7a 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_status.cpp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_status.cpp
@@ -15,6 +15,9 @@
*/
#define LOG_TAG "Cts-NdkBinderTest"
+#include "utilities.h"
+
+#include <android/binder_auto_utils.h>
#include <android/binder_status.h>
#include <gtest/gtest.h>
@@ -193,3 +196,20 @@
AStatus_delete(status);
}
}
+
+TEST(NdkBinderTest_AStatus, StatusDescription) {
+ using ndk::ScopedAStatus;
+
+ EXPECT_TRUE(
+ ContainsSubstring(ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED).getDescription(),
+ "TRANSACTION_FAILED"));
+ EXPECT_TRUE(ContainsSubstring(
+ ScopedAStatus::fromExceptionCodeWithMessage(EX_TRANSACTION_FAILED, "asdf").getDescription(),
+ "asdf"));
+ EXPECT_TRUE(
+ ContainsSubstring(ScopedAStatus::fromServiceSpecificError(42).getDescription(), "42"));
+ EXPECT_TRUE(ContainsSubstring(
+ ScopedAStatus::fromServiceSpecificErrorWithMessage(42, "asdf").getDescription(), "asdf"));
+ EXPECT_TRUE(
+ ContainsSubstring(ScopedAStatus::fromStatus(STATUS_BAD_TYPE).getDescription(), "BAD_TYPE"));
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/utilities.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/utilities.cpp
index e5b317f..63a3f1b 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/utilities.cpp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/utilities.cpp
@@ -75,3 +75,26 @@
EXPECT_NE(nullptr, result);
return result;
}
+
+jobject callStaticJavaMethodForObject(JNIEnv* env, const std::string& clazz,
+ const std::string& method, const std::string& type) {
+ jclass cl = env->FindClass(clazz.c_str());
+ if (cl == nullptr) {
+ __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "No class %s", clazz.c_str());
+ return nullptr;
+ }
+
+ jmethodID mid = env->GetStaticMethodID(cl, method.c_str(), type.c_str());
+ if (mid == nullptr) {
+ __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "No method id %s", method.c_str());
+ return nullptr;
+ }
+
+ jobject object = env->CallStaticObjectMethod(cl, mid);
+ if (object == nullptr) {
+ __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Got null object from Java");
+ return nullptr;
+ }
+
+ return object;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/utilities.h b/tests/tests/binder_ndk/libbinder_ndk_test/utilities.h
index e9d6ad5..3d86ee2 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/utilities.h
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/utilities.h
@@ -48,6 +48,15 @@
return ::testing::AssertionFailure() << "Status: " << t;
}
+inline ::testing::AssertionResult ContainsSubstring(const std::string& s, const std::string& ss) {
+ if (s.find(ss) != std::string::npos) {
+ return ::testing::AssertionSuccess();
+ } else {
+ return ::testing::AssertionFailure()
+ << "String: '" << s << "' does not contain substring: " << ss;
+ }
+}
+
#define EXPECT_OK(THING) EXPECT_TRUE(isOk(THING))
#define ASSERT_OK(THING) ASSERT_TRUE(isOk(THING))
@@ -162,3 +171,5 @@
};
JNIEnv* GetEnv();
+jobject callStaticJavaMethodForObject(JNIEnv* env, const std::string& clazz,
+ const std::string& method, const std::string& type);
diff --git a/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java b/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java
index 01429f6..21c40c7 100644
--- a/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java
+++ b/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java
@@ -294,6 +294,36 @@
}
@Test
+ public void testRepeatUnexpectedNullPolygon() throws RemoteException {
+ try {
+ RegularPolygon result = mInterface.RepeatPolygon(null);
+ } catch (NullPointerException e) {
+ // non-@nullable C++ result can't handle null Polygon
+ return;
+ }
+ // Java always works w/ nullptr
+ assertEquals("JAVA", mExpectedName);
+ }
+
+ @Test
+ public void testRepeatNullNullablePolygon() throws RemoteException {
+ RegularPolygon result = mInterface.RepeatNullablePolygon(null);
+ assertEquals(null, result);
+ }
+
+ @Test
+ public void testRepeatPresentNullablePolygon() throws RemoteException {
+ RegularPolygon polygon = new RegularPolygon();
+ polygon.name = "septagon";
+ polygon.numSides = 7;
+ polygon.sideLength = 9.0f;
+
+ RegularPolygon result = mInterface.RepeatNullablePolygon(polygon);
+
+ assertPolygonEquals(polygon, result);
+ }
+
+ @Test
public void testInsAndOuts() throws RemoteException {
RegularPolygon polygon = new RegularPolygon();
mInterface.RenamePolygon(polygon, "Jerry");
diff --git a/tests/tests/binder_ndk/src/android/binder/cts/NdkBinderTest.java b/tests/tests/binder_ndk/src/android/binder/cts/NdkBinderTest.java
index 5c42a17..f58d613 100644
--- a/tests/tests/binder_ndk/src/android/binder/cts/NdkBinderTest.java
+++ b/tests/tests/binder_ndk/src/android/binder/cts/NdkBinderTest.java
@@ -17,6 +17,7 @@
package android.binder.cts;
import android.os.IBinder;
+import android.os.Parcel;
import androidx.test.InstrumentationRegistry;
@@ -56,4 +57,7 @@
InstrumentationRegistry.getTargetContext(), NativeService.RemoteOld.class)
.get().asBinder();
}
+ static Parcel getEmptyParcel() {
+ return Parcel.obtain();
+ }
}
diff --git a/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java b/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java
index 828d11e..872c166 100644
--- a/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java
+++ b/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java
@@ -194,6 +194,11 @@
}
@Override
+ public RegularPolygon RepeatNullablePolygon(RegularPolygon in_value) {
+ return in_value;
+ }
+
+ @Override
public void RenamePolygon(RegularPolygon value, String name) {
value.name = name;
}
diff --git a/tests/tests/content/src/android/content/cts/ContextTest.java b/tests/tests/content/src/android/content/cts/ContextTest.java
index dafaed6..6b10df9 100644
--- a/tests/tests/content/src/android/content/cts/ContextTest.java
+++ b/tests/tests/content/src/android/content/cts/ContextTest.java
@@ -17,6 +17,7 @@
package android.content.cts;
import android.app.AppOpsManager;
+import android.app.WallpaperManager;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -778,6 +779,8 @@
}
public void testAccessWallpaper() throws IOException, InterruptedException {
+ if (!isWallpaperSupported()) return;
+
// set Wallpaper by context#setWallpaper(Bitmap)
Bitmap bitmap = Bitmap.createBitmap(20, 30, Bitmap.Config.RGB_565);
// Test getWallpaper
@@ -1004,6 +1007,8 @@
}
public void testGetWallpaperDesiredMinimumHeightAndWidth() {
+ if (!isWallpaperSupported()) return;
+
int height = mContext.getWallpaperDesiredMinimumHeight();
int width = mContext.getWallpaperDesiredMinimumWidth();
@@ -1524,4 +1529,7 @@
}
}
+ private boolean isWallpaperSupported() {
+ return WallpaperManager.getInstance(mContext).isWallpaperSupported();
+ }
}
diff --git a/tests/tests/sdkext/Android.bp b/tests/tests/cronet/Android.bp
similarity index 75%
copy from tests/tests/sdkext/Android.bp
copy to tests/tests/cronet/Android.bp
index 9ad6c7f..0b50579 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/tests/tests/cronet/Android.bp
@@ -12,19 +12,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+
+// TODO: Move this target to cts/tests/tests/net/cronet
android_test {
- name: "CtsSdkExtTestCases",
+ name: "CtsCronetTestCases",
defaults: ["cts_defaults"],
+
+ // Include both the 32 and 64 bit versions
+ compile_multilib: "both",
+
static_libs: [
- "androidx.test.rules",
+ "CronetApiCommonTests",
"ctstestrunner-axt",
],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+
+ // Tag this module as a cts test artifact
test_suites: [
"cts",
- "mts",
+ "vts",
"general-tests",
+ "mts",
],
- sdk_version: "system_current",
+
}
diff --git a/tests/tests/cronet/AndroidManifest.xml b/tests/tests/cronet/AndroidManifest.xml
new file mode 100644
index 0000000..b7ae844
--- /dev/null
+++ b/tests/tests/cronet/AndroidManifest.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2007 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.cronet.cts" >
+
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+ <uses-permission android:name="android.permission.INTERNET" />
+
+ <application android:usesCleartextTraffic="true">
+ <uses-library android:name="android.test.runner" />
+ <uses-library android:name="org.chromium.net.cronet" />
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.cronet.cts"
+ android:label="CTS tests of android.cronet">
+ <meta-data android:name="listener"
+ android:value="com.android.cts.runner.CtsTestRunListener" />
+ </instrumentation>
+
+</manifest>
diff --git a/tests/tests/sdkext/CtsSdkExtTestCases.xml b/tests/tests/cronet/AndroidTest.xml
similarity index 72%
copy from tests/tests/sdkext/CtsSdkExtTestCases.xml
copy to tests/tests/cronet/AndroidTest.xml
index b22653c..79c37f7 100644
--- a/tests/tests/sdkext/CtsSdkExtTestCases.xml
+++ b/tests/tests/cronet/AndroidTest.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
+<!-- Copyright (C) 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,16 +13,18 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<configuration description="Configuration for SdkExt Tests">
+<configuration description="Config for CTS Cronet test cases">
<option name="test-suite-tag" value="cts" />
- <option name="config-descriptor:metadata" key="component" value="framework" />
+ <option name="config-descriptor:metadata" key="component" value="networking" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
- <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
- <option name="test-file-name" value="CtsSdkExtTestCases.apk" />
+ <option name="test-file-name" value="CtsCronetTestCases.apk" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="package" value="android.os.ext.cts" />
+ <option name="package" value="android.cronet.cts" />
+ <option name="runtime-hint" value="10s" />
</test>
-</configuration>
+</configuration>
\ No newline at end of file
diff --git a/tests/tests/cronet/OWNERS b/tests/tests/cronet/OWNERS
new file mode 100644
index 0000000..f4525df
--- /dev/null
+++ b/tests/tests/cronet/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 31808
+include ../net/OWNERS
\ No newline at end of file
diff --git a/tests/tests/graphics/AndroidTest.xml b/tests/tests/graphics/AndroidTest.xml
index 0c99b6a..e96c3df 100644
--- a/tests/tests/graphics/AndroidTest.xml
+++ b/tests/tests/graphics/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="uitoolkit" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsGraphicsTestCases.apk" />
diff --git a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
index 415bef0..13c6165 100644
--- a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
+++ b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
@@ -34,6 +34,7 @@
#include <unordered_set>
#include <vector>
+#include <android-base/file.h>
#include <android-base/properties.h>
#include <android-base/strings.h>
#include <nativehelper/JNIHelp.h>
@@ -186,7 +187,18 @@
std::string baselib = basename(path.c_str());
bool is_public = public_library_basenames.find(baselib) != public_library_basenames.end();
- bool is_in_search_path = is_library_on_path(library_search_paths, baselib, path);
+
+ // Special casing for symlinks in APEXes. For bundled APEXes, some files in
+ // the APEXes could be symlinks pointing to libraries in /system/lib to save
+ // storage. In that case, use the realpath so that `is_in_search_path` is
+ // correctly determined
+ bool is_in_search_path;
+ std::string realpath;
+ if (android::base::StartsWith(path, "/apex/") && android::base::Realpath(path, &realpath)) {
+ is_in_search_path = is_library_on_path(library_search_paths, baselib, realpath);
+ } else {
+ is_in_search_path = is_library_on_path(library_search_paths, baselib, path);
+ }
if (is_public) {
if (is_in_search_path) {
diff --git a/tests/tests/keystore/AndroidManifest.xml b/tests/tests/keystore/AndroidManifest.xml
index 9eb8ae6..be6d151 100644
--- a/tests/tests/keystore/AndroidManifest.xml
+++ b/tests/tests/keystore/AndroidManifest.xml
@@ -19,6 +19,8 @@
package="android.keystore.cts">
<uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission
+ android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application>
<uses-library android:name="android.test.runner" />
</application>
diff --git a/tests/tests/keystore/AndroidTest.xml b/tests/tests/keystore/AndroidTest.xml
index 398273f..da74c93 100644
--- a/tests/tests/keystore/AndroidTest.xml
+++ b/tests/tests/keystore/AndroidTest.xml
@@ -29,5 +29,6 @@
<!-- test-timeout unit is ms, value = 50 min -->
<option name="test-timeout" value="3000000" />
<option name="hidden-api-checks" value="false" />
+ <option name="isolated-storage" value="false" />
</test>
</configuration>
diff --git a/tests/tests/keystore/src/android/keystore/cts/AesCipherPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/AesCipherPerformanceTest.java
new file mode 100644
index 0000000..a2598a9
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/AesCipherPerformanceTest.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import java.security.AlgorithmParameters;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+
+public class AesCipherPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_AES_KEY_SIZES = {128, 256};
+ final int[] TEST_MESSAGE_SIZES = {1 << 6, 1 << 10, 1 << 17};
+
+ public void testAES_CBC_NoPadding() throws Exception {
+ testAesCipher("AES/CBC/NoPadding", SUPPORTED_AES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testAES_CBC_PKCS7Padding() throws Exception {
+ testAesCipher("AES/CBC/PKCS7Padding", SUPPORTED_AES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testAES_CTR_NoPadding() throws Exception {
+ testAesCipher("AES/CTR/NoPadding", SUPPORTED_AES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testAES_ECB_NoPadding() throws Exception {
+ testAesCipher("AES/ECB/NoPadding", SUPPORTED_AES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testAES_ECB_PKCS7Padding() throws Exception {
+ testAesCipher("AES/ECB/PKCS7Padding", SUPPORTED_AES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testAES_GCM_NoPadding() throws Exception {
+ testAesCipher("AES/GCM/NoPadding", SUPPORTED_AES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ private void testAesCipher(String algorithm, int[] keySizes, int[] messageSizes)
+ throws Exception {
+ for (int keySize : keySizes) {
+ KeystoreKeyGenerator androidKeystoreAesGenerator =
+ new AndroidKeystoreAesKeyGenerator(algorithm, keySize);
+ KeystoreKeyGenerator defaultKeystoreAesGenerator =
+ new DefaultKeystoreSecretKeyGenerator(algorithm, keySize);
+ for (int messageSize : messageSizes) {
+ measure(
+ new KeystoreAesEncryptMeasurable(
+ androidKeystoreAesGenerator, keySize, messageSize),
+ new KeystoreAesEncryptMeasurable(
+ defaultKeystoreAesGenerator, keySize, messageSize),
+ new KeystoreAesDecryptMeasurable(
+ androidKeystoreAesGenerator, keySize, messageSize),
+ new KeystoreAesDecryptMeasurable(
+ defaultKeystoreAesGenerator, keySize, messageSize));
+ }
+ }
+ }
+
+ private class AndroidKeystoreAesKeyGenerator extends AndroidKeystoreKeyGenerator {
+ AndroidKeystoreAesKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getSecretKeyGenerator()
+ .init(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_ENCRYPT
+ | KeyProperties.PURPOSE_DECRYPT)
+ .setBlockModes(TestUtils.getCipherBlockMode(algorithm))
+ .setEncryptionPaddings(
+ TestUtils.getCipherEncryptionPadding(algorithm))
+ .setRandomizedEncryptionRequired(false)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+
+ private class KeystoreAesEncryptMeasurable extends KeystoreMeasurable {
+ private final Cipher mCipher;
+ private SecretKey mKey;
+
+ KeystoreAesEncryptMeasurable(
+ KeystoreKeyGenerator keyGenerator, int keySize, int messageSize) throws Exception {
+ super(keyGenerator, "encrypt", keySize, messageSize);
+ mCipher = Cipher.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateSecretKey();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mCipher.init(Cipher.ENCRYPT_MODE, mKey);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mCipher.doFinal(getMessage());
+ }
+ }
+
+ private class KeystoreAesDecryptMeasurable extends KeystoreMeasurable {
+ private final Cipher mCipher;
+ private byte[] mEncryptedMessage;
+ private AlgorithmParameters mParameters;
+ private SecretKey mKey;
+
+ KeystoreAesDecryptMeasurable(
+ KeystoreKeyGenerator keyGenerator, int keySize, int messageSize) throws Exception {
+ super(keyGenerator, "decrypt", keySize, messageSize);
+ mCipher = Cipher.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateSecretKey();
+ mCipher.init(Cipher.ENCRYPT_MODE, mKey);
+ mEncryptedMessage = mCipher.doFinal(getMessage());
+ mParameters = mCipher.getParameters();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mCipher.init(Cipher.DECRYPT_MODE, mKey, mParameters);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mCipher.doFinal(mEncryptedMessage);
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/AesKeyGenPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/AesKeyGenPerformanceTest.java
new file mode 100644
index 0000000..abfea06
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/AesKeyGenPerformanceTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+public class AesKeyGenPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_AES_KEY_SIZES = {128, 256};
+
+ public void testAesKeyGen() throws Exception {
+ for (int keySize : SUPPORTED_AES_KEY_SIZES) {
+ measure(
+ new KeystoreSecretKeyGenMeasurable(
+ new DefaultKeystoreSecretKeyGenerator("AES", keySize), keySize),
+ new KeystoreSecretKeyGenMeasurable(
+ new AndroidKeystoreAesKeyGenerator("AES", keySize), keySize));
+ }
+ }
+
+ private class AndroidKeystoreAesKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreAesKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getSecretKeyGenerator()
+ .init(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_ENCRYPT
+ | KeyProperties.PURPOSE_DECRYPT)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/AttestationPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/AttestationPerformanceTest.java
new file mode 100644
index 0000000..9101f3b
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/AttestationPerformanceTest.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.keystore.cts.PerformanceTestBase.AndroidKeystoreKeyGenerator;
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import java.security.spec.ECGenParameterSpec;
+
+public class AttestationPerformanceTest extends PerformanceTestBase {
+
+ private final int[] RSA_KEY_SIZES = {2048, 3072, 4096};
+ private final int[] EC_CURVES = {224, 256, 384, 521};
+
+ private final byte[][] ATTESTATION_CHALLENGES = {
+ new byte[0], // empty challenge
+ "challenge".getBytes(), // short challenge
+ new byte[128], // long challenge
+ };
+
+ public void testRsaKeyAttestation() throws Exception {
+ for (byte[] challenge : ATTESTATION_CHALLENGES) {
+ for (int keySize : RSA_KEY_SIZES) {
+ measure(new KeystoreAttestationMeasurable(
+ new AndroidKeystoreRsaKeyGenerator("SHA1withRSA", keySize, challenge),
+ keySize, challenge.length));
+ }
+ }
+ }
+
+ public void testEcKeyAttestation() throws Exception {
+ for (byte[] challenge : ATTESTATION_CHALLENGES) {
+ for (int curve : EC_CURVES) {
+ measure(new KeystoreAttestationMeasurable(
+ new AndroidKeystoreEcKeyGenerator("SHA1withECDSA", curve, challenge),
+ curve,
+ challenge.length));
+ }
+ }
+ }
+
+ private class AndroidKeystoreRsaKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreRsaKeyGenerator(String algorithm, int keySize, byte[] challenge)
+ throws Exception {
+ super(algorithm);
+ getKeyPairGenerator()
+ .initialize(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .setSignaturePaddings(
+ TestUtils.getSignatureAlgorithmPadding(algorithm))
+ .setDigests(TestUtils.getSignatureAlgorithmDigest(algorithm))
+ .setAttestationChallenge(challenge)
+ .build());
+ }
+ }
+
+ private class AndroidKeystoreEcKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreEcKeyGenerator(String algorithm, int keySize, byte[] challenge)
+ throws Exception {
+ super(algorithm);
+ getKeyPairGenerator()
+ .initialize(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .setDigests(TestUtils.getSignatureAlgorithmDigest(algorithm))
+ .setAttestationChallenge(challenge)
+ .build());
+ }
+ }
+
+ private class KeystoreAttestationMeasurable extends KeystoreMeasurable {
+ private final AndroidKeystoreKeyGenerator mKeyGen;
+
+ KeystoreAttestationMeasurable(
+ AndroidKeystoreKeyGenerator keyGen, int keySize, int challengeSize)
+ throws Exception {
+ super(keyGen, "attest", keySize, challengeSize);
+ mKeyGen = keyGen;
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKeyGen.getKeyPairGenerator().generateKeyPair();
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mKeyGen.getCertificateChain();
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/DesCipherPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/DesCipherPerformanceTest.java
new file mode 100644
index 0000000..5d9d7aa
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/DesCipherPerformanceTest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import java.security.AlgorithmParameters;
+
+import javax.crypto.Cipher;
+import javax.crypto.SecretKey;
+
+public class DesCipherPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_DES_KEY_SIZES = {168};
+ final int[] TEST_MESSAGE_SIZES = {1 << 6, 1 << 10, 1 << 17};
+
+ public void testDESede_CBC_NoPadding() throws Exception {
+ testDesCipher("DESede/CBC/NoPadding", SUPPORTED_DES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testDESede_CBC_PKCS7Padding() throws Exception {
+ testDesCipher("DESede/CBC/PKCS7Padding", SUPPORTED_DES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testDESede_ECB_NoPadding() throws Exception {
+ testDesCipher("DESede/ECB/NoPadding", SUPPORTED_DES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testDESede_ECB_PKCS7Padding() throws Exception {
+ testDesCipher("DESede/ECB/PKCS7Padding", SUPPORTED_DES_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ private void testDesCipher(String algorithm, int[] keySizes, int[] messageSizes)
+ throws Exception {
+ for (int keySize : keySizes) {
+ KeystoreKeyGenerator androidKeystoreDesGenerator =
+ new AndroidKeystoreDesKeyGenerator(algorithm, keySize);
+ KeystoreKeyGenerator defaultKeystoreDesGenerator =
+ new DefaultKeystoreSecretKeyGenerator(algorithm, keySize);
+ for (int messageSize : messageSizes) {
+ measure(
+ new KeystoreDesEncryptMeasurable(
+ androidKeystoreDesGenerator, keySize, messageSize),
+ new KeystoreDesEncryptMeasurable(
+ defaultKeystoreDesGenerator, keySize, messageSize),
+ new KeystoreDesDecryptMeasurable(
+ androidKeystoreDesGenerator, keySize, messageSize),
+ new KeystoreDesDecryptMeasurable(
+ defaultKeystoreDesGenerator, keySize, messageSize));
+ }
+ }
+ }
+
+ private class AndroidKeystoreDesKeyGenerator extends AndroidKeystoreKeyGenerator {
+ AndroidKeystoreDesKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getSecretKeyGenerator()
+ .init(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_ENCRYPT
+ | KeyProperties.PURPOSE_DECRYPT)
+ .setBlockModes(TestUtils.getCipherBlockMode(algorithm))
+ .setEncryptionPaddings(
+ TestUtils.getCipherEncryptionPadding(algorithm))
+ .setRandomizedEncryptionRequired(false)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+
+ private class KeystoreDesEncryptMeasurable extends KeystoreMeasurable {
+ private final Cipher mCipher;
+ private SecretKey mKey;
+
+ KeystoreDesEncryptMeasurable(
+ KeystoreKeyGenerator keyGenerator, int keySize, int messageSize) throws Exception {
+ super(keyGenerator, "encrypt", keySize, messageSize);
+ mCipher = Cipher.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateSecretKey();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mCipher.init(Cipher.ENCRYPT_MODE, mKey);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mCipher.doFinal(getMessage());
+ }
+ }
+
+ private class KeystoreDesDecryptMeasurable extends KeystoreMeasurable {
+ private final Cipher mCipher;
+ private byte[] mEncryptedMessage;
+ private SecretKey mKey;
+ private AlgorithmParameters mParameters;
+
+ KeystoreDesDecryptMeasurable(
+ KeystoreKeyGenerator keyGenerator, int keySize, int messageSize) throws Exception {
+ super(keyGenerator, "decrypt", keySize, messageSize);
+ mCipher = Cipher.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateSecretKey();
+ mCipher.init(Cipher.ENCRYPT_MODE, mKey);
+ mEncryptedMessage = mCipher.doFinal(getMessage());
+ mParameters = mCipher.getParameters();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mCipher.init(Cipher.DECRYPT_MODE, mKey, mParameters);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mCipher.doFinal(mEncryptedMessage);
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/DesKeyGenPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/DesKeyGenPerformanceTest.java
new file mode 100644
index 0000000..195d573
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/DesKeyGenPerformanceTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+public class DesKeyGenPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_DES_KEY_SIZES = {168};
+
+ public void testDesKeyGen() throws Exception {
+ for (int keySize : SUPPORTED_DES_KEY_SIZES) {
+ measure(
+ new KeystoreSecretKeyGenMeasurable(
+ new DefaultKeystoreSecretKeyGenerator("DESede", keySize), keySize),
+ new KeystoreSecretKeyGenMeasurable(
+ new AndroidKeystoreDesKeyGenerator("DESede", keySize), keySize));
+ }
+ }
+
+ private class AndroidKeystoreDesKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreDesKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getSecretKeyGenerator()
+ .init(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_ENCRYPT
+ | KeyProperties.PURPOSE_DECRYPT)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/EcKeyGenPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/EcKeyGenPerformanceTest.java
new file mode 100644
index 0000000..afedb9f
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/EcKeyGenPerformanceTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import java.security.spec.ECGenParameterSpec;
+
+public class EcKeyGenPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_CURVES = {224, 256, 384, 521};
+
+ public void testEcKeyGen() throws Exception {
+ for (int curve : SUPPORTED_CURVES) {
+ measure(
+ new KeystoreKeyPairGenMeasurable(
+ new AndroidKeystoreEcKeyGenerator("EC", curve), curve),
+ new KeystoreKeyPairGenMeasurable(
+ new DefaultKeystoreEcKeyGenerator("EC", curve), curve));
+ }
+ }
+
+ private class AndroidKeystoreEcKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreEcKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getKeyPairGenerator()
+ .initialize(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+
+ private class DefaultKeystoreEcKeyGenerator extends KeystoreKeyGenerator {
+
+ DefaultKeystoreEcKeyGenerator(String algorithm, int curve) throws Exception {
+ super(algorithm);
+ getKeyPairGenerator().initialize(curve);
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/EcdsaSignaturePerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/EcdsaSignaturePerformanceTest.java
new file mode 100644
index 0000000..179dacc
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/EcdsaSignaturePerformanceTest.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import java.security.KeyPair;
+import java.security.Signature;
+import java.security.spec.ECGenParameterSpec;
+
+public class EcdsaSignaturePerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_KEY_SIZES = {224, 256, 384, 521};
+ final int[] TEST_MESSAGE_SIZES = {1 << 6, 1 << 10, 1 << 17};
+
+ public void testNONEwithECDSA() throws Exception {
+ testEcdsaSign("NONEwithECDSA", TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA1withECDSA() throws Exception {
+ testEcdsaSign("SHA1withECDSA", TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA224withECDSA() throws Exception {
+ testEcdsaSign("SHA224withECDSA", TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA256withECDSA() throws Exception {
+ testEcdsaSign("SHA256withECDSA", TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA384withECDSA() throws Exception {
+ testEcdsaSign("SHA384withECDSA", TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA512withECDSA() throws Exception {
+ testEcdsaSign("SHA512withECDSA", TEST_MESSAGE_SIZES);
+ }
+
+ private void testEcdsaSign(String algorithm, int[] messageSizes) throws Exception {
+ for (int keySize : SUPPORTED_KEY_SIZES) {
+ KeystoreKeyGenerator androidKeystoreEcGenerator =
+ new AndroidKeystoreEcKeyGenerator(algorithm, keySize);
+ KeystoreKeyGenerator defaultKeystoreEcGenerator =
+ new DefaultKeystoreEcKeyGenerator(algorithm, keySize);
+ for (int messageSize : messageSizes) {
+ measure(
+ new KeystoreEcSignMeasurable(
+ androidKeystoreEcGenerator, keySize, messageSize),
+ new KeystoreEcVerifyMeasurable(
+ androidKeystoreEcGenerator, keySize, messageSize),
+ new KeystoreEcSignMeasurable(
+ defaultKeystoreEcGenerator, keySize, messageSize),
+ new KeystoreEcVerifyMeasurable(
+ defaultKeystoreEcGenerator, keySize, messageSize));
+ }
+ }
+ }
+
+ private class DefaultKeystoreEcKeyGenerator extends KeystoreKeyGenerator {
+
+ DefaultKeystoreEcKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getKeyPairGenerator().initialize(keySize);
+ }
+ }
+
+ private class AndroidKeystoreEcKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreEcKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getKeyPairGenerator()
+ .initialize(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .setDigests(TestUtils.getSignatureAlgorithmDigest(algorithm))
+ .build());
+ }
+ }
+
+ private class KeystoreEcSignMeasurable extends KeystoreMeasurable {
+ private final Signature mSignature;
+ private KeyPair mKey;
+
+ KeystoreEcSignMeasurable(KeystoreKeyGenerator keyGen, int keySize, int messageSize)
+ throws Exception {
+ super(keyGen, "sign", keySize, messageSize);
+ mSignature = Signature.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateKeyPair();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mSignature.initSign(mKey.getPrivate());
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mSignature.update(getMessage());
+ mSignature.sign();
+ }
+ }
+
+ private class KeystoreEcVerifyMeasurable extends KeystoreMeasurable {
+ private byte[] mMessageSignature;
+ private final Signature mSignature;
+ private KeyPair mKey;
+
+ KeystoreEcVerifyMeasurable(KeystoreKeyGenerator keyGen, int keySize, int messageSize)
+ throws Exception {
+ super(keyGen, "verify", keySize, messageSize);
+ mSignature = Signature.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateKeyPair();
+ mSignature.initSign(mKey.getPrivate());
+ mSignature.update(getMessage());
+ mMessageSignature = mSignature.sign();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mSignature.initVerify(mKey.getPublic());
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mSignature.update(getMessage());
+ mSignature.verify(mMessageSignature);
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/HmacKeyGenPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/HmacKeyGenPerformanceTest.java
new file mode 100644
index 0000000..544621e
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/HmacKeyGenPerformanceTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+public class HmacKeyGenPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_KEY_SIZES = {64, 128, 256, 512};
+
+ public void testHmacKeyGen() throws Exception {
+ for (int keySize : SUPPORTED_KEY_SIZES) {
+ measure(
+ new KeystoreSecretKeyGenMeasurable(
+ new AndroidKeystoreHmacKeyGenerator("HmacSHA1", keySize), keySize),
+ new KeystoreSecretKeyGenMeasurable(
+ new DefaultKeystoreSecretKeyGenerator("HmacSHA1", keySize), keySize));
+ }
+ }
+
+ private class AndroidKeystoreHmacKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreHmacKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getSecretKeyGenerator()
+ .init(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/HmacMacPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/HmacMacPerformanceTest.java
new file mode 100644
index 0000000..dc7de74
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/HmacMacPerformanceTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+
+public class HmacMacPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_KEY_SIZES = {64, 128, 256, 512};
+ final int[] TEST_MESSAGE_SIZES = {1 << 6, 1 << 10, 1 << 17};
+
+ public void testHmacSHA1() throws Exception {
+ testHmac("HmacSHA1", SUPPORTED_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testHmacSHA224() throws Exception {
+ testHmac("HmacSHA224", SUPPORTED_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testHmacSHA256() throws Exception {
+ testHmac("HmacSHA256", SUPPORTED_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testHmacSHA384() throws Exception {
+ testHmac("HmacSHA384", SUPPORTED_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testHmacSHA512() throws Exception {
+ testHmac("HmacSHA512", SUPPORTED_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ private void testHmac(String algorithm, int[] keySizes, int[] messageSizes) throws Exception {
+ for (int keySize : keySizes) {
+ KeystoreKeyGenerator androidKeystoreHmacKeyGenerator =
+ new AndroidKeystoreHmacKeyGenerator(algorithm, keySize);
+ KeystoreKeyGenerator defaultKeystoreHmacGenerator =
+ new DefaultKeystoreSecretKeyGenerator(algorithm, keySize);
+ for (int messageSize : messageSizes) {
+ measure(
+ new KeystoreHmacMacMeasurable(
+ androidKeystoreHmacKeyGenerator, keySize, messageSize),
+ new KeystoreHmacMacMeasurable(
+ defaultKeystoreHmacGenerator, keySize, messageSize));
+ }
+ }
+ }
+
+ private class AndroidKeystoreHmacKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreHmacKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getSecretKeyGenerator()
+ .init(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+
+ private class KeystoreHmacMacMeasurable extends KeystoreMeasurable {
+ private final Mac mMac;
+ private SecretKey mKey;
+
+ public KeystoreHmacMacMeasurable(
+ KeystoreKeyGenerator generator, int keySize, int messageSize) throws Exception {
+ super(generator, "sign", keySize, messageSize);
+ mMac = Mac.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateSecretKey();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mMac.init(mKey);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mMac.update(getMessage());
+ mMac.doFinal();
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
index 7e8be97..0847800 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
@@ -64,6 +64,7 @@
import android.security.keystore.KeyProperties;
import android.test.AndroidTestCase;
import android.util.ArraySet;
+import android.util.Log;
import com.google.common.collect.ImmutableSet;
@@ -99,6 +100,8 @@
*/
public class KeyAttestationTest extends AndroidTestCase {
+ private static final String TAG = AndroidKeyStoreTest.class.getSimpleName();
+
private static final int ORIGINATION_TIME_OFFSET = 1000000;
private static final int CONSUMPTION_TIME_OFFSET = 2000000;
@@ -880,7 +883,8 @@
RootOfTrust rootOfTrust = attestation.getTeeEnforced().getRootOfTrust();
assertNotNull(rootOfTrust);
assertNotNull(rootOfTrust.getVerifiedBootKey());
- assertTrue(rootOfTrust.getVerifiedBootKey().length >= 32);
+ assertTrue("Verified boot key is only " + rootOfTrust.getVerifiedBootKey().length +
+ " bytes long", rootOfTrust.getVerifiedBootKey().length >= 32);
checkEntropy(rootOfTrust.getVerifiedBootKey());
if (requireLocked) {
assertTrue(rootOfTrust.isDeviceLocked());
@@ -889,8 +893,8 @@
}
private void checkEntropy(byte[] verifiedBootKey) {
- assertTrue(checkShannonEntropy(verifiedBootKey));
- assertTrue(checkTresBiEntropy(verifiedBootKey));
+ assertTrue("Failed Shannon entropy check", checkShannonEntropy(verifiedBootKey));
+ assertTrue("Failed BiEntropy check", checkTresBiEntropy(verifiedBootKey));
}
private boolean checkShannonEntropy(byte[] verifiedBootKey) {
@@ -900,8 +904,10 @@
private double calculateShannonEntropy(double probabilityOfSetBit) {
if (probabilityOfSetBit <= 0.001 || probabilityOfSetBit >= .999) return 0;
- return (-probabilityOfSetBit * logTwo(probabilityOfSetBit)) -
- ((1 - probabilityOfSetBit) * logTwo(1 - probabilityOfSetBit));
+ double entropy = (-probabilityOfSetBit * logTwo(probabilityOfSetBit)) -
+ ((1 - probabilityOfSetBit) * logTwo(1 - probabilityOfSetBit));
+ Log.i(TAG, "Shannon entropy of VB Key: " + entropy);
+ return entropy;
}
private boolean checkTresBiEntropy(byte[] verifiedBootKey) {
@@ -917,6 +923,7 @@
length -= 1;
}
double tresBiEntropy = (1 / weightingFactor) * weightedEntropy;
+ Log.i(TAG, "BiEntropy of VB Key: " + tresBiEntropy);
return tresBiEntropy > 0.9;
}
diff --git a/tests/tests/keystore/src/android/keystore/cts/PerformanceTestBase.java b/tests/tests/keystore/src/android/keystore/cts/PerformanceTestBase.java
new file mode 100644
index 0000000..791435b
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/PerformanceTestBase.java
@@ -0,0 +1,363 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.os.SystemClock;
+import android.security.keystore.KeyGenParameterSpec;
+import android.test.AndroidTestCase;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.DeviceReportLog;
+import com.android.compatibility.common.util.ResultType;
+import com.android.compatibility.common.util.ResultUnit;
+
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+
+import javax.crypto.KeyGenerator;
+import javax.crypto.SecretKey;
+
+import android.os.Build;
+
+public class PerformanceTestBase extends AndroidTestCase {
+
+ public static final long MS_PER_NS = 1000000L;
+ protected static final String TAG = "KeystorePerformanceTest";
+ private static final String REPORT_LOG_NAME = "CtsKeystoreTestCases";
+ /**
+ * Number of milliseconds to spend repeating a single test.
+ *
+ * <p>For each algorithm we run the test repeatedly up to a maximum of this time limit (or up to
+ * {@link #TEST_ITERATION_LIMIT} whichever is reached first), then report back the number of
+ * repetitions. We don't abort a test at the time limit but let it run to completion, so we're
+ * guaranteed to always get at least one repetition, even if it takes longer than the limit.
+ */
+ private static int TEST_TIME_LIMIT = 20000;
+
+ /** Maximum number of iterations to run a single test. */
+ static int TEST_ITERATION_LIMIT = 20;
+
+ protected void measure(Measurable... measurables) throws Exception {
+ ArrayList<PerformanceTestResult> results = new ArrayList<>();
+ results.ensureCapacity(measurables.length);
+ for (Measurable measurable : measurables) {
+ DeviceReportLog reportLog = new DeviceReportLog(REPORT_LOG_NAME, "performance_test");
+ PerformanceTestResult result = measure(measurable);
+
+ reportLog.addValue(
+ "test_environment",
+ measurable.getEnvironment(),
+ ResultType.NEUTRAL,
+ ResultUnit.NONE);
+ reportLog.addValue(
+ "test_name", measurable.getName(), ResultType.NEUTRAL, ResultUnit.NONE);
+ reportLog.addValue(
+ "sample_count", result.getSampleCount(), ResultType.NEUTRAL, ResultUnit.COUNT);
+ reportLog.addValue(
+ "setup_time", result.getSetupTime(), ResultType.LOWER_BETTER, ResultUnit.MS);
+ reportLog.addValue(
+ "mean_time", result.getMean(), ResultType.LOWER_BETTER, ResultUnit.MS);
+ reportLog.addValue(
+ "sample_std_dev",
+ result.getSampleStdDev(),
+ ResultType.LOWER_BETTER,
+ ResultUnit.MS);
+ reportLog.addValue(
+ "median_time", result.getMedian(), ResultType.LOWER_BETTER, ResultUnit.MS);
+ reportLog.addValue(
+ "percentile_90_time",
+ result.getPercentile(0.9),
+ ResultType.LOWER_BETTER,
+ ResultUnit.MS);
+ reportLog.addValue(
+ "teardown_time",
+ result.getTearDownTime(),
+ ResultType.LOWER_BETTER,
+ ResultUnit.MS);
+ reportLog.addValue(
+ "teardown_time",
+ result.getTearDownTime(),
+ ResultType.LOWER_BETTER,
+ ResultUnit.MS);
+ reportLog.submit(InstrumentationRegistry.getInstrumentation());
+ }
+ }
+
+ private PerformanceTestResult measure(Measurable measurable) throws Exception {
+ // One un-measured time through everything, to warm caches, etc.
+
+ PerformanceTestResult result = new PerformanceTestResult();
+
+ measurable.initialSetUp();
+ measurable.setUp();
+ measurable.measure();
+ measurable.tearDown();
+
+ long runLimit = now() + TEST_TIME_LIMIT * MS_PER_NS;
+ while (now() < runLimit && result.getSampleCount() < TEST_ITERATION_LIMIT) {
+ long setupBegin = now();
+ measurable.setUp();
+ result.addSetupTime(now() - setupBegin);
+
+ long runBegin = now();
+ measurable.measure();
+ result.addMeasurement(now() - runBegin);
+
+ long tearDownBegin = now();
+ measurable.tearDown();
+ result.addTeardownTime(now() - tearDownBegin);
+ }
+ measurable.finalTearDown();
+
+ return result;
+ }
+
+ protected long now() {
+ return SystemClock.elapsedRealtimeNanos();
+ }
+
+ public abstract class Measurable {
+
+ private Measurable() {}
+ ;
+
+ public abstract String getEnvironment();
+
+ public abstract String getName();
+
+ public void initialSetUp() throws Exception {}
+
+ public void setUp() throws Exception {}
+
+ public abstract void measure() throws Exception;
+
+ public void tearDown() throws Exception {}
+
+ public void finalTearDown() throws Exception {}
+ }
+
+ /** Base class for measuring Keystore operations. */
+ abstract class KeystoreMeasurable extends Measurable {
+ private final String mName;
+ private final byte[] mMessage;
+ private final KeystoreKeyGenerator mGenerator;
+
+ KeystoreMeasurable(
+ KeystoreKeyGenerator generator, String operation, int keySize, int messageSize)
+ throws Exception {
+ super();
+ mGenerator = generator;
+ if (messageSize < 0) {
+ mName = (operation
+ + "/" + getAlgorithm()
+ + "/" + keySize);
+ mMessage = null;
+ } else {
+ mName = (operation
+ + "/" + getAlgorithm()
+ + "/" + keySize
+ + "/" + messageSize);
+ mMessage = TestUtils.generateRandomMessage(messageSize);
+ }
+ }
+
+ KeystoreMeasurable(KeystoreKeyGenerator generator, String operation, int keySize)
+ throws Exception {
+ this(generator, operation, keySize, -1);
+ }
+
+ @Override
+ public String getEnvironment() {
+ return mGenerator.getProvider() + "/" + Build.CPU_ABI;
+ }
+
+ @Override
+ public String getName() {
+ return mName;
+ }
+
+ byte[] getMessage() {
+ return mMessage;
+ }
+
+ String getAlgorithm() {
+ return mGenerator.getAlgorithm();
+ }
+
+ @Override
+ public void finalTearDown() throws Exception {
+ deleteKey();
+ }
+
+ public void deleteKey() throws Exception {
+ mGenerator.deleteKey();
+ }
+
+ SecretKey generateSecretKey() throws Exception {
+ return mGenerator.getSecretKeyGenerator().generateKey();
+ }
+
+ KeyPair generateKeyPair() throws Exception {
+ return mGenerator.getKeyPairGenerator().generateKeyPair();
+ }
+ }
+
+ /**
+ * Measurable for generating key pairs.
+ *
+ * <p>This class is ignostic to the Keystore provider or key algorithm.
+ */
+ class KeystoreKeyPairGenMeasurable extends KeystoreMeasurable {
+
+ KeystoreKeyPairGenMeasurable(KeystoreKeyGenerator keyGenerator, int keySize)
+ throws Exception {
+ super(keyGenerator, "keygen", keySize);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ generateKeyPair();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ deleteKey();
+ }
+ }
+
+ /**
+ * Measurable for generating a secret key.
+ *
+ * <p>This class is ignostic to the Keystore provider or key algorithm.
+ */
+ class KeystoreSecretKeyGenMeasurable extends KeystoreMeasurable {
+
+ KeystoreSecretKeyGenMeasurable(KeystoreKeyGenerator keyGenerator, int keySize)
+ throws Exception {
+ super(keyGenerator, "keygen", keySize);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ generateSecretKey();
+ }
+
+ @Override
+ public void tearDown() throws Exception {
+ deleteKey();
+ }
+ }
+
+ /**
+ * Wrapper for generating Keystore keys.
+ *
+ * <p>Abstracts the provider and initilization of the generator.
+ */
+ abstract class KeystoreKeyGenerator {
+ private final String mAlgorithm;
+ private final String mProvider;
+ private KeyGenerator mSecretKeyGenerator = null;
+ private KeyPairGenerator mKeyPairGenerator = null;
+
+ KeystoreKeyGenerator(String algorithm, String provider) throws Exception {
+ mAlgorithm = algorithm;
+ mProvider = provider;
+ }
+
+ KeystoreKeyGenerator(String algorithm) throws Exception {
+ // This is a hack to get the default provider.
+ this(algorithm, KeyGenerator.getInstance("AES").getProvider().getName());
+ }
+
+ String getAlgorithm() {
+ return mAlgorithm;
+ }
+
+ String getProvider() {
+ return mProvider;
+ }
+
+ /** By default, deleteKey is a nop */
+ void deleteKey() throws Exception {}
+
+ KeyGenerator getSecretKeyGenerator() throws Exception {
+ if (mSecretKeyGenerator == null) {
+ mSecretKeyGenerator =
+ KeyGenerator.getInstance(TestUtils.getKeyAlgorithm(mAlgorithm), mProvider);
+ }
+ return mSecretKeyGenerator;
+ }
+
+ KeyPairGenerator getKeyPairGenerator() throws Exception {
+ if (mKeyPairGenerator == null) {
+ mKeyPairGenerator =
+ KeyPairGenerator.getInstance(
+ TestUtils.getKeyAlgorithm(mAlgorithm), mProvider);
+ }
+ return mKeyPairGenerator;
+ }
+ }
+
+ /**
+ * Wrapper for generating Android Keystore keys.
+ *
+ * <p>Provides Android Keystore specific functionality, like deleting the key.
+ */
+ abstract class AndroidKeystoreKeyGenerator extends KeystoreKeyGenerator {
+ private final KeyStore mKeyStore;
+ private final String KEY_ALIAS = "perf_key";
+
+ AndroidKeystoreKeyGenerator(String algorithm) throws Exception {
+ super(algorithm, TestUtils.EXPECTED_PROVIDER_NAME);
+ mKeyStore = KeyStore.getInstance(getProvider());
+ mKeyStore.load(null);
+ }
+
+ @Override
+ void deleteKey() throws Exception {
+ mKeyStore.deleteEntry(KEY_ALIAS);
+ }
+
+ KeyGenParameterSpec.Builder getKeyGenParameterSpecBuilder(int purpose) {
+ return new KeyGenParameterSpec.Builder(KEY_ALIAS, purpose);
+ }
+
+ Certificate[] getCertificateChain() throws Exception {
+ return mKeyStore.getCertificateChain(KEY_ALIAS);
+ }
+ }
+
+ /** Basic generator for KeyPairs that uses the default provider. */
+ class DefaultKeystoreKeyPairGenerator extends KeystoreKeyGenerator {
+ DefaultKeystoreKeyPairGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getKeyPairGenerator().initialize(keySize);
+ }
+ }
+
+ /** Basic generator for SecretKeys that uses the default provider. */
+ class DefaultKeystoreSecretKeyGenerator extends KeystoreKeyGenerator {
+ DefaultKeystoreSecretKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getSecretKeyGenerator().init(keySize);
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/PerformanceTestResult.java b/tests/tests/keystore/src/android/keystore/cts/PerformanceTestResult.java
new file mode 100644
index 0000000..08fdee0
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/PerformanceTestResult.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import junit.framework.TestCase;
+
+import java.util.Arrays;
+
+/**
+ * Simple struct to package test results. All times are in nanoseconds. Doubles are used rather than
+ * longs because arithmetic on nanoseconds in longs can overflow.
+ */
+public class PerformanceTestResult {
+ private double mSetupTime;
+ private int mSampleCount = 0;
+ private double[] mSamples = new double[PerformanceTestBase.TEST_ITERATION_LIMIT];
+ private double mTeardownTime;
+
+ public void addSetupTime(double timeInNs) {
+ mSetupTime += timeInNs / PerformanceTestBase.MS_PER_NS;
+ }
+
+ public double getSetupTime() {
+ return mSetupTime;
+ }
+
+ public void addTeardownTime(double timeInNs) {
+ mTeardownTime += timeInNs / PerformanceTestBase.MS_PER_NS;
+ }
+
+ public double getTearDownTime() {
+ return mTeardownTime;
+ }
+
+ public void addMeasurement(double timeInNs) {
+ if (mSampleCount == PerformanceTestBase.TEST_ITERATION_LIMIT) {
+ TestCase.fail("Array is full, this is a test bug.");
+ }
+ mSamples[mSampleCount++] = timeInNs / PerformanceTestBase.MS_PER_NS;
+ }
+
+ public int getSampleCount() {
+ return mSampleCount;
+ }
+
+ public double getTotalTime() {
+ double sum = 0;
+ for (int i = 0; i < mSampleCount; ++i) {
+ sum += mSamples[i];
+ }
+ return sum;
+ }
+
+ public double getTotalTimeSq() {
+ double sum = 0;
+ for (int i = 0; i < mSampleCount; ++i) {
+ sum += (double) mSamples[i] * mSamples[i];
+ }
+ return sum;
+ }
+
+ public double getMedian() {
+ return getPercentile(0.5);
+ }
+
+ public double getPercentile(double v) {
+ Arrays.sort(mSamples, 0, mSampleCount);
+ return mSamples[(int) Math.ceil(mSampleCount * v) - 1];
+ }
+
+ public double getMean() {
+ return getTotalTime() / mSampleCount;
+ }
+
+ public double getSampleStdDev() {
+ double totalTime = getTotalTime();
+ return Math.sqrt(mSampleCount * getTotalTimeSq() - totalTime * totalTime)
+ / (mSampleCount * (mSampleCount - 1));
+ }
+
+ @Override
+ public String toString() {
+ return mSampleCount
+ + ","
+ + getMean()
+ + ","
+ + getSampleStdDev()
+ + ","
+ + getMedian()
+ + ","
+ + getPercentile(0.9);
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/RsaCipherPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/RsaCipherPerformanceTest.java
new file mode 100644
index 0000000..6233981
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/RsaCipherPerformanceTest.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import java.security.AlgorithmParameters;
+import java.security.KeyPair;
+
+import javax.crypto.Cipher;
+
+public class RsaCipherPerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_RSA_KEY_SIZES = {2048, 3072, 4096};
+ final int[] TEST_MESSAGE_SIZES = {1 << 6, 1 << 10};
+
+ public void testRSA_ECB_NoPadding() throws Exception {
+ testRsaCipher("RSA/ECB/NoPadding", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testRSA_ECB_PKCS1Padding() throws Exception {
+ testRsaCipher("RSA/ECB/PKCS1Padding", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testRSA_ECB_OAEPWithSHA_1AndMGF1Padding() throws Exception {
+ testRsaCipher(
+ "RSA/ECB/OAEPWithSHA-1AndMGF1Padding", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testRSA_ECB_OAEPPadding() throws Exception {
+ testRsaCipher("RSA/ECB/OAEPPadding", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ private void testRsaCipher(String algorithm, int[] keySizes, int[] messageSizes)
+ throws Exception {
+ for (int keySize : keySizes) {
+ int maxMessageSize =
+ TestUtils.getMaxSupportedPlaintextInputSizeBytes(algorithm, keySize);
+ for (int messageSize : messageSizes) {
+ if (messageSize > maxMessageSize) {
+ continue;
+ }
+ measure(
+ new KeystoreRsaEncryptMeasurable(
+ new AndroidKeystoreRsaKeyGenerator(algorithm, keySize),
+ keySize,
+ messageSize),
+ new KeystoreRsaDecryptMeasurable(
+ new AndroidKeystoreRsaKeyGenerator(algorithm, keySize),
+ keySize,
+ messageSize),
+ new KeystoreRsaEncryptMeasurable(
+ new DefaultKeystoreKeyPairGenerator(algorithm, keySize),
+ keySize,
+ messageSize),
+ new KeystoreRsaDecryptMeasurable(
+ new DefaultKeystoreKeyPairGenerator(algorithm, keySize),
+ keySize,
+ messageSize));
+ }
+ }
+ }
+
+ private class AndroidKeystoreRsaKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreRsaKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ String digest = TestUtils.getCipherDigest(algorithm);
+ getKeyPairGenerator()
+ .initialize(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_ENCRYPT
+ | KeyProperties.PURPOSE_DECRYPT)
+ .setBlockModes(TestUtils.getCipherBlockMode(algorithm))
+ .setEncryptionPaddings(
+ TestUtils.getCipherEncryptionPadding(algorithm))
+ .setRandomizedEncryptionRequired(false)
+ .setKeySize(keySize)
+ .setDigests(
+ (digest != null)
+ ? new String[] {digest}
+ : EmptyArray.STRING)
+ .build());
+ }
+ }
+
+ private class KeystoreRsaEncryptMeasurable extends KeystoreMeasurable {
+ private final Cipher mCipher;
+ private KeyPair mKey;
+
+ KeystoreRsaEncryptMeasurable(
+ KeystoreKeyGenerator keyGenerator, int keySize, int messageSize) throws Exception {
+ super(keyGenerator, "encrypt", keySize, messageSize);
+ mCipher = Cipher.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateKeyPair();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mCipher.init(Cipher.ENCRYPT_MODE, mKey.getPublic());
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mCipher.doFinal(getMessage());
+ }
+ }
+
+ private class KeystoreRsaDecryptMeasurable extends KeystoreMeasurable {
+ private final Cipher mCipher;
+ private byte[] mEncryptedMessage;
+ private AlgorithmParameters mAlgorithmParams;
+ private KeyPair mKey;
+
+ KeystoreRsaDecryptMeasurable(
+ KeystoreKeyGenerator keyGenerator, int keySize, int messageSize) throws Exception {
+ super(keyGenerator, "decrypt", keySize, messageSize);
+ mCipher = Cipher.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateKeyPair();
+ mCipher.init(Cipher.ENCRYPT_MODE, mKey.getPublic());
+ mEncryptedMessage = mCipher.doFinal(getMessage());
+ mAlgorithmParams = mCipher.getParameters();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mCipher.init(Cipher.DECRYPT_MODE, mKey.getPrivate(), mAlgorithmParams);
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mCipher.doFinal(mEncryptedMessage);
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/RsaKeyGenPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/RsaKeyGenPerformanceTest.java
new file mode 100644
index 0000000..1ba1bd0
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/RsaKeyGenPerformanceTest.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+public class RsaKeyGenPerformanceTest extends PerformanceTestBase {
+
+ private final int[] SUPPORTED_RSA_KEY_SIZES = {2048, 3072, 4096};
+
+ public void testRsaKeyGen() throws Exception {
+ for (int keySize : SUPPORTED_RSA_KEY_SIZES) {
+ measure(
+ new KeystoreKeyPairGenMeasurable(
+ new AndroidKeystoreRsaKeyenerator("RSA", keySize),
+ keySize),
+ new KeystoreKeyPairGenMeasurable(
+ new DefaultKeystoreKeyPairGenerator("RSA", keySize),
+ keySize));
+ }
+ }
+
+ private class AndroidKeystoreRsaKeyenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreRsaKeyenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getKeyPairGenerator()
+ .initialize(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .build());
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/RsaSignaturePerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/RsaSignaturePerformanceTest.java
new file mode 100644
index 0000000..906693b
--- /dev/null
+++ b/tests/tests/keystore/src/android/keystore/cts/RsaSignaturePerformanceTest.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package android.keystore.cts;
+
+import android.security.keystore.KeyProperties;
+
+import org.junit.Test;
+
+import java.security.KeyPair;
+import java.security.Signature;
+import java.util.Arrays;
+
+public class RsaSignaturePerformanceTest extends PerformanceTestBase {
+
+ final int[] SUPPORTED_RSA_KEY_SIZES = {2048, 3072, 4096};
+ final int[] TEST_MESSAGE_SIZES = {1 << 6, 1 << 10, 1 << 17};
+
+ public void testNONEwithRSA() throws Exception {
+ for (int keySize : SUPPORTED_RSA_KEY_SIZES) {
+ int modulusSizeBytes = (keySize + 7) / 8;
+ int[] messageSizes =
+ Arrays.stream(TEST_MESSAGE_SIZES).filter(x -> modulusSizeBytes > x).toArray();
+ testRsaSign("NONEwithRSA", new int[] {keySize}, messageSizes);
+ }
+ }
+
+ public void testMD5withRSA() throws Exception {
+ testRsaSign("MD5withRSA", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA1withRSA() throws Exception {
+ testRsaSign("SHA1withRSA", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA224withRSA() throws Exception {
+ testRsaSign("SHA224withRSA", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA256withRSA() throws Exception {
+ testRsaSign("SHA256withRSA", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA384withRSA() throws Exception {
+ testRsaSign("SHA384withRSA", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA512withRSA() throws Exception {
+ testRsaSign("SHA512withRSA", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA1withRSA_PSS() throws Exception {
+ testRsaSign("SHA1withRSA/PSS", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA224withRSA_PSS() throws Exception {
+ testRsaSign("SHA224withRSA/PSS", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA256withRSA_PSS() throws Exception {
+ testRsaSign("SHA256withRSA/PSS", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA384withRSA_PSS() throws Exception {
+ testRsaSign("SHA384withRSA/PSS", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ public void testSHA512withRSA_PSS() throws Exception {
+ testRsaSign("SHA512withRSA/PSS", SUPPORTED_RSA_KEY_SIZES, TEST_MESSAGE_SIZES);
+ }
+
+ private void testRsaSign(String algorithm, int[] keySizes, int[] messageSizes)
+ throws Exception {
+ for (int keySize : keySizes) {
+ if (!TestUtils.isKeyLongEnoughForSignatureAlgorithm(algorithm, keySize)) {
+ continue;
+ }
+ KeystoreKeyGenerator androidKeystoreRsaGenerator =
+ new AndroidKeystoreRsaKeyGenerator(algorithm, keySize);
+ KeystoreKeyGenerator defaultKeystoreRsaGenerator =
+ new DefaultKeystoreKeyPairGenerator(algorithm, keySize);
+ for (int messageSize : messageSizes) {
+ measure(
+ new KeystoreRsaSignMeasurable(
+ androidKeystoreRsaGenerator, keySize, messageSize),
+ new KeystoreRsaSignMeasurable(
+ defaultKeystoreRsaGenerator, keySize, messageSize),
+ new KeystoreRsaVerifyMeasurable(
+ androidKeystoreRsaGenerator, keySize, messageSize),
+ new KeystoreRsaVerifyMeasurable(
+ defaultKeystoreRsaGenerator, keySize, messageSize));
+ }
+ }
+ }
+
+ private class AndroidKeystoreRsaKeyGenerator extends AndroidKeystoreKeyGenerator {
+
+ AndroidKeystoreRsaKeyGenerator(String algorithm, int keySize) throws Exception {
+ super(algorithm);
+ getKeyPairGenerator()
+ .initialize(
+ getKeyGenParameterSpecBuilder(
+ KeyProperties.PURPOSE_SIGN
+ | KeyProperties.PURPOSE_VERIFY)
+ .setKeySize(keySize)
+ .setSignaturePaddings(
+ TestUtils.getSignatureAlgorithmPadding(algorithm))
+ .setDigests(TestUtils.getSignatureAlgorithmDigest(algorithm))
+ .build());
+ }
+ }
+
+ private class KeystoreRsaSignMeasurable extends KeystoreMeasurable {
+ private final Signature mSignature;
+ private KeyPair mKey;
+
+ KeystoreRsaSignMeasurable(KeystoreKeyGenerator keyGen, int keySize, int messageSize)
+ throws Exception {
+ super(keyGen, "sign", keySize, messageSize);
+ mSignature = Signature.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateKeyPair();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mSignature.initSign(mKey.getPrivate());
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mSignature.update(getMessage());
+ mSignature.sign();
+ }
+ }
+
+ private class KeystoreRsaVerifyMeasurable extends KeystoreMeasurable {
+ private final Signature mSignature;
+ private byte[] mMessageSignature;
+ private KeyPair mKey;
+
+ KeystoreRsaVerifyMeasurable(KeystoreKeyGenerator keyGen, int keySize, int messageSize)
+ throws Exception {
+ super(keyGen, "verify", keySize, messageSize);
+ mSignature = Signature.getInstance(getAlgorithm());
+ }
+
+ @Override
+ public void initialSetUp() throws Exception {
+ mKey = generateKeyPair();
+ mSignature.initSign(mKey.getPrivate());
+ mSignature.update(getMessage());
+ mMessageSignature = mSignature.sign();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ mSignature.initVerify(mKey.getPublic());
+ }
+
+ @Override
+ public void measure() throws Exception {
+ mSignature.update(getMessage());
+ mSignature.verify(mMessageSignature);
+ }
+ }
+}
diff --git a/tests/tests/keystore/src/android/keystore/cts/TestUtils.java b/tests/tests/keystore/src/android/keystore/cts/TestUtils.java
index d48c644..23886be 100644
--- a/tests/tests/keystore/src/android/keystore/cts/TestUtils.java
+++ b/tests/tests/keystore/src/android/keystore/cts/TestUtils.java
@@ -33,6 +33,8 @@
import java.security.Key;
import java.security.KeyFactory;
import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyPairGeneratorSpi;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.MessageDigest;
@@ -61,6 +63,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.security.SecureRandom;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
@@ -73,7 +76,6 @@
static final long DAY_IN_MILLIS = 1000 * 60 * 60 * 24;
-
private TestUtils() {}
/**
@@ -638,6 +640,46 @@
return result;
}
+ static String getKeyAlgorithm(String transformation) {
+ try {
+ return getCipherKeyAlgorithm(transformation);
+ } catch (IllegalArgumentException e) {
+
+ }
+ try {
+ return getSignatureAlgorithmKeyAlgorithm(transformation);
+ } catch (IllegalArgumentException e) {
+
+ }
+ String transformationUpperCase = transformation.toUpperCase(Locale.US);
+ if (transformationUpperCase.equals("EC")) {
+ return KeyProperties.KEY_ALGORITHM_EC;
+ }
+ if (transformationUpperCase.equals("RSA")) {
+ return KeyProperties.KEY_ALGORITHM_RSA;
+ }
+ if (transformationUpperCase.equals("DESEDE")) {
+ return KeyProperties.KEY_ALGORITHM_3DES;
+ }
+ if (transformationUpperCase.equals("AES")) {
+ return KeyProperties.KEY_ALGORITHM_AES;
+ }
+ if (transformationUpperCase.startsWith("HMAC")) {
+ if (transformation.endsWith("SHA1")) {
+ return KeyProperties.KEY_ALGORITHM_HMAC_SHA1;
+ } else if (transformation.endsWith("SHA224")) {
+ return KeyProperties.KEY_ALGORITHM_HMAC_SHA224;
+ } else if (transformation.endsWith("SHA256")) {
+ return KeyProperties.KEY_ALGORITHM_HMAC_SHA256;
+ } else if (transformation.endsWith("SHA384")) {
+ return KeyProperties.KEY_ALGORITHM_HMAC_SHA384;
+ } else if (transformation.endsWith("SHA512")) {
+ return KeyProperties.KEY_ALGORITHM_HMAC_SHA512;
+ }
+ }
+ throw new IllegalArgumentException("Unsupported transformation: " + transformation);
+ }
+
static String getCipherKeyAlgorithm(String transformation) {
String transformationUpperCase = transformation.toUpperCase(Locale.US);
if (transformationUpperCase.startsWith("AES/")) {
@@ -749,13 +791,12 @@
}
}
- static boolean isKeyLongEnoughForSignatureAlgorithm(String algorithm, Key key) {
- String keyAlgorithm = key.getAlgorithm();
+ static boolean isKeyLongEnoughForSignatureAlgorithm(String algorithm, int keySizeBits) {
+ String keyAlgorithm = getSignatureAlgorithmKeyAlgorithm(algorithm);
if (KeyProperties.KEY_ALGORITHM_EC.equalsIgnoreCase(keyAlgorithm)) {
// No length restrictions for ECDSA
return true;
} else if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyAlgorithm)) {
- // No length restrictions for RSA
String digest = getSignatureAlgorithmDigest(algorithm);
int digestOutputSizeBits = getDigestOutputSizeBits(digest);
if (digestOutputSizeBits == -1) {
@@ -774,21 +815,25 @@
"Unsupported signature padding scheme: " + paddingScheme);
}
int minKeySizeBytes = paddingOverheadBytes + (digestOutputSizeBits + 7) / 8 + 1;
- int keySizeBytes = ((RSAKey) key).getModulus().bitLength() / 8;
+ int keySizeBytes = keySizeBits / 8;
return keySizeBytes >= minKeySizeBytes;
} else {
throw new IllegalArgumentException("Unsupported key algorithm: " + keyAlgorithm);
}
}
- static int getMaxSupportedPlaintextInputSizeBytes(String transformation, Key key) {
+ static boolean isKeyLongEnoughForSignatureAlgorithm(String algorithm, Key key) {
+ return isKeyLongEnoughForSignatureAlgorithm(algorithm, getKeySizeBits(key));
+ }
+
+ static int getMaxSupportedPlaintextInputSizeBytes(String transformation, int keySizeBits) {
String keyAlgorithm = getCipherKeyAlgorithm(transformation);
if (KeyProperties.KEY_ALGORITHM_AES.equalsIgnoreCase(keyAlgorithm)
|| KeyProperties.KEY_ALGORITHM_3DES.equalsIgnoreCase(keyAlgorithm)) {
return Integer.MAX_VALUE;
} else if (KeyProperties.KEY_ALGORITHM_RSA.equalsIgnoreCase(keyAlgorithm)) {
String encryptionPadding = getCipherEncryptionPadding(transformation);
- int modulusSizeBytes = (getKeySizeBits(key) + 7) / 8;
+ int modulusSizeBytes = (keySizeBits + 7) / 8;
if (KeyProperties.ENCRYPTION_PADDING_NONE.equalsIgnoreCase(encryptionPadding)) {
return modulusSizeBytes - 1;
} else if (KeyProperties.ENCRYPTION_PADDING_RSA_PKCS1.equalsIgnoreCase(
@@ -808,6 +853,10 @@
}
}
+ static int getMaxSupportedPlaintextInputSizeBytes(String transformation, Key key) {
+ return getMaxSupportedPlaintextInputSizeBytes(transformation, getKeySizeBits(key));
+ }
+
static int getDigestOutputSizeBits(String digest) {
if (KeyProperties.DIGEST_NONE.equals(digest)) {
return -1;
@@ -946,4 +995,10 @@
}
return TestUtils.subarray(value, 1, value.length - 1);
}
+
+ static byte[] generateRandomMessage(int messageSize) {
+ byte[] message = new byte[messageSize];
+ new SecureRandom().nextBytes(message);
+ return message;
+ }
}
diff --git a/tests/tests/location/src/android/location/cts/GnssTtffTests.java b/tests/tests/location/src/android/location/cts/GnssTtffTests.java
index d614b72..e26b978 100644
--- a/tests/tests/location/src/android/location/cts/GnssTtffTests.java
+++ b/tests/tests/location/src/android/location/cts/GnssTtffTests.java
@@ -42,6 +42,10 @@
*/
@CddTest(requirement="7.3.3")
public void testTtffWithNetwork() throws Exception {
+ if (!TestUtils.deviceHasGpsFeature(getContext())) {
+ return;
+ }
+
ensureNetworkStatus();
if (hasCellularData()) {
checkTtffWarmWithWifiOn(TTFF_WITH_WIFI_CELLUAR_WARM_TH_SECS);
diff --git a/tests/tests/media/res/raw/video_dovi_1920x1080_30fps_dvhe_04.mp4 b/tests/tests/media/res/raw/video_dovi_1920x1080_30fps_dvhe_04.mp4
new file mode 100644
index 0000000..58f0f5b
--- /dev/null
+++ b/tests/tests/media/res/raw/video_dovi_1920x1080_30fps_dvhe_04.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvav_09.mp4 b/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvav_09.mp4
new file mode 100755
index 0000000..0c754d6
--- /dev/null
+++ b/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvav_09.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvhe_05.mp4 b/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvhe_05.mp4
new file mode 100644
index 0000000..894f308
--- /dev/null
+++ b/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvhe_05.mp4
Binary files differ
diff --git a/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvhe_08.mp4 b/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvhe_08.mp4
new file mode 100755
index 0000000..9cc7925
--- /dev/null
+++ b/tests/tests/media/res/raw/video_dovi_1920x1080_60fps_dvhe_08.mp4
Binary files differ
diff --git a/tests/tests/media/src/android/media/cts/AudioFormatTest.java b/tests/tests/media/src/android/media/cts/AudioFormatTest.java
index 221dcfa..6ca4a3b 100644
--- a/tests/tests/media/src/android/media/cts/AudioFormatTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioFormatTest.java
@@ -176,14 +176,23 @@
// Test case 7: Check frame size for compressed, float formats.
public void testFrameSize() throws Exception {
- final AudioFormat formatMp3 = new AudioFormat.Builder()
- .setEncoding(AudioFormat.ENCODING_MP3)
- .setSampleRate(44100)
- .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
- .build();
+ int[] encodings = {
+ AudioFormat.ENCODING_MP3,
+ AudioFormat.ENCODING_AAC_LC,
+ AudioFormat.ENCODING_AAC_HE_V1,
+ AudioFormat.ENCODING_AAC_HE_V2,
+ AudioFormat.ENCODING_OPUS
+ };
+ for (int encoding : encodings) {
+ final AudioFormat format = new AudioFormat.Builder()
+ .setEncoding(encoding)
+ .setSampleRate(44100)
+ .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
+ .build();
- assertEquals("MP3 AudioFormat has the wrong frame size",
- 1, formatMp3.getFrameSizeInBytes());
+ assertEquals("AudioFormat with encoding " + encoding + " has the wrong frame size",
+ 1, format.getFrameSizeInBytes());
+ }
final AudioFormat formatPcmFloat = new AudioFormat.Builder()
.setEncoding(AudioFormat.ENCODING_PCM_FLOAT)
diff --git a/tests/tests/media/src/android/media/cts/AudioTrackOffloadTest.java b/tests/tests/media/src/android/media/cts/AudioTrackOffloadTest.java
index aa0d50b..5d46c3a 100644
--- a/tests/tests/media/src/android/media/cts/AudioTrackOffloadTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioTrackOffloadTest.java
@@ -17,6 +17,7 @@
package android.media.cts;
+import android.annotation.RawRes;
import android.content.res.AssetFileDescriptor;
import android.media.AudioAttributes;
import android.media.AudioFormat;
@@ -34,18 +35,12 @@
public class AudioTrackOffloadTest extends CtsAndroidTestCase {
private static final String TAG = "AudioTrackOffloadTest";
- private static final int MP3_BUFF_SIZE = 192 * 1024 * 3 / 8; // 3s for 192kbps MP3
+ private static final int BUFFER_SIZE_SEC = 3;
private static final int PRESENTATION_END_TIMEOUT_MS = 8 * 1000; // 8s
private static final AudioAttributes DEFAULT_ATTR = new AudioAttributes.Builder().build();
- private static final AudioFormat DEFAULT_FORMAT = new AudioFormat.Builder()
- .setEncoding(AudioFormat.ENCODING_MP3)
- .setSampleRate(44100)
- .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
- .build();
-
public void testIsOffloadSupportedNullFormat() throws Exception {
try {
final boolean offloadableFormat = AudioManager.isOffloadedPlaybackSupported(null,
@@ -59,30 +54,43 @@
public void testIsOffloadSupportedNullAttributes() throws Exception {
try {
final boolean offloadableFormat = AudioManager.isOffloadedPlaybackSupported(
- DEFAULT_FORMAT, null);
+ getAudioFormatWithEncoding(AudioFormat.ENCODING_MP3), null);
fail("Shouldn't be able to use null AudioAttributes in isOffloadedPlaybackSupported()");
} catch (NullPointerException e) {
// ok, NPE is expected here
}
}
-
public void testExerciseIsOffloadSupported() throws Exception {
- final boolean offloadableFormat =
- AudioManager.isOffloadedPlaybackSupported(DEFAULT_FORMAT, DEFAULT_ATTR);
+ final boolean offloadableFormat = AudioManager.isOffloadedPlaybackSupported(
+ getAudioFormatWithEncoding(AudioFormat.ENCODING_MP3), DEFAULT_ATTR);
}
- public void testAudioTrackOffload() throws Exception {
+ public void testMP3AudioTrackOffload() throws Exception {
+ testAudioTrackOffload(R.raw.sine1khzs40dblong,
+ /* bitRateInkbps= */ 192,
+ getAudioFormatWithEncoding(AudioFormat.ENCODING_MP3));
+ }
+
+ public void testOpusAudioTrackOffload() throws Exception {
+ testAudioTrackOffload(R.raw.testopus,
+ /* bitRateInkbps= */ 118, // Average
+ getAudioFormatWithEncoding(AudioFormat.ENCODING_OPUS));
+ }
+
+ /** Test offload of an audio resource that MUST be at least 3sec long. */
+ private void testAudioTrackOffload(@RawRes int audioRes, int bitRateInkbps,
+ AudioFormat audioFormat) throws Exception {
AudioTrack track = null;
+ int bufferSizeInBytes3sec = bitRateInkbps * 1024 * 3 / 8;
+ try (AssetFileDescriptor audioToOffload = getContext().getResources()
+ .openRawResourceFd(audioRes);
+ InputStream audioInputStream = audioToOffload.createInputStream()) {
- try (AssetFileDescriptor mp3ToOffload = getContext().getResources()
- .openRawResourceFd(R.raw.sine1khzs40dblong);
- InputStream mp3InputStream = mp3ToOffload.createInputStream()) {
-
- long mp3ToOffloadLength = mp3ToOffload.getLength();
- if (!AudioManager.isOffloadedPlaybackSupported(DEFAULT_FORMAT, DEFAULT_ATTR)) {
- Log.i(TAG, "skipping test testPlayback");
+ if (!AudioManager.isOffloadedPlaybackSupported(audioFormat, DEFAULT_ATTR)) {
+ Log.i(TAG, "skipping testAudioTrackOffload as offload encoding "
+ + audioFormat.getEncoding() + " is not supported");
// cannot test if offloading is not supported
return;
}
@@ -90,9 +98,9 @@
// format is offloadable, test playback head is progressing
track = new AudioTrack.Builder()
.setAudioAttributes(DEFAULT_ATTR)
- .setAudioFormat(DEFAULT_FORMAT)
+ .setAudioFormat(audioFormat)
.setTransferMode(AudioTrack.MODE_STREAM)
- .setBufferSizeInBytes(MP3_BUFF_SIZE)
+ .setBufferSizeInBytes(bufferSizeInBytes3sec)
.setOffloadedPlayback(true).build();
assertNotNull("Couldn't create offloaded AudioTrack", track);
assertEquals("Unexpected track sample rate", 44100, track.getSampleRate());
@@ -105,8 +113,10 @@
} catch (Exception e) { }
track.registerStreamEventCallback(mExec, mCallback);
- final byte[] data = new byte[MP3_BUFF_SIZE];
- final int read = mp3InputStream.read(data);
+ final byte[] data = new byte[bufferSizeInBytes3sec];
+ final int read = audioInputStream.read(data);
+ assertEquals("Could not read enough audio from the resource file",
+ bufferSizeInBytes3sec, read);
track.play();
int written = 0;
@@ -145,6 +155,14 @@
}
}
+ private static AudioFormat getAudioFormatWithEncoding(int encoding) {
+ return new AudioFormat.Builder()
+ .setEncoding(encoding)
+ .setSampleRate(44100)
+ .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
+ .build();
+ }
+
private Executor mExec = new Executor() {
@Override
public void execute(Runnable command) {
diff --git a/tests/tests/media/src/android/media/cts/MediaExtractorTest.java b/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
index 67de797..78e22d5 100644
--- a/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
@@ -23,9 +23,11 @@
import android.icu.util.ULocale;
import android.media.AudioFormat;
import android.media.AudioPresentation;
+import android.media.MediaCodecInfo;
import android.media.MediaDataSource;
import android.media.MediaExtractor;
import android.media.MediaFormat;
+import static android.media.MediaFormat.MIMETYPE_VIDEO_DOLBY_VISION;
import android.media.cts.R;
import android.os.PersistableBundle;
import android.platform.test.annotations.AppModeFull;
@@ -35,6 +37,8 @@
import androidx.test.filters.SmallTest;
+import com.android.compatibility.common.util.MediaUtils;
+
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
@@ -130,6 +134,169 @@
afd.close();
}
+ // DolbyVisionMediaExtractor for profile-level (DvheDtr/Fhd30).
+ public void testDolbyVisionMediaExtractorProfileDvheDtr() throws Exception {
+ TestMediaDataSource dataSource = setDataSource(R.raw.video_dovi_1920x1080_30fps_dvhe_04);
+
+ assertTrue("There should be either 1 or 2 tracks",
+ 0 < mExtractor.getTrackCount() && 3 > mExtractor.getTrackCount());
+
+ MediaFormat trackFormat = mExtractor.getTrackFormat(0);
+ int trackCountForDolbyVision = 1;
+
+ // Handle the case where there is a Dolby Vision extractor
+ // Note that it may or may not have a Dolby Vision Decoder
+ if (mExtractor.getTrackCount() == 2) {
+ if (trackFormat.getString(MediaFormat.KEY_MIME)
+ .equalsIgnoreCase(MIMETYPE_VIDEO_DOLBY_VISION)) {
+ trackFormat = mExtractor.getTrackFormat(1);
+ trackCountForDolbyVision = 0;
+ }
+ }
+
+ if (MediaUtils.hasDecoder(MIMETYPE_VIDEO_DOLBY_VISION)) {
+ assertEquals("There must be 2 tracks", 2, mExtractor.getTrackCount());
+
+ MediaFormat trackFormatForDolbyVision =
+ mExtractor.getTrackFormat(trackCountForDolbyVision);
+
+ final String mimeType = trackFormatForDolbyVision.getString(MediaFormat.KEY_MIME);
+ assertEquals("video/dolby-vision", mimeType);
+
+ int profile = trackFormatForDolbyVision.getInteger(MediaFormat.KEY_PROFILE);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvheDtr, profile);
+
+ int level = trackFormatForDolbyVision.getInteger(MediaFormat.KEY_LEVEL);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionLevelFhd30, level);
+
+ final int trackIdForDolbyVision =
+ trackFormatForDolbyVision.getInteger(MediaFormat.KEY_TRACK_ID);
+
+ final int trackIdForBackwardCompat = trackFormat.getInteger(MediaFormat.KEY_TRACK_ID);
+ assertEquals(trackIdForDolbyVision, trackIdForBackwardCompat);
+ }
+
+ // The backward-compatible track should have mime video/hevc
+ final String mimeType = trackFormat.getString(MediaFormat.KEY_MIME);
+ assertEquals("video/hevc", mimeType);
+ }
+
+ // DolbyVisionMediaExtractor for profile-level (DvheStn/Fhd60).
+ public void testDolbyVisionMediaExtractorProfileDvheStn() throws Exception {
+ TestMediaDataSource dataSource = setDataSource(R.raw.video_dovi_1920x1080_60fps_dvhe_05);
+
+ if (MediaUtils.hasDecoder(MIMETYPE_VIDEO_DOLBY_VISION)) {
+ // DvheStn exposes only a single non-backward compatible Dolby Vision HDR track.
+ assertEquals("There must be 1 track", 1, mExtractor.getTrackCount());
+ final MediaFormat trackFormat = mExtractor.getTrackFormat(0);
+
+ final String mimeType = trackFormat.getString(MediaFormat.KEY_MIME);
+ assertEquals("video/dolby-vision", mimeType);
+
+ final int profile = trackFormat.getInteger(MediaFormat.KEY_PROFILE);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvheStn, profile);
+
+ final int level = trackFormat.getInteger(MediaFormat.KEY_LEVEL);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionLevelFhd60, level);
+ } else {
+ MediaUtils.skipTest("Device does not provide a Dolby Vision decoder");
+ }
+ }
+
+ // DolbyVisionMediaExtractor for profile-level (DvheSt/Fhd60).
+ public void testDolbyVisionMediaExtractorProfileDvheSt() throws Exception {
+ TestMediaDataSource dataSource = setDataSource(R.raw.video_dovi_1920x1080_60fps_dvhe_08);
+
+ assertTrue("There should be either 1 or 2 tracks",
+ 0 < mExtractor.getTrackCount() && 3 > mExtractor.getTrackCount());
+
+ MediaFormat trackFormat = mExtractor.getTrackFormat(0);
+ int trackCountForDolbyVision = 1;
+
+ // Handle the case where there is a Dolby Vision extractor
+ // Note that it may or may not have a Dolby Vision Decoder
+ if (mExtractor.getTrackCount() == 2) {
+ if (trackFormat.getString(MediaFormat.KEY_MIME)
+ .equalsIgnoreCase(MIMETYPE_VIDEO_DOLBY_VISION)) {
+ trackFormat = mExtractor.getTrackFormat(1);
+ trackCountForDolbyVision = 0;
+ }
+ }
+
+ if (MediaUtils.hasDecoder(MIMETYPE_VIDEO_DOLBY_VISION)) {
+ assertEquals("There must be 2 tracks", 2, mExtractor.getTrackCount());
+
+ MediaFormat trackFormatForDolbyVision =
+ mExtractor.getTrackFormat(trackCountForDolbyVision);
+
+ final String mimeType = trackFormatForDolbyVision.getString(MediaFormat.KEY_MIME);
+ assertEquals("video/dolby-vision", mimeType);
+
+ int profile = trackFormatForDolbyVision.getInteger(MediaFormat.KEY_PROFILE);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvheSt, profile);
+
+ int level = trackFormatForDolbyVision.getInteger(MediaFormat.KEY_LEVEL);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionLevelFhd60, level);
+
+ final int trackIdForDolbyVision =
+ trackFormatForDolbyVision.getInteger(MediaFormat.KEY_TRACK_ID);
+
+ final int trackIdForBackwardCompat = trackFormat.getInteger(MediaFormat.KEY_TRACK_ID);
+ assertEquals(trackIdForDolbyVision, trackIdForBackwardCompat);
+ }
+
+ // The backward-compatible track should have mime video/hevc
+ final String mimeType = trackFormat.getString(MediaFormat.KEY_MIME);
+ assertEquals("video/hevc", mimeType);
+ }
+
+ // DolbyVisionMediaExtractor for profile-level (DvavSe/Fhd60).
+ public void testDolbyVisionMediaExtractorProfileDvavSe() throws Exception {
+ TestMediaDataSource dataSource = setDataSource(R.raw.video_dovi_1920x1080_60fps_dvav_09);
+
+ assertTrue("There should be either 1 or 2 tracks",
+ 0 < mExtractor.getTrackCount() && 3 > mExtractor.getTrackCount());
+
+ MediaFormat trackFormat = mExtractor.getTrackFormat(0);
+ int trackCountForDolbyVision = 1;
+
+ // Handle the case where there is a Dolby Vision extractor
+ // Note that it may or may not have a Dolby Vision Decoder
+ if (mExtractor.getTrackCount() == 2) {
+ if (trackFormat.getString(MediaFormat.KEY_MIME)
+ .equalsIgnoreCase(MIMETYPE_VIDEO_DOLBY_VISION)) {
+ trackFormat = mExtractor.getTrackFormat(1);
+ trackCountForDolbyVision = 0;
+ }
+ }
+
+ if (MediaUtils.hasDecoder(MIMETYPE_VIDEO_DOLBY_VISION)) {
+ assertEquals("There must be 2 tracks", 2, mExtractor.getTrackCount());
+
+ MediaFormat trackFormatForDolbyVision =
+ mExtractor.getTrackFormat(trackCountForDolbyVision);
+
+ final String mimeType = trackFormatForDolbyVision.getString(MediaFormat.KEY_MIME);
+ assertEquals("video/dolby-vision", mimeType);
+
+ int profile = trackFormatForDolbyVision.getInteger(MediaFormat.KEY_PROFILE);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionProfileDvavSe, profile);
+
+ int level = trackFormatForDolbyVision.getInteger(MediaFormat.KEY_LEVEL);
+ assertEquals(MediaCodecInfo.CodecProfileLevel.DolbyVisionLevelFhd60, level);
+
+ final int trackIdForDolbyVision =
+ trackFormatForDolbyVision.getInteger(MediaFormat.KEY_TRACK_ID);
+
+ final int trackIdForBackwardCompat = trackFormat.getInteger(MediaFormat.KEY_TRACK_ID);
+ assertEquals(trackIdForDolbyVision, trackIdForBackwardCompat);
+ }
+
+ // The backward-compatible track should have mime video/avc
+ final String mimeType = trackFormat.getString(MediaFormat.KEY_MIME);
+ assertEquals("video/avc", mimeType);
+ }
+
private void checkExtractorSamplesAndMetrics() {
// 1MB is enough for any sample.
final ByteBuffer buf = ByteBuffer.allocate(1024*1024);
diff --git a/tests/tests/mediastress/AndroidTest.xml b/tests/tests/mediastress/AndroidTest.xml
index 4457aca..c6ed526 100644
--- a/tests/tests/mediastress/AndroidTest.xml
+++ b/tests/tests/mediastress/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="media" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
<option name="target" value="host" />
<option name="config-filename" value="cts" />
diff --git a/tests/tests/nativemidi/AndroidTest.xml b/tests/tests/nativemidi/AndroidTest.xml
index 536e8f8..0c40eea 100644
--- a/tests/tests/nativemidi/AndroidTest.xml
+++ b/tests/tests/nativemidi/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsNativeMidiTestCases.apk" />
diff --git a/tests/tests/net/src/android/net/cts/MacAddressTest.java b/tests/tests/net/src/android/net/cts/MacAddressTest.java
index af1e760..4d25e62 100644
--- a/tests/tests/net/src/android/net/cts/MacAddressTest.java
+++ b/tests/tests/net/src/android/net/cts/MacAddressTest.java
@@ -20,6 +20,11 @@
import static android.net.MacAddress.TYPE_MULTICAST;
import static android.net.MacAddress.TYPE_UNICAST;
+import static com.android.testutils.ParcelUtilsKt.assertParcelSane;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import android.net.MacAddress;
@@ -30,6 +35,7 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.net.Inet6Address;
import java.util.Arrays;
@SmallTest
@@ -161,4 +167,57 @@
} catch (NullPointerException excepted) {
}
}
+
+ @Test
+ public void testMatches() {
+ // match 4 bytes prefix
+ assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
+ MacAddress.fromString("aa:bb:cc:dd:00:00"),
+ MacAddress.fromString("ff:ff:ff:ff:00:00")));
+
+ // match bytes 0,1,2 and 5
+ assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
+ MacAddress.fromString("aa:bb:cc:00:00:11"),
+ MacAddress.fromString("ff:ff:ff:00:00:ff")));
+
+ // match 34 bit prefix
+ assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
+ MacAddress.fromString("aa:bb:cc:dd:c0:00"),
+ MacAddress.fromString("ff:ff:ff:ff:c0:00")));
+
+ // fail to match 36 bit prefix
+ assertFalse(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
+ MacAddress.fromString("aa:bb:cc:dd:40:00"),
+ MacAddress.fromString("ff:ff:ff:ff:f0:00")));
+
+ // match all 6 bytes
+ assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
+ MacAddress.fromString("aa:bb:cc:dd:ee:11"),
+ MacAddress.fromString("ff:ff:ff:ff:ff:ff")));
+
+ // match none of 6 bytes
+ assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
+ MacAddress.fromString("00:00:00:00:00:00"),
+ MacAddress.fromString("00:00:00:00:00:00")));
+ }
+
+ /**
+ * Tests that link-local address generation from MAC is valid.
+ */
+ @Test
+ public void testLinkLocalFromMacGeneration() {
+ final MacAddress mac = MacAddress.fromString("52:74:f2:b1:a8:7f");
+ final byte[] inet6ll = {(byte) 0xfe, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
+ 0x74, (byte) 0xf2, (byte) 0xff, (byte) 0xfe, (byte) 0xb1, (byte) 0xa8, 0x7f};
+ final Inet6Address llv6 = mac.getLinkLocalIpv6FromEui48Mac();
+ assertTrue(llv6.isLinkLocalAddress());
+ assertArrayEquals(inet6ll, llv6.getAddress());
+ }
+
+ @Test
+ public void testParcelMacAddress() {
+ final MacAddress mac = MacAddress.fromString("52:74:f2:b1:a8:7f");
+
+ assertParcelSane(mac, 1);
+ }
}
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
index 3e47764..5b8a8d5 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
@@ -49,6 +49,7 @@
import com.android.compatibility.common.util.SystemUtil;
+import java.lang.StringBuilder;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;
@@ -770,6 +771,7 @@
final List<PackageInfo> holding = pm.getPackagesHoldingPermissions(new String[] {
android.Manifest.permission.NETWORK_SETTINGS
}, PackageManager.MATCH_UNINSTALLED_PACKAGES);
+ StringBuilder stringBuilder = new StringBuilder();
for (PackageInfo pi : holding) {
String packageName = pi.packageName;
@@ -784,10 +786,13 @@
continue;
}
if (!allowedUIDs.contains(uid)) {
- fail("The NETWORK_SETTINGS permission must not be held by " + packageName
- + ":" + uid + " and must be revoked for security reasons");
+ stringBuilder.append("The NETWORK_SETTINGS permission must not be held by "
+ + packageName + ":" + uid + " and must be revoked for security reasons\n");
}
}
+ if (stringBuilder.length() > 0) {
+ fail(stringBuilder.toString());
+ }
}
/**
diff --git a/tests/tests/neuralnetworks/benchmark/Android.mk b/tests/tests/neuralnetworks/benchmark/Android.mk
index 7956522c4..d076683 100644
--- a/tests/tests/neuralnetworks/benchmark/Android.mk
+++ b/tests/tests/neuralnetworks/benchmark/Android.mk
@@ -27,7 +27,7 @@
LOCAL_MULTILIB := both
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts mts general-tests
+LOCAL_COMPATIBILITY_SUITE := cts vts mts
LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules \
compatibility-device-util-axt ctstestrunner-axt junit NeuralNetworksApiBenchmark_Lib
diff --git a/tests/tests/notificationlegacy/notificationlegacy27/AndroidTest.xml b/tests/tests/notificationlegacy/notificationlegacy27/AndroidTest.xml
index 05ca75a..fcdb64d 100644
--- a/tests/tests/notificationlegacy/notificationlegacy27/AndroidTest.xml
+++ b/tests/tests/notificationlegacy/notificationlegacy27/AndroidTest.xml
@@ -19,6 +19,7 @@
<!-- Notification Listeners are not supported for instant apps. -->
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsLegacyNotification27TestCases.apk" />
diff --git a/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java b/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
index ef2bef4..f2960a6 100644
--- a/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
+++ b/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
@@ -356,7 +356,10 @@
private void toggleNotificationPolicyAccess(String packageName,
Instrumentation instrumentation, boolean on) throws IOException {
- String command = " cmd notification " + (on ? "allow_dnd " : "disallow_dnd ") + packageName;
+ String command = " cmd notification"
+ + " " + (on ? "allow_dnd" : "disallow_dnd")
+ + " " + packageName
+ + " " + mContext.getUserId();
runCommand(command, instrumentation);
@@ -368,8 +371,10 @@
private void suspendPackage(String packageName,
Instrumentation instrumentation, boolean suspend) throws IOException {
- String command = " cmd package " + (suspend ? "suspend "
- : "unsuspend ") + packageName;
+ String command = " cmd package"
+ + " " + (suspend ? "suspend" : "unsuspend")
+ + " --user " + mContext.getUserId()
+ + " " + packageName;
runCommand(command, instrumentation);
}
@@ -377,8 +382,10 @@
private void toggleListenerAccess(String componentName, Instrumentation instrumentation,
boolean on) throws IOException {
- String command = " cmd notification " + (on ? "allow_listener " : "disallow_listener ")
- + componentName;
+ String command = " cmd notification"
+ + " " + (on ? "allow_listener" : "disallow_listener")
+ + " " + componentName
+ + " " + mContext.getUserId();
runCommand(command, instrumentation);
diff --git a/tests/tests/opengl/AndroidTest.xml b/tests/tests/opengl/AndroidTest.xml
index 3105abb..487687c 100644
--- a/tests/tests/opengl/AndroidTest.xml
+++ b/tests/tests/opengl/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="graphics" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsOpenGLTestCases.apk" />
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglConfigCtsActivity.java b/tests/tests/opengl/src/android/opengl/cts/EglConfigCtsActivity.java
index cef9e2f..1b8cf77 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglConfigCtsActivity.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglConfigCtsActivity.java
@@ -16,83 +16,176 @@
package android.opengl.cts;
+import static org.junit.Assert.assertTrue;
+
import android.app.Activity;
-import android.content.Intent;
+import android.content.Context;
import android.opengl.GLSurfaceView;
import android.os.Bundle;
+import android.util.Log;
import android.view.WindowManager;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+
/**
* {@link Activity} with a {@link GLSurfaceView} that chooses a specific configuration.
*/
public class EglConfigCtsActivity extends Activity {
+ private final String TAG = this.getClass().getSimpleName();
+
public static final String CONFIG_ID_EXTRA = "eglConfigId";
public static final String CONTEXT_CLIENT_VERSION_EXTRA = "eglContextClientVersion";
+ private static final int EGL_OPENGL_ES_BIT = 0x1;
+ private static final int EGL_OPENGL_ES2_BIT = 0x4;
+
private EglConfigGLSurfaceView mView;
private CountDownLatch mFinishedDrawing;
+ private CountDownLatch mFinishedTesting;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- int configId = getConfigId();
- int contextClientVersion = getContextClientVersion();
- setTitle("EGL Config Id: " + configId + " Client Version: " + contextClientVersion);
// Dismiss keyguard and keep screen on while this test is on.
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON |
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
- mFinishedDrawing = new CountDownLatch(1);
- mView = new EglConfigGLSurfaceView(this, configId, contextClientVersion, new Runnable() {
- @Override
- public void run() {
- mFinishedDrawing.countDown();
- }
- });
- setContentView(mView);
- }
-
- private int getConfigId() {
- Intent intent = getIntent();
- if (intent != null) {
- return intent.getIntExtra(CONFIG_ID_EXTRA, 0);
- } else {
- return 0;
- }
- }
-
- private int getContextClientVersion() {
- Intent intent = getIntent();
- if (intent != null) {
- return intent.getIntExtra(CONTEXT_CLIENT_VERSION_EXTRA, 0);
- } else {
- return 0;
+ int[] configIds = getEglConfigIds(EGL_OPENGL_ES_BIT);
+ int[] configIds2 = getEglConfigIds(EGL_OPENGL_ES2_BIT);
+ assertTrue(configIds.length + configIds2.length > 0);
+ mFinishedTesting = new CountDownLatch(configIds.length + configIds2.length);
+ try {
+ runConfigTests(configIds, 1);
+ runConfigTests(configIds2, 2);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Caught exception");
}
}
@Override
protected void onResume() {
super.onResume();
- mView.onResume();
+ if (mView != null)
+ {
+ mView.onResume();
+ }
}
@Override
protected void onPause() {
super.onPause();
- mView.onPause();
+ if (mView != null)
+ {
+ mView.onPause();
+ }
}
- public void waitToFinishDrawing() throws InterruptedException {
- if (!mFinishedDrawing.await(3, TimeUnit.SECONDS)) {
- throw new IllegalStateException("Coudn't finish drawing frames!");
+ private void runConfigTests(int[] configIds, int contextClientVersion)
+ throws InterruptedException {
+ Context context = this;
+ Thread thread = new Thread() {
+ @Override
+ public void run() {
+ for (int configId : configIds) {
+ mFinishedDrawing = new CountDownLatch(1);
+
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ setTitle("EGL Config Id: " + configId + " Client Version: " + contextClientVersion);
+ mView = new EglConfigGLSurfaceView(context, configId, contextClientVersion, new Runnable() {
+ @Override
+ public void run() {
+ mFinishedDrawing.countDown();
+ }
+ });
+ setContentView(mView);
+ }
+ });
+
+ try {
+ waitToFinishDrawing();
+ } catch (Exception e) {
+ Log.e(TAG, "Timed out!");
+ }
+
+ mFinishedTesting.countDown();
+ }
+ }
+ };
+ thread.start();
+ }
+
+ private void waitToFinishDrawing() throws InterruptedException {
+ if (!mFinishedDrawing.await(5, TimeUnit.SECONDS)) {
+ throw new IllegalStateException("Couldn't finish drawing frames!");
+ }
+ }
+
+ void waitToFinishTesting() throws InterruptedException {
+ if (!mFinishedTesting.await(300, TimeUnit.SECONDS)) {
+ throw new IllegalStateException("Couldn't finish testing!");
+ }
+ }
+
+ private static int[] getEglConfigIds(int renderableType) {
+ EGL10 egl = (EGL10) EGLContext.getEGL();
+ EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+ int[] numConfigs = new int[1];
+
+ int[] attributeList = new int[] {
+ EGL10.EGL_RENDERABLE_TYPE, renderableType,
+
+ // Avoid configs like RGBA0008 which crash even though they have the window bit set.
+ EGL10.EGL_RED_SIZE, 1,
+ EGL10.EGL_GREEN_SIZE, 1,
+ EGL10.EGL_BLUE_SIZE, 1,
+
+ EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT,
+ EGL10.EGL_NONE
+ };
+
+ if (egl.eglInitialize(display, null)) {
+ try {
+ if (egl.eglChooseConfig(display, attributeList, null, 0, numConfigs)) {
+ EGLConfig[] configs = new EGLConfig[numConfigs[0]];
+ if (egl.eglChooseConfig(display, attributeList, configs, configs.length,
+ numConfigs)) {
+ int[] configIds = new int[numConfigs[0]];
+ for (int i = 0; i < numConfigs[0]; i++) {
+ int[] value = new int[1];
+ if (egl.eglGetConfigAttrib(display, configs[i], EGL10.EGL_CONFIG_ID,
+ value)) {
+ configIds[i] = value[0];
+ } else {
+ throw new IllegalStateException("Couldn't call eglGetConfigAttrib");
+ }
+ }
+ return configIds;
+ } else {
+ throw new IllegalStateException("Couldn't call eglChooseConfig (1)");
+ }
+ } else {
+ throw new IllegalStateException("Couldn't call eglChooseConfig (2)");
+ }
+ } finally {
+ egl.eglTerminate(display);
+ }
+ } else {
+ throw new IllegalStateException("Couldn't initialize EGL.");
}
}
}
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java b/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
index 3e5565e..613456a 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
@@ -25,6 +25,7 @@
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
+import static androidx.test.internal.util.Checks.checkState;
import org.junit.Before;
import org.junit.Rule;
@@ -36,14 +37,16 @@
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
+import android.util.Log;
+import java.lang.Runnable;
+
/**
* Test that gets a list of EGL configurations and tries to use each one in a GLSurfaceView.
*/
@LargeTest
@RunWith(AndroidJUnit4.class)
public class EglConfigTest {
- private static final int EGL_OPENGL_ES_BIT = 0x1;
- private static final int EGL_OPENGL_ES2_BIT = 0x4;
+ private final String TAG = this.getClass().getSimpleName();
private Instrumentation mInstrumentation;
@@ -58,75 +61,11 @@
@Test
public void testEglConfigs() throws Exception {
- int[] configIds = getEglConfigIds(EGL_OPENGL_ES_BIT);
- int[] configIds2 = getEglConfigIds(EGL_OPENGL_ES2_BIT);
- assertTrue(configIds.length + configIds2.length > 0);
- runConfigTests(configIds, 1);
- runConfigTests(configIds2, 2);
- }
-
- private void runConfigTests(int[] configIds, int contextClientVersion)
- throws InterruptedException {
- for (int configId : configIds) {
- Intent intent = new Intent(InstrumentationRegistry.getTargetContext(),
- EglConfigCtsActivity.class);
- intent.putExtra(EglConfigCtsActivity.CONFIG_ID_EXTRA, configId);
- intent.putExtra(EglConfigCtsActivity.CONTEXT_CLIENT_VERSION_EXTRA,
- contextClientVersion);
- EglConfigCtsActivity activity = mActivityRule.launchActivity(intent);
- activity.waitToFinishDrawing();
- // TODO(b/30948621): Remove the sleep below once b/30948621 is fixed.
- Thread.sleep(500);
- activity.finish();
- mInstrumentation.waitForIdleSync();
- }
- }
-
- private static int[] getEglConfigIds(int renderableType) {
- EGL10 egl = (EGL10) EGLContext.getEGL();
- EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
- int[] numConfigs = new int[1];
-
- int[] attributeList = new int[] {
- EGL10.EGL_RENDERABLE_TYPE, renderableType,
-
- // Avoid configs like RGBA0008 which crash even though they have the window bit set.
- EGL10.EGL_RED_SIZE, 1,
- EGL10.EGL_GREEN_SIZE, 1,
- EGL10.EGL_BLUE_SIZE, 1,
-
- EGL10.EGL_SURFACE_TYPE, EGL10.EGL_WINDOW_BIT,
- EGL10.EGL_NONE
- };
-
- if (egl.eglInitialize(display, null)) {
- try {
- if (egl.eglChooseConfig(display, attributeList, null, 0, numConfigs)) {
- EGLConfig[] configs = new EGLConfig[numConfigs[0]];
- if (egl.eglChooseConfig(display, attributeList, configs, configs.length,
- numConfigs)) {
- int[] configIds = new int[numConfigs[0]];
- for (int i = 0; i < numConfigs[0]; i++) {
- int[] value = new int[1];
- if (egl.eglGetConfigAttrib(display, configs[i], EGL10.EGL_CONFIG_ID,
- value)) {
- configIds[i] = value[0];
- } else {
- throw new IllegalStateException("Couldn't call eglGetConfigAttrib");
- }
- }
- return configIds;
- } else {
- throw new IllegalStateException("Couldn't call eglChooseConfig (1)");
- }
- } else {
- throw new IllegalStateException("Couldn't call eglChooseConfig (2)");
- }
- } finally {
- egl.eglTerminate(display);
- }
- } else {
- throw new IllegalStateException("Couldn't initialize EGL.");
- }
+ Intent intent = new Intent(InstrumentationRegistry.getTargetContext(),
+ EglConfigCtsActivity.class);
+ EglConfigCtsActivity activity = mActivityRule.launchActivity(intent);
+ activity.waitToFinishTesting();
+ activity.finish();
+ mInstrumentation.waitForIdleSync();
}
}
diff --git a/tests/tests/os/src/android/os/cts/PersistableBundleTest.java b/tests/tests/os/src/android/os/cts/PersistableBundleTest.java
new file mode 100644
index 0000000..579ec9c
--- /dev/null
+++ b/tests/tests/os/src/android/os/cts/PersistableBundleTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os.cts;
+
+import android.os.PersistableBundle;
+import android.test.AndroidTestCase;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+
+public class PersistableBundleTest extends AndroidTestCase {
+
+ public void testWriteToStreamAndReadFromStream() throws IOException {
+ PersistableBundle bundle = new PersistableBundle();
+ bundle.putBoolean("boolean", true);
+ bundle.putBooleanArray("boolean_array", new boolean[] {false});
+ bundle.putDouble("double", 1.23);
+ bundle.putDoubleArray("double_array", new double[] {2.34, 3.45});
+ bundle.putInt("int", 1);
+ bundle.putIntArray("int_array", new int[] {2});
+ bundle.putLong("long", 12345L);
+ bundle.putLongArray("long_array", new long[] {1234567L, 2345678L});
+ bundle.putString("string", "abc123");
+ bundle.putStringArray("string_array", new String[] {"xyz789"});
+ PersistableBundle nestedBundle = new PersistableBundle();
+ nestedBundle.putBooleanArray("boolean_array", new boolean[]{});
+ nestedBundle.putInt("int", 9);
+ nestedBundle.putLongArray("long_array", new long [] {654321L});
+ bundle.putPersistableBundle("bundle", nestedBundle);
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ bundle.writeToStream(outputStream);
+ ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
+ PersistableBundle restoredBundle = PersistableBundle.readFromStream(inputStream);
+
+ assertEquals(bundle.size(), restoredBundle.size());
+ assertEquals(true, restoredBundle.getBoolean("boolean"));
+ assertTrue(Arrays.equals(
+ new boolean[] {false}, restoredBundle.getBooleanArray("boolean_array")));
+ assertEquals(1.23, restoredBundle.getDouble("double"));
+ assertTrue(Arrays.equals(
+ new double[] {2.34, 3.45}, restoredBundle.getDoubleArray("double_array")));
+ assertEquals(1, restoredBundle.getInt("int"));
+ assertTrue(Arrays.equals(
+ new int[] {2}, restoredBundle.getIntArray("int_array")));
+ assertEquals(12345L, restoredBundle.getLong("long"));
+ assertTrue(Arrays.equals(
+ new long[] {1234567L, 2345678L}, restoredBundle.getLongArray("long_array")));
+ assertEquals("abc123", restoredBundle.getString("string"));
+ assertTrue(Arrays.equals(
+ new String[] {"xyz789"}, restoredBundle.getStringArray("string_array")));
+ PersistableBundle restoredNestedBundle = restoredBundle.getPersistableBundle("bundle");
+ assertEquals(nestedBundle.size(), restoredNestedBundle.size());
+ assertTrue(Arrays.equals(
+ new boolean[] {}, restoredNestedBundle.getBooleanArray("boolean_array")));
+ assertEquals(9, restoredNestedBundle.getInt("int"));
+ assertTrue(Arrays.equals(
+ new long[] {654321L}, restoredNestedBundle.getLongArray("long_array")));
+ }
+
+}
diff --git a/tests/tests/permission/src/android/permission/cts/SecureElementPermissionTest.java b/tests/tests/permission/src/android/permission/cts/SecureElementPermissionTest.java
new file mode 100644
index 0000000..5821582
--- /dev/null
+++ b/tests/tests/permission/src/android/permission/cts/SecureElementPermissionTest.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.permission.cts;
+
+import static org.junit.Assert.fail;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Process;
+
+import androidx.test.InstrumentationRegistry;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import android.util.Log;
+@RunWith(JUnit4.class)
+public final class SecureElementPermissionTest {
+ // Needed because SECURE_ELEMENT_PRIVILEGED_PERMISSION is a systemapi
+ public static final String SECURE_ELEMENT_PRIVILEGED_PERMISSION =
+ "android.permission.SECURE_ELEMENT_PRIVILEGED";
+
+ @Test
+ public void testSecureElementPrivilegedPermission() {
+ PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
+
+ List<Integer> specialUids = Arrays.asList(Process.SYSTEM_UID, Process.PHONE_UID);
+
+ List<PackageInfo> holding = pm.getPackagesHoldingPermissions(
+ new String[] { SECURE_ELEMENT_PRIVILEGED_PERMISSION },
+ PackageManager.MATCH_DISABLED_COMPONENTS);
+
+ List<Integer> nonSpecialPackages = holding.stream()
+ .map(pi -> {
+ try {
+ return pm.getPackageUid(pi.packageName, 0);
+ } catch (PackageManager.NameNotFoundException e) {
+ return Process.INVALID_UID;
+ }
+ })
+ .filter(uid -> !specialUids.contains(uid))
+ .collect(Collectors.toList());
+
+ if (nonSpecialPackages.size() > 1) {
+ fail("Only one app on the device is allowed to hold the SECURE_ELEMENT_PRIVILEGED " +
+ "permission.");
+ }
+ }
+}
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 36c7cbf..cae32b3 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -305,6 +305,7 @@
<protected-broadcast android:name="android.net.nsd.STATE_CHANGED" />
<protected-broadcast android:name="android.nfc.action.ADAPTER_STATE_CHANGED" />
+ <protected-broadcast android:name="android.nfc.action.PREFERRED_PAYMENT_CHANGED" />
<protected-broadcast android:name="android.nfc.action.TRANSACTION_DETECTED" />
<protected-broadcast android:name="com.android.nfc.action.LLCP_UP" />
<protected-broadcast android:name="com.android.nfc.action.LLCP_DOWN" />
@@ -449,7 +450,6 @@
<protected-broadcast android:name="android.intent.action.internal_sim_state_changed" />
<protected-broadcast android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<protected-broadcast android:name="android.intent.action.PRECISE_CALL_STATE" />
- <protected-broadcast android:name="android.intent.action.PRECISE_DATA_CONNECTION_STATE_CHANGED" />
<protected-broadcast android:name="android.intent.action.SUBSCRIPTION_PHONE_STATE" />
<protected-broadcast android:name="android.intent.action.USER_INFO_CHANGED" />
<protected-broadcast android:name="android.intent.action.USER_UNLOCKED" />
@@ -555,10 +555,12 @@
<protected-broadcast android:name="com.android.sync.SYNC_CONN_STATUS_CHANGED" />
- <protected-broadcast android:name="com.android.phone.SIP_INCOMING_CALL" />
+ <protected-broadcast android:name="android.net.sip.action.SIP_INCOMING_CALL" />
<protected-broadcast android:name="com.android.phone.SIP_ADD_PHONE" />
- <protected-broadcast android:name="com.android.phone.SIP_REMOVE_PHONE" />
- <protected-broadcast android:name="com.android.phone.SIP_CALL_OPTION_CHANGED" />
+ <protected-broadcast android:name="android.net.sip.action.SIP_REMOVE_PROFILE" />
+ <protected-broadcast android:name="android.net.sip.action.SIP_SERVICE_UP" />
+ <protected-broadcast android:name="android.net.sip.action.SIP_CALL_OPTION_CHANGED" />
+ <protected-broadcast android:name="android.net.sip.action.START_SIP" />
<protected-broadcast android:name="android.bluetooth.adapter.action.BLE_ACL_CONNECTED" />
<protected-broadcast android:name="android.bluetooth.adapter.action.BLE_ACL_DISCONNECTED" />
@@ -651,6 +653,11 @@
<!-- ====================================================================== -->
<eat-comment />
+ <!-- @SystemApi Allows accessing the messages on ICC
+ @hide Used internally. -->
+ <permission android:name="android.permission.ACCESS_MESSAGES_ON_ICC"
+ android:protectionLevel="signature|telephony" />
+
<!-- Used for runtime permissions related to contacts and profiles on this
device. -->
<permission-group android:name="android.permission-group.CONTACTS"
@@ -1696,6 +1703,19 @@
<permission android:name="android.permission.NFC_TRANSACTION_EVENT"
android:protectionLevel="normal" />
+ <!-- Allows applications to receive NFC preferred payment service information.
+ <p>Protection level: normal
+ -->
+ <permission android:name="android.permission.NFC_PREFERRED_PAYMENT_INFO"
+ android:description="@string/permdesc_preferredPaymentInfo"
+ android:label="@string/permlab_preferredPaymentInfo"
+ android:protectionLevel="normal" />
+
+ <!-- @SystemApi Allows an internal user to use privileged SecureElement APIs.
+ @hide -->
+ <permission android:name="android.permission.SECURE_ELEMENT_PRIVILEGED"
+ android:protectionLevel="signature|privileged" />
+
<!-- @SystemApi Allows an internal user to use privileged ConnectivityManager APIs.
@hide -->
<permission android:name="android.permission.CONNECTIVITY_INTERNAL"
@@ -1790,6 +1810,13 @@
android:description="@string/permdesc_vibrate"
android:protectionLevel="normal|instant" />
+ <!-- Allows access to the vibrator always-on settings.
+ <p>Protection level: signature
+ @hide
+ -->
+ <permission android:name="android.permission.VIBRATE_ALWAYS_ON"
+ android:protectionLevel="signature" />
+
<!-- Allows using PowerManager WakeLocks to keep processor from sleeping or screen
from dimming.
<p>Protection level: normal
@@ -1952,6 +1979,11 @@
<!-- =========================================== -->
<eat-comment />
+ <!-- @SystemApi Allows granting runtime permissions to telephony related components.
+ @hide Used internally. -->
+ <permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS_TO_TELEPHONY_DEFAULTS"
+ android:protectionLevel="signature|telephony" />
+
<!-- Allows modification of the telephony state - power on, mmi, etc.
Does not include placing calls.
<p>Not for use by third-party applications. -->
@@ -2425,17 +2457,17 @@
<permission android:name="android.permission.READ_WALLPAPER_INTERNAL"
android:protectionLevel="signature|privileged" />
- <!-- ============================================ -->
- <!-- Permissions for changing the system clock -->
- <!-- ============================================ -->
+ <!-- ===================================================== -->
+ <!-- Permissions for changing the system clock / time zone -->
+ <!-- ===================================================== -->
<eat-comment />
- <!-- Allows applications to set the system time.
- <p>Not for use by third-party applications. -->
+ <!-- Allows applications to set the system time directly.
+ <p>Not for use by third-party applications. -->
<permission android:name="android.permission.SET_TIME"
android:protectionLevel="signature|privileged" />
- <!-- Allows applications to set the system time zone.
+ <!-- Allows applications to set the system time zone directly.
<p>Not for use by third-party applications.
-->
<permission android:name="android.permission.SET_TIME_ZONE"
@@ -2443,6 +2475,20 @@
android:description="@string/permdesc_setTimeZone"
android:protectionLevel="signature|privileged" />
+ <!-- Allows telephony to suggest the time / time zone.
+ <p>Not for use by third-party applications.
+ @hide
+ -->
+ <permission android:name="android.permission.SUGGEST_PHONE_TIME_AND_ZONE"
+ android:protectionLevel="signature|telephony" />
+
+ <!-- Allows applications like settings to suggest the user's manually chosen time / time zone.
+ <p>Not for use by third-party applications.
+ @hide
+ -->
+ <permission android:name="android.permission.SUGGEST_MANUAL_TIME_AND_ZONE"
+ android:protectionLevel="signature" />
+
<!-- ==================================================== -->
<!-- Permissions related to changing status bar -->
<!-- ==================================================== -->
diff --git a/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java b/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java
index 4195add..5e18189 100644
--- a/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java
@@ -82,8 +82,6 @@
"android.provider.Telephony.SPN_STRINGS_UPDATED",
"android.intent.action.EMERGENCY_CALLBACK_MODE_CHANGED",
"android.intent.action.SIM_STATE_CHANGED",
- "android.intent.action.DATA_CONNECTION_FAILED",
- "android.intent.action.NETWORK_SET_TIME",
"android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED",
"android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED",
"com.android.internal.intent.action.ACTION_SHOW_NOTICE_ECM_BLOCK_OTHERS",
diff --git a/tests/tests/permission2/src/android/permission2/cts/RestrictedPermissionsTest.java b/tests/tests/permission2/src/android/permission2/cts/RestrictedPermissionsTest.java
index e6b4256..970bf6a 100644
--- a/tests/tests/permission2/src/android/permission2/cts/RestrictedPermissionsTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/RestrictedPermissionsTest.java
@@ -430,6 +430,7 @@
@AppModeFull
public void testStorageTargetingSdk28DoesNotLooseAccessWhenOptingIn() throws Exception {
installApp(APK_USES_STORAGE_DEFAULT_28, null);
+ assertHasFullStorageAccess();
installApp(APK_USES_STORAGE_OPT_IN_28, null);
assertHasFullStorageAccess();
@@ -439,6 +440,7 @@
@AppModeFull
public void testStorageTargetingSdk28DoesNotLooseAccessViaUpdate() throws Exception {
installApp(APK_USES_STORAGE_DEFAULT_28, null);
+ assertHasFullStorageAccess();
installApp(APK_USES_STORAGE_DEFAULT_29, null);
assertHasFullStorageAccess();
@@ -448,6 +450,7 @@
@AppModeFull
public void testStorageTargetingSdk29DoesNotLooseAccessViaUpdate() throws Exception {
installApp(APK_USES_STORAGE_OPT_OUT_29, null);
+ assertHasFullStorageAccess();
installApp(APK_USES_STORAGE_DEFAULT_29, null);
assertHasFullStorageAccess();
@@ -457,6 +460,7 @@
@AppModeFull
public void testStorageTargetingSdk29DoesNotLooseAccessWhenOptingIn() throws Exception {
installApp(APK_USES_STORAGE_OPT_OUT_29, null);
+ assertHasFullStorageAccess();
installApp(APK_USES_STORAGE_OPT_IN_28, null);
assertHasFullStorageAccess();
diff --git a/tests/tests/proto/AndroidTest.xml b/tests/tests/proto/AndroidTest.xml
index 6237e8f..1f77e75a 100644
--- a/tests/tests/proto/AndroidTest.xml
+++ b/tests/tests/proto/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="metrics" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsProtoTestCases.apk" />
diff --git a/tests/tests/provider/AndroidTest.xml b/tests/tests/provider/AndroidTest.xml
index a802979..e376ed0 100644
--- a/tests/tests/provider/AndroidTest.xml
+++ b/tests/tests/provider/AndroidTest.xml
@@ -20,6 +20,7 @@
<!-- Instant apps can't access the system providers. -->
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="android.provider.cts.preconditions.ExternalStoragePreparer" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Video_ThumbnailsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Video_ThumbnailsTest.java
index 9d39c1c..323e6f6 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Video_ThumbnailsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Video_ThumbnailsTest.java
@@ -225,10 +225,10 @@
// Thumbnail should be smaller
MediaStore.waitForIdle(mContext);
- final Bitmap beforeThumb = mResolver.loadThumbnail(finalUri, new Size(32, 32), null);
+ final Bitmap beforeThumb = mResolver.loadThumbnail(finalUri, new Size(64, 64), null);
assertTrue(beforeThumb.getWidth() < full.getWidth());
assertTrue(beforeThumb.getHeight() < full.getHeight());
- final int beforeColor = beforeThumb.getPixel(16, 16);
+ final int beforeColor = beforeThumb.getPixel(32, 32);
// Verify legacy APIs still work
if (MediaStore.VOLUME_EXTERNAL.equals(mVolumeName)) {
@@ -251,8 +251,8 @@
// Thumbnail should match updated contents
MediaStore.waitForIdle(mContext);
- final Bitmap afterThumb = mResolver.loadThumbnail(finalUri, new Size(32, 32), null);
- final int afterColor = afterThumb.getPixel(16, 16);
+ final Bitmap afterThumb = mResolver.loadThumbnail(finalUri, new Size(64, 64), null);
+ final int afterColor = afterThumb.getPixel(32, 32);
assertNotColorMostlyEquals(beforeColor, afterColor);
// Delete video contents
@@ -261,7 +261,7 @@
// Thumbnail should no longer exist
try {
MediaStore.waitForIdle(mContext);
- mResolver.loadThumbnail(finalUri, new Size(32, 32), null);
+ mResolver.loadThumbnail(finalUri, new Size(64, 64), null);
fail("Funky; we somehow made a thumbnail out of nothing?");
} catch (FileNotFoundException expected) {
}
diff --git a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
index e80e393..4c5f898 100644
--- a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
@@ -56,10 +56,11 @@
private static final String RESOURCE_SEE_MORE = "see_more";
private static final String RESOURCE_TITLE = "panel_title";
- private String mSettingsPackage = "com.android.settings";
+ private String mSettingsPackage;
private String mLauncherPackage;
private Context mContext;
+ private boolean mHasTouchScreen;
private UiDevice mDevice;
@@ -68,15 +69,19 @@
mContext = InstrumentationRegistry.getTargetContext();
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
- PackageManager packageManager = mContext.getPackageManager();
+ final PackageManager packageManager = mContext.getPackageManager();
+
+ mHasTouchScreen = packageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)
+ || packageManager.hasSystemFeature(PackageManager.FEATURE_FAKETOUCH);
+
Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
launcherIntent.addCategory(Intent.CATEGORY_HOME);
mLauncherPackage = packageManager.resolveActivity(launcherIntent,
PackageManager.MATCH_DEFAULT_ONLY).activityInfo.packageName;
- if (packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
- mSettingsPackage = "com.android.car.settings";
- }
+ Intent settingsIntent = new Intent(android.provider.Settings.ACTION_SETTINGS);
+ mSettingsPackage = packageManager.resolveActivity(settingsIntent,
+ PackageManager.MATCH_DEFAULT_ONLY).activityInfo.packageName;
}
@After
@@ -131,8 +136,7 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the done button
- mDevice.findObject(By.res(mSettingsPackage, RESOURCE_DONE)).click();
- mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
+ pressDone();
// Assert that we have left the panel
currentPackage = mDevice.getCurrentPackageName();
@@ -147,8 +151,7 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the done button
- mDevice.findObject(By.res(mSettingsPackage, RESOURCE_DONE)).click();
- mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
+ pressDone();
// Assert that we have left the panel
currentPackage = mDevice.getCurrentPackageName();
@@ -163,8 +166,7 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the done button
- mDevice.findObject(By.res(mSettingsPackage, RESOURCE_DONE)).click();
- mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
+ pressDone();
// Assert that we have left the panel
currentPackage = mDevice.getCurrentPackageName();
@@ -179,8 +181,7 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the done button
- mDevice.findObject(By.res(mSettingsPackage, RESOURCE_DONE)).click();
- mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
+ pressDone();
// Assert that we have left the panel
currentPackage = mDevice.getCurrentPackageName();
@@ -195,6 +196,7 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the see more button
+ assumeTrue(mHasTouchScreen);
mDevice.findObject(By.res(mSettingsPackage, RESOURCE_SEE_MORE)).click();
mDevice.wait(Until.hasObject(By.pkg(mSettingsPackage).depth(0)), TIMEOUT);
@@ -213,8 +215,8 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the see more button
- mDevice.findObject(By.res(mSettingsPackage, RESOURCE_SEE_MORE)).click();
- mDevice.wait(Until.hasObject(By.pkg(mSettingsPackage).depth(0)), TIMEOUT);
+ assumeTrue(mHasTouchScreen);
+ pressSeeMore();
// Assert that we're still in Settings, on a different page.
currentPackage = mDevice.getCurrentPackageName();
@@ -231,8 +233,8 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the see more button
- mDevice.findObject(By.res(mSettingsPackage, RESOURCE_SEE_MORE)).click();
- mDevice.wait(Until.hasObject(By.pkg(mSettingsPackage).depth(0)), TIMEOUT);
+ assumeTrue(mHasTouchScreen);
+ pressSeeMore();
// Assert that we're still in Settings, on a different page.
currentPackage = mDevice.getCurrentPackageName();
@@ -249,8 +251,8 @@
assertThat(currentPackage).isEqualTo(mSettingsPackage);
// Click the see more button
- mDevice.findObject(By.res(mSettingsPackage, RESOURCE_SEE_MORE)).click();
- mDevice.wait(Until.hasObject(By.pkg(mSettingsPackage).depth(0)), TIMEOUT);
+ assumeTrue(mHasTouchScreen);
+ pressSeeMore();
// Assert that we're still in Settings, on a different page.
currentPackage = mDevice.getCurrentPackageName();
@@ -268,11 +270,12 @@
}
private void launchNfcPanel() {
- assumeTrue("device does not support NFC", RequiredServiceRule.hasService("nfc"));
+ assumeTrue(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC));
launchPanel(Settings.Panel.ACTION_NFC);
}
private void launchWifiPanel() {
+ assumeTrue(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI));
launchPanel(Settings.Panel.ACTION_WIFI);
}
@@ -289,4 +292,18 @@
// Wait for the app to appear
mDevice.wait(Until.hasObject(By.pkg(mSettingsPackage).depth(0)), TIMEOUT);
}
+
+ private void pressDone() {
+ if (mHasTouchScreen) {
+ mDevice.findObject(By.res(mSettingsPackage, RESOURCE_DONE)).click();
+ mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
+ } else {
+ mDevice.pressBack();
+ }
+ }
+
+ private void pressSeeMore() {
+ mDevice.findObject(By.res(mSettingsPackage, RESOURCE_SEE_MORE)).click();
+ mDevice.wait(Until.hasObject(By.pkg(mSettingsPackage).depth(0)), TIMEOUT);
+ }
}
diff --git a/tests/tests/provider/src/android/provider/cts/SettingsTest.java b/tests/tests/provider/src/android/provider/cts/SettingsTest.java
index 6d808e0..d2d72ae 100644
--- a/tests/tests/provider/src/android/provider/cts/SettingsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SettingsTest.java
@@ -35,6 +35,7 @@
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
+import android.os.Binder;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.RemoteException;
@@ -344,6 +345,33 @@
}
}
+ @Test
+ public void testCheckWriteSettingsOperation() throws Exception {
+ final int myUid = Binder.getCallingUid();
+ final String callingPackage = InstrumentationRegistry.getTargetContext().getPackageName();
+ // Verify write settings permission.
+ Settings.checkAndNoteWriteSettingsOperation(getContext(), myUid, callingPackage,
+ true /* throwException */);
+
+ // Verify SecurityException throw if uid do not match callingPackage.
+ final int otherUid = myUid + 1;
+ try {
+ Settings.checkAndNoteWriteSettingsOperation(getContext(), otherUid, callingPackage,
+ true /* throwException */);
+ fail("Expect SecurityException because uid " + otherUid + " do not belong to "
+ + callingPackage);
+ } catch (SecurityException se) { }
+
+ // Verify SecurityException throw if calling package do not have WRITE_SETTINGS permission.
+ try {
+ final String fakeCallingPackage = "android.provider.cts.fakepackagename";
+ Settings.checkAndNoteWriteSettingsOperation(getContext(), myUid, fakeCallingPackage,
+ true /* throwException */);
+ fail("Expect throwing SecurityException due to no WRITE_SETTINGS permission");
+ } catch (SecurityException se) { }
+
+ }
+
private Instrumentation getInstrumentation() {
return InstrumentationRegistry.getInstrumentation();
}
diff --git a/tests/tests/provider/src/android/provider/cts/WifiSliceTest.java b/tests/tests/provider/src/android/provider/cts/WifiSliceTest.java
index 6fd0c19..da5c713 100644
--- a/tests/tests/provider/src/android/provider/cts/WifiSliceTest.java
+++ b/tests/tests/provider/src/android/provider/cts/WifiSliceTest.java
@@ -69,6 +69,7 @@
@Before
public void setUp() throws Exception {
assumeFalse("Skipping test: Auto does not support provider android.settings.slices", isCar());
+ assumeFalse("Skipping test: TV does not support provider android.settings.slices", isTv());
mWifiSlice = mSliceManager.bindSlice(WIFI_SLICE_URI, Collections.emptySet());
}
@@ -140,6 +141,12 @@
return pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
}
+ private boolean isTv() {
+ PackageManager pm = mContext.getPackageManager();
+ return pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
+ && pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+ }
+
private boolean isWifiEnabled() {
final WifiManager wifiManager = mContext.getSystemService(WifiManager.class);
return wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLED
diff --git a/tests/tests/sdkext/TEST_MAPPING b/tests/tests/sdkext/TEST_MAPPING
deleted file mode 100644
index 91947f3..0000000
--- a/tests/tests/sdkext/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "presubmit": [
- {
- "name": "CtsSdkExtTestCases"
- }
- ]
-}
diff --git a/tests/tests/sdkext/Android.bp b/tests/tests/sdkextensions/Android.bp
similarity index 90%
rename from tests/tests/sdkext/Android.bp
rename to tests/tests/sdkextensions/Android.bp
index 9ad6c7f..89b241b 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/tests/tests/sdkextensions/Android.bp
@@ -13,14 +13,14 @@
// limitations under the License.
android_test {
- name: "CtsSdkExtTestCases",
+ name: "CtsSdkExtensionsTestCases",
defaults: ["cts_defaults"],
static_libs: [
"androidx.test.rules",
"ctstestrunner-axt",
],
srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+ test_config: "CtsSdkExtensionsTestCases.xml",
test_suites: [
"cts",
"mts",
diff --git a/tests/tests/sdkext/AndroidManifest.xml b/tests/tests/sdkextensions/AndroidManifest.xml
similarity index 100%
rename from tests/tests/sdkext/AndroidManifest.xml
rename to tests/tests/sdkextensions/AndroidManifest.xml
diff --git a/tests/tests/sdkext/CtsSdkExtTestCases.xml b/tests/tests/sdkextensions/CtsSdkExtensionsTestCases.xml
similarity index 89%
rename from tests/tests/sdkext/CtsSdkExtTestCases.xml
rename to tests/tests/sdkextensions/CtsSdkExtensionsTestCases.xml
index b22653c..61edee5 100644
--- a/tests/tests/sdkext/CtsSdkExtTestCases.xml
+++ b/tests/tests/sdkextensions/CtsSdkExtensionsTestCases.xml
@@ -13,14 +13,14 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<configuration description="Configuration for SdkExt Tests">
+<configuration description="Configuration for SdkExtension Tests">
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
- <option name="test-file-name" value="CtsSdkExtTestCases.apk" />
+ <option name="test-file-name" value="CtsSdkExtensionsTestCases.apk" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.os.ext.cts" />
diff --git a/tests/tests/sdkextensions/OWNERS b/tests/tests/sdkextensions/OWNERS
new file mode 100644
index 0000000..8e32df8
--- /dev/null
+++ b/tests/tests/sdkextensions/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/base:/apex/sdkextensions/OWNERS
diff --git a/tests/tests/sdkextensions/TEST_MAPPING b/tests/tests/sdkextensions/TEST_MAPPING
new file mode 100644
index 0000000..7783bda
--- /dev/null
+++ b/tests/tests/sdkextensions/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit": [
+ {
+ "name": "CtsSdkExtensionsTestCases"
+ }
+ ]
+}
diff --git a/tests/tests/sdkext/src/android/os/ext/cts/SdkExtensionsTest.java b/tests/tests/sdkextensions/src/android/os/ext/cts/SdkExtensionsTest.java
similarity index 100%
rename from tests/tests/sdkext/src/android/os/ext/cts/SdkExtensionsTest.java
rename to tests/tests/sdkextensions/src/android/os/ext/cts/SdkExtensionsTest.java
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk b/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk
index d82007a..3674e96 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk
Binary files differ
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk b/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk
index 6c8cb70..30d9d13 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk
Binary files differ
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk b/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk
index 4d8f5e3..0335b88 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk
Binary files differ
diff --git a/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java b/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
index 0734a9b..d634fee 100644
--- a/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
+++ b/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
@@ -190,7 +190,6 @@
public void setUp() throws Exception {
assumeTrue(PropertyUtil.getFirstApiLevel() > Build.VERSION_CODES.O_MR1);
assumeTrue(supportsHardware());
- assumeTrue(supportOMAPIReaders());
seService = new SEService(InstrumentationRegistry.getContext(), new SynchronousExecutor(), mListener);
connectionTimer = new Timer();
connectionTimer.schedule(mTimerTask, SERVICE_CONNECTION_TIME_OUT);
@@ -279,6 +278,7 @@
/** Tests getATR API */
@Test
public void testATR() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -311,6 +311,7 @@
/** Tests OpenBasicChannel API when aid is null */
@Test
public void testOpenBasicChannelNullAid() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -340,6 +341,7 @@
/** Tests OpenBasicChannel API when aid is provided */
@Test
public void testOpenBasicChannelNonNullAid() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -369,6 +371,7 @@
/** Tests Select API */
@Test
public void testSelectableAid() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -382,6 +385,7 @@
@Test
public void testLongSelectResponse() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -419,6 +423,7 @@
/** Tests if NoSuchElementException in Select */
@Test
public void testWrongAid() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -450,6 +455,7 @@
/** Tests if Security Exception in Transmit */
@Test
public void testSecurityExceptionInTransmit() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -536,6 +542,7 @@
*/
@Test
public void testTransmitApdu() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -571,6 +578,7 @@
*/
@Test
public void testStatusWordTransmit() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -618,6 +626,7 @@
/** Test if the responses are segmented by the underlying implementation */
@Test
public void testSegmentedResponseTransmit() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
@@ -646,6 +655,7 @@
*/
@Test
public void testP2Value() {
+ assumeTrue(supportOMAPIReaders());
try {
waitForConnection();
Reader[] readers = seService.getReaders();
diff --git a/tests/tests/security/AndroidTest.xml b/tests/tests/security/AndroidTest.xml
index 0160b8b..45220d9 100644
--- a/tests/tests/security/AndroidTest.xml
+++ b/tests/tests/security/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="security" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSecurityTestCases.apk" />
diff --git a/tests/tests/security/src/android/security/cts/EncryptionTest.java b/tests/tests/security/src/android/security/cts/EncryptionTest.java
index 9ca9e14..a53106c 100644
--- a/tests/tests/security/src/android/security/cts/EncryptionTest.java
+++ b/tests/tests/security/src/android/security/cts/EncryptionTest.java
@@ -16,6 +16,7 @@
package android.security.cts;
+import com.android.compatibility.common.util.CddTest;
import com.android.compatibility.common.util.PropertyUtil;
import android.platform.test.annotations.AppModeFull;
@@ -80,6 +81,7 @@
// "getprop", used by PropertyUtil.getProperty(), is not executable
// to instant apps
@AppModeFull
+ @CddTest(requirement="9.9.2/C-0-1,C-0-2,C-0-3")
public void testEncryption() throws Exception {
if ("encrypted".equals(PropertyUtil.getProperty("ro.crypto.state"))) {
handleEncryptedDevice();
diff --git a/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml b/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml
index fa2b1b9..7ffabcd 100644
--- a/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxEphemeral/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="security" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
index cdca38c..191aedc 100644
--- a/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="security" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
index ac816b2..f0246fc 100644
--- a/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="security" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
index 6a53a30..8d4037c 100644
--- a/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="security" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
index f4b6aa9..f78ddf2 100644
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="security" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/simpleperf/AndroidTest.xml b/tests/tests/simpleperf/AndroidTest.xml
index c302f8e..2b0fc31 100644
--- a/tests/tests/simpleperf/AndroidTest.xml
+++ b/tests/tests/simpleperf/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="bionic" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
<option name="user-type" value="system" />
</target_preparer>
diff --git a/tests/tests/telecom/CallScreeningServiceTestApp/AndroidManifest.xml b/tests/tests/telecom/CallScreeningServiceTestApp/AndroidManifest.xml
index c0b4673..7428130 100644
--- a/tests/tests/telecom/CallScreeningServiceTestApp/AndroidManifest.xml
+++ b/tests/tests/telecom/CallScreeningServiceTestApp/AndroidManifest.xml
@@ -33,5 +33,12 @@
<action android:name="android.telecom.cts.screeningtestapp.ACTION_CONTROL_CALL_SCREENING_SERVICE" />
</intent-filter>
</service>
+ <activity android:name=".CtsPostCallActivity"
+ android:label="CtsPostCallActivity">
+ <intent-filter>
+ <action android:name="android.telecom.action.POST_CALL" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
+ </activity>
</application>
</manifest>
diff --git a/tests/tests/telecom/CallScreeningServiceTestApp/aidl/android/telecom/cts/screeningtestapp/ICallScreeningControl.aidl b/tests/tests/telecom/CallScreeningServiceTestApp/aidl/android/telecom/cts/screeningtestapp/ICallScreeningControl.aidl
index 8da8769..9e7cc2c 100644
--- a/tests/tests/telecom/CallScreeningServiceTestApp/aidl/android/telecom/cts/screeningtestapp/ICallScreeningControl.aidl
+++ b/tests/tests/telecom/CallScreeningServiceTestApp/aidl/android/telecom/cts/screeningtestapp/ICallScreeningControl.aidl
@@ -26,4 +26,10 @@
boolean shouldSkipCall, boolean shouldSkipCallLog, boolean shouldSkipNotification);
boolean waitForBind();
+
+ boolean waitForActivity();
+
+ String getCachedHandle();
+
+ int getCachedDisconnectCause();
}
diff --git a/tests/tests/telecom/CallScreeningServiceTestApp/src/android/telecom/cts/screeningtestapp/CallScreeningServiceControl.java b/tests/tests/telecom/CallScreeningServiceTestApp/src/android/telecom/cts/screeningtestapp/CallScreeningServiceControl.java
index 954d9af..96f4173 100644
--- a/tests/tests/telecom/CallScreeningServiceTestApp/src/android/telecom/cts/screeningtestapp/CallScreeningServiceControl.java
+++ b/tests/tests/telecom/CallScreeningServiceTestApp/src/android/telecom/cts/screeningtestapp/CallScreeningServiceControl.java
@@ -52,6 +52,7 @@
.setSkipNotification(false)
.build();
mBindingLatch = new CountDownLatch(1);
+ CtsPostCallActivity.resetPostCallActivity();
}
@Override
@@ -78,6 +79,21 @@
return false;
}
}
+
+ @Override
+ public boolean waitForActivity() {
+ return CtsPostCallActivity.waitForActivity();
+ }
+
+ @Override
+ public String getCachedHandle() {
+ return CtsPostCallActivity.getCachedHandle().getSchemeSpecificPart();
+ }
+
+ @Override
+ public int getCachedDisconnectCause() {
+ return CtsPostCallActivity.getCachedDisconnectCause();
+ }
};
private CallScreeningService.CallResponse mCallResponse =
diff --git a/tests/tests/telecom/CallScreeningServiceTestApp/src/android/telecom/cts/screeningtestapp/CtsPostCallActivity.java b/tests/tests/telecom/CallScreeningServiceTestApp/src/android/telecom/cts/screeningtestapp/CtsPostCallActivity.java
new file mode 100644
index 0000000..ac5ce01
--- /dev/null
+++ b/tests/tests/telecom/CallScreeningServiceTestApp/src/android/telecom/cts/screeningtestapp/CtsPostCallActivity.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telecom.cts.screeningtestapp;
+
+import static android.telecom.TelecomManager.EXTRA_DISCONNECT_CAUSE;
+import static android.telecom.TelecomManager.EXTRA_HANDLE;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class CtsPostCallActivity extends Activity {
+ private static final String ACTION_POST_CALL = "android.telecom.action.POST_CALL";
+ private static final int DEFAULT_DISCONNECT_CAUSE = -1;
+ private static final long TEST_TIMEOUT = 5000;
+
+ private static Uri cachedHandle;
+ private static int cachedDisconnectCause;
+ private static CountDownLatch sLatch = new CountDownLatch(1);
+
+ @Override
+ protected void onCreate(Bundle bundle) {
+ super.onCreate(bundle);
+ final Intent intent = getIntent();
+ final String action = intent != null ? intent.getAction() : null;
+ if (ACTION_POST_CALL.equals(action)) {
+ cachedHandle = intent.getParcelableExtra(EXTRA_HANDLE);
+ cachedDisconnectCause = intent
+ .getIntExtra(EXTRA_DISCONNECT_CAUSE, DEFAULT_DISCONNECT_CAUSE);
+ sLatch.countDown();
+ }
+ }
+
+ public static Uri getCachedHandle() {
+ return cachedHandle;
+ }
+
+ public static int getCachedDisconnectCause() {
+ return cachedDisconnectCause;
+ }
+
+ public static void resetPostCallActivity() {
+ sLatch = new CountDownLatch(1);
+ cachedHandle = null;
+ cachedDisconnectCause = DEFAULT_DISCONNECT_CAUSE;
+ }
+
+ public static boolean waitForActivity() {
+ try {
+ return sLatch.await(TEST_TIMEOUT, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ return false;
+ }
+ }
+}
diff --git a/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java b/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
index c8463fb..116cc12 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
@@ -43,6 +43,7 @@
import android.telecom.StatusHints;
import android.telecom.TelecomManager;
import android.telephony.TelephonyManager;
+import android.text.TextUtils;
import java.util.Arrays;
import java.util.List;
@@ -318,6 +319,18 @@
}
/**
+ * Test the contacts display name. We don't have anything set up in contacts, so expect it to
+ * be null
+ */
+ public void testContactDisplayName() {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
+ assertTrue(TextUtils.isEmpty(mCall.getDetails().getContactDisplayName()));
+ }
+
+ /**
* Tests whether the getCallProperties() getter returns the correct object.
*/
public void testCallProperties() {
diff --git a/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java
index d498de0..a04e921 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java
@@ -76,16 +76,20 @@
mCarModeIncallServiceControlTwo.reset();
}
+ assertUiMode(Configuration.UI_MODE_TYPE_NORMAL);
+
InstrumentationRegistry.getInstrumentation().getUiAutomation()
.dropShellPermissionIdentity();
-
- assertUiMode(Configuration.UI_MODE_TYPE_NORMAL);
}
/**
* Verifies that a car mode InCallService can enter and exit car mode using a priority.
*/
public void testSetCarMode() {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
enableAndVerifyCarMode(mCarModeIncallServiceControlOne, 1000);
disableAndVerifyCarMode(mCarModeIncallServiceControlOne, Configuration.UI_MODE_TYPE_NORMAL);
}
@@ -95,6 +99,10 @@
* already in car mode.
*/
public void testStartCallInCarMode() {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
enableAndVerifyCarMode(mCarModeIncallServiceControlOne, 1000);
// Place a call and verify we bound to the Car Mode InCallService
@@ -113,6 +121,10 @@
* and receives information about the call.
*/
public void testStartCallInCarModeTwoServices() {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
enableAndVerifyCarMode(mCarModeIncallServiceControlOne, 1000);
enableAndVerifyCarMode(mCarModeIncallServiceControlTwo, 999);
@@ -135,6 +147,10 @@
* enabled.
*/
public void testSwitchToCarMode() {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
// Place a call and verify it went to the default dialer
placeAndVerifyCall();
verifyConnectionForOutgoingCall();
@@ -152,6 +168,10 @@
* Similar to {@link #testSwitchToCarMode}, except exits car mode before the call terminates.
*/
public void testSwitchToCarModeAndBack() {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
// Place a call and verify it went to the default dialer
placeAndVerifyCall();
verifyConnectionForOutgoingCall();
@@ -184,6 +204,10 @@
* uses multiple car mode InCallServices.
*/
public void testSwitchToCarModeMultiple() {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
// Place a call and verify it went to the default dialer
placeAndVerifyCall();
verifyConnectionForOutgoingCall();
diff --git a/tests/tests/telecom/src/android/telecom/cts/ConferenceTest.java b/tests/tests/telecom/src/android/telecom/cts/ConferenceTest.java
index fc40da9..771f09b 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ConferenceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ConferenceTest.java
@@ -151,6 +151,8 @@
conf.mergeConference();
assertCallDisplayName(mCall1, TestUtils.MERGE_CALLER_NAME);
assertCallDisplayName(mCall2, TestUtils.MERGE_CALLER_NAME);
+ Call activeChild = conf.getGenericConferenceActiveChildCall();
+ assertNotNull(activeChild);
assertConnectionCallDisplayName(mConferenceObject.getConnections().get(0),
TestUtils.MERGE_CALLER_NAME);
assertConnectionCallDisplayName(mConferenceObject.getConnections().get(1),
@@ -159,6 +161,8 @@
conf.swapConference();
assertCallDisplayName(mCall1, TestUtils.SWAP_CALLER_NAME);
assertCallDisplayName(mCall2, TestUtils.SWAP_CALLER_NAME);
+ Call activeChildAfterSwap = conf.getGenericConferenceActiveChildCall();
+ assertNotSame(activeChild, activeChildAfterSwap);
assertConnectionCallDisplayName(mConferenceObject.getConnections().get(0),
TestUtils.SWAP_CALLER_NAME);
assertConnectionCallDisplayName(mConferenceObject.getConnections().get(1),
diff --git a/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java b/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
index 56c8ed9..72da8dc 100644
--- a/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
+++ b/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
@@ -16,6 +16,8 @@
package android.telecom.cts;
+import static android.telecom.cts.ThirdPartyCallScreeningServiceTest.EXTRA_NETWORK_IDENTIFIED_EMERGENCY_CALL;
+
import android.net.Uri;
import android.os.Bundle;
import android.telecom.Connection;
@@ -132,6 +134,11 @@
Connection.VERIFICATION_STATUS_FAILED);
}
+ Bundle requestExtra = request.getExtras();
+ if (requestExtra.getBoolean(EXTRA_NETWORK_IDENTIFIED_EMERGENCY_CALL, false)) {
+ connection.setConnectionProperties(
+ Connection.PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL);
+ }
incomingConnections.add(connection);
lock.release();
return connection;
diff --git a/tests/tests/telecom/src/android/telecom/cts/ThirdPartyCallScreeningServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyCallScreeningServiceTest.java
index 532c69e..6deea62 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ThirdPartyCallScreeningServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyCallScreeningServiceTest.java
@@ -52,6 +52,7 @@
import java.util.concurrent.TimeUnit;
public class ThirdPartyCallScreeningServiceTest extends BaseTelecomTestWithMockServices {
+ public static final String EXTRA_NETWORK_IDENTIFIED_EMERGENCY_CALL = "identifiedEmergencyCall";
private static final String TAG = ThirdPartyCallScreeningServiceTest.class.getSimpleName();
private static final String TEST_APP_NAME = "CTSCSTest";
private static final String TEST_APP_PACKAGE = "android.telecom.cts.screeningtestapp";
@@ -273,6 +274,101 @@
assertFalse(mCallScreeningControl.waitForBind());
}
+ public void testNoPostCallActivityWithoutRole() throws Exception {
+ if (!shouldTestTelecom(mContext)) {
+ return;
+ }
+
+ removeRoleHolder(ROLE_CALL_SCREENING, CtsCallScreeningService.class.getPackage().getName());
+ addIncomingAndVerifyAllowed(false);
+ assertFalse(mCallScreeningControl.waitForActivity());
+ }
+
+ public void testAllowCall() throws Exception {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
+ mCallScreeningControl.setCallResponse(false /* shouldDisallowCall */,
+ false /* shouldRejectCall */, false /* shouldSilenceCall */,
+ false /* shouldSkipCallLog */, false /* shouldSkipNotification */);
+ addIncomingAndVerifyAllowed(false /* addContact */);
+ assertTrue(mCallScreeningControl.waitForActivity());
+ }
+
+ public void testNoPostCallActivityWhenBlocked() throws Exception {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+
+ mCallScreeningControl.setCallResponse(true /* shouldDisallowCall */,
+ true /* shouldRejectCall */, false /* shouldSilenceCall */,
+ false /* shouldSkipCallLog */, true /* shouldSkipNotification */);
+ addIncomingAndVerifyBlocked(false /* addContact */);
+ assertFalse(mCallScreeningControl.waitForActivity());
+ }
+
+ public void testNoPostCallActivityWhenAudioProcessing() throws Exception {
+ if (!shouldTestTelecom(mContext)) {
+ return;
+ }
+
+ mCallScreeningControl.setCallResponse(false /* shouldDisallowCall */,
+ false /* shouldRejectCall */, false /* shouldSilenceCall */,
+ false /* shouldSkipCallLog */, false /* shouldSkipNotification */);
+ Uri testNumber = createRandomTestNumber();
+ Bundle extras = new Bundle();
+ extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, testNumber);
+ mTelecomManager.addNewIncomingCall(TestUtils.TEST_PHONE_ACCOUNT_HANDLE, extras);
+
+ // Wait until the new incoming call is processed.
+ waitOnAllHandlers(getInstrumentation());
+
+ assertEquals(1, mInCallCallbacks.getService().getCallCount());
+ Call call = mInCallCallbacks.getService().getLastCall();
+ call.enterBackgroundAudioProcessing();
+
+ waitOnAllHandlers(getInstrumentation());
+ mInCallCallbacks.getService().disconnectAllCalls();
+ assertFalse(mCallScreeningControl.waitForActivity());
+ }
+
+ public void testNoPostCallActivityForOutgoingEmergencyCall() throws Exception {
+ if (!shouldTestTelecom(mContext)) {
+ return;
+ }
+
+ setupForEmergencyCalling(TEST_EMERGENCY_NUMBER);
+ Bundle extras = new Bundle();
+ extras.putParcelable(TestUtils.EXTRA_PHONE_NUMBER, TEST_EMERGENCY_URI);
+ placeAndVerifyCall(extras);
+
+ // Wait until the new incoming call is processed.
+ waitOnAllHandlers(getInstrumentation());
+ mInCallCallbacks.getService().disconnectAllCalls();
+ assertFalse(mCallScreeningControl.waitForActivity());
+ }
+
+ public void testNoPostCallActivityForIncomingEmergencyCall() throws Exception {
+ if (!shouldTestTelecom(mContext)) {
+ return;
+ }
+ setupForEmergencyCalling(TEST_EMERGENCY_NUMBER);
+ mCallScreeningControl.setCallResponse(false /* shouldDisallowCall */,
+ false /* shouldRejectCall */, false /* shouldSilenceCall */,
+ false /* shouldSkipCallLog */, false /* shouldSkipNotification */);
+ Bundle extras = new Bundle();
+ extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, TEST_EMERGENCY_URI);
+ extras.putBoolean(EXTRA_NETWORK_IDENTIFIED_EMERGENCY_CALL, true);
+ mTelecomManager.addNewIncomingCall(TestUtils.TEST_PHONE_ACCOUNT_HANDLE, extras);
+
+ // Wait until the new incoming call is processed.
+ waitOnAllHandlers(getInstrumentation());
+ mInCallCallbacks.getService().disconnectAllCalls();
+
+ assertFalse(mCallScreeningControl.waitForActivity());
+ }
+
private void placeOutgoingCall(boolean addContact) throws Exception {
// Setup content observer to notify us when we call log entry is added.
CountDownLatch callLogEntryLatch = getCallLogEntryLatch();
diff --git a/tests/tests/telecom/src/android/telecom/cts/carmodetestapp/CtsCarModeInCallServiceControl.java b/tests/tests/telecom/src/android/telecom/cts/carmodetestapp/CtsCarModeInCallServiceControl.java
index c815b75..3ec5d83 100644
--- a/tests/tests/telecom/src/android/telecom/cts/carmodetestapp/CtsCarModeInCallServiceControl.java
+++ b/tests/tests/telecom/src/android/telecom/cts/carmodetestapp/CtsCarModeInCallServiceControl.java
@@ -43,7 +43,7 @@
@Override
public boolean isUnbound() {
- return CtsCarModeInCallService.isBound();
+ return CtsCarModeInCallService.isUnbound();
}
@Override
diff --git a/tests/tests/telecom3/AndroidTest.xml b/tests/tests/telecom3/AndroidTest.xml
index 7e8fcfd..60e3475 100644
--- a/tests/tests/telecom3/AndroidTest.xml
+++ b/tests/tests/telecom3/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="telecom" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/telephony/current/AndroidTest.xml b/tests/tests/telephony/current/AndroidTest.xml
index 64ae177..326b336 100644
--- a/tests/tests/telephony/current/AndroidTest.xml
+++ b/tests/tests/telephony/current/AndroidTest.xml
@@ -19,6 +19,7 @@
<option name="config-descriptor:metadata" key="token" value="SIM_CARD" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="android.telephony.cts.preconditions.TelephonyPreparer">
<option name="apk" value="CtsTelephonyPreparerApp.apk" />
diff --git a/tests/tests/telephony/current/TestExternalImsServiceApp/aidl/android/telephony/cts/externalimsservice/ITestExternalImsService.aidl b/tests/tests/telephony/current/TestExternalImsServiceApp/aidl/android/telephony/cts/externalimsservice/ITestExternalImsService.aidl
index 6a34175..e8bd95c 100644
--- a/tests/tests/telephony/current/TestExternalImsServiceApp/aidl/android/telephony/cts/externalimsservice/ITestExternalImsService.aidl
+++ b/tests/tests/telephony/current/TestExternalImsServiceApp/aidl/android/telephony/cts/externalimsservice/ITestExternalImsService.aidl
@@ -16,6 +16,7 @@
package android.telephony.cts.externalimsservice;
+import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.stub.ImsFeatureConfiguration;
/**
@@ -28,4 +29,14 @@
boolean isRcsFeatureCreated();
boolean isMmTelFeatureCreated();
void resetState();
-}
\ No newline at end of file
+ void notifyRcsCapabilitiesStatusChanged(int capability);
+ boolean isRcsCapable(int capability, int radioTech);
+ boolean isRcsAvailable(int capability);
+ String getConfigString(int subId, int item);
+
+ // IMS registration status changed
+ void triggerImsOnRegistered(int radioTech);
+ void triggerImsOnRegistering(int radioTech);
+ void triggerImsOnDeregistered(in ImsReasonInfo info);
+ void triggerImsOnTechnologyChangeFailed(int imsRadioTech, in ImsReasonInfo info);
+}
diff --git a/tests/tests/telephony/current/TestExternalImsServiceApp/src/android/telephony/cts/externalimsservice/TestExternalImsService.java b/tests/tests/telephony/current/TestExternalImsServiceApp/src/android/telephony/cts/externalimsservice/TestExternalImsService.java
index 48e71a3..b0bbdfb 100644
--- a/tests/tests/telephony/current/TestExternalImsServiceApp/src/android/telephony/cts/externalimsservice/TestExternalImsService.java
+++ b/tests/tests/telephony/current/TestExternalImsServiceApp/src/android/telephony/cts/externalimsservice/TestExternalImsService.java
@@ -18,9 +18,13 @@
import android.content.Intent;
import android.os.IBinder;
+import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.cts.ImsUtils;
import android.telephony.ims.cts.TestImsService;
+import android.telephony.ims.feature.RcsFeature.RcsImsCapabilities;
+import android.telephony.ims.stub.ImsConfigImplBase;
import android.telephony.ims.stub.ImsFeatureConfiguration;
+import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
/**
@@ -40,18 +44,65 @@
public boolean waitForLatchCountdown(int latchIndex) {
return TestExternalImsService.this.waitForLatchCountdown(latchIndex);
}
+
public void setFeatureConfig(ImsFeatureConfiguration f) {
TestExternalImsService.this.setFeatureConfig(f);
}
+
public boolean isRcsFeatureCreated() {
return (getRcsFeature() != null);
}
+
public boolean isMmTelFeatureCreated() {
return (getMmTelFeature() != null);
}
+
public void resetState() {
TestExternalImsService.this.resetState();
}
+
+ public String getConfigString(int subId, int item) {
+ ImsConfigImplBase imsConfig = TestExternalImsService.this.getImsService().getConfig(
+ subId);
+ if (imsConfig != null) {
+ return imsConfig.getConfigString(item);
+ }
+ return null;
+ }
+
+ public void triggerImsOnRegistered(int imsRadioTech) {
+ ImsRegistrationImplBase imsReg = TestExternalImsService.this.getImsRegistration();
+ imsReg.onRegistered(imsRadioTech);
+ }
+
+ public void triggerImsOnRegistering(int imsRadioTech) {
+ ImsRegistrationImplBase imsReg = TestExternalImsService.this.getImsRegistration();
+ imsReg.onRegistering(imsRadioTech);
+ }
+
+ public void triggerImsOnDeregistered(ImsReasonInfo info) {
+ ImsRegistrationImplBase imsReg = TestExternalImsService.this.getImsRegistration();
+ imsReg.onDeregistered(info);
+ }
+
+ public void triggerImsOnTechnologyChangeFailed(int imsRadioTech, ImsReasonInfo info) {
+ ImsRegistrationImplBase imsReg = TestExternalImsService.this.getImsRegistration();
+ imsReg.onTechnologyChangeFailed(imsRadioTech, info);
+ }
+
+ public void notifyRcsCapabilitiesStatusChanged(int capability) {
+ RcsImsCapabilities capabilities = new RcsImsCapabilities(capability);
+ getRcsFeature().notifyCapabilitiesStatusChanged(capabilities);
+ }
+
+ public boolean isRcsCapable(int capability, int radioTech) {
+ return getRcsFeature().queryCapabilityConfiguration(capability, radioTech);
+ }
+
+ public boolean isRcsAvailable(int capability) {
+ RcsImsCapabilities capabilityStatus = getRcsFeature().queryCapabilityStatus();
+ return capabilityStatus.isCapable(capability);
+ }
}
@Override
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
index aeeb9b1..4ba93db 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
@@ -47,6 +47,7 @@
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
+import com.android.compatibility.common.util.ShellIdentityUtils;
import com.android.compatibility.common.util.TestThread;
import org.junit.After;
@@ -136,6 +137,18 @@
config.getString(CarrierConfigManager.KEY_CARRIER_VVM_PACKAGE_NAME_STRING), "");
assertFalse(CarrierConfigManager.isConfigForIdentifiedCarrier(config));
}
+
+ // These key should return default values if not customized.
+ assertNotNull(config.getIntArray(
+ CarrierConfigManager.KEY_5G_NR_SSRSRP_THRESHOLDS_INT_ARRAY));
+ assertNotNull(config.getIntArray(
+ CarrierConfigManager.KEY_5G_NR_SSRSRQ_THRESHOLDS_INT_ARRAY));
+ assertNotNull(config.getIntArray(
+ CarrierConfigManager.KEY_5G_NR_SSSINR_THRESHOLDS_INT_ARRAY));
+ assertNotNull(config.getIntArray(
+ CarrierConfigManager.KEY_LTE_RSRQ_THRESHOLDS_INT_ARRAY));
+ assertNotNull(config.getIntArray(
+ CarrierConfigManager.KEY_LTE_RSSNR_THRESHOLDS_INT_ARRAY));
}
@Test
@@ -196,6 +209,16 @@
}
/**
+ * The following methods may return any value depending on the state of the device. Simply
+ * call them to make sure they do not throw any exceptions.
+ */
+ @Test
+ public void testCarrierConfigManagerResultDependentApi() {
+ assertNotNull(ShellIdentityUtils.invokeMethodWithShellPermissions(mConfigManager,
+ (cm) -> cm.getDefaultCarrierServicePackageName()));
+ }
+
+ /**
* This checks that {@link CarrierConfigManager#overrideConfig(int, PersistableBundle)}
* correctly overrides the Carrier Name (SPN) string.
*/
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java
index c0fd028..dfe4275 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CarrierServiceTest.java
@@ -29,8 +29,6 @@
import android.test.ServiceTestCase;
import android.util.Log;
-import org.junit.Test;
-
public class CarrierServiceTest extends ServiceTestCase<CarrierServiceTest.TestCarrierService> {
private static final String TAG = CarrierServiceTest.class.getSimpleName();
@@ -56,14 +54,12 @@
&& telephonyManager.getPhoneCount() > 0;
}
- @Test
public void testNotifyCarrierNetworkChange_true() {
if (!mHasCellular) return;
notifyCarrierNetworkChange(true);
}
- @Test
public void testNotifyCarrierNetworkChange_false() {
if (!mHasCellular) return;
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CellBroadcastIntentsTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CellBroadcastIntentsTest.java
new file mode 100644
index 0000000..c652131
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CellBroadcastIntentsTest.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package android.telephony.cts;
+
+import static junit.framework.Assert.fail;
+
+import android.content.Intent;
+import android.os.UserHandle;
+import android.telephony.CellBroadcastIntents;
+
+import androidx.test.InstrumentationRegistry;
+
+import org.junit.Test;
+
+public class CellBroadcastIntentsTest {
+
+ private static final String TEST_ACTION = "test_action";
+
+ @Test
+ public void testGetIntentForBackgroundReceivers() {
+ try {
+ CellBroadcastIntents.sendOrderedBroadcastForBackgroundReceivers(
+ InstrumentationRegistry.getContext(), UserHandle.ALL, new Intent(TEST_ACTION),
+ null, null, null, null, 0, null, null);
+ } catch (SecurityException e) {
+ // expected
+ return;
+ }
+ fail();
+ }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
index aafb9ef..ab6937f 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
@@ -324,6 +324,9 @@
assertTrue("Invalid timestamp in CellInfo: " + info.getTimeStamp(),
info.getTimeStamp() > 0 && info.getTimeStamp() < Long.MAX_VALUE);
+ assertTrue("Invalid timestamp in CellInfo: " + info.getTimestampNanos(),
+ info.getTimestampNanos() > 0 && info.getTimestampNanos() < Long.MAX_VALUE);
+
if (mRadioHalVersion >= RADIO_HAL_VERSION_1_2) {
// In HAL 1.2 or greater, the connection status must be reported
assertTrue(info.getCellConnectionStatus() != CellInfo.CONNECTION_UNKNOWN);
@@ -777,8 +780,8 @@
wcdma.getDbm();
int asuLevel = wcdma.getAsuLevel();
- assertTrue("getLevel() out of range [0,31] (or 99 is unknown), level=" + asuLevel,
- asuLevel == 99 || (asuLevel >= 0 && asuLevel <= 31));
+ assertTrue("getAsuLevel() out of range 0..96, 255, asuLevel=" + asuLevel,
+ asuLevel == 255 || (asuLevel >= 0 && asuLevel <= 96));
int level = wcdma.getLevel();
assertTrue("getLevel() out of range [0,4], level=" + level, level >= 0 && level <= 4);
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java b/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
index 4c839b1..7568670 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
@@ -18,10 +18,10 @@
import static android.telephony.ServiceState.DUPLEX_MODE_FDD;
import static android.telephony.ServiceState.DUPLEX_MODE_TDD;
import static android.telephony.ServiceState.DUPLEX_MODE_UNKNOWN;
-import static android.telephony.ServiceState.STATE_OUT_OF_SERVICE;
-import static android.telephony.ServiceState.STATE_POWER_OFF;
import static android.telephony.ServiceState.ROAMING_TYPE_DOMESTIC;
import static android.telephony.ServiceState.ROAMING_TYPE_NOT_ROAMING;
+import static android.telephony.ServiceState.STATE_OUT_OF_SERVICE;
+import static android.telephony.ServiceState.STATE_POWER_OFF;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -209,6 +209,41 @@
}
@Test
+ public void testGetDataNetworkType() {
+ NetworkRegistrationInfo iwlanReg = new NetworkRegistrationInfo.Builder()
+ .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_IWLAN)
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .build();
+
+ NetworkRegistrationInfo wwanReg = new NetworkRegistrationInfo.Builder()
+ .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_1xRTT)
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .build();
+
+ NetworkRegistrationInfo outOfServiceWwanReg = new NetworkRegistrationInfo.Builder()
+ .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_1xRTT)
+ .setRegistrationState(
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_OR_SEARCHING)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .build();
+
+ serviceState = new ServiceState();
+ serviceState.addNetworkRegistrationInfo(iwlanReg);
+ serviceState.addNetworkRegistrationInfo(wwanReg);
+ assertEquals(TelephonyManager.NETWORK_TYPE_1xRTT, serviceState.getDataNetworkType());
+
+ serviceState = new ServiceState();
+ serviceState.addNetworkRegistrationInfo(iwlanReg);
+ serviceState.addNetworkRegistrationInfo(outOfServiceWwanReg);
+ assertEquals(TelephonyManager.NETWORK_TYPE_IWLAN, serviceState.getDataNetworkType());
+ }
+
+ @Test
public void testIsManualSelection() {
serviceState.setIsManualSelection(false);
assertFalse(serviceState.getIsManualSelection());
@@ -318,4 +353,29 @@
AccessNetworkConstants.TRANSPORT_TYPE_WWAN).getDataSpecificInfo().getLteVopsSupportInfo(),
lteVopsSupportInfo);
}
+
+ @Test
+ public void testIsSearchingPs() {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
+ .setRegistrationState(
+ NetworkRegistrationInfo.REGISTRATION_STATE_NOT_REGISTERED_SEARCHING)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setDomain(NetworkRegistrationInfo.DOMAIN_PS)
+ .build();
+ serviceState.addNetworkRegistrationInfo(nri);
+ assertTrue(serviceState.isSearching());
+ }
+
+ @Test
+ public void testNotSearchingCs() {
+ NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder()
+ .setAccessNetworkTechnology(TelephonyManager.NETWORK_TYPE_LTE)
+ .setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_HOME)
+ .setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
+ .setDomain(NetworkRegistrationInfo.DOMAIN_CS)
+ .build();
+ serviceState.addNetworkRegistrationInfo(nri);
+ assertFalse(serviceState.isSearching());
+ }
}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
index 604a821..3077bbb 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
@@ -25,13 +25,14 @@
import android.content.Context;
import android.content.pm.PackageManager;
+import android.os.SystemClock;
+import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma;
import android.telephony.CellSignalStrengthGsm;
import android.telephony.CellSignalStrengthLte;
import android.telephony.CellSignalStrengthNr;
import android.telephony.CellSignalStrengthTdscdma;
import android.telephony.CellSignalStrengthWcdma;
-import android.telephony.CellSignalStrength;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
@@ -80,6 +81,11 @@
SignalStrength ss = mTm.getSignalStrength();
assertNotNull("TelephonyManager.getSignalStrength() returned NULL!", ss);
+ long curTime = SystemClock.elapsedRealtimeNanos();
+ assertTrue("Invalid timestamp in SignalStrength: " + ss.getTimestampNanos(),
+ ss.getTimestampNanos() > 0 && ss.getTimestampNanos() < curTime);
+ Log.d(TAG, "Timestamp of SignalStrength: " + Long.toString(ss.getTimestampNanos()));
+
List<CellSignalStrength> signalStrengths = ss.getCellSignalStrengths();
assertTrue("No Signal Strength Information Reported!", !signalStrengths.isEmpty());
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java
index 165c5cd..8c855db 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsMessageTest.java
@@ -103,6 +103,7 @@
assertEquals(MESSAGE_BODY1, sms.getMessageBody());
assertEquals(TPLAYER_LENGTH_FOR_PDU, SmsMessage.getTPLayerLengthForPDU(pdu));
int[] result = SmsMessage.calculateLength(sms.getMessageBody(), true);
+ assertEquals(6, result.length);
assertEquals(SMS_NUMBER1, result[0]);
assertEquals(sms.getMessageBody().length(), result[1]);
assertRemaining(sms.getMessageBody().length(), result[2], SmsMessage.MAX_USER_DATA_SEPTETS);
@@ -135,6 +136,7 @@
assertEquals(MESSAGE_BODY2, sms.getMessageBody());
CharSequence msgBody = sms.getMessageBody();
result = SmsMessage.calculateLength(msgBody, false);
+ assertEquals(6, result.length);
assertEquals(SMS_NUMBER2, result[0]);
assertEquals(sms.getMessageBody().length(), result[1]);
assertRemaining(sms.getMessageBody().length(), result[2], SmsMessage.MAX_USER_DATA_SEPTETS);
@@ -146,6 +148,7 @@
sms = SmsMessage.createFromPdu(hexStringToByteArray(pdu), SmsMessage.FORMAT_3GPP);
assertEquals(MESSAGE_BODY3, sms.getMessageBody());
result = SmsMessage.calculateLength(sms.getMessageBody(), true);
+ assertEquals(6, result.length);
assertEquals(SMS_NUMBER3, result[0]);
assertEquals(sms.getMessageBody().length(), result[1]);
assertRemaining(sms.getMessageBody().length(), result[2], SmsMessage.MAX_USER_DATA_SEPTETS);
@@ -317,6 +320,7 @@
}
int[] result = SmsMessage.calculateLength(LONG_TEXT_WITH_32BIT_CHARS, false);
+ assertEquals(6, result.length);
assertEquals(3, result[0]);
assertEquals(LONG_TEXT_WITH_32BIT_CHARS.length(), result[1]);
// 3 parts, each with (SmsMessage.MAX_USER_DATA_BYTES_WITH_HEADER / 2) 16-bit
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
index 9950386..7614ffe 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -160,6 +160,14 @@
}
@Test
+ public void testGetActiveSubscriptionInfoForIcc() throws Exception {
+ if (!isSupported()) return;
+ SubscriptionInfo info = mSm.getActiveSubscriptionInfo(mSubId);
+ assertNotNull(ShellIdentityUtils.invokeMethodWithShellPermissions(mSm,
+ (sm) -> sm.getActiveSubscriptionInfoForIcc(info.getIccId())));
+ }
+
+ @Test
public void testIsActiveSubscriptionId() throws Exception {
if (!isSupported()) return;
assertTrue(mSm.isActiveSubscriptionId(mSubId));
@@ -337,6 +345,49 @@
}
@Test
+ public void testSubscriptionPlansUnmetered() throws Exception {
+ if (!isSupported()) return;
+
+ final ConnectivityManager cm = InstrumentationRegistry.getContext()
+ .getSystemService(ConnectivityManager.class);
+ final Network net = findCellularNetwork();
+ assertNotNull("Active cellular network required", net);
+
+ // Make ourselves the owner and define some plans
+ setSubPlanOwner(mSubId, mPackageName);
+ mSm.setSubscriptionPlans(mSubId, Arrays.asList(buildValidSubscriptionPlan()));
+
+ // Cellular is metered by default
+ assertFalse(cm.getNetworkCapabilities(net).hasCapability(NET_CAPABILITY_NOT_METERED));
+
+ SubscriptionPlan unmeteredPlan = SubscriptionPlan.Builder
+ .createRecurring(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"),
+ Period.ofMonths(1))
+ .setTitle("CTS")
+ .setDataLimit(SubscriptionPlan.BYTES_UNLIMITED,
+ SubscriptionPlan.LIMIT_BEHAVIOR_THROTTLED)
+ .build();
+
+ // Unmetered plan should make it go unmetered
+ {
+ final CountDownLatch latch = waitForNetworkCapabilities(net, caps -> {
+ return caps.hasCapability(NET_CAPABILITY_NOT_METERED);
+ });
+ mSm.setSubscriptionPlans(mSubId, Arrays.asList(unmeteredPlan));
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ }
+
+ // Metered plan should make it go metered
+ {
+ final CountDownLatch latch = waitForNetworkCapabilities(net, caps -> {
+ return !caps.hasCapability(NET_CAPABILITY_NOT_METERED);
+ });
+ mSm.setSubscriptionPlans(mSubId, Arrays.asList(buildValidSubscriptionPlan()));
+ assertTrue(latch.await(10, TimeUnit.SECONDS));
+ }
+ }
+
+ @Test
public void testSubscriptionPlansInvalid() throws Exception {
if (!isSupported()) return;
@@ -378,6 +429,49 @@
}
@Test
+ public void testSubscriptionPlansNetworkTypeValidation() throws Exception {
+ if (!isSupported()) return;
+
+ // Make ourselves the owner
+ setSubPlanOwner(mSubId, mPackageName);
+
+ // Error when adding 2 plans with the same network type
+ List<SubscriptionPlan> plans = new ArrayList<>();
+ plans.add(buildValidSubscriptionPlan());
+ plans.add(SubscriptionPlan.Builder
+ .createRecurring(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"),
+ Period.ofMonths(1))
+ .setTitle("CTS")
+ .setNetworkTypes(new int[] {TelephonyManager.NETWORK_TYPE_LTE})
+ .build());
+ plans.add(SubscriptionPlan.Builder
+ .createRecurring(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"),
+ Period.ofMonths(1))
+ .setTitle("CTS")
+ .setNetworkTypes(new int[] {TelephonyManager.NETWORK_TYPE_LTE})
+ .build());
+ try {
+ mSm.setSubscriptionPlans(mSubId, plans);
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+
+ // Error when there is no general plan
+ plans.clear();
+ plans.add(SubscriptionPlan.Builder
+ .createRecurring(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"),
+ Period.ofMonths(1))
+ .setTitle("CTS")
+ .setNetworkTypes(new int[] {TelephonyManager.NETWORK_TYPE_LTE})
+ .build());
+ try {
+ mSm.setSubscriptionPlans(mSubId, plans);
+ fail();
+ } catch (IllegalArgumentException expected) {
+ }
+ }
+
+ @Test
public void testSubscriptionGrouping() throws Exception {
if (!isSupported()) return;
@@ -405,12 +499,12 @@
}
// Add into subscription group that doesn't exist. This should fail
- // with IllegalArgumentException.
+ // because we don't have MODIFY_PHONE_STATE or carrier privilege permission.
try {
ParcelUuid groupUuid = new ParcelUuid(UUID.randomUUID());
mSm.addSubscriptionsIntoGroup(subGroup, groupUuid);
fail();
- } catch (IllegalArgumentException expected) {
+ } catch (SecurityException expected) {
}
// Remove from subscription group with current sub Id. This should fail
@@ -466,6 +560,32 @@
}
@Test
+ public void testAddSubscriptionIntoNewGroupWithPermission() throws Exception {
+ if (!isSupported()) return;
+
+ // Set subscription group with current sub Id.
+ List<Integer> subGroup = new ArrayList();
+ subGroup.add(mSubId);
+ ParcelUuid uuid = new ParcelUuid(UUID.randomUUID());
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mSm,
+ (sm) -> sm.addSubscriptionsIntoGroup(subGroup, uuid));
+
+ // Getting subscriptions in group.
+ List<SubscriptionInfo> infoList = mSm.getSubscriptionsInGroup(uuid);
+ assertNotNull(infoList);
+ assertEquals(1, infoList.size());
+ assertEquals(uuid, infoList.get(0).getGroupUuid());
+
+ // Remove from subscription group with current sub Id.
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mSm,
+ (sm) -> sm.removeSubscriptionsFromGroup(subGroup, uuid));
+
+ infoList = mSm.getSubscriptionsInGroup(uuid);
+ assertNotNull(infoList);
+ assertTrue(infoList.isEmpty());
+ }
+
+ @Test
public void testSettingOpportunisticSubscription() throws Exception {
if (!isSupported()) return;
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index 85e81fb..b7159db 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -87,6 +87,7 @@
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -319,9 +320,50 @@
}
@Test
+ public void testDevicePolicyApn() {
+ // These methods aren't accessible to anything except system and phone by design, so we just
+ // look for security exceptions here.
+ try {
+ List<ApnSetting> apns = mTelephonyManager.getDevicePolicyOverrideApns(getContext());
+ fail("SecurityException expected");
+ } catch (SecurityException e) {
+ // expected
+ }
+
+ try {
+ ApnSetting.Builder builder = new ApnSetting.Builder();
+
+ ApnSetting setting = builder
+ .setEntryName("asdf")
+ .setApnName("asdf")
+ .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT)
+ .build();
+ int id = mTelephonyManager.addDevicePolicyOverrideApn(getContext(), setting);
+ fail("SecurityException expected");
+ } catch (SecurityException e) {
+ // expected
+ }
+
+ try {
+ ApnSetting.Builder builder = new ApnSetting.Builder();
+
+ ApnSetting setting = builder
+ .setEntryName("asdf")
+ .setApnName("asdf")
+ .setApnTypeBitmask(ApnSetting.TYPE_DEFAULT)
+ .build();
+ boolean success = mTelephonyManager.modifyDevicePolicyOverrideApn(
+ getContext(), 0, setting);
+ fail("SecurityException expected");
+ } catch (SecurityException e) {
+ // expected
+ }
+ }
+ @Test
public void testListen() throws Throwable {
- if (mCm.getNetworkInfo(ConnectivityManager.TYPE_MOBILE) == null) {
- Log.d(TAG, "Skipping test that requires ConnectivityManager.TYPE_MOBILE");
+ if (!InstrumentationRegistry.getContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ Log.d(TAG, "Skipping test that requires PackageManager.FEATURE_TELEPHONY");
return;
}
@@ -416,7 +458,9 @@
}
// Make sure devices without MMS service won't fail on this
- if (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE) {
+ if (InstrumentationRegistry.getContext().getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_TELEPHONY)
+ && (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_NONE)) {
assertFalse(mTelephonyManager.getMmsUserAgent().isEmpty());
assertFalse(mTelephonyManager.getMmsUAProfUrl().isEmpty());
}
@@ -467,6 +511,18 @@
mTelephonyManager.isVoicemailVibrationEnabled(defaultAccount);
mTelephonyManager.getSubscriptionId(defaultAccount);
mTelephonyManager.getCarrierConfig();
+ ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ (tm) -> tm.isAnyRadioPoweredOn());
+
+ // Verify TelephonyManager.getCarrierPrivilegedPackagesForAllActiveSubscriptions
+ List<String> resultForGetCarrierPrivilegedApis =
+ ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ (tm) -> tm.getCarrierPrivilegedPackagesForAllActiveSubscriptions());
+ assertNotNull(resultForGetCarrierPrivilegedApis);
+ for (String result : resultForGetCarrierPrivilegedApis) {
+ assertFalse(TextUtils.isEmpty(result));
+ }
+
TelephonyManager.getDefaultRespondViaMessageApplication(getContext(), false);
}
@@ -611,12 +667,9 @@
if (sanitizedForFineOnly) return;
- assertTrue(TextUtils.isEmpty(state.getDataOperatorAlphaLong()));
- assertTrue(TextUtils.isEmpty(state.getDataOperatorAlphaShort()));
- assertTrue(TextUtils.isEmpty(state.getDataOperatorNumeric()));
- assertTrue(TextUtils.isEmpty(state.getVoiceOperatorAlphaLong()));
- assertTrue(TextUtils.isEmpty(state.getVoiceOperatorAlphaShort()));
- assertTrue(TextUtils.isEmpty(state.getVoiceOperatorNumeric()));
+ assertTrue(TextUtils.isEmpty(state.getOperatorAlphaLong()));
+ assertTrue(TextUtils.isEmpty(state.getOperatorAlphaShort()));
+ assertTrue(TextUtils.isEmpty(state.getOperatorNumeric()));
}
@Test
@@ -1200,6 +1253,26 @@
}
/**
+ * Verifies that {@link TelephonyManager#getIsimImpu()} does not throw any exception when called
+ * and has the correct permissions.
+ */
+ @Test
+ public void testGetIsimImpu() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ return;
+ }
+ ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ TelephonyManager::getIsimImpu);
+ // Try without the correct permissions and ensure it fails.
+ try {
+ mTelephonyManager.getIsimImpu();
+ fail();
+ } catch (SecurityException e) {
+ // expected
+ }
+ }
+
+ /**
* Basic test to ensure {@link NetworkRegistrationInfo#isRoaming()} does not throw any
* exception.
*/
@@ -1596,8 +1669,25 @@
assertEquals(0, cq.getCodecType());
}
+
+ // Reference: packages/services/Telephony/ecc/input/eccdata.txt
+ private static final Map<String, String> EMERGENCY_NUMBERS_FOR_COUNTRIES =
+ new HashMap<String, String>() {{
+ put("au", "000");
+ put("ca", "911");
+ put("de", "112");
+ put("gb", "999");
+ put("in", "112");
+ put("jp", "110");
+ put("sg", "999");
+ put("tw", "110");
+ put("us", "911");
+ }};
+
/**
* Tests TelephonyManager.getEmergencyNumberList.
+ *
+ * Also enforce country-specific emergency number in CTS.
*/
@Test
public void testGetEmergencyNumberList() {
@@ -1612,58 +1702,29 @@
checkEmergencyNumberFormat(emergencyNumberList);
int defaultSubId = mSubscriptionManager.getDefaultSubscriptionId();
-
- // 112 and 911 should always be available
- // Reference: 3gpp 22.101, Section 10 - Emergency Calls
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "911"));
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "112"));
-
- // 000, 08, 110, 118, 119, and 999 should be always available when sim is absent
- // Reference: 3gpp 22.101, Section 10 - Emergency Calls
- if (mTelephonyManager.getPhoneCount() > 0
- && mSubscriptionManager.getSimStateForSlotIndex(0)
- == TelephonyManager.SIM_STATE_ABSENT) {
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "000"));
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "08"));
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "110"));
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "118"));
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "119"));
- assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
- emergencyNumberList.get(defaultSubId), "999"));
+ for (Map.Entry<String, String> entry : EMERGENCY_NUMBERS_FOR_COUNTRIES.entrySet()) {
+ if (mTelephonyManager.getNetworkCountryIso().equals(entry.getKey())) {
+ assertTrue(checkIfEmergencyNumberListHasSpecificAddress(
+ emergencyNumberList.get(defaultSubId), entry.getValue()));
+ }
}
}
/**
* Tests TelephonyManager.isEmergencyNumber.
+ *
+ * Also enforce country-specific emergency number in CTS.
*/
@Test
public void testIsEmergencyNumber() {
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
return;
}
- // 112 and 911 should always be available
- // Reference: 3gpp 22.101, Section 10 - Emergency Calls
- assertTrue(mTelephonyManager.isEmergencyNumber("911"));
- assertTrue(mTelephonyManager.isEmergencyNumber("112"));
- // 000, 08, 110, 118, 119, and 999 should be always available when sim is absent
- // Reference: 3gpp 22.101, Section 10 - Emergency Calls
- if (mTelephonyManager.getPhoneCount() > 0
- && mSubscriptionManager.getSimStateForSlotIndex(0)
- == TelephonyManager.SIM_STATE_ABSENT) {
- assertTrue(mTelephonyManager.isEmergencyNumber("000"));
- assertTrue(mTelephonyManager.isEmergencyNumber("08"));
- assertTrue(mTelephonyManager.isEmergencyNumber("110"));
- assertTrue(mTelephonyManager.isEmergencyNumber("118"));
- assertTrue(mTelephonyManager.isEmergencyNumber("119"));
- assertTrue(mTelephonyManager.isEmergencyNumber("999"));
+ for (Map.Entry<String, String> entry : EMERGENCY_NUMBERS_FOR_COUNTRIES.entrySet()) {
+ if (mTelephonyManager.getNetworkCountryIso().equals(entry.getKey())) {
+ assertTrue(mTelephonyManager.isEmergencyNumber(entry.getValue()));
+ }
}
}
@@ -1707,8 +1768,9 @@
assertThat(value).isEqualTo(TelephonyManager.SET_OPPORTUNISTIC_SUB_SUCCESS);
}
- private static void assertSetOpportunisticInvalidParameter(int value) {
- assertThat(value).isEqualTo(TelephonyManager.SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION);
+ private static void assertSetOpportunisticNoOpportunisticSub(int value) {
+ assertThat(value).isEqualTo(
+ TelephonyManager.SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE);
}
/**
@@ -1743,18 +1805,17 @@
ShellIdentityUtils.invokeMethodWithShellPermissions(mSubscriptionManager,
(tm) -> tm.getOpportunisticSubscriptions());
Consumer<Integer> callbackSuccess = TelephonyManagerTest::assertSetOpportunisticSubSuccess;
- Consumer<Integer> callbackFailure =
- TelephonyManagerTest::assertSetOpportunisticInvalidParameter;
+ Consumer<Integer> callbackNoOpSub =
+ TelephonyManagerTest::assertSetOpportunisticNoOpportunisticSub;
if (subscriptionInfoList == null || subscriptionInfoList.size() == 0) {
ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
(tm) -> tm.setPreferredOpportunisticDataSubscription(randomSubId, false,
- AsyncTask.SERIAL_EXECUTOR, callbackFailure));
+ AsyncTask.SERIAL_EXECUTOR, callbackNoOpSub));
// wait for the data change to take effect
waitForMs(500);
subId = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
(tm) -> tm.getPreferredOpportunisticDataSubscription());
assertThat(subId).isEqualTo(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);
-
} else {
ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
(tm) -> tm.setPreferredOpportunisticDataSubscription(
@@ -1786,6 +1847,11 @@
assertThat(value).isEqualTo(TelephonyManager.UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
}
+ private static void assertUpdateAvailableNetworkNoOpportunisticSub(int value) {
+ assertThat(value).isEqualTo(
+ TelephonyManager.UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE);
+ }
+
private static boolean checkIfEmergencyNumberListHasSpecificAddress(
List<EmergencyNumber> emergencyNumberList, String address) {
for (EmergencyNumber emergencyNumber : emergencyNumberList) {
@@ -1846,9 +1912,15 @@
int randomSubId = 1;
int activeSubscriptionInfoCount = ShellIdentityUtils.invokeMethodWithShellPermissions(
mSubscriptionManager, (tm) -> tm.getActiveSubscriptionInfoCount());
+ boolean isOpportunisticNetworkEnabled = ShellIdentityUtils.invokeMethodWithShellPermissions(
+ mTelephonyManager, (tm) -> tm.isOpportunisticNetworkEnabled());
+
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
return;
}
+ if (!isOpportunisticNetworkEnabled) {
+ return;
+ }
if (mTelephonyManager.getPhoneCount() == 1) {
return;
}
@@ -1866,6 +1938,8 @@
TelephonyManagerTest::assertUpdateAvailableNetworkSuccess;
Consumer<Integer> callbackFailure =
TelephonyManagerTest::assertUpdateAvailableNetworkInvalidArguments;
+ Consumer<Integer> callbackNoOpSub =
+ TelephonyManagerTest::assertUpdateAvailableNetworkNoOpportunisticSub;
if (subscriptionInfoList == null || subscriptionInfoList.size() == 0
|| !mSubscriptionManager.isActiveSubscriptionId(
subscriptionInfoList.get(0).getSubscriptionId())) {
@@ -1874,7 +1948,7 @@
availableNetworkInfos.add(availableNetworkInfo);
ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
(tm) -> tm.updateAvailableNetworks(availableNetworkInfos,
- AsyncTask.SERIAL_EXECUTOR, callbackFailure));
+ AsyncTask.SERIAL_EXECUTOR, callbackNoOpSub));
// wait for the data change to take effect
waitForMs(500);
// clear all the operations at the end of test.
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java
index f526ed7..a996dcf 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import android.os.Bundle;
@@ -45,6 +46,9 @@
}
Bundle testBundle = new Bundle();
testBundle.putString("testString", "testResult");
+ Bundle testProprietaryBundle = new Bundle();
+ testProprietaryBundle.putString("proprietaryString", "proprietaryValue");
+ testBundle.putBundle(ImsCallProfile.EXTRA_OEM_EXTRAS, testProprietaryBundle);
ImsStreamMediaProfile testProfile = new ImsStreamMediaProfile(1, 1, 1, 1, 1);
ImsCallProfile data = new ImsCallProfile(ImsCallProfile.SERVICE_TYPE_NORMAL,
ImsCallProfile.CALL_TYPE_VOICE_N_VIDEO, testBundle, testProfile);
@@ -91,6 +95,10 @@
assertEquals(testProfile.getVideoQuality(), resultProfile.getVideoQuality());
// bundle
assertEquals(testBundle.getString("testString"), unparceledData.getCallExtra("testString"));
+ Bundle unparceledProprietaryBundle = unparceledData.getProprietaryCallExtras();
+ assertNotNull(unparceledProprietaryBundle);
+ assertEquals(testProprietaryBundle.getString("proprietaryString"),
+ unparceledProprietaryBundle.getString("proprietaryString"));
// number verification
assertEquals(ImsCallProfile.VERIFICATION_STATUS_PASSED,
unparceledData.getCallerNumberVerificationStatus());
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsMmTelManagerTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsMmTelManagerTest.java
index 34a1f3d..a917d93 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsMmTelManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsMmTelManagerTest.java
@@ -137,6 +137,17 @@
}
}
+ @Test
+ public void testGetVoWiFiSetting_noPermission() {
+ try {
+ ImsMmTelManager mMmTelManager = ImsMmTelManager.createForSubscriptionId(sTestSub);
+ boolean isEnabled = mMmTelManager.isVoWiFiSettingEnabled();
+ fail("Expected SecurityException for missing permissoins");
+ } catch (SecurityException ex) {
+ /* Expected */
+ }
+ }
+
/**
* Given the advanced calling setting is editable and not hidden
* (see {@link CarrierConfigManager#KEY_EDITABLE_ENHANCED_4G_LTE_BOOL}, and
@@ -285,6 +296,43 @@
}
/**
+ * Expect to fail when Set the VoWiFi Mode setting withour proper permission
+ */
+ @Test
+ public void testGetVoWiFiModeSetting_noPermission() throws Exception {
+ if (!ImsUtils.shouldTestImsService()) {
+ return;
+ }
+ try {
+ ImsMmTelManager mMmTelManager = ImsMmTelManager.createForSubscriptionId(sTestSub);
+ int oldMode = mMmTelManager.getVoWiFiModeSetting();
+ fail("Expected SecurityException for missing permissoins");
+ } catch (SecurityException ex) {
+ /* Expected */
+ }
+
+ }
+
+ /**
+ * Expect to fail when Set the VoWiFi Mode setting withour proper permission
+ */
+ @Test
+ public void testGetVoWiFiRoamingModeSetting_noPermission() throws Exception {
+ if (!ImsUtils.shouldTestImsService()) {
+ return;
+ }
+ try {
+ ImsMmTelManager mMmTelManager = ImsMmTelManager.createForSubscriptionId(sTestSub);
+ int oldMode = mMmTelManager.getVoWiFiRoamingModeSetting();
+ fail("Expected SecurityException for missing permissoins");
+ } catch (SecurityException ex) {
+ /* Expected */
+ }
+
+ }
+
+
+ /**
* Set the VoWiFi Mode setting and ensure the ContentResolver is triggered as well.
*/
@Test
@@ -403,6 +451,34 @@
}
try {
+ mMmTelManager.isVtSettingEnabled();
+ fail("isVtSettingEnabled requires READ_PRECISE_PHONE_STATE permission.");
+ } catch (SecurityException e) {
+ //expected
+ }
+
+ try {
+ mMmTelManager.isAdvancedCallingSettingEnabled();
+ fail("isAdvancedCallingSettingEnabled requires READ_PRECISE_PHONE_STATE.");
+ } catch (SecurityException e) {
+ //expected
+ }
+
+ try {
+ mMmTelManager.isVoWiFiRoamingSettingEnabled();
+ fail("isVoWiFiRoamingSettingEnabled requires READ_PRECISE_PHONE_STATE permission.");
+ } catch (SecurityException e) {
+ //expected
+ }
+
+ try {
+ mMmTelManager.isVoWiFiSettingEnabled();
+ fail("isVoWiFiSettingEnabled requires READ_PRECISE_PHONE_STATE permission.");
+ } catch (SecurityException e) {
+ //expected
+ }
+
+ try {
mMmTelManager.isTtyOverVolteEnabled();
fail("isTtyOverVolteEnabled requires READ_PRIVILEGED_PHONE_STATE permission.");
} catch (SecurityException e) {
@@ -417,7 +493,7 @@
}
try {
mMmTelManager.getRegistrationState(Runnable::run, (result) -> { });
- fail("getRegistrationState requires READ_PRIVILEGED_PHONE_STATE permission.");
+ fail("getRegistrationState requires READ_PRECISE_PHONE_STATE permission.");
} catch (SecurityException e) {
//expected
}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java
index 9215672..dcc0f9a 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java
@@ -26,6 +26,7 @@
import android.telephony.cts.TelephonyUtils;
import android.telephony.cts.externalimsservice.ITestExternalImsService;
import android.telephony.cts.externalimsservice.TestExternalImsService;
+import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.stub.ImsFeatureConfiguration;
import android.util.Log;
@@ -56,6 +57,7 @@
private static final String COMMAND_CARRIER_SERVICE_IDENTIFIER = "-c ";
private static final String COMMAND_DEVICE_SERVICE_IDENTIFIER = "-d ";
private static final String COMMAND_SLOT_IDENTIFIER = "-s ";
+ private static final String COMMAND_FEATURE_IDENTIFIER = "-f ";
private static final String COMMAND_ENABLE_IMS = "ims enable ";
private static final String COMMAND_DISABLE_IMS = "ims disable ";
@@ -106,7 +108,9 @@
private static final int CONNECTION_TYPE_DEFAULT_SMS_APP = 3;
private boolean mIsServiceOverridden = false;
- private String mOrigServicePackage;
+ private String mOrigMmTelServicePackage;
+ private String mOrigRcsServicePackage;
+ private String mOrigSmsPackage;
private int mConnectionType;
private int mSlotId;
Connection(int connectionType, int slotId) {
@@ -118,7 +122,7 @@
mIsServiceOverridden = true;
switch (mConnectionType) {
case CONNECTION_TYPE_IMS_SERVICE_CARRIER: {
- setCarrierImsService("");
+ setCarrierImsService("none");
break;
}
case CONNECTION_TYPE_IMS_SERVICE_DEVICE: {
@@ -152,21 +156,28 @@
if (!mIsServiceOverridden) {
return;
}
- if (mOrigServicePackage == null) {
- mOrigServicePackage = "";
+
+ if (mOrigRcsServicePackage == null) {
+ mOrigRcsServicePackage = "";
+ }
+
+ if (mOrigMmTelServicePackage == null) {
+ mOrigMmTelServicePackage = "";
}
switch (mConnectionType) {
case CONNECTION_TYPE_IMS_SERVICE_CARRIER: {
- setCarrierImsService(mOrigServicePackage);
+ setCarrierImsService(mOrigMmTelServicePackage, ImsFeature.FEATURE_MMTEL);
+ setCarrierImsService(mOrigRcsServicePackage, ImsFeature.FEATURE_RCS);
break;
}
case CONNECTION_TYPE_IMS_SERVICE_DEVICE: {
- setDeviceImsService(mOrigServicePackage);
+ setDeviceImsService(mOrigMmTelServicePackage, ImsFeature.FEATURE_MMTEL);
+ setDeviceImsService(mOrigRcsServicePackage, ImsFeature.FEATURE_RCS);
break;
}
case CONNECTION_TYPE_DEFAULT_SMS_APP: {
- setDefaultSmsApp(mOrigServicePackage);
+ setDefaultSmsApp(mOrigSmsPackage);
break;
}
}
@@ -175,15 +186,17 @@
private void storeOriginalPackage() throws Exception {
switch (mConnectionType) {
case CONNECTION_TYPE_IMS_SERVICE_CARRIER: {
- mOrigServicePackage = getOriginalCarrierService();
+ mOrigMmTelServicePackage = getOriginalMmTelCarrierService();
+ mOrigRcsServicePackage = getOriginalRcsCarrierService();
break;
}
case CONNECTION_TYPE_IMS_SERVICE_DEVICE: {
- mOrigServicePackage = getOriginalDeviceService();
+ mOrigMmTelServicePackage = getOriginalMmTelDeviceService();
+ mOrigRcsServicePackage = getOriginalRcsDeviceService();
break;
}
case CONNECTION_TYPE_DEFAULT_SMS_APP: {
- mOrigServicePackage = getDefaultSmsApp();
+ mOrigSmsPackage = getDefaultSmsApp();
break;
}
}
@@ -191,18 +204,40 @@
private boolean setDeviceImsService(String packageName) throws Exception {
String result = TelephonyUtils.executeShellCommand(mInstrumentation,
- constructSetImsServiceOverrideCommand(false, packageName));
+ constructSetImsServiceOverrideCommand(false, packageName, new int[] {
+ ImsFeature.FEATURE_MMTEL, ImsFeature.FEATURE_RCS}));
if (ImsUtils.VDBG) {
- Log.d(TAG, "setDeviceImsService result: " + result);
+ Log.d(TAG, "setDeviceMmTelImsService result: " + result);
}
return "true".equals(result);
}
private boolean setCarrierImsService(String packageName) throws Exception {
String result = TelephonyUtils.executeShellCommand(mInstrumentation,
- constructSetImsServiceOverrideCommand(true, packageName));
+ constructSetImsServiceOverrideCommand(true, packageName, new int[] {
+ ImsFeature.FEATURE_MMTEL, ImsFeature.FEATURE_RCS}));
if (ImsUtils.VDBG) {
- Log.d(TAG, "setCarrierImsService result: " + result);
+ Log.d(TAG, "setCarrierMmTelImsService result: " + result);
+ }
+ return "true".equals(result);
+ }
+
+ private boolean setDeviceImsService(String packageName, int featureType) throws Exception {
+ String result = TelephonyUtils.executeShellCommand(mInstrumentation,
+ constructSetImsServiceOverrideCommand(false, packageName,
+ new int[]{featureType}));
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "setDeviceMmTelImsService result: " + result);
+ }
+ return "true".equals(result);
+ }
+
+ private boolean setCarrierImsService(String packageName, int featureType) throws Exception {
+ String result = TelephonyUtils.executeShellCommand(mInstrumentation,
+ constructSetImsServiceOverrideCommand(true, packageName,
+ new int[]{featureType}));
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "setCarrierMmTelImsService result: " + result);
}
return "true".equals(result);
}
@@ -249,36 +284,67 @@
TestImsService.LATCH_FEATURES_READY);
}
- private String getOriginalCarrierService() throws Exception {
+ private String getOriginalMmTelCarrierService() throws Exception {
String result = TelephonyUtils.executeShellCommand(mInstrumentation,
- constructGetImsServiceCommand(true));
+ constructGetImsServiceCommand(true, ImsFeature.FEATURE_MMTEL));
if (ImsUtils.VDBG) {
- Log.d(TAG, "getOriginalCarrierService result: " + result);
+ Log.d(TAG, "getOriginalMmTelCarrierService result: " + result);
}
return result;
}
- private String getOriginalDeviceService() throws Exception {
+ private String getOriginalRcsCarrierService() throws Exception {
String result = TelephonyUtils.executeShellCommand(mInstrumentation,
- constructGetImsServiceCommand(false));
+ constructGetImsServiceCommand(true, ImsFeature.FEATURE_RCS));
if (ImsUtils.VDBG) {
- Log.d(TAG, "getOriginalDeviceService result: " + result);
+ Log.d(TAG, "getOriginalRcsCarrierService result: " + result);
+ }
+ return result;
+ }
+
+ private String getOriginalMmTelDeviceService() throws Exception {
+ String result = TelephonyUtils.executeShellCommand(mInstrumentation,
+ constructGetImsServiceCommand(false, ImsFeature.FEATURE_MMTEL));
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "getOriginalMmTelDeviceService result: " + result);
+ }
+ return result;
+ }
+
+ private String getOriginalRcsDeviceService() throws Exception {
+ String result = TelephonyUtils.executeShellCommand(mInstrumentation,
+ constructGetImsServiceCommand(false, ImsFeature.FEATURE_RCS));
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "getOriginalRcsDeviceService result: " + result);
}
return result;
}
private String constructSetImsServiceOverrideCommand(boolean isCarrierService,
- String packageName) {
+ String packageName, int[] featureTypes) {
return COMMAND_BASE + COMMAND_SET_IMS_SERVICE + COMMAND_SLOT_IDENTIFIER + mSlotId + " "
+ (isCarrierService
? COMMAND_CARRIER_SERVICE_IDENTIFIER : COMMAND_DEVICE_SERVICE_IDENTIFIER)
+ + COMMAND_FEATURE_IDENTIFIER + getFeatureTypesString(featureTypes) + " "
+ packageName;
}
- private String constructGetImsServiceCommand(boolean isCarrierService) {
+ private String constructGetImsServiceCommand(boolean isCarrierService, int featureType) {
return COMMAND_BASE + COMMAND_GET_IMS_SERVICE + COMMAND_SLOT_IDENTIFIER + mSlotId + " "
+ (isCarrierService
- ? COMMAND_CARRIER_SERVICE_IDENTIFIER : COMMAND_DEVICE_SERVICE_IDENTIFIER);
+ ? COMMAND_CARRIER_SERVICE_IDENTIFIER : COMMAND_DEVICE_SERVICE_IDENTIFIER)
+ + COMMAND_FEATURE_IDENTIFIER + featureType;
+ }
+
+ private String getFeatureTypesString(int[] featureTypes) {
+ if (featureTypes.length == 0) return "";
+ StringBuilder builder = new StringBuilder();
+ builder.append(featureTypes[0]);
+ for (int i = 1; i < featureTypes.length; i++) {
+ builder.append(",");
+ builder.append(featureTypes[i]);
+ }
+ return builder.toString();
}
}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
index d6698c9..c698547 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
@@ -40,13 +40,17 @@
import android.telephony.TelephonyManager;
import android.telephony.cts.AsyncSmsMessageListener;
import android.telephony.cts.SmsReceiverHelper;
+import android.telephony.cts.externalimsservice.ITestExternalImsService;
import android.telephony.ims.ImsException;
+import android.telephony.ims.ImsManager;
import android.telephony.ims.ImsMmTelManager;
+import android.telephony.ims.ImsRcsManager;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ProvisioningManager;
import android.telephony.ims.RegistrationManager;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
+import android.telephony.ims.feature.RcsFeature.RcsImsCapabilities;
import android.telephony.ims.stub.ImsFeatureConfiguration;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Base64;
@@ -77,6 +81,10 @@
private static ImsServiceConnector sServiceConnector;
+ private static final int RCS_CAP_NONE = RcsImsCapabilities.CAPABILITY_TYPE_NONE;
+ private static final int RCS_CAP_OPTIONS = RcsImsCapabilities.CAPABILITY_TYPE_OPTIONS_UCE;
+ private static final int RCS_CAP_PRESENCE = RcsImsCapabilities.CAPABILITY_TYPE_PRESENCE_UCE;
+
private static final String MSG_CONTENTS = "hi";
private static final String EXPECTED_RECEIVED_MESSAGE = "foo5";
private static final String DEST_NUMBER = "5555554567";
@@ -93,6 +101,13 @@
private static final int TEST_CONFIG_KEY = 1000;
private static final int TEST_CONFIG_VALUE_INT = 0xDEADBEEF;
private static final String TEST_CONFIG_VALUE_STRING = "DEADBEEF";
+ private static final String TEST_AUTOCONFIG_CONTENT = "<?xml version=\"1.0\"?>\n"
+ + "<wap-provisioningdoc version=\"1.1\">\n"
+ + "<characteristic type=\"VERS\">\n"
+ + "<parm name=\"version\" value=\"1\"/>\n"
+ + "<parm name=\"validity\" value=\"1728000\"/>\n"
+ + "</characteristic>"
+ + "</wap-provisioningdoc>";
private static CarrierConfigReceiver sReceiver;
@@ -626,7 +641,9 @@
Integer result = getFeatureState();
assertNotNull(result);
-
+ assertEquals("ImsService state should be STATE_READY",
+ sServiceConnector.getCarrierService().getMmTelFeature().getFeatureState(),
+ ImsFeature.STATE_READY);
assertTrue("ImsService state is ready, but STATE_READY is not reported.",
ImsUtils.retryUntilTrue(() -> (getFeatureState() == ImsFeature.STATE_READY)));
@@ -634,6 +651,9 @@
ImsFeature.STATE_INITIALIZING);
result = getFeatureState();
assertNotNull(result);
+ assertEquals("ImsService state should be STATE_INITIALIZING",
+ sServiceConnector.getCarrierService().getMmTelFeature().getFeatureState(),
+ ImsFeature.STATE_INITIALIZING);
assertTrue("ImsService state is initializing, but STATE_INITIALIZING is not reported.",
ImsUtils.retryUntilTrue(
() -> (getFeatureState() == ImsFeature.STATE_INITIALIZING)));
@@ -642,6 +662,9 @@
ImsFeature.STATE_UNAVAILABLE);
result = getFeatureState();
assertNotNull(result);
+ assertEquals("ImsService state should be STATE_UNAVAILABLE",
+ sServiceConnector.getCarrierService().getMmTelFeature().getFeatureState(),
+ ImsFeature.STATE_UNAVAILABLE);
assertTrue("ImsService state is unavailable, but STATE_UNAVAILABLE is not reported.",
ImsUtils.retryUntilTrue(
() -> (getFeatureState() == ImsFeature.STATE_UNAVAILABLE)));
@@ -699,6 +722,14 @@
final UiAutomation automan = InstrumentationRegistry.getInstrumentation().getUiAutomation();
// Latch will count down here (we callback on the state during registration).
try {
+ ImsMmTelManager mmTelManager = ImsMmTelManager.createForSubscriptionId(sTestSub);
+ mmTelManager.registerImsRegistrationCallback(getContext().getMainExecutor(), callback);
+ fail("registerImsRegistrationCallback requires READ_PRECISE_PHONE_STATE permission.");
+ } catch (SecurityException e) {
+ //expected
+ }
+
+ try {
automan.adoptShellPermissionIdentity();
ImsMmTelManager mmTelManager = ImsMmTelManager.createForSubscriptionId(sTestSub);
mmTelManager.registerImsRegistrationCallback(getContext().getMainExecutor(), callback);
@@ -733,6 +764,100 @@
} finally {
automan.dropShellPermissionIdentity();
}
+
+ try {
+ ImsMmTelManager mmTelManager = ImsMmTelManager.createForSubscriptionId(sTestSub);
+ mmTelManager.unregisterImsRegistrationCallback(callback);
+ fail("unregisterImsRegistrationCallback requires READ_PRECISE_PHONE_STATE permission.");
+ } catch (SecurityException e) {
+ //expected
+ }
+
+ }
+
+ @Test
+ public void testRcsManagerRegistrationCallback() throws Exception {
+ if (!ImsUtils.shouldTestImsService()) {
+ return;
+ }
+
+ ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+ if (imsManager == null) {
+ fail("Cannot find IMS service");
+ }
+
+ // Connect to device ImsService with RcsFeature
+ triggerFrameworkConnectToDeviceImsServiceBindRcsFeature();
+ ImsRcsManager imsRcsManager = imsManager.getImsRcsManager(sTestSub);
+
+ ITestExternalImsService testImsService = sServiceConnector.getExternalService();
+ // Wait for the framework to set the capabilities on the ImsService
+ testImsService.waitForLatchCountdown(TestImsService.LATCH_RCS_CAP_SET);
+
+ // Start de-registered
+ sServiceConnector.getExternalService().triggerImsOnDeregistered(
+ new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_NOT_REGISTERED,
+ ImsReasonInfo.CODE_UNSPECIFIED, ""));
+
+ LinkedBlockingQueue<Integer> mQueue = new LinkedBlockingQueue<>();
+ RegistrationManager.RegistrationCallback callback =
+ new RegistrationManager.RegistrationCallback() {
+ @Override
+ public void onRegistered(int imsTransportType) {
+ mQueue.offer(imsTransportType);
+ }
+
+ @Override
+ public void onRegistering(int imsTransportType) {
+ mQueue.offer(imsTransportType);
+ }
+
+ @Override
+ public void onUnregistered(ImsReasonInfo info) {
+ mQueue.offer(info.getCode());
+ }
+
+ @Override
+ public void onTechnologyChangeFailed(int imsTransportType, ImsReasonInfo info) {
+ mQueue.offer(imsTransportType);
+ mQueue.offer(info.getCode());
+ }
+ };
+
+ final UiAutomation automan = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+ try {
+ automan.adoptShellPermissionIdentity();
+ imsRcsManager.registerImsRegistrationCallback(getContext().getMainExecutor(), callback);
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
+ // Verify it's not registered
+ assertEquals(ImsReasonInfo.CODE_LOCAL_NOT_REGISTERED, waitForIntResult(mQueue));
+
+ // Start registration
+ sServiceConnector.getExternalService().triggerImsOnRegistering(
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, waitForIntResult(mQueue));
+
+ // Complete registration
+ sServiceConnector.getExternalService().triggerImsOnRegistered(
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, waitForIntResult(mQueue));
+
+ // Fail handover to IWLAN
+ sServiceConnector.getExternalService().triggerImsOnTechnologyChangeFailed(
+ ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
+ new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_HO_NOT_FEASIBLE,
+ ImsReasonInfo.CODE_UNSPECIFIED, ""));
+ assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WLAN, waitForIntResult(mQueue));
+ assertEquals(ImsReasonInfo.CODE_LOCAL_HO_NOT_FEASIBLE, waitForIntResult(mQueue));
+
+ try {
+ automan.adoptShellPermissionIdentity();
+ imsRcsManager.unregisterImsRegistrationCallback(callback);
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
}
@Test
@@ -820,6 +945,96 @@
}
@Test
+ public void testRcsManagerRegistrationState() throws Exception {
+ if (!ImsUtils.shouldTestImsService()) {
+ return;
+ }
+
+ ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+ if (imsManager == null) {
+ fail("Cannot find IMS service");
+ }
+
+ // Connect to device ImsService with RcsFeature
+ triggerFrameworkConnectToDeviceImsServiceBindRcsFeature();
+ ITestExternalImsService testImsService = sServiceConnector.getExternalService();
+ testImsService.waitForLatchCountdown(TestImsService.LATCH_RCS_CAP_SET);
+
+ // Start de-registered
+ sServiceConnector.getExternalService().triggerImsOnDeregistered(
+ new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_NOT_REGISTERED,
+ ImsReasonInfo.CODE_UNSPECIFIED, ""));
+
+ LinkedBlockingQueue<Integer> mQueue = new LinkedBlockingQueue<>();
+ RegistrationManager.RegistrationCallback callback =
+ new RegistrationManager.RegistrationCallback() {
+ @Override
+ public void onRegistered(int imsTransportType) {
+ mQueue.offer(imsTransportType);
+ }
+
+ @Override
+ public void onRegistering(int imsTransportType) {
+ mQueue.offer(imsTransportType);
+ }
+
+ @Override
+ public void onUnregistered(ImsReasonInfo info) {
+ mQueue.offer(info.getCode());
+ }
+
+ @Override
+ public void onTechnologyChangeFailed(int imsTransportType, ImsReasonInfo info) {
+ mQueue.offer(imsTransportType);
+ mQueue.offer(info.getCode());
+ }
+ };
+
+ ImsRcsManager imsRcsManager = imsManager.getImsRcsManager(sTestSub);
+ ShellIdentityUtils.invokeThrowableMethodWithShellPermissionsNoReturn(imsRcsManager,
+ (m) -> m.registerImsRegistrationCallback(getContext().getMainExecutor(), callback),
+ ImsException.class);
+ assertEquals(ImsReasonInfo.CODE_LOCAL_NOT_REGISTERED, waitForIntResult(mQueue));
+
+ // Ensure that the Framework reports Deregistered correctly
+ verifyRegistrationState(imsRcsManager,
+ RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED);
+ verifyRegistrationTransportType(imsRcsManager,
+ AccessNetworkConstants.TRANSPORT_TYPE_INVALID);
+
+ // Start registration
+ sServiceConnector.getExternalService().triggerImsOnRegistering(
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, waitForIntResult(mQueue));
+ verifyRegistrationState(imsRcsManager, RegistrationManager.REGISTRATION_STATE_REGISTERING);
+ verifyRegistrationTransportType(imsRcsManager, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+
+ // Complete registration
+ sServiceConnector.getExternalService().triggerImsOnRegistered(
+ ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, waitForIntResult(mQueue));
+ verifyRegistrationState(imsRcsManager, RegistrationManager.REGISTRATION_STATE_REGISTERED);
+ verifyRegistrationTransportType(imsRcsManager, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+
+ // Fail handover to IWLAN
+ sServiceConnector.getExternalService().triggerImsOnTechnologyChangeFailed(
+ ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
+ new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_HO_NOT_FEASIBLE,
+ ImsReasonInfo.CODE_UNSPECIFIED, ""));
+ assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WLAN, waitForIntResult(mQueue));
+ assertEquals(ImsReasonInfo.CODE_LOCAL_HO_NOT_FEASIBLE, waitForIntResult(mQueue));
+ verifyRegistrationTransportType(imsRcsManager, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
+
+ // handover to IWLAN
+ sServiceConnector.getExternalService().triggerImsOnRegistered(
+ ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN);
+ assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WLAN, waitForIntResult(mQueue));
+ verifyRegistrationTransportType(imsRcsManager, AccessNetworkConstants.TRANSPORT_TYPE_WLAN);
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(imsRcsManager,
+ (m) -> m.unregisterImsRegistrationCallback(callback));
+ }
+
+ @Test
public void testCapabilityStatusCallback() throws Exception {
if (!ImsUtils.shouldTestImsService()) {
return;
@@ -873,6 +1088,13 @@
automan.dropShellPermissionIdentity();
}
+ try {
+ mmTelManager.registerMmTelCapabilityCallback(getContext().getMainExecutor(), callback);
+ fail("registerMmTelCapabilityCallback requires READ_PRECISE_PHONE_STATE permission.");
+ } catch (SecurityException e) {
+ //expected
+ }
+
// We should not have voice availability here, we notified the framework earlier.
MmTelFeature.MmTelCapabilities capCb = waitForResult(mQueue);
assertNotNull(capCb);
@@ -896,6 +1118,140 @@
} finally {
automan.dropShellPermissionIdentity();
}
+
+ try {
+ mmTelManager.unregisterMmTelCapabilityCallback(callback);
+ fail("unregisterMmTelCapabilityCallback requires READ_PRECISE_PHONE_STATE permission.");
+ } catch (SecurityException e) {
+ //expected
+ }
+ }
+
+ @Test
+ public void testProvisioningManagerNotifyAutoConfig() throws Exception {
+ triggerFrameworkConnectToDeviceImsServiceBindRcsFeature();
+
+ ProvisioningManager provisioningManager =
+ ProvisioningManager.createForSubscriptionId(sTestSub);
+
+ final UiAutomation automan = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+ try {
+ automan.adoptShellPermissionIdentity();
+ provisioningManager.notifyRcsAutoConfigurationReceived(
+ TEST_AUTOCONFIG_CONTENT.getBytes(), false);
+ assertEquals(TEST_AUTOCONFIG_CONTENT,
+ sServiceConnector.getExternalService().getConfigString(sTestSlot,
+ ImsUtils.ITEM_NON_COMPRESSED));
+
+ provisioningManager.notifyRcsAutoConfigurationReceived(
+ TEST_AUTOCONFIG_CONTENT.getBytes(), true);
+ assertEquals(TEST_AUTOCONFIG_CONTENT,
+ sServiceConnector.getExternalService().getConfigString(sTestSlot,
+ ImsUtils.ITEM_COMPRESSED));
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
+ }
+
+ @Test
+ public void testRcsCapabilityStatusCallback() throws Exception {
+ if (!ImsUtils.shouldTestImsService()) {
+ return;
+ }
+
+ ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+ if (imsManager == null) {
+ fail("Cannot find IMS service");
+ }
+
+ // Connect to device ImsService with RcsFeature
+ triggerFrameworkConnectToDeviceImsServiceBindRcsFeature();
+
+ int registrationTech = ImsRegistrationImplBase.REGISTRATION_TECH_LTE;
+ ImsRcsManager imsRcsManager = imsManager.getImsRcsManager(sTestSub);
+
+ ITestExternalImsService testImsService = sServiceConnector.getExternalService();
+ // Wait for the framework to set the capabilities on the ImsService
+ testImsService.waitForLatchCountdown(TestImsService.LATCH_RCS_CAP_SET);
+ // Make sure we start off with none-capability
+ testImsService.triggerImsOnRegistered(ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
+ testImsService.notifyRcsCapabilitiesStatusChanged(RCS_CAP_NONE);
+
+ // Make sure the capabilities match the API getter for capabilities
+ final UiAutomation automan = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+ // Latch will count down here (we callback on the state during registration).
+ try {
+ automan.adoptShellPermissionIdentity();
+ // Make sure we are tracking voice capability over LTE properly.
+ assertEquals(testImsService.isRcsAvailable(RCS_CAP_PRESENCE),
+ imsRcsManager.isAvailable(RCS_CAP_PRESENCE));
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
+
+ // Trigger carrier config changed
+ PersistableBundle bundle = new PersistableBundle();
+ bundle.putBoolean(CarrierConfigManager.KEY_USE_RCS_SIP_OPTIONS_BOOL, true);
+ bundle.putBoolean(CarrierConfigManager.KEY_USE_RCS_PRESENCE_BOOL, true);
+ overrideCarrierConfig(bundle);
+
+ // The carrier config changed should trigger RcsFeature#changeEnabledCapabilities
+ try {
+ automan.adoptShellPermissionIdentity();
+ // Checked by isCapable api to make sure RcsFeature#changeEnabledCapabilities is called
+ assertTrue(ImsUtils.retryUntilTrue(() ->
+ imsRcsManager.isCapable(RCS_CAP_OPTIONS, registrationTech)));
+ assertTrue(ImsUtils.retryUntilTrue(() ->
+ imsRcsManager.isCapable(RCS_CAP_PRESENCE, registrationTech)));
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
+
+ // A queue to receive capability changed
+ LinkedBlockingQueue<RcsImsCapabilities> mQueue = new LinkedBlockingQueue<>();
+ ImsRcsManager.AvailabilityCallback callback = new ImsRcsManager.AvailabilityCallback() {
+ @Override
+ public void onAvailabilityChanged(RcsImsCapabilities capabilities) {
+ mQueue.offer(capabilities);
+ }
+ };
+
+ // Latch will count down here (we callback on the state during registration).
+ try {
+ automan.adoptShellPermissionIdentity();
+ imsRcsManager.registerRcsAvailabilityCallback(getContext().getMainExecutor(), callback);
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
+
+ // We should not have any availabilities here, we notified the framework earlier.
+ RcsImsCapabilities capCb = waitForResult(mQueue);
+
+ // The SIP OPTIONS capability from onAvailabilityChanged should be disabled.
+ // Moreover, ImsRcsManager#isAvailable also return FALSE with SIP OPTIONS
+ assertTrue(capCb.isCapable(RCS_CAP_NONE));
+ try {
+ automan.adoptShellPermissionIdentity();
+ assertFalse(imsRcsManager.isAvailable(RCS_CAP_OPTIONS));
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
+
+ // Notify the SIP OPTIONS capability status changed
+ testImsService.notifyRcsCapabilitiesStatusChanged(RCS_CAP_OPTIONS);
+ capCb = waitForResult(mQueue);
+
+ // The SIP OPTIONS capability from onAvailabilityChanged should be enabled.
+ // Verify ImsRcsManager#isAvailable also return true with SIP OPTIONS
+ assertTrue(capCb.isCapable(RCS_CAP_OPTIONS));
+ try {
+ automan.adoptShellPermissionIdentity();
+ assertTrue(imsRcsManager.isAvailable(RCS_CAP_OPTIONS));
+ } finally {
+ automan.dropShellPermissionIdentity();
+ }
+
+ overrideCarrierConfig(null);
}
@Test
@@ -1037,6 +1393,20 @@
sServiceConnector.getCarrierService().getMmTelFeature());
}
+ private void triggerFrameworkConnectToDeviceImsServiceBindRcsFeature() throws Exception {
+ // Connect to the ImsService with the RCS feature.
+ assertTrue(sServiceConnector.connectDeviceImsService(new ImsFeatureConfiguration.Builder()
+ .addFeature(sTestSlot, ImsFeature.FEATURE_RCS)
+ .build()));
+ // The RcsFeature is created when the ImsService is bound. If it wasn't created, then the
+ // Framework did not call it.
+ sServiceConnector.getExternalService().waitForLatchCountdown(
+ TestImsService.LATCH_CREATE_RCS);
+ // Make sure the RcsFeature was created in the test service.
+ assertTrue("Device ImsService created, but TestDeviceImsService#createRcsFeature was not"
+ + "called!", sServiceConnector.getExternalService().isRcsFeatureCreated());
+ }
+
private void verifyRegistrationState(RegistrationManager regManager, int expectedState)
throws Exception {
LinkedBlockingQueue<Integer> mQueue = new LinkedBlockingQueue<>();
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
index 406d61a..8c904ee 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
@@ -33,13 +33,17 @@
import java.util.concurrent.Callable;
public class ImsUtils {
- public static final String TAG = "GtsImsServiceTests";
public static final boolean VDBG = false;
// ImsService rebind has an exponential backoff capping at 64 seconds. Wait for 70 seconds to
// allow for the new poll to happen in the framework.
public static final int TEST_TIMEOUT_MS = 70000;
+ // Id for non compressed auto configuration xml.
+ public static final int ITEM_NON_COMPRESSED = 2000;
+ // Id for compressed auto configuration xml.
+ public static final int ITEM_COMPRESSED = 2001;
+
public static boolean shouldTestImsService() {
final PackageManager pm = InstrumentationRegistry.getInstrumentation().getContext()
.getPackageManager();
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsContactUceCapabilityTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsContactUceCapabilityTest.java
new file mode 100644
index 0000000..73e3b05
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsContactUceCapabilityTest.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.ims.cts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.telephony.ims.RcsContactUceCapability;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+@RunWith(AndroidJUnit4.class)
+public class RcsContactUceCapabilityTest {
+
+ private static final Uri TEST_CONTACT = Uri.fromParts("sip", "me.test", null);
+ private static final Uri TEST_VT_CONTACT = Uri.fromParts("sip", "contact.test", null);
+ private static final String TEST_EXTENSION_TAG = "+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gpp"
+ + "-application.ims.iari.rcs.mnc000.mcc000.testService\"";
+
+ @Test
+ public void createParcelUnparcel() {
+ if (!ImsUtils.shouldTestImsService()) {
+ return;
+ }
+
+ RcsContactUceCapability.Builder builder = new RcsContactUceCapability.Builder(TEST_CONTACT);
+ builder.add(RcsContactUceCapability.CAPABILITY_IP_VIDEO_CALL, TEST_VT_CONTACT);
+ builder.add(RcsContactUceCapability.CAPABILITY_IP_VOICE_CALL);
+ builder.add(TEST_EXTENSION_TAG);
+ RcsContactUceCapability testCapability = builder.build();
+
+ // parcel and unparcel
+ Parcel infoParceled = Parcel.obtain();
+ testCapability.writeToParcel(infoParceled, 0);
+ infoParceled.setDataPosition(0);
+ RcsContactUceCapability unparceledCapability =
+ RcsContactUceCapability.CREATOR.createFromParcel(infoParceled);
+ infoParceled.recycle();
+
+ assertTrue(unparceledCapability.isCapable(
+ RcsContactUceCapability.CAPABILITY_IP_VOICE_CALL));
+ assertTrue(unparceledCapability.isCapable(
+ RcsContactUceCapability.CAPABILITY_IP_VIDEO_CALL));
+ assertEquals(TEST_VT_CONTACT, unparceledCapability.getServiceUri(
+ RcsContactUceCapability.CAPABILITY_IP_VIDEO_CALL));
+ assertEquals(TEST_CONTACT, unparceledCapability.getServiceUri(
+ RcsContactUceCapability.CAPABILITY_IP_VOICE_CALL));
+ assertEquals(TEST_CONTACT, unparceledCapability.getContactUri());
+
+ List<String> extensions = unparceledCapability.getCapableExtensionTags();
+ assertEquals(1, extensions.size());
+ assertEquals(TEST_EXTENSION_TAG, extensions.get(0));
+ }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsConfig.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsConfig.java
index 325ec59..00c5a1b 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsConfig.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsConfig.java
@@ -47,4 +47,10 @@
public String getConfigString(int item) {
return mStringHashMap.get(item);
}
+
+ @Override
+ public void notifyRcsAutoConfigurationReceived(byte[] content, boolean isCompressed) {
+ int item = isCompressed ? ImsUtils.ITEM_COMPRESSED : ImsUtils.ITEM_NON_COMPRESSED;
+ setConfig(item, new String(content));
+ }
}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java
index c21d8ba..ef7702f 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java
@@ -58,8 +58,10 @@
public static final int LATCH_REMOVE_MMTEL = 5;
public static final int LATCH_REMOVE_RCS = 6;
public static final int LATCH_MMTEL_READY = 7;
- public static final int LATCH_MMTEL_CAP_SET = 8;
- private static final int LATCH_MAX = 9;
+ public static final int LATCH_RCS_READY = 8;
+ public static final int LATCH_MMTEL_CAP_SET = 9;
+ public static final int LATCH_RCS_CAP_SET = 10;
+ private static final int LATCH_MAX = 11;
protected static final CountDownLatch[] sLatches = new CountDownLatch[LATCH_MAX];
static {
for (int i = 0; i < LATCH_MAX; i++) {
@@ -123,12 +125,27 @@
public RcsFeature createRcsFeature(int slotId) {
synchronized (mLock) {
countDownLatch(LATCH_CREATE_RCS);
- mTestRcsFeature = new TestRcsFeature(() -> {
- synchronized (mLock) {
- countDownLatch(LATCH_REMOVE_RCS);
- mTestRcsFeature = null;
- }
- });
+ mTestRcsFeature = new TestRcsFeature(
+ //onReady
+ () -> {
+ synchronized (mLock) {
+ countDownLatch(LATCH_RCS_READY);
+ }
+ },
+ //onRemoved
+ () -> {
+ synchronized (mLock) {
+ countDownLatch(LATCH_REMOVE_RCS);
+ mTestRcsFeature = null;
+ }
+ },
+ //onCapabilitiesSet
+ () -> {
+ synchronized (mLock) {
+ countDownLatch(LATCH_RCS_CAP_SET);
+ }
+ }
+ );
return mTestRcsFeature;
}
}
@@ -181,7 +198,7 @@
}
}
- ImsService getImsService() {
+ protected ImsService getImsService() {
synchronized (mLock) {
if (mTestImsService != null) {
return mTestImsService;
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestRcsFeature.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestRcsFeature.java
index 8781550..9752258 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestRcsFeature.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestRcsFeature.java
@@ -16,18 +16,77 @@
package android.telephony.ims.cts;
+import android.telephony.ims.feature.CapabilityChangeRequest;
import android.telephony.ims.feature.RcsFeature;
+import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.util.Log;
+
+import java.util.List;
public class TestRcsFeature extends RcsFeature {
+ private static final String TAG = "CtsTestImsService";
+ private final TestImsService.ReadyListener mReadyListener;
private final TestImsService.RemovedListener mRemovedListener;
+ private final TestImsService.CapabilitiesSetListener mCapSetListener;
- TestRcsFeature(TestImsService.RemovedListener listener) {
+ private RcsImsCapabilities mCapabilities =
+ new RcsImsCapabilities(RcsImsCapabilities.CAPABILITY_TYPE_NONE);
+
+ TestRcsFeature(TestImsService.ReadyListener readyListener,
+ TestImsService.RemovedListener listener,
+ TestImsService.CapabilitiesSetListener setListener) {
+ mReadyListener = readyListener;
mRemovedListener = listener;
+ mCapSetListener = setListener;
+
+ setFeatureState(STATE_READY);
+ }
+
+ @Override
+ public void onFeatureReady() {
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "TestRcsFeature.onFeatureReady called");
+ }
+ mReadyListener.onReady();
}
@Override
public void onFeatureRemoved() {
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "TestRcsFeature.onFeatureRemoved called");
+ }
mRemovedListener.onRemoved();
}
+
+
+ @Override
+ public boolean queryCapabilityConfiguration(int capability, int radioTech) {
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "TestRcsFeature.queryCapabilityConfiguration called with capability: "
+ + capability);
+ }
+ return mCapabilities.isCapable(capability);
+ }
+
+ @Override
+ public void changeEnabledCapabilities(CapabilityChangeRequest request,
+ CapabilityCallbackProxy c) {
+ if (ImsUtils.VDBG) {
+ Log.d(TAG, "TestRcsFeature.changeEnabledCapabilities");
+ }
+ List<CapabilityChangeRequest.CapabilityPair> pairs = request.getCapabilitiesToEnable();
+ for (CapabilityChangeRequest.CapabilityPair pair : pairs) {
+ if (pair.getRadioTech() == ImsRegistrationImplBase.REGISTRATION_TECH_LTE) {
+ mCapabilities.addCapabilities(pair.getCapability());
+ }
+ }
+ pairs = request.getCapabilitiesToDisable();
+ for (CapabilityChangeRequest.CapabilityPair pair : pairs) {
+ if (pair.getRadioTech() == ImsRegistrationImplBase.REGISTRATION_TECH_LTE) {
+ mCapabilities.removeCapabilities(pair.getCapability());
+ }
+ }
+ mCapSetListener.onSet();
+ }
}
diff --git a/tests/tests/telephony/sdk28/AndroidTest.xml b/tests/tests/telephony/sdk28/AndroidTest.xml
index 32c0401..b8c086f 100644
--- a/tests/tests/telephony/sdk28/AndroidTest.xml
+++ b/tests/tests/telephony/sdk28/AndroidTest.xml
@@ -20,6 +20,7 @@
<option name="not-shardable" value="true" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="android.telephony.cts.preconditions.TelephonyPreparer">
<option name="apk" value="CtsTelephonyPreparerApp.apk" />
<option name="package" value="android.telephony.cts.preconditions.app" />
diff --git a/tests/tests/telephony2/AndroidTest.xml b/tests/tests/telephony2/AndroidTest.xml
index ed815e3..3d3d476 100644
--- a/tests/tests/telephony2/AndroidTest.xml
+++ b/tests/tests/telephony2/AndroidTest.xml
@@ -19,6 +19,7 @@
<option name="not-shardable" value="true" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTelephony2TestCases.apk" />
diff --git a/tests/tests/telephony3/AndroidTest.xml b/tests/tests/telephony3/AndroidTest.xml
index 41a2a27..7ba44ac 100644
--- a/tests/tests/telephony3/AndroidTest.xml
+++ b/tests/tests/telephony3/AndroidTest.xml
@@ -19,6 +19,7 @@
<option name="not-shardable" value="true" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsTelephony3TestCases.apk" />
diff --git a/tests/tests/telephony4/AndroidTest.xml b/tests/tests/telephony4/AndroidTest.xml
index 057a2eb..3140fea 100644
--- a/tests/tests/telephony4/AndroidTest.xml
+++ b/tests/tests/telephony4/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="telecom" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/telephonyprovider/AndroidTest.xml b/tests/tests/telephonyprovider/AndroidTest.xml
index bd8dd7b..50892c3 100644
--- a/tests/tests/telephonyprovider/AndroidTest.xml
+++ b/tests/tests/telephonyprovider/AndroidTest.xml
@@ -20,6 +20,7 @@
<!-- TelephonyProvider uses permissions not available to instant apps. -->
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/CellBroadcastProviderTest.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/CellBroadcastProviderTest.java
index 16c9c39..8218ce4 100644
--- a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/CellBroadcastProviderTest.java
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/CellBroadcastProviderTest.java
@@ -16,22 +16,28 @@
package android.telephonyprovider.cts;
+import static android.telephonyprovider.cts.DefaultSmsAppHelper.hasTelephony;
+
import android.content.ContentResolver;
import android.provider.Telephony;
import android.test.InstrumentationTestCase;
public class CellBroadcastProviderTest extends InstrumentationTestCase {
private ContentResolver mContentResolver;
- private static boolean sHasShellPermissionIdentity = false;
+ private boolean mHasTelephony;
@Override
protected void setUp() throws Exception {
super.setUp();
mContentResolver = getInstrumentation().getContext().getContentResolver();
+ mHasTelephony = hasTelephony();
}
// this is only allowed for privileged process
public void testAccess() {
+ if (!mHasTelephony) {
+ return;
+ }
try {
mContentResolver.query(Telephony.CellBroadcasts.CONTENT_URI,
null, null, null, null);
@@ -42,6 +48,9 @@
}
public void testAccessMessageHistoryWithoutPermission() {
+ if (!mHasTelephony) {
+ return;
+ }
try {
mContentResolver.query(Telephony.CellBroadcasts.MESSAGE_HISTORY_URI,
null, null, null, null);
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/DefaultSmsAppHelper.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/DefaultSmsAppHelper.java
index 3f85f84..0a8d117 100644
--- a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/DefaultSmsAppHelper.java
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/DefaultSmsAppHelper.java
@@ -74,7 +74,7 @@
Assume.assumeTrue(hasTelephony());
}
- private static boolean hasTelephony() {
+ static boolean hasTelephony() {
Context context = ApplicationProvider.getApplicationContext();
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
}
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/LockedMessageTest.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/LockedMessageTest.java
index f3d04cb..d2e6fd0 100644
--- a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/LockedMessageTest.java
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/LockedMessageTest.java
@@ -16,6 +16,8 @@
package android.telephonyprovider.cts;
+import static android.telephonyprovider.cts.DefaultSmsAppHelper.assumeTelephony;
+
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.google.common.truth.Truth.assertThat;
@@ -58,6 +60,7 @@
@Before
public void setupTestEnvironment() {
+ assumeTelephony();
cleanup();
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsConversationTest.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsConversationTest.java
index 69f3ce6..ebecd8a 100644
--- a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsConversationTest.java
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsConversationTest.java
@@ -16,6 +16,8 @@
package android.telephonyprovider.cts;
+import static android.telephonyprovider.cts.DefaultSmsAppHelper.assumeTelephony;
+
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.google.common.truth.Truth.assertThat;
@@ -56,6 +58,7 @@
@Before
public void setupTestEnvironment() {
+ assumeTelephony();
cleanup();
mContentResolver = getInstrumentation().getContext().getContentResolver();
}
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsTest.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsTest.java
index 7831bb5..f9a999d 100644
--- a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsTest.java
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/SmsTest.java
@@ -16,6 +16,8 @@
package android.telephonyprovider.cts;
+import static android.telephonyprovider.cts.DefaultSmsAppHelper.assumeTelephony;
+
import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static com.google.common.truth.Truth.assertThat;
@@ -57,6 +59,7 @@
@Before
public void setupTestEnvironment() {
+ assumeTelephony();
cleanup();
mContentResolver = getInstrumentation().getContext().getContentResolver();
mSmsTestHelper = new SmsTestHelper();
diff --git a/tests/tests/sdkext/Android.bp b/tests/tests/tethering/Android.bp
similarity index 68%
copy from tests/tests/sdkext/Android.bp
copy to tests/tests/tethering/Android.bp
index 9ad6c7f..0f98125 100644
--- a/tests/tests/sdkext/Android.bp
+++ b/tests/tests/tethering/Android.bp
@@ -13,18 +13,32 @@
// limitations under the License.
android_test {
- name: "CtsSdkExtTestCases",
+ name: "CtsTetheringTest",
defaults: ["cts_defaults"],
- static_libs: [
- "androidx.test.rules",
- "ctstestrunner-axt",
+
+ libs: [
+ "android.test.base.stubs",
],
- srcs: [ "src/**/*.java" ],
- test_config: "CtsSdkExtTestCases.xml",
+
+ srcs: [
+ "src/**/*.java",
+ ],
+
+ static_libs: [
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "junit",
+ "junit-params",
+ ],
+
+ // Change to system current when TetheringManager move to bootclass path.
+ platform_apis: true,
+
+ // Tag this module as a cts test artifact
test_suites: [
"cts",
- "mts",
"general-tests",
+ "mts",
],
- sdk_version: "system_current",
+
}
diff --git a/tests/tests/tethering/AndroidManifest.xml b/tests/tests/tethering/AndroidManifest.xml
new file mode 100644
index 0000000..665002e
--- /dev/null
+++ b/tests/tests/tethering/AndroidManifest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.tethering.cts">
+
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
+ <application android:debuggable="true">
+ <uses-library android:name="android.test.runner" />
+ </application>
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.tethering.cts"
+ android:label="CTS tests of android.tethering">
+ <meta-data android:name="listener"
+ android:value="com.android.cts.runner.CtsTestRunListener" />
+ </instrumentation>
+
+</manifest>
diff --git a/tests/tests/sdkext/CtsSdkExtTestCases.xml b/tests/tests/tethering/AndroidTest.xml
similarity index 70%
copy from tests/tests/sdkext/CtsSdkExtTestCases.xml
copy to tests/tests/tethering/AndroidTest.xml
index b22653c..25051ba 100644
--- a/tests/tests/sdkext/CtsSdkExtTestCases.xml
+++ b/tests/tests/tethering/AndroidTest.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
+<!-- Copyright (C) 2019 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -13,16 +13,18 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<configuration description="Configuration for SdkExt Tests">
+<configuration description="Config for CTS Tethering test cases">
<option name="test-suite-tag" value="cts" />
- <option name="config-descriptor:metadata" key="component" value="framework" />
- <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
- <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="component" value="networking" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+ <option name="not-shardable" value="true" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
- <option name="test-file-name" value="CtsSdkExtTestCases.apk" />
+ <option name="test-file-name" value="CtsTetheringTest.apk" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="package" value="android.os.ext.cts" />
+ <option name="package" value="android.tethering.cts" />
</test>
</configuration>
diff --git a/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
new file mode 100644
index 0000000..043d04f
--- /dev/null
+++ b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.tethering.test;
+
+import static org.junit.Assert.fail;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ConnectivityManager;
+import android.os.ConditionVariable;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+@RunWith(AndroidJUnit4.class)
+public class TetheringManagerTest {
+
+ private Context mContext;
+
+ private ConnectivityManager mCM;
+
+ private TetherChangeReceiver mTetherChangeReceiver;
+
+ private String[] mTetheredList;
+
+ private static final int DEFAULT_TIMEOUT_MS = 60_000;
+
+ @Before
+ public void setUp() throws Exception {
+ InstrumentationRegistry.getInstrumentation()
+ .getUiAutomation()
+ .adoptShellPermissionIdentity();
+ mContext = InstrumentationRegistry.getContext();
+ mCM = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+ mTetherChangeReceiver = new TetherChangeReceiver();
+ final IntentFilter filter = new IntentFilter(
+ ConnectivityManager.ACTION_TETHER_STATE_CHANGED);
+ final Intent intent = mContext.registerReceiver(mTetherChangeReceiver, filter);
+ if (intent != null) mTetherChangeReceiver.onReceive(null, intent);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ mContext.unregisterReceiver(mTetherChangeReceiver);
+ InstrumentationRegistry.getInstrumentation()
+ .getUiAutomation()
+ .dropShellPermissionIdentity();
+ }
+
+ private class TetherChangeReceiver extends BroadcastReceiver {
+ private class TetherState {
+ final ArrayList<String> mAvailable;
+ final ArrayList<String> mActive;
+ final ArrayList<String> mErrored;
+
+ TetherState(Intent intent) {
+ mAvailable = intent.getStringArrayListExtra(
+ ConnectivityManager.EXTRA_AVAILABLE_TETHER);
+ mActive = intent.getStringArrayListExtra(
+ ConnectivityManager.EXTRA_ACTIVE_TETHER);
+ mErrored = intent.getStringArrayListExtra(
+ ConnectivityManager.EXTRA_ERRORED_TETHER);
+ }
+ }
+
+ @Override
+ public void onReceive(Context content, Intent intent) {
+ String action = intent.getAction();
+ if (action.equals(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)) {
+ mResult.add(new TetherState(intent));
+ }
+ }
+
+ public final LinkedBlockingQueue<TetherState> mResult = new LinkedBlockingQueue<>();
+
+ // This method expects either an event where one of the interfaces is active, or an event
+ // where one of the interface is available followed by one where one of the interfaces is
+ // active.
+ public void expectActiveTethering(String[] ifaceRegexs) {
+ TetherState state = pollAndAssertNoError(DEFAULT_TIMEOUT_MS);
+ if (state == null) fail("Do not receive tethering state change broadcast");
+
+ if (isIfaceActive(ifaceRegexs, state)) return;
+
+ if (isIfaceAvailable(ifaceRegexs, state)) {
+ state = pollAndAssertNoError(DEFAULT_TIMEOUT_MS);
+ if (isIfaceActive(ifaceRegexs, state)) return;
+ }
+
+ fail("Tethering is not actived, available ifaces: " + state.mAvailable.toString()
+ + ", active ifaces: " + state.mActive.toString());
+ }
+
+ private TetherState pollAndAssertNoError(final int timeout) {
+ final TetherState state = pollTetherState(timeout);
+ assertNoErroredIfaces(state);
+ return state;
+ }
+
+ private TetherState pollTetherState(final int timeout) {
+ try {
+ return mResult.poll(timeout, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ fail("No result after " + timeout + " ms");
+ return null;
+ }
+ }
+
+ private boolean isIfaceActive(final String[] ifaceRegexs, final TetherState state) {
+ return isIfaceMatch(ifaceRegexs, state.mActive);
+ }
+
+ private boolean isIfaceAvailable(final String[] ifaceRegexs, final TetherState state) {
+ return isIfaceMatch(ifaceRegexs, state.mAvailable);
+ }
+
+ // This method requires a broadcast to have been recorded iff the timeout is non-zero.
+ public void expectNoActiveTethering(final int timeout) {
+ final TetherState state = pollAndAssertNoError(timeout);
+
+ if (state == null) {
+ if (timeout != 0) {
+ fail("Do not receive tethering state change broadcast");
+ }
+ return;
+ }
+
+ assertNoActiveIfaces(state);
+
+ for (final TetherState ts : mResult) {
+ assertNoErroredIfaces(ts);
+
+ assertNoActiveIfaces(ts);
+ }
+ }
+
+ private void assertNoErroredIfaces(final TetherState state) {
+ if (state == null || state.mErrored == null) return;
+
+ if (state.mErrored.size() > 0) {
+ fail("Found failed tethering interfaces: " + Arrays.toString(state.mErrored.toArray()));
+ }
+ }
+
+ private void assertNoActiveIfaces(final TetherState state) {
+ if (state.mActive != null && state.mActive.size() > 0) {
+ fail("Found active tethering interface: " + Arrays.toString(state.mActive.toArray()));
+ }
+ }
+ }
+
+ private class OnStartTetheringCallback extends
+ ConnectivityManager.OnStartTetheringCallback {
+ @Override
+ public void onTetheringStarted() {
+ // Do nothing, TetherChangeReceiver will wait until it receives the broadcast.
+ }
+
+ @Override
+ public void onTetheringFailed() {
+ fail("startTethering fail");
+ }
+ }
+
+ private static boolean isIfaceMatch(final String[] ifaceRegexs,
+ final ArrayList<String> ifaces) {
+ if (ifaceRegexs == null) fail("ifaceRegexs should not be null");
+
+ if (ifaces == null) return false;
+
+ for (String s : ifaces) {
+ for (String regex : ifaceRegexs) {
+ if (s.matches(regex)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Test
+ public void testStartTetheringWithStateChangeBroadcast() throws Exception {
+ if (!mCM.isTetheringSupported()) return;
+
+ final String[] wifiRegexs = mCM.getTetherableWifiRegexs();
+ if (wifiRegexs.length == 0) return;
+
+ mTetherChangeReceiver.expectNoActiveTethering(0 /** timeout */);
+
+ final OnStartTetheringCallback startTetheringCallback = new OnStartTetheringCallback();
+ mCM.startTethering(ConnectivityManager.TETHERING_WIFI, true, startTetheringCallback);
+ mTetherChangeReceiver.expectActiveTethering(wifiRegexs);
+
+ mCM.stopTethering(ConnectivityManager.TETHERING_WIFI);
+ mTetherChangeReceiver.expectNoActiveTethering(DEFAULT_TIMEOUT_MS);
+ }
+}
diff --git a/tests/tests/text/TEST_MAPPING b/tests/tests/text/TEST_MAPPING
index cc40b03..05e9696 100644
--- a/tests/tests/text/TEST_MAPPING
+++ b/tests/tests/text/TEST_MAPPING
@@ -2,6 +2,9 @@
"presubmit": [
{
"name": "CtsTextTestCases"
+ },
+ {
+ "name": "minikin_tests"
}
]
-}
\ No newline at end of file
+}
diff --git a/tests/tests/theme/AndroidTest.xml b/tests/tests/theme/AndroidTest.xml
index fa00709..426f366 100644
--- a/tests/tests/theme/AndroidTest.xml
+++ b/tests/tests/theme/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="uitoolkit" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsThemeDeviceTestCases.apk" />
diff --git a/tests/tests/toastlegacy/AndroidTest.xml b/tests/tests/toastlegacy/AndroidTest.xml
index dac51a6..95d5a02 100644
--- a/tests/tests/toastlegacy/AndroidTest.xml
+++ b/tests/tests/toastlegacy/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsToastLegacyTestCases.apk" />
diff --git a/tests/tests/view/AndroidTest.xml b/tests/tests/view/AndroidTest.xml
index 4f53b76..5750c26 100644
--- a/tests/tests/view/AndroidTest.xml
+++ b/tests/tests/view/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="uitoolkit" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsViewTestCases.apk" />
diff --git a/tests/tests/view/TEST_MAPPING b/tests/tests/view/TEST_MAPPING
new file mode 100644
index 0000000..279657d
--- /dev/null
+++ b/tests/tests/view/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit": [
+ {
+ "name": "minikin_tests"
+ }
+ ]
+}
diff --git a/tests/tests/voiceinteraction/AndroidTest.xml b/tests/tests/voiceinteraction/AndroidTest.xml
index bbf478d..68501e2 100644
--- a/tests/tests/voiceinteraction/AndroidTest.xml
+++ b/tests/tests/voiceinteraction/AndroidTest.xml
@@ -18,6 +18,7 @@
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
<option name="not-shardable" value="true" />
<!-- Force service to be installed as non-instant mode, always -->
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java b/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java
index 2c63dd8..21f939c 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java
+++ b/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java
@@ -86,7 +86,10 @@
}
private boolean runTest(BroadcastUtils.TestcaseType test, int expectedMode) throws Exception {
- if (!startTestAndWaitForBroadcast(test, VOICE_SETTINGS_PACKAGE, VOICE_INTERACTION_CLASS)) {
+ if (!startTestAndWaitForChange(test,
+ Settings.Global.getUriFor(Settings.Global.AIRPLANE_MODE_ON),
+ VOICE_SETTINGS_PACKAGE,
+ VOICE_INTERACTION_CLASS)) {
return false;
}
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/BroadcastTestBase.java b/tests/tests/voicesettings/src/android/voicesettings/cts/BroadcastTestBase.java
index 95e9433..b734b47 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/BroadcastTestBase.java
+++ b/tests/tests/voicesettings/src/android/voicesettings/cts/BroadcastTestBase.java
@@ -24,11 +24,15 @@
import android.content.BroadcastReceiver;
import android.content.ComponentName;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
+import android.database.ContentObserver;
+import android.net.Uri;
import android.os.Bundle;
+import android.os.Handler;
import android.provider.Settings;
import android.util.Log;
@@ -154,4 +158,39 @@
}
}
}
+
+ protected CountDownLatch registerForChanges(Uri uri) throws Exception {
+ final CountDownLatch latch = new CountDownLatch(1);
+ final ContentResolver resolver = mActivity.getContentResolver();
+ mActivity.runOnUiThread(() -> {
+ resolver.registerContentObserver(uri, true,
+ new ContentObserver(new Handler()) {
+ @Override
+ public void onChange(boolean selfChange) {
+ latch.countDown();
+ resolver.unregisterContentObserver(this);
+ }
+ });
+ });
+ return latch;
+ }
+
+ protected boolean startTestAndWaitForChange(BroadcastUtils.TestcaseType testCaseType, Uri uri,
+ String pkg, String cls)
+ throws Exception {
+ Log.i(TAG, "Begin Testing: " + testCaseType);
+
+ // We also wait for broadcast because some results are obtained by
+ // ActivityDoneReceiver#onReceive
+ registerBroadcastReceiver(testCaseType);
+
+ CountDownLatch latch = registerForChanges(uri);
+ mActivity.startTest(testCaseType.toString(), pkg, cls);
+ if (!mLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)
+ || !latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+ fail("Failed to change in " + TIMEOUT_MS + "msec");
+ return false;
+ }
+ return true;
+ }
}
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java b/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java
index 883f907..f352d94 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java
+++ b/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java
@@ -89,7 +89,9 @@
}
private boolean runTest(BroadcastUtils.TestcaseType test, int expectedMode) throws Exception {
- if (!startTestAndWaitForBroadcast(test, VOICE_SETTINGS_PACKAGE, VOICE_INTERACTION_CLASS)) {
+ if (!startTestAndWaitForChange(test,
+ Settings.Global.getUriFor(ZEN_MODE), VOICE_SETTINGS_PACKAGE,
+ VOICE_INTERACTION_CLASS)) {
return false;
}
diff --git a/tools/cts-device-info/Android.mk b/tools/cts-device-info/Android.mk
index 82ea994..fc55328 100644
--- a/tools/cts-device-info/Android.mk
+++ b/tools/cts-device-info/Android.mk
@@ -38,7 +38,7 @@
LOCAL_PACKAGE_NAME := CtsDeviceInfo
# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests sts mts
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests sts mts vts-core
include $(BUILD_CTS_DEVICE_INFO_PACKAGE)
diff --git a/tools/selinux/SELinuxNeverallowTestFrame.py b/tools/selinux/SELinuxNeverallowTestFrame.py
index f8f93b9..e7c560b 100644
--- a/tools/selinux/SELinuxNeverallowTestFrame.py
+++ b/tools/selinux/SELinuxNeverallowTestFrame.py
@@ -69,7 +69,8 @@
protected void setUp() throws Exception {
super.setUp();
CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(mBuild);
- sepolicyAnalyze = buildHelper.getTestFile("sepolicy-analyze");
+ File sepolicyAnalyzeDir = buildHelper.getTestFile("sepolicy-analyze");
+ sepolicyAnalyze = new File(sepolicyAnalyzeDir, "sepolicy-analyze");
sepolicyAnalyze.setExecutable(true);
devicePolicyFile = android.security.cts.SELinuxHostTest.getDevicePolicyFile(mDevice);