Merge "Modify test cae for adding more error codes."
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 532ed68..4d46518 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -3197,6 +3197,8 @@
<meta-data android:name="test_category" android:value="@string/test_category_tv" />
<meta-data android:name="test_required_features"
android:value="android.software.leanback" />
+ <meta-data android:name="test_required_configs"
+ android:value="config_hdmi_source"/>
</activity>
<activity android:name=".tv.display.DisplayModesTestActivity"
android:label="@string/tv_display_modes_test"
@@ -3205,9 +3207,11 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
- <meta-data android:name="test_category" android:value="@string/test_category_tv" />
+ <meta-data android:name="test_category" android:value="@string/test_category_tv"/>
<meta-data android:name="test_required_features"
- android:value="android.software.leanback" />
+ android:value="android.software.leanback"/>
+ <meta-data android:name="test_required_configs"
+ android:value="config_hdmi_source"/>
</activity>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java
index 3132219..9378596 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java
@@ -31,6 +31,8 @@
private static final int LAUNCH_TEST_REQUEST_CODE = 9001;
protected TestListAdapter mAdapter;
+ // Start time of test item.
+ protected long mStartTime;
protected void setTestListAdapter(TestListAdapter adapter) {
mAdapter = adapter;
@@ -74,6 +76,8 @@
protected void handleLaunchTestResult(int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
TestResult testResult = TestResult.fromActivityResult(resultCode, data);
+ testResult.getHistoryCollection().add(
+ testResult.getName(), mStartTime, System.currentTimeMillis());
mAdapter.setTestResult(testResult);
}
}
@@ -82,6 +86,7 @@
@Override
protected final void onListItemClick(ListView listView, View view, int position, long id) {
super.onListItemClick(listView, view, position, id);
+ mStartTime = System.currentTimeMillis();
handleItemClick(listView, view, position, id);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/DialogTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/DialogTestListActivity.java
index aa6eaba..bed5a77 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/DialogTestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/DialogTestListActivity.java
@@ -224,7 +224,7 @@
// Bundle result in an intent to feed into handleLaunchTestResult
Intent resultIntent = new Intent();
TestResult.addResultData(resultIntent, result, test.testName, /* testDetails */ null,
- /* reportLog */ null);
+ /* reportLog */ null, null);
handleLaunchTestResult(RESULT_OK, resultIntent);
getListView().smoothScrollToPosition(mCurrentTestPosition + 1);
}
@@ -233,7 +233,7 @@
// Bundle result in an intent to feed into handleLaunchTestResult
Intent resultIntent = new Intent();
TestResult.addResultData(resultIntent, result, testName, /* testDetails */ null,
- /* reportLog */ null);
+ /* reportLog */ null, null);
handleLaunchTestResult(RESULT_OK, resultIntent);
getListView().smoothScrollToPosition(mCurrentTestPosition + 1);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
index 47514b8..76019cb 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
@@ -27,13 +27,17 @@
import android.util.Log;
import android.widget.ListView;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.stream.Collectors;
/**
* {@link TestListAdapter} that populates the {@link TestListActivity}'s {@link ListView} by
@@ -89,6 +93,7 @@
* </ol>
*/
public class ManifestTestListAdapter extends TestListAdapter {
+ private static final String LOG_TAG = "ManifestTestListAdapter";
private static final String TEST_CATEGORY_META_DATA = "test_category";
@@ -106,6 +111,8 @@
private static final String CONFIG_HAS_RECENTS = "config_has_recents";
+ private static final String CONFIG_HDMI_SOURCE = "config_hdmi_source";
+
private final HashSet<String> mDisabledTests;
private Context mContext;
@@ -146,12 +153,7 @@
List<TestListItem> tests = filterTests(testsByCategory.get(testCategory));
if (!tests.isEmpty()) {
allRows.add(TestListItem.newCategory(testCategory));
- Collections.sort(tests, new Comparator<TestListItem>() {
- @Override
- public int compare(TestListItem item, TestListItem otherItem) {
- return item.title.compareTo(otherItem.title);
- }
- });
+ Collections.sort(tests, Comparator.comparing(item -> item.title));
allRows.addAll(tests);
}
}
@@ -168,7 +170,7 @@
PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA);
int size = list.size();
- List<ResolveInfo> matchingList = new ArrayList<ResolveInfo>();
+ List<ResolveInfo> matchingList = new ArrayList<>();
for (int i = 0; i < size; i++) {
ResolveInfo info = list.get(i);
String parent = getTestParent(info.activityInfo.metaData);
@@ -181,14 +183,13 @@
}
Map<String, List<TestListItem>> getTestsByCategory(List<ResolveInfo> list) {
- Map<String, List<TestListItem>> testsByCategory =
- new HashMap<String, List<TestListItem>>();
+ Map<String, List<TestListItem>> testsByCategory = new HashMap<>();
int size = list.size();
for (int i = 0; i < size; i++) {
ResolveInfo info = list.get(i);
if (info.activityInfo == null || mDisabledTests.contains(info.activityInfo.name)) {
- Log.w("CtsVerifier", "ignoring disabled test: " + info.activityInfo.name);
+ Log.w(LOG_TAG, "ignoring disabled test: " + info.activityInfo.name);
continue;
}
String title = getTitle(mContext, info.activityInfo);
@@ -345,6 +346,19 @@
return false;
}
break;
+ case CONFIG_HDMI_SOURCE:
+ final int DEVICE_TYPE_HDMI_SOURCE = 4;
+ try {
+ if (!getHdmiDeviceType().contains(DEVICE_TYPE_HDMI_SOURCE)) {
+ return false;
+ }
+ } catch (Exception exception) {
+ Log.e(
+ LOG_TAG,
+ "Exception while looking up HDMI device type.",
+ exception);
+ }
+ break;
default:
break;
}
@@ -353,8 +367,24 @@
return true;
}
+ private static List<Integer> getHdmiDeviceType()
+ throws InvocationTargetException, IllegalAccessException, ClassNotFoundException,
+ NoSuchMethodException {
+ Method getStringMethod =
+ ClassLoader.getSystemClassLoader()
+ .loadClass("android.os.SystemProperties")
+ .getMethod("get", String.class);
+ String deviceTypesStr = (String) getStringMethod.invoke(null, "ro.hdmi.device_type");
+ if (deviceTypesStr.equals("")) {
+ return new ArrayList<>();
+ }
+ return Arrays.stream(deviceTypesStr.split(","))
+ .map(Integer::parseInt)
+ .collect(Collectors.toList());
+ }
+
List<TestListItem> filterTests(List<TestListItem> tests) {
- List<TestListItem> filteredTests = new ArrayList<TestListItem>();
+ List<TestListItem> filteredTests = new ArrayList<>();
for (TestListItem test : tests) {
if (!hasAnyFeature(test.excludedFeatures) && hasAllFeatures(test.requiredFeatures)
&& matchAllConfigs(test.requiredConfigs)) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
index 4a8004a..7776d27 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
@@ -36,6 +36,10 @@
import android.widget.ImageButton;
import android.widget.Toast;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
/**
* {@link Activity}s to handle clicks to the pass and fail buttons of the pass fail buttons layout.
*
@@ -99,14 +103,21 @@
/** @return A {@link ReportLog} that is used to record test metric data. */
ReportLog getReportLog();
+
+ /**
+ * @return A {@link TestResultHistoryCollection} that is used to record test execution time.
+ */
+ TestResultHistoryCollection getHistoryCollection();
}
public static class Activity extends android.app.Activity implements PassFailActivity {
private WakeLock mWakeLock;
private final ReportLog reportLog;
+ private final TestResultHistoryCollection mHistoryCollection;
public Activity() {
this.reportLog = new CtsVerifierReportLog();
+ this.mHistoryCollection = new TestResultHistoryCollection();
}
@Override
@@ -160,19 +171,25 @@
@Override
public void setTestResultAndFinish(boolean passed) {
PassFailButtons.setTestResultAndFinishHelper(
- this, getTestId(), getTestDetails(), passed, getReportLog());
+ this, getTestId(), getTestDetails(), passed, getReportLog(),
+ getHistoryCollection());
}
@Override
public ReportLog getReportLog() { return reportLog; }
+
+ @Override
+ public TestResultHistoryCollection getHistoryCollection() { return mHistoryCollection; }
}
public static class ListActivity extends android.app.ListActivity implements PassFailActivity {
private final ReportLog reportLog;
+ private final TestResultHistoryCollection mHistoryCollection;
public ListActivity() {
this.reportLog = new CtsVerifierReportLog();
+ this.mHistoryCollection = new TestResultHistoryCollection();
}
@Override
@@ -208,11 +225,15 @@
@Override
public void setTestResultAndFinish(boolean passed) {
PassFailButtons.setTestResultAndFinishHelper(
- this, getTestId(), getTestDetails(), passed, getReportLog());
+ this, getTestId(), getTestDetails(), passed, getReportLog(),
+ getHistoryCollection());
}
@Override
public ReportLog getReportLog() { return reportLog; }
+
+ @Override
+ public TestResultHistoryCollection getHistoryCollection() { return mHistoryCollection; }
}
public static class TestListActivity extends AbstractTestListActivity
@@ -257,12 +278,27 @@
@Override
public void setTestResultAndFinish(boolean passed) {
PassFailButtons.setTestResultAndFinishHelper(
- this, getTestId(), getTestDetails(), passed, getReportLog());
+ this, getTestId(), getTestDetails(), passed, getReportLog(),
+ getHistoryCollection());
}
@Override
public ReportLog getReportLog() { return reportLog; }
+ /**
+ * Get existing test history to aggregate.
+ */
+ @Override
+ public TestResultHistoryCollection getHistoryCollection() {
+ List<TestResultHistoryCollection> histories =
+ IntStream.range(0, mAdapter.getCount())
+ .mapToObj(mAdapter::getHistoryCollection)
+ .collect(Collectors.toList());
+ TestResultHistoryCollection historyCollection = new TestResultHistoryCollection();
+ historyCollection.merge(getTestId(), histories);
+ return historyCollection;
+ }
+
public void updatePassButton() {
getPassButton().setEnabled(mAdapter.allTestsPassed());
}
@@ -274,7 +310,7 @@
@Override
public void onClick(View target) {
setTestResultAndFinish(activity, activity.getTestId(), activity.getTestDetails(),
- activity.getReportLog(), target);
+ activity.getReportLog(), activity.getHistoryCollection(), target);
}
};
@@ -399,7 +435,8 @@
/** Set the test result corresponding to the button clicked and finish the activity. */
protected static void setTestResultAndFinish(android.app.Activity activity, String testId,
- String testDetails, ReportLog reportLog, View target) {
+ String testDetails, ReportLog reportLog, TestResultHistoryCollection historyCollection,
+ View target) {
boolean passed;
if (target.getId() == R.id.pass_button) {
passed = true;
@@ -409,16 +446,17 @@
throw new IllegalArgumentException("Unknown id: " + target.getId());
}
- setTestResultAndFinishHelper(activity, testId, testDetails, passed, reportLog);
+ setTestResultAndFinishHelper(activity, testId, testDetails, passed, reportLog, historyCollection);
}
/** Set the test result and finish the activity. */
protected static void setTestResultAndFinishHelper(android.app.Activity activity, String testId,
- String testDetails, boolean passed, ReportLog reportLog) {
+ String testDetails, boolean passed, ReportLog reportLog,
+ TestResultHistoryCollection historyCollection) {
if (passed) {
- TestResult.setPassedResult(activity, testId, testDetails, reportLog);
+ TestResult.setPassedResult(activity, testId, testDetails, reportLog, historyCollection);
} else {
- TestResult.setFailedResult(activity, testId, testDetails, reportLog);
+ TestResult.setFailedResult(activity, testId, testDetails, reportLog, historyCollection);
}
activity.finish();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
index d9ea84f..17efb22 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
@@ -17,6 +17,7 @@
package com.android.cts.verifier;
import com.android.compatibility.common.util.ReportLog;
+import com.android.compatibility.common.util.TestResultHistory;
import android.content.ContentResolver;
import android.content.Context;
@@ -74,6 +75,9 @@
/** Map from test name to {@link ReportLog}. */
private final Map<String, ReportLog> mReportLogs = new HashMap<String, ReportLog>();
+ /** Map from test name to {@link TestResultHistory}. */
+ private final Map<String, TestResultHistoryCollection> mHistories = new HashMap<>();
+
private final LayoutInflater mLayoutInflater;
/** {@link ListView} row that is either a test category header or a test. */
@@ -192,8 +196,14 @@
}
public void setTestResult(TestResult testResult) {
- new SetTestResultTask(testResult.getName(), testResult.getResult(),
- testResult.getDetails(), testResult.getReportLog()).execute();
+ String name = testResult.getName();
+
+ // Append existing history
+ TestResultHistoryCollection histories = testResult.getHistoryCollection();
+ histories.merge(null, mHistories.get(name));
+
+ new SetTestResultTask(name, testResult.getResult(),
+ testResult.getDetails(), testResult.getReportLog(), histories).execute();
}
class RefreshTestResultsTask extends AsyncTask<Void, Void, RefreshResult> {
@@ -214,6 +224,8 @@
mTestDetails.putAll(result.mDetails);
mReportLogs.clear();
mReportLogs.putAll(result.mReportLogs);
+ mHistories.clear();
+ mHistories.putAll(result.mHistories);
notifyDataSetChanged();
}
}
@@ -223,16 +235,19 @@
Map<String, Integer> mResults;
Map<String, String> mDetails;
Map<String, ReportLog> mReportLogs;
+ Map<String, TestResultHistoryCollection> mHistories;
RefreshResult(
List<TestListItem> items,
Map<String, Integer> results,
Map<String, String> details,
- Map<String, ReportLog> reportLogs) {
+ Map<String, ReportLog> reportLogs,
+ Map<String, TestResultHistoryCollection> histories) {
mItems = items;
mResults = results;
mDetails = details;
mReportLogs = reportLogs;
+ mHistories = histories;
}
}
@@ -244,12 +259,14 @@
TestResultsProvider.COLUMN_TEST_RESULT,
TestResultsProvider.COLUMN_TEST_DETAILS,
TestResultsProvider.COLUMN_TEST_METRICS,
+ TestResultsProvider.COLUMN_TEST_RESULT_HISTORY,
};
RefreshResult getRefreshResults(List<TestListItem> items) {
Map<String, Integer> results = new HashMap<String, Integer>();
Map<String, String> details = new HashMap<String, String>();
Map<String, ReportLog> reportLogs = new HashMap<String, ReportLog>();
+ Map<String, TestResultHistoryCollection> histories = new HashMap<>();
ContentResolver resolver = mContext.getContentResolver();
Cursor cursor = null;
try {
@@ -261,9 +278,12 @@
int testResult = cursor.getInt(2);
String testDetails = cursor.getString(3);
ReportLog reportLog = (ReportLog) deserialize(cursor.getBlob(4));
+ TestResultHistoryCollection historyCollection =
+ (TestResultHistoryCollection) deserialize(cursor.getBlob(5));
results.put(testName, testResult);
details.put(testName, testDetails);
reportLogs.put(testName, reportLog);
+ histories.put(testName, historyCollection);
} while (cursor.moveToNext());
}
} finally {
@@ -271,7 +291,7 @@
cursor.close();
}
}
- return new RefreshResult(items, results, details, reportLogs);
+ return new RefreshResult(items, results, details, reportLogs, histories);
}
class ClearTestResultsTask extends AsyncTask<Void, Void, Void> {
@@ -287,27 +307,28 @@
class SetTestResultTask extends AsyncTask<Void, Void, Void> {
private final String mTestName;
-
private final int mResult;
-
private final String mDetails;
-
private final ReportLog mReportLog;
+ private final TestResultHistoryCollection mHistoryCollection;
SetTestResultTask(
String testName,
int result,
String details,
- ReportLog reportLog) {
+ ReportLog reportLog,
+ TestResultHistoryCollection historyCollection) {
mTestName = testName;
mResult = result;
mDetails = details;
mReportLog = reportLog;
+ mHistoryCollection = historyCollection;
}
@Override
protected Void doInBackground(Void... params) {
- TestResultsProvider.setTestResult(mContext, mTestName, mResult, mDetails, mReportLog);
+ TestResultsProvider.setTestResult(
+ mContext, mTestName, mResult, mDetails, mReportLog, mHistoryCollection);
return null;
}
}
@@ -382,6 +403,19 @@
: null;
}
+ /**
+ * Get test result histories.
+ *
+ * @param position The position of test.
+ * @return A {@link TestResultHistoryCollection} object containing test result histories of tests.
+ */
+ public TestResultHistoryCollection getHistoryCollection(int position) {
+ TestListItem item = getItem(position);
+ return mHistories.containsKey(item.testName)
+ ? mHistories.get(item.testName)
+ : null;
+ }
+
public boolean allTestsPassed() {
for (TestListItem item : mRows) {
if (item.isTest() && (!mTestResults.containsKey(item.testName)
@@ -451,7 +485,7 @@
}
}
- private static Object deserialize(byte[] bytes) {
+ public static Object deserialize(byte[] bytes) {
if (bytes == null || bytes.length == 0) {
return null;
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java
index 07208dd..9f867d5 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java
@@ -17,6 +17,7 @@
package com.android.cts.verifier;
import com.android.compatibility.common.util.ReportLog;
+import com.android.compatibility.common.util.TestResultHistory;
import android.app.Activity;
import android.content.Intent;
@@ -38,11 +39,13 @@
private static final String TEST_RESULT = "result";
private static final String TEST_DETAILS = "details";
private static final String TEST_METRICS = "metrics";
+ private static final String TEST_HISTORY_COLLECTION = "historyCollection";
private final String mName;
private final int mResult;
private final String mDetails;
private final ReportLog mReportLog;
+ private final TestResultHistoryCollection mHistoryCollection;
/** Sets the test activity's result to pass. */
public static void setPassedResult(Activity activity, String testId, String testDetails) {
@@ -53,7 +56,14 @@
public static void setPassedResult(Activity activity, String testId, String testDetails,
ReportLog reportLog) {
activity.setResult(Activity.RESULT_OK, createResult(activity, TEST_RESULT_PASSED, testId,
- testDetails, reportLog));
+ testDetails, reportLog, null /*history*/));
+ }
+
+ /** Sets the test activity's result to pass including a test report log result and history. */
+ public static void setPassedResult(Activity activity, String testId, String testDetails,
+ ReportLog reportLog, TestResultHistoryCollection historyCollection) {
+ activity.setResult(Activity.RESULT_OK, createResult(activity, TEST_RESULT_PASSED, testId,
+ testDetails, reportLog, historyCollection));
}
/** Sets the test activity's result to failed. */
@@ -65,22 +75,30 @@
public static void setFailedResult(Activity activity, String testId, String testDetails,
ReportLog reportLog) {
activity.setResult(Activity.RESULT_OK, createResult(activity, TEST_RESULT_FAILED, testId,
- testDetails, reportLog));
+ testDetails, reportLog, null /*history*/));
+ }
+
+ /** Sets the test activity's result to failed including a test report log result and history. */
+ public static void setFailedResult(Activity activity, String testId, String testDetails,
+ ReportLog reportLog, TestResultHistoryCollection historyCollection) {
+ activity.setResult(Activity.RESULT_OK, createResult(activity, TEST_RESULT_FAILED, testId,
+ testDetails, reportLog, historyCollection));
}
public static Intent createResult(Activity activity, int testResult, String testName,
- String testDetails, ReportLog reportLog) {
+ String testDetails, ReportLog reportLog, TestResultHistoryCollection historyCollection) {
Intent data = new Intent(activity, activity.getClass());
- addResultData(data, testResult, testName, testDetails, reportLog);
+ addResultData(data, testResult, testName, testDetails, reportLog, historyCollection);
return data;
}
public static void addResultData(Intent intent, int testResult, String testName,
- String testDetails, ReportLog reportLog) {
+ String testDetails, ReportLog reportLog, TestResultHistoryCollection historyCollection) {
intent.putExtra(TEST_NAME, testName);
intent.putExtra(TEST_RESULT, testResult);
intent.putExtra(TEST_DETAILS, testDetails);
intent.putExtra(TEST_METRICS, reportLog);
+ intent.putExtra(TEST_HISTORY_COLLECTION, historyCollection);
}
/**
@@ -92,15 +110,20 @@
int result = data.getIntExtra(TEST_RESULT, TEST_RESULT_NOT_EXECUTED);
String details = data.getStringExtra(TEST_DETAILS);
ReportLog reportLog = (ReportLog) data.getSerializableExtra(TEST_METRICS);
- return new TestResult(name, result, details, reportLog);
+ TestResultHistoryCollection historyCollection =
+ (TestResultHistoryCollection) data.getSerializableExtra(TEST_HISTORY_COLLECTION);
+ return new TestResult(name, result, details, reportLog, historyCollection);
}
private TestResult(
- String name, int result, String details, ReportLog reportLog) {
+ String name, int result, String details, ReportLog reportLog,
+ TestResultHistoryCollection historyCollection) {
this.mName = name;
this.mResult = result;
this.mDetails = details;
this.mReportLog = reportLog;
+ this.mHistoryCollection =
+ historyCollection == null ? new TestResultHistoryCollection() : historyCollection;
}
/** Return the name of the test like "com.android.cts.verifier.foo.FooTest" */
@@ -122,4 +145,9 @@
public ReportLog getReportLog() {
return mReportLog;
}
+
+ /** @return the {@link TestResultHistoryCollection} containing test history */
+ public TestResultHistoryCollection getHistoryCollection() {
+ return mHistoryCollection;
+ }
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultHistoryCollection.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultHistoryCollection.java
new file mode 100644
index 0000000..0e7160c
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultHistoryCollection.java
@@ -0,0 +1,81 @@
+package com.android.cts.verifier;
+
+import com.android.compatibility.common.util.TestResultHistory;
+
+import java.io.Serializable;
+import java.util.AbstractMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class TestResultHistoryCollection implements Serializable {
+
+ private final Set<TestResultHistory> mHistoryCollection = new HashSet<>();
+
+ /**
+ * Covert object to set.
+ *
+ * @return A set of test result history.
+ */
+ public Set<TestResultHistory> asSet() {
+ return mHistoryCollection;
+ }
+
+ /**
+ * Add a test result history with test name, start time and end time.
+ *
+ * @param test a string of test name.
+ * @param start start time of a test.
+ * @param end end time of a test.
+ */
+ public void add(String test, long start, long end) {
+ Set<Map.Entry> duration = new HashSet<>();
+ duration.add(new AbstractMap.SimpleEntry<>(start, end));
+ mHistoryCollection.add(new TestResultHistory(test, duration));
+ }
+
+ /**
+ * Add test result histories for tests containing test name and a set of execution time.
+ *
+ * @param test test name.
+ * @param durations set of start and end time.
+ */
+ public void addAll(String test, Set<Map.Entry> durations) {
+ TestResultHistory history = new TestResultHistory(test, durations);
+ boolean match = false;
+ for (TestResultHistory resultHistory: mHistoryCollection) {
+ if (resultHistory.getTestName().equals(test)) {
+ resultHistory.getDurations().addAll(durations);
+ match = true;
+ break;
+ }
+ }
+ if (match == false) {
+ mHistoryCollection.add(history);
+ }
+ }
+
+ /**
+ * Merge test with its sub-tests result histories.
+ *
+ * @param prefix optional test name prefix to apply.
+ * @param resultHistoryCollection a set of test result histories.
+ */
+ public void merge(String prefix, TestResultHistoryCollection resultHistoryCollection) {
+ if (resultHistoryCollection != null) {
+ resultHistoryCollection.asSet().forEach(t-> addAll(
+ prefix != null ? prefix + ":" + t.getTestName() : t.getTestName(), t.getDurations()));
+ }
+ }
+
+ /**
+ * Merge test with its sub-tests result histories.
+ *
+ * @param prefix optional test name prefix to apply.
+ * @param resultHistories a list of test result history collection.
+ */
+ public void merge(String prefix, List<TestResultHistoryCollection> resultHistories) {
+ resultHistories.forEach(resultHistoryCollection -> merge(prefix, resultHistoryCollection));
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
index a2ef71d..4bbb12b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
@@ -59,6 +59,8 @@
static final String COLUMN_TEST_DETAILS = "testdetails";
/** ReportLog containing the test result metrics. */
static final String COLUMN_TEST_METRICS = "testmetrics";
+ /** TestResultHistory containing the test run histories. */
+ static final String COLUMN_TEST_RESULT_HISTORY = "testresulthistory";
/**
* Report saved location
@@ -102,12 +104,13 @@
}
static void setTestResult(Context context, String testName, int testResult,
- String testDetails, ReportLog reportLog) {
+ String testDetails, ReportLog reportLog, TestResultHistoryCollection historyCollection) {
ContentValues values = new ContentValues(2);
values.put(TestResultsProvider.COLUMN_TEST_RESULT, testResult);
values.put(TestResultsProvider.COLUMN_TEST_NAME, testName);
values.put(TestResultsProvider.COLUMN_TEST_DETAILS, testDetails);
values.put(TestResultsProvider.COLUMN_TEST_METRICS, serialize(reportLog));
+ values.put(TestResultsProvider.COLUMN_TEST_RESULT_HISTORY, serialize(historyCollection));
final Uri uri = getResultContentUri(context);
ContentResolver resolver = context.getContentResolver();
@@ -400,7 +403,8 @@
+ COLUMN_TEST_RESULT + " INTEGER,"
+ COLUMN_TEST_INFO_SEEN + " INTEGER DEFAULT 0,"
+ COLUMN_TEST_DETAILS + " TEXT,"
- + COLUMN_TEST_METRICS + " BLOB);");
+ + COLUMN_TEST_METRICS + " BLOB,"
+ + COLUMN_TEST_RESULT_HISTORY + " BLOB);");
}
@Override
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
index a87e9d8..a32b842 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
@@ -29,6 +29,7 @@
import com.android.compatibility.common.util.ITestResult;
import com.android.compatibility.common.util.MetricsXmlSerializer;
import com.android.compatibility.common.util.ReportLog;
+import com.android.compatibility.common.util.TestResultHistory;
import com.android.compatibility.common.util.TestStatus;
import com.android.cts.verifier.TestListAdapter.TestListItem;
@@ -38,9 +39,16 @@
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
/**
* Helper class for creating an {@code InvocationResult} for CTS result generation.
@@ -136,6 +144,27 @@
if (reportLog != null) {
currentTestResult.setReportLog(reportLog);
}
+
+ TestResultHistoryCollection historyCollection = mAdapter.getHistoryCollection(i);
+ if (historyCollection != null) {
+ // Get non-terminal prefixes.
+ Set<String> prefixes = new HashSet<>();
+ for (TestResultHistory history: historyCollection.asSet()) {
+ Arrays.stream(history.getTestName().split(":")).reduce(
+ (total, current) -> { prefixes.add(total);
+ return total + ":" + current;
+ });
+ }
+
+ // Filter out non-leaf test histories.
+ List<TestResultHistory> leafTestHistories = new ArrayList<TestResultHistory>();
+ for (TestResultHistory history: historyCollection.asSet()) {
+ if (!prefixes.contains(history.getTestName())) {
+ leafTestHistories.add(history);
+ }
+ }
+ currentTestResult.setTestResultHistories(leafTestHistories);
+ }
}
}
moduleResult.setDone(true);
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/managedprovisioning/ByodFlowTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
index cef8ae3..b13e3aa 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
@@ -747,6 +747,8 @@
private void queryProfileOwner(boolean showToast) {
try {
+ // Set execution start time for counting test execution time.
+ mStartTime = System.currentTimeMillis();
Intent intent = new Intent(ByodHelperActivity.ACTION_QUERY_PROFILE_OWNER);
startActivityForResult(intent, REQUEST_PROFILE_OWNER_STATUS);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
index 93bb6a5..d3f4889 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
@@ -495,6 +495,8 @@
}
private Intent createCreateManagedUserIntent() {
+ // Set execution start time for counting test execution time.
+ mStartTime = System.currentTimeMillis();
return new Intent(this, CommandReceiverActivity.class)
.putExtra(CommandReceiverActivity.EXTRA_COMMAND,
CommandReceiverActivity.COMMAND_CREATE_MANAGED_USER);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/RecentsRedactionActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/RecentsRedactionActivity.java
index cce6df0..189248d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/RecentsRedactionActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/RecentsRedactionActivity.java
@@ -68,7 +68,7 @@
throw new IllegalArgumentException("Unknown id: " + target.getId());
}
Intent resultIntent = TestResult.createResult(RecentsRedactionActivity.this, resultCode,
- getTestId(), getTestDetails(), getReportLog());
+ getTestId(), getTestDetails(), getReportLog(), getHistoryCollection());
new ByodFlowTestHelper(this).sendResultToPrimary(resultIntent);
finish();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/TurnOffWorkActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/TurnOffWorkActivity.java
index c0a1626..ef2d798 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/TurnOffWorkActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/TurnOffWorkActivity.java
@@ -65,10 +65,15 @@
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ // Set execution start time when start this activity for counting test execution time.
+ mStartTime = System.currentTimeMillis();
mPrepareTestButton.setText(R.string.provisioning_byod_turn_off_work_prepare_button);
mPrepareTestButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
+ // Set execution start time when users start to turn/off work profile for counting
+ // test execution time.
+ mStartTime = System.currentTimeMillis();
try {
startActivity(new Intent(Settings.ACTION_SYNC_SETTINGS));
} catch (ActivityNotFoundException e) {
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java
index 360c078..bb27360 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java
@@ -23,11 +23,16 @@
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Intent;
+import android.database.ContentObserver;
import android.net.Uri;
import android.os.Bundle;
+import android.os.Handler;
import android.os.ResultReceiver;
import android.util.Log;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
/**
* A service to handle interactions with the BlockedNumberProvider. The BlockedNumberProvider
* can only be accessed by the primary user. This service can be run as a singleton service
@@ -41,11 +46,14 @@
static final String PHONE_NUMBER_EXTRA = "number";
static final String URI_EXTRA = "uri";
static final String ROWS_EXTRA = "rows";
+ static final String FAIL_EXTRA = "fail";
static final String RESULT_RECEIVER_EXTRA = "resultReceiver";
private static final String TAG = "CtsBlockNumberSvc";
+ private static final int ASYNC_TIMEOUT = 10000;
private ContentResolver mContentResolver;
+ private Handler mHandler = new Handler();
public BlockedNumberService() {
super(BlockedNumberService.class.getName());
@@ -77,14 +85,37 @@
private Bundle insertBlockedNumber(String number) {
Log.i(TAG, "insertBlockedNumber: " + number);
+ CountDownLatch blockedNumberLatch = getBlockedNumberLatch();
ContentValues cv = new ContentValues();
cv.put(COLUMN_ORIGINAL_NUMBER, number);
Uri uri = mContentResolver.insert(CONTENT_URI, cv);
Bundle bundle = new Bundle();
bundle.putString(URI_EXTRA, uri.toString());
+
+ // Wait for the content provider to be updated.
+ try {
+ blockedNumberLatch.await(ASYNC_TIMEOUT, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ bundle.putBoolean(FAIL_EXTRA, true);
+ }
return bundle;
}
+ private CountDownLatch getBlockedNumberLatch() {
+ CountDownLatch changeLatch = new CountDownLatch(1);
+ getContentResolver().registerContentObserver(
+ CONTENT_URI, true,
+ new ContentObserver(mHandler) {
+ @Override
+ public void onChange(boolean selfChange, Uri uri) {
+ getContentResolver().unregisterContentObserver(this);
+ changeLatch.countDown();
+ super.onChange(selfChange);
+ }
+ });
+ return changeLatch;
+ }
+
private Bundle deleteBlockedNumber(Uri uri) {
Log.i(TAG, "deleteBlockedNumber: " + uri);
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java
index e5a0ce4..91959d5 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java
@@ -51,7 +51,11 @@
Intent intent = new Intent(INSERT_ACTION);
intent.putExtra(PHONE_NUMBER_EXTRA, phoneNumber);
- return Uri.parse(runBlockedNumberService(context, intent).getString(URI_EXTRA));
+ Bundle result = runBlockedNumberService(context, intent);
+ if (result.getBoolean(BlockedNumberService.FAIL_EXTRA)) {
+ return null;
+ }
+ return Uri.parse(result.getString(URI_EXTRA));
}
/** Remove a number from the blocked number provider and returns the number of rows deleted. */
diff --git a/hostsidetests/apex/src/android/apex/cts/ApexTest.java b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
index 9222dbb..0347299 100644
--- a/hostsidetests/apex/src/android/apex/cts/ApexTest.java
+++ b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
@@ -32,13 +32,27 @@
return Boolean.parseBoolean(getDevice().getProperty("ro.apex.updatable"));
}
+ private boolean isGSI() throws Exception {
+ String systemProduct = getDevice().getProperty("ro.product.system.name");
+ return systemProduct.equals("aosp_arm")
+ || systemProduct.equals("aosp_arm64")
+ || systemProduct.equals("aosp_x86")
+ || systemProduct.equals("aosp_x86_64");
+ }
+
/**
* Ensures that the built-in APEXes are all with flattened APEXes
* or non-flattend APEXes. Mixture of them is not supported and thus
* not allowed.
+ *
+ * GSI is exempt from this test since it exceptionally includes both types os APEXes.
*/
@Test
public void testApexType() throws Exception {
+ if (isGSI()) {
+ return;
+ }
+
String[] builtinDirs = {
"/system/apex",
"/system_ext/apex",
diff --git a/hostsidetests/appsecurity/OWNERS b/hostsidetests/appsecurity/OWNERS
index 13f1b02..fc0a238 100644
--- a/hostsidetests/appsecurity/OWNERS
+++ b/hostsidetests/appsecurity/OWNERS
@@ -1,14 +1,15 @@
-# Bug component: 36137
+# Bug component: 533114
toddke@google.com
per-file AccessSerialNumberTest.java = moltmann@google.com
per-file AdoptableHostTest.java = jsharkey@google.com
per-file ApexSignatureVerificationTest.java = dariofreni@google.com
per-file ApplicationVisibilityTest.java = toddke@google.com
+per-file AppOpsTest.java = moltmann@google.com
per-file AppSecurityTests.java = cbrubaker@google.com
per-file AuthBoundKeyTest.java = cbrubaker@google.com
per-file BaseInstallMultiple.java = toddke@google.com
-per-file BasePermissionsTest.java = moltmann@google.com
per-file CorruptApkTests.java = rtmitchell@google.com
+per-file DeviceIdentifierTest.java = cbrubaker@google.com
per-file DirectBootHostTest.java = jsharkey@google.com
per-file DocumentsTestCase.java = jsharkey@google.com
per-file DocumentsTest.java = jsharkey@google.com
@@ -27,7 +28,13 @@
per-file PkgInstallSignatureVerificationTest.java = cbrubaker@google.com
per-file PrivilegedUpdateTests.java = toddke@google.com
per-file ScopedDirectoryAccessTest.java = jsharkey@google.com
+per-file SharedUserIdTest.java = toddke@google.com
per-file SplitTests.java = toddke@google.com
per-file StorageHostTest.java = jsharkey@google.com
per-file UseEmbeddedDexTest.java = victorhsieh@google.com
+# test apps
+per-file BasePermissionsTest.java = moltmann@google.com
+per-file RequestsOnlyCalendarApp22.java = moltmann@google.com
+per-file ReviewPermissionHelper = moltmann@google.com
per-file UsePermission*.java = moltmann@google.com
+
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
index 3149383..946b74d 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
@@ -416,7 +416,7 @@
}
public void testPermissionSplit28() throws Exception {
- if (getDevice().hasFeature("android.software.leanback")) {
+ if (getDevice().hasFeature("feature:android.software.leanback")) {
return;
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_28), false, false));
@@ -425,7 +425,7 @@
}
public void testPermissionNotSplit29() throws Exception {
- if (getDevice().hasFeature("android.software.leanback")) {
+ if (getDevice().hasFeature("feature:android.software.leanback")) {
return;
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_29), false, false));
@@ -440,7 +440,7 @@
}
public void testRequestBoth() throws Exception {
- if (getDevice().hasFeature("android.software.leanback")) {
+ if (getDevice().hasFeature("feature:android.software.leanback")) {
return;
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_29), false, false));
@@ -449,7 +449,7 @@
}
public void testRequestBothInSequence() throws Exception {
- if (getDevice().hasFeature("android.software.leanback")) {
+ if (getDevice().hasFeature("feature:android.software.leanback")) {
return;
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_29), false, false));
@@ -458,7 +458,7 @@
}
public void testRequestBothButGrantInSequence() throws Exception {
- if (getDevice().hasFeature("android.software.leanback")) {
+ if (getDevice().hasFeature("feature:android.software.leanback")) {
return;
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_29), false, false));
@@ -467,7 +467,7 @@
}
public void testDenyBackgroundWithPrejudice() throws Exception {
- if (getDevice().hasFeature("android.software.leanback")) {
+ if (getDevice().hasFeature("feature:android.software.leanback")) {
return;
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_29), false, false));
@@ -476,7 +476,7 @@
}
public void testPermissionNotSplitLatest() throws Exception {
- if (getDevice().hasFeature("android.software.leanback")) {
+ if (getDevice().hasFeature("feature:android.software.leanback")) {
return;
}
assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK_Latest), false, false));
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/OWNERS b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/OWNERS
new file mode 100644
index 0000000..98dd33e
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+cbrubaker@google.com
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/OWNERS b/hostsidetests/appsecurity/test-apps/AccessSerialModern/OWNERS
new file mode 100644
index 0000000..98dd33e
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+cbrubaker@google.com
diff --git a/hostsidetests/appsecurity/test-apps/Android.bp b/hostsidetests/appsecurity/test-apps/Android.bp
index 64bfa62..6d60626 100644
--- a/hostsidetests/appsecurity/test-apps/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/Android.bp
@@ -37,6 +37,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
optimize: {
@@ -68,6 +69,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
optimize: {
@@ -98,6 +100,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
optimize: {
@@ -130,6 +133,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
}
@@ -155,6 +159,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
min_sdk_version: "22",
@@ -186,6 +191,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
}
diff --git a/hostsidetests/appsecurity/test-apps/CorruptApkTests/OWNERS b/hostsidetests/appsecurity/test-apps/CorruptApkTests/OWNERS
new file mode 100644
index 0000000..21cd9d9
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/CorruptApkTests/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 568761
+rtmitchell@google.com
diff --git a/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.bp b/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.bp
index 42242c6..d7b8c37 100644
--- a/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.bp
@@ -22,6 +22,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
dex_preopt: {
enabled: false,
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/OWNERS b/hostsidetests/appsecurity/test-apps/DocumentClient/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/DocumentProvider/OWNERS b/hostsidetests/appsecurity/test-apps/DocumentProvider/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/DocumentProvider/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/DuplicatePermissionDeclareApp/OWNERS b/hostsidetests/appsecurity/test-apps/DuplicatePermissionDeclareApp/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/DuplicatePermissionDeclareApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/OWNERS b/hostsidetests/appsecurity/test-apps/EncryptionApp/OWNERS
new file mode 100644
index 0000000..aacd866
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 49763
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/OWNERS b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.bp b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.bp
index 12bc836..b012ac0 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.bp
@@ -24,6 +24,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
optimize: {
enabled: false,
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/OWNERS b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/OWNERS b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/OWNERS b/hostsidetests/appsecurity/test-apps/InstantCookieApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/OWNERS b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/OWNERS b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/OWNERS b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/OWNERS
new file mode 100644
index 0000000..40cc594
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+cbrubaker@google.com
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/OWNERS b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/ListeningPortsApp/OWNERS b/hostsidetests/appsecurity/test-apps/ListeningPortsApp/OWNERS
new file mode 100644
index 0000000..40cc594
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ListeningPortsApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+cbrubaker@google.com
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/OWNERS b/hostsidetests/appsecurity/test-apps/MajorVersionApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/MediaStorageApp/OWNERS b/hostsidetests/appsecurity/test-apps/MediaStorageApp/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MediaStorageApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/OWNERS b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/OWNERS b/hostsidetests/appsecurity/test-apps/NoRestartApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/OWNERS b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/OWNERS b/hostsidetests/appsecurity/test-apps/PackageAccessApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/OWNERS b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/OWNERS b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.bp b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.bp
index c01f8b8..af55a55 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.bp
@@ -29,6 +29,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
optimize: {
enabled: false,
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/OWNERS b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/OWNERS b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/OWNERS b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/RequestsOnlyCalendarApp22/OWNERS b/hostsidetests/appsecurity/test-apps/RequestsOnlyCalendarApp22/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/RequestsOnlyCalendarApp22/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/ReviewPermissionHelper/Android.bp b/hostsidetests/appsecurity/test-apps/ReviewPermissionHelper/Android.bp
index 0a00438..5488ecb 100644
--- a/hostsidetests/appsecurity/test-apps/ReviewPermissionHelper/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/ReviewPermissionHelper/Android.bp
@@ -24,5 +24,6 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
}
diff --git a/hostsidetests/appsecurity/test-apps/ReviewPermissionHelper/OWNERS b/hostsidetests/appsecurity/test-apps/ReviewPermissionHelper/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ReviewPermissionHelper/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstall/OWNERS b/hostsidetests/appsecurity/test-apps/SharedUidInstall/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstall/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/OWNERS b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/OWNERS b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/OWNERS b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/OWNERS
new file mode 100644
index 0000000..87e75ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 533114
+toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/StorageApp/OWNERS b/hostsidetests/appsecurity/test-apps/StorageApp/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/StorageApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/OWNERS b/hostsidetests/appsecurity/test-apps/StorageStatsApp/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/OWNERS b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/OWNERS
new file mode 100644
index 0000000..5a88bff
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 86431
+victorhsieh@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.bp b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.bp
index 9bcf428..705f7c9 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.bp
@@ -35,6 +35,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
optimize: {
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.bp b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.bp
index 5286c5f..30029bb 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.bp
@@ -36,6 +36,7 @@
"cts",
"vts",
"general-tests",
+ "mts",
],
certificate: ":cts-testkey2",
optimize: {
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp28/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionApp28/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp28/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp29/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionApp29/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp29/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/OWNERS
new file mode 100644
index 0000000..e5912b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137825
+moltmann@google.com
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/OWNERS b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp2/OWNERS b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp2/OWNERS
new file mode 100644
index 0000000..9fe672b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp2/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 95221
+jsharkey@google.com
diff --git a/hostsidetests/appsecurity/test-apps/rro/OWNERS b/hostsidetests/appsecurity/test-apps/rro/OWNERS
new file mode 100644
index 0000000..21cd9d9
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/rro/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 568761
+rtmitchell@google.com
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
index b30e8d6..2d839c0 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
@@ -51,12 +51,6 @@
public static class BasicAdminService extends Service {
@Override
- public void onCreate() {
- super.onCreate();
- putBooleanPref(getApplicationContext(), KEY_TRANSFER_ADMIN_SERVICE_BOUND, true);
- }
-
- @Override
public IBinder onBind(Intent intent) {
return null;
}
@@ -68,8 +62,6 @@
private final static String SHARED_PREFERENCE_NAME = "shared-preference-name";
private final static String KEY_TRANSFER_COMPLETED_CALLED = "key-transfer-completed-called";
- private final static String KEY_TRANSFER_ADMIN_SERVICE_BOUND =
- "key-transfer-admin-service-bound";
private final static String ARE_PARAMETERS_SAVED = "ARE_PARAMETERS_SAVED";
protected Context mContext;
@@ -120,11 +112,6 @@
assertTrue(bundle.isEmpty());
}
- @Test
- public void testAdminServiceIsBound() {
- assertTrue(getBooleanPref(mContext, KEY_TRANSFER_ADMIN_SERVICE_BOUND));
- }
-
private static SharedPreferences getPrefs(Context context) {
return context.getSharedPreferences(SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE);
}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerHostSideTransferTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerHostSideTransferTest.java
index 9cdcf1a..ea7bdc4 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerHostSideTransferTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerHostSideTransferTest.java
@@ -5,6 +5,8 @@
import com.android.cts.devicepolicy.metrics.DevicePolicyEventWrapper;
import com.android.tradefed.device.DeviceNotAvailableException;
+import static com.google.common.truth.Truth.assertThat;
+
import android.stats.devicepolicy.EventId;
public abstract class DeviceAndProfileOwnerHostSideTransferTest extends BaseDevicePolicyTest {
@@ -24,6 +26,10 @@
"com.android.cts.transferowner.TransferProfileOwnerOutgoingTest";
protected static final String TRANSFER_PROFILE_OWNER_INCOMING_TEST =
"com.android.cts.transferowner.TransferProfileOwnerIncomingTest";
+ private final String INCOMING_ADMIN_SERVICE_FULL_NAME =
+ "com.android.cts.transferowner"
+ + ".DeviceAndProfileOwnerTransferIncomingTest$BasicAdminService";
+
protected int mUserId;
protected String mOutgoingTestClassName;
@@ -215,9 +221,13 @@
runDeviceTestsAsUser(TRANSFER_OWNER_OUTGOING_PKG,
mOutgoingTestClassName,
"testTransferOwnership", mUserId);
- runDeviceTestsAsUser(TRANSFER_OWNER_INCOMING_PKG,
- mIncomingTestClassName,
- "testAdminServiceIsBound", mUserId);
+ assertServiceRunning(INCOMING_ADMIN_SERVICE_FULL_NAME);
+ }
+
+ private void assertServiceRunning(String serviceName) throws DeviceNotAvailableException {
+ final String result = getDevice().executeShellCommand(
+ String.format("dumpsys activity services %s", serviceName));
+ assertThat(result).contains("app=ProcessRecord");
}
protected void setSameAffiliationId(int profileUserId, String testClassName)
@@ -239,9 +249,4 @@
testClassName,
"testIsAffiliationId1", profileUserId);
}
-
- /* TODO: Add tests for:
- * 1. passwordOwner
- *
- * */
}
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecVendorCommandsTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecVendorCommandsTest.java
index 49c5b3b..d4111d4 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecVendorCommandsTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecVendorCommandsTest.java
@@ -52,7 +52,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/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/os/OWNERS b/hostsidetests/os/OWNERS
new file mode 100644
index 0000000..ca737ac
--- /dev/null
+++ b/hostsidetests/os/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 25692
+michaelwr@google.com
+santoscordon@google.com
+per-file InattentiveSleepTests.java=rgl@google.com, robhor@google.com
diff --git a/hostsidetests/security/src/android/cts/security/KernelConfigTest.java b/hostsidetests/security/src/android/cts/security/KernelConfigTest.java
index a8b1179..9834561 100644
--- a/hostsidetests/security/src/android/cts/security/KernelConfigTest.java
+++ b/hostsidetests/security/src/android/cts/security/KernelConfigTest.java
@@ -227,14 +227,19 @@
*/
@CddTest(requirement="9.7")
public void testConfigHardwareMitigations() throws Exception {
+ String mitigations[];
+
if (PropertyUtil.getFirstApiLevel(mDevice) < 28) {
return;
}
if (CpuFeatures.isArm64(mDevice) && !CpuFeatures.kernelVersionLessThan(mDevice, 4, 4)) {
- for (String mitigation : lookupMitigations()) {
- assertTrue("Linux kernel must have " + mitigation + " enabled.",
- configSet.contains(mitigation));
+ mitigations = lookupMitigations();
+ if (mitigations != null) {
+ for (String mitigation : mitigations) {
+ assertTrue("Linux kernel must have " + mitigation + " enabled.",
+ configSet.contains(mitigation));
+ }
}
} else if (CpuFeatures.isX86(mDevice)) {
assertTrue("Linux kernel must have KPTI enabled: CONFIG_PAGE_TABLE_ISOLATION=y",
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 e705117..6aa8be6 100644
--- a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
@@ -213,6 +213,11 @@
StageSessionResult failedSessionResult = stageSingleApk(TestApp.A1);
assertThat(failedSessionResult.getErrorMessage()).contains(
"There is already in-progress committed staged session");
+ // Currently abandoning a session before pre-reboot verification finishes might result in
+ // a system_server crash. Before that issue is resolved we need to manually wait for
+ // pre-reboot verification to finish before abandoning sessions.
+ // TODO(b/145925842): remove following line after fixing the bug.
+ waitForIsReadyBroadcast(sessionId);
getPackageInstaller().abandonSession(sessionId);
}
@@ -223,6 +228,11 @@
StageSessionResult failedSessionResult = stageMultipleApks(TestApp.A1, TestApp.B1);
assertThat(failedSessionResult.getErrorMessage()).contains(
"There is already in-progress committed staged session");
+ // Currently abandoning a session before pre-reboot verification finishes might result in
+ // a system_server crash. Before that issue is resolved we need to manually wait for
+ // pre-reboot verification to finish before abandoning sessions.
+ // TODO(b/145925842): remove following line after fixing the bug.
+ waitForIsReadyBroadcast(sessionId);
getPackageInstaller().abandonSession(sessionId);
}
@@ -234,6 +244,11 @@
StageSessionResult failedSessionResult = stageSingleApk(TestApp.A1);
assertThat(failedSessionResult.getErrorMessage()).contains(
"There is already in-progress committed staged session");
+ // Currently abandoning a session before pre-reboot verification finishes might result in
+ // a system_server crash. Before that issue is resolved we need to manually wait for
+ // pre-reboot verification to finish before abandoning sessions.
+ // TODO(b/145925842): remove following line after fixing the bug.
+ waitForIsReadyBroadcast(sessionId);
getPackageInstaller().abandonSession(sessionId);
}
@@ -245,6 +260,11 @@
StageSessionResult failedSessionResult = stageMultipleApks(TestApp.A1, TestApp.B1);
assertThat(failedSessionResult.getErrorMessage()).contains(
"There is already in-progress committed staged session");
+ // Currently abandoning a session before pre-reboot verification finishes might result in
+ // a system_server crash. Before that issue is resolved we need to manually wait for
+ // pre-reboot verification to finish before abandoning sessions.
+ // TODO(b/145925842): remove following line after fixing the bug.
+ waitForIsReadyBroadcast(sessionId);
getPackageInstaller().abandonSession(sessionId);
}
@@ -287,6 +307,11 @@
int sessionId = stageSingleApk(TestApp.A1).assertSuccessful().getSessionId();
PackageInstaller.SessionInfo session = packageInstaller.getActiveStagedSession();
assertThat(session.getSessionId()).isEqualTo(sessionId);
+ // Currently abandoning a session before pre-reboot verification finishes might result in
+ // a system_server crash. Before that issue is resolved we need to manually wait for
+ // pre-reboot verification to finish before abandoning sessions.
+ // TODO(b/145925842): remove following line after fixing the bug.
+ waitForIsReadyBroadcast(sessionId);
}
@Test
@@ -302,6 +327,11 @@
.assertSuccessful().getSessionId();
PackageInstaller.SessionInfo session = getPackageInstaller().getActiveStagedSession();
assertThat(session.getSessionId()).isEqualTo(sessionId);
+ // Currently abandoning a session before pre-reboot verification finishes might result in
+ // a system_server crash. Before that issue is resolved we need to manually wait for
+ // pre-reboot verification to finish before abandoning sessions.
+ // TODO(b/145925842): remove following line after fixing the bug.
+ waitForIsReadyBroadcast(sessionId);
}
@Test
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..e3bdbdd 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..5f05659 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..680dfb2 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..6103b50 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..cf0e800 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_signed_bob.apex b/hostsidetests/stagedinstall/testdata/apex/com.android.apex.cts.shim.v2_signed_bob.apex
index b43ad69..0af717c 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..d3f7014 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..05f1cbb 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..37acf43 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..c82c1e0 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..d9905a8 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..dfb6757 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..ca32c0d 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..befa6b2 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/src/android/cts/statsd/alert/AnomalyDetectionTests.java b/hostsidetests/statsd/src/android/cts/statsd/alert/AnomalyDetectionTests.java
index 3109138..3b81a0b 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/alert/AnomalyDetectionTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/alert/AnomalyDetectionTests.java
@@ -69,6 +69,23 @@
}
}
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (PERFETTO_TESTS_ENABLED) {
+ //Deadline to finish trace collection
+ final long deadLine = System.currentTimeMillis() + 10000;
+ while (isSystemTracingEnabled()) {
+ if (System.currentTimeMillis() > deadLine) {
+ CLog.w("/sys/kernel/debug/tracing/tracing_on is still 1 after 10 secs : " + isSystemTracingEnabled());
+ break;
+ }
+ CLog.d("Waiting to finish collecting traces. ");
+ Thread.sleep(WAIT_TIME_SHORT);
+ }
+ }
+ }
+
// Tests that anomaly detection for count works.
// Also tests that anomaly detection works when spanning multiple buckets.
public void testCountAnomalyDetection() throws Exception {
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/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..2608830 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
@@ -247,6 +247,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;
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.h b/tests/tests/binder_ndk/libbinder_ndk_test/utilities.h
index e9d6ad5..009ff31 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))
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
index e73c11a..73897fd 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
@@ -36,8 +36,8 @@
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
-import android.os.Build;
import android.os.AsyncTask;
+import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.ParcelUuid;
@@ -278,11 +278,15 @@
if (mTelephonyManager.getPhoneCount() == 1) {
return;
}
+
+ /* TODO: b/145993690 */
if (mTelephonyManager.getPhoneCount() == 2 && activeSubscriptionInfoCount != 2) {
- fail("This test requires two SIM cards.");
+ /* This test requires two SIM cards */
+ return;
}
if (subIdWithCarrierPrivilege == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
- failMessage();
+ /* This test requires SIM with carrier privilege */
+ return;
}
List<SubscriptionInfo> subscriptionInfoList =
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index 39ec713..9232dc9 100644
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -281,11 +281,17 @@
}
public void testAlarmClockDismissAlarm() {
+ if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY)) {
+ return;
+ }
Intent intent = new Intent(AlarmClock.ACTION_DISMISS_ALARM);
assertCanBeHandled(intent);
}
public void testAlarmClockSnoozeAlarm() {
+ if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY)) {
+ return;
+ }
Intent intent = new Intent(AlarmClock.ACTION_SNOOZE_ALARM);
intent.putExtra(AlarmClock.EXTRA_ALARM_SNOOZE_DURATION, 10);
assertCanBeHandled(intent);
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/cronet/Android.bp b/tests/tests/cronet/Android.bp
new file mode 100644
index 0000000..0b50579
--- /dev/null
+++ b/tests/tests/cronet/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+
+// TODO: Move this target to cts/tests/tests/net/cronet
+android_test {
+ name: "CtsCronetTestCases",
+ defaults: ["cts_defaults"],
+
+ // Include both the 32 and 64 bit versions
+ compile_multilib: "both",
+
+ static_libs: [
+ "CronetApiCommonTests",
+ "ctstestrunner-axt",
+ ],
+
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ "mts",
+ ],
+
+}
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/cronet/AndroidTest.xml b/tests/tests/cronet/AndroidTest.xml
new file mode 100644
index 0000000..79c37f7
--- /dev/null
+++ b/tests/tests/cronet/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="Config for CTS Cronet test cases">
+ <option name="test-suite-tag" value="cts" />
+ <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="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="CtsCronetTestCases.apk" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="android.cronet.cts" />
+ <option name="runtime-hint" value="10s" />
+ </test>
+</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/src/android/graphics/cts/ImageDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
index 596e939..a6b04c6 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
@@ -1911,6 +1911,7 @@
if (resId == R.drawable.webp_orientation1) {
// The webp files may not look exactly the same as the jpegs.
// Recreate the reference.
+ reference.recycle();
reference = null;
}
Uri uri = getAsResourceUri(resId);
@@ -1928,6 +1929,7 @@
reference = bm;
} else {
BitmapUtils.compareBitmaps(bm, reference);
+ bm.recycle();
}
} catch (IOException e) {
fail("Decoding " + uri.toString() + " yielded " + e);
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/location/src/android/location/cts/ScanningSettingsTest.java b/tests/tests/location/src/android/location/cts/ScanningSettingsTest.java
index ea81089..5da1f97 100644
--- a/tests/tests/location/src/android/location/cts/ScanningSettingsTest.java
+++ b/tests/tests/location/src/android/location/cts/ScanningSettingsTest.java
@@ -65,6 +65,10 @@
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
mPackageManager = mContext.getPackageManager();
+ if (isTv()) {
+ // TV does not support the setting options of WIFI scanning and Bluetooth scanning
+ return;
+ }
final Intent launcherIntent = new Intent(Intent.ACTION_MAIN);
launcherIntent.addCategory(Intent.CATEGORY_HOME);
mLauncherPackage = mPackageManager.resolveActivity(launcherIntent,
@@ -73,17 +77,28 @@
@CddTest(requirement = "7.4.2/C-2-1")
public void testWifiScanningSettings() throws PackageManager.NameNotFoundException {
+ if (isTv()) {
+ return;
+ }
launchScanningSettings();
toggleSettingAndVerify(WIFI_SCANNING_TITLE_RES, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE);
}
@CddTest(requirement = "7.4.3/C-4-1")
public void testBleScanningSettings() throws PackageManager.NameNotFoundException {
+ if (isTv()) {
+ return;
+ }
launchScanningSettings();
toggleSettingAndVerify(BLUETOOTH_SCANNING_TITLE_RES,
Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE);
}
+ private boolean isTv() {
+ return mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
+ && mPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+ }
+
private void launchScanningSettings() {
// Start from the home screen
mDevice.pressHome();
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/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 7c396cb..aba1d72 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -39,6 +39,7 @@
import android.view.Surface;
import android.net.Uri;
+import com.android.compatibility.common.util.CddTest;
import com.android.compatibility.common.util.DeviceReportLog;
import com.android.compatibility.common.util.DynamicConfigDeviceSide;
import com.android.compatibility.common.util.MediaUtils;
@@ -231,57 +232,83 @@
public void testDecodeOpusMp4() throws Exception {
testTimeStampOrdering(R.raw.sinesweepopusmp4);
}
- public void testDecodeOpusChannelsAndRates() throws Exception {
- int[] sampleRates = { 16000, 24000, 44100, 48000 };
+
+ @CddTest(requirement="5.1.3")
+ public void testDecodeG711ChannelsAndRates() throws Exception {
+ String[] mimetypes = { MediaFormat.MIMETYPE_AUDIO_G711_ALAW,
+ MediaFormat.MIMETYPE_AUDIO_G711_MLAW };
+ int[] sampleRates = { 8000 };
int[] channelMasks = { AudioFormat.CHANNEL_OUT_MONO,
AudioFormat.CHANNEL_OUT_STEREO,
AudioFormat.CHANNEL_OUT_5POINT1 };
- for (MediaCodecInfo codecInfo : getOpusDecoderMediaCodecInfoList()) {
- MediaCodec codec = MediaCodec.createByCodecName(codecInfo.getCanonicalName());
- for (int sampleRate : sampleRates) {
- for (int channelMask : channelMasks) {
- int channelCount = AudioFormat.channelCountFromOutChannelMask(channelMask);
+ verifyChannelsAndRates(mimetypes, sampleRates, channelMasks);
+ }
- codec.reset();
- MediaFormat desiredFormat = MediaFormat.createAudioFormat(
- MediaFormat.MIMETYPE_AUDIO_OPUS,
- sampleRate,
- channelCount);
- codec.configure(desiredFormat, null, null, 0);
+ @CddTest(requirement="5.1.3")
+ public void testDecodeOpusChannelsAndRates() throws Exception {
+ String[] mimetypes = { MediaFormat.MIMETYPE_AUDIO_OPUS };
+ int[] sampleRates = { 8000, 12000, 16000, 24000, 48000 };
+ int[] channelMasks = { AudioFormat.CHANNEL_OUT_MONO,
+ AudioFormat.CHANNEL_OUT_STEREO,
+ AudioFormat.CHANNEL_OUT_5POINT1 };
- Log.d(TAG, "codec: " + codecInfo.getCanonicalName() +
- " sample rate: " + sampleRate +
- " channelcount:" + channelCount);
+ verifyChannelsAndRates(mimetypes, sampleRates, channelMasks);
+ }
- MediaFormat actualFormat = codec.getInputFormat();
- int actualChannels = actualFormat.getInteger(MediaFormat.KEY_CHANNEL_COUNT, -1);
- int actualSampleRate = actualFormat.getInteger(MediaFormat.KEY_SAMPLE_RATE, -1);
- assertTrue("channels: configured " + actualChannels + " != desired " + channelCount,
- actualChannels == channelCount);
- assertTrue("sample rate: configured " + actualSampleRate + " != desired " + sampleRate,
- actualSampleRate == sampleRate);
+ private void verifyChannelsAndRates(String[] mimetypes, int[] sampleRates,
+ int[] channelMasks) throws Exception {
+
+ for (String mimetype : mimetypes) {
+ ArrayList<MediaCodecInfo> codecInfoList = getDecoderMediaCodecInfoList(mimetype);
+ if (codecInfoList == null) {
+ continue;
+ }
+ for (MediaCodecInfo codecInfo : codecInfoList) {
+ MediaCodec codec = MediaCodec.createByCodecName(codecInfo.getName());
+ for (int sampleRate : sampleRates) {
+ for (int channelMask : channelMasks) {
+ int channelCount = AudioFormat.channelCountFromOutChannelMask(channelMask);
+
+ codec.reset();
+ MediaFormat desiredFormat = MediaFormat.createAudioFormat(
+ mimetype,
+ sampleRate,
+ channelCount);
+ codec.configure(desiredFormat, null, null, 0);
+
+ Log.d(TAG, "codec: " + codecInfo.getName() +
+ " sample rate: " + sampleRate +
+ " channelcount:" + channelCount);
+
+ MediaFormat actual = codec.getInputFormat();
+ int actualChannels = actual.getInteger(MediaFormat.KEY_CHANNEL_COUNT, -1);
+ int actualSampleRate = actual.getInteger(MediaFormat.KEY_SAMPLE_RATE, -1);
+ assertTrue("channels: configured " + actualChannels +
+ " != desired " + channelCount, actualChannels == channelCount);
+ assertTrue("sample rate: configured " + actualSampleRate +
+ " != desired " + sampleRate, actualSampleRate == sampleRate);
+ }
}
+ codec.release();
}
-
- codec.release();
}
}
- private ArrayList<MediaCodecInfo> getOpusDecoderMediaCodecInfoList() {
+ private ArrayList<MediaCodecInfo> getDecoderMediaCodecInfoList(String mimeType) {
MediaCodecList mediaCodecList = new MediaCodecList(MediaCodecList.ALL_CODECS);
- ArrayList<MediaCodecInfo> opusDecoderInfos = new ArrayList<MediaCodecInfo>();
+ ArrayList<MediaCodecInfo> decoderInfos = new ArrayList<MediaCodecInfo>();
for (MediaCodecInfo codecInfo : mediaCodecList.getCodecInfos()) {
- if (!codecInfo.isEncoder() && isOpusSupported(codecInfo)) {
- opusDecoderInfos.add(codecInfo);
+ if (!codecInfo.isEncoder() && isMimeTypeSupported(codecInfo, mimeType)) {
+ decoderInfos.add(codecInfo);
}
}
- return opusDecoderInfos;
+ return decoderInfos;
}
- private boolean isOpusSupported(MediaCodecInfo codecInfo) {
+ private boolean isMimeTypeSupported(MediaCodecInfo codecInfo, String mimeType) {
for (String type : codecInfo.getSupportedTypes()) {
- if (type.equalsIgnoreCase(MediaFormat.MIMETYPE_AUDIO_OPUS)) {
+ if (type.equalsIgnoreCase(mimeType)) {
return true;
}
}
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/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
index bbc2298..fa7e138 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -16,8 +16,10 @@
package android.net.cts;
+import static android.content.pm.PackageManager.FEATURE_ETHERNET;
import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
import static android.content.pm.PackageManager.FEATURE_WIFI;
+import static android.content.pm.PackageManager.FEATURE_USB_HOST;
import static android.net.NetworkCapabilities.NET_CAPABILITY_IMS;
import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
@@ -257,7 +259,7 @@
public void testGetNetworkInfo() {
for (int type = -1; type <= ConnectivityManager.MAX_NETWORK_TYPE+1; type++) {
- if (isSupported(type)) {
+ if (shouldBeSupported(type)) {
NetworkInfo ni = mCm.getNetworkInfo(type);
assertTrue("Info shouldn't be null for " + type, ni != null);
State state = ni.getState();
@@ -277,7 +279,7 @@
NetworkInfo[] ni = mCm.getAllNetworkInfo();
assertTrue(ni.length >= MIN_NUM_NETWORK_TYPES);
for (int type = 0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
- int desiredFoundCount = (isSupported(type) ? 1 : 0);
+ int desiredFoundCount = (shouldBeSupported(type) ? 1 : 0);
int foundCount = 0;
for (NetworkInfo i : ni) {
if (i.getType() == type) foundCount++;
@@ -385,20 +387,32 @@
assertStartUsingNetworkFeatureUnsupported(TYPE_WIFI, mmsFeature);
}
- private boolean isSupported(int networkType) {
+ private boolean shouldEthernetBeSupported() {
+ // Instant mode apps aren't allowed to query the Ethernet service due to selinux policies.
+ // When in instant mode, don't fail if the Ethernet service is available. Instead, rely on
+ // the fact that Ethernet should be supported if the device has a hardware Ethernet port, or
+ // if the device can be a USB host and thus can use USB Ethernet adapters.
+ //
+ // Note that this test this will still fail in instant mode if a device supports Ethernet
+ // via other hardware means. We are not currently aware of any such device.
+ return (mContext.getSystemService(Context.ETHERNET_SERVICE) != null) ||
+ mPackageManager.hasSystemFeature(FEATURE_ETHERNET) ||
+ mPackageManager.hasSystemFeature(FEATURE_USB_HOST);
+ }
+
+ private boolean shouldBeSupported(int networkType) {
return mNetworks.containsKey(networkType) ||
(networkType == ConnectivityManager.TYPE_VPN) ||
- (networkType == ConnectivityManager.TYPE_ETHERNET &&
- mContext.getSystemService(Context.ETHERNET_SERVICE) != null);
+ (networkType == ConnectivityManager.TYPE_ETHERNET && shouldEthernetBeSupported());
}
public void testIsNetworkSupported() {
for (int type = -1; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
boolean supported = mCm.isNetworkSupported(type);
- if (isSupported(type)) {
- assertTrue(supported);
+ if (shouldBeSupported(type)) {
+ assertTrue("Network type " + type + " should be supported", supported);
} else {
- assertFalse(supported);
+ assertFalse("Network type " + type + " should not be supported", supported);
}
}
}
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/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 36c7cbf..7fc29e2 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -1790,6 +1790,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 +1959,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. -->
diff --git a/tests/tests/permission2/res/raw/automotive_android_manifest.xml b/tests/tests/permission2/res/raw/automotive_android_manifest.xml
index fac0789..dac484b 100644
--- a/tests/tests/permission2/res/raw/automotive_android_manifest.xml
+++ b/tests/tests/permission2/res/raw/automotive_android_manifest.xml
@@ -281,6 +281,12 @@
android:label="@string/car_permission_label_enroll_trust"
android:description="@string/car_permission_desc_enroll_trust" />
+ <permission
+ android:name="android.car.permission.CAR_TEST_SERVICE"
+ android:protectionLevel="system|signature"
+ android:label="@string/car_permission_label_car_test_service"
+ android:description="@string/car_permission_desc_car_test_service" />
+
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.DEVICE_POWER" />
<uses-permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS" />
diff --git a/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java b/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java
index 197e73d..4195add 100644
--- a/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/ProtectedBroadcastsTest.java
@@ -84,7 +84,6 @@
"android.intent.action.SIM_STATE_CHANGED",
"android.intent.action.DATA_CONNECTION_FAILED",
"android.intent.action.NETWORK_SET_TIME",
- "android.intent.action.NETWORK_SET_TIMEZONE",
"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/role/Android.bp b/tests/tests/role/Android.bp
index ac8d967..72b89ef 100644
--- a/tests/tests/role/Android.bp
+++ b/tests/tests/role/Android.bp
@@ -17,7 +17,7 @@
sdk_version: "test_current",
srcs: [
- "src/**/*.java"
+ "src/**/*.java",
],
static_libs: [
@@ -31,5 +31,6 @@
"cts",
"vts",
"general-tests",
- ]
+ "mts",
+ ],
}
diff --git a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
index 0da6988..3d96ab3 100644
--- a/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
+++ b/tests/tests/role/src/android/app/role/cts/RoleManagerTest.java
@@ -22,6 +22,7 @@
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
import android.app.Activity;
import android.app.AppOpsManager;
@@ -385,6 +386,7 @@
@Test
public void targetCurrentSdkAndChangeDefaultDialerThenIsCanceled() throws Exception {
+ assumeTrue(sRoleManager.isRoleAvailable(RoleManager.ROLE_DIALER));
WaitForResultActivity activity = mActivityRule.getActivity();
activity.startActivityToWaitForResult(new Intent()
.setComponent(new ComponentName(APP_PACKAGE_NAME,
@@ -396,6 +398,7 @@
@Test
public void targetCurrentSdkAndChangeDefaultSmsThenIsCanceled() throws Exception {
+ assumeTrue(sRoleManager.isRoleAvailable(RoleManager.ROLE_SMS));
WaitForResultActivity activity = mActivityRule.getActivity();
activity.startActivityToWaitForResult(new Intent()
.setComponent(new ComponentName(APP_PACKAGE_NAME,
@@ -408,6 +411,7 @@
@FlakyTest
@Test
public void targetSdk28AndChangeDefaultDialerAndAllowThenIsDefaultDialer() throws Exception {
+ assumeTrue(sRoleManager.isRoleAvailable(RoleManager.ROLE_DIALER));
sContext.startActivity(new Intent()
.setComponent(new ComponentName(APP_28_PACKAGE_NAME,
APP_28_CHANGE_DEFAULT_DIALER_ACTIVITY_NAME))
@@ -422,6 +426,7 @@
@FlakyTest
@Test
public void targetSdk28AndChangeDefaultSmsAndAllowThenIsDefaultSms() throws Exception {
+ assumeTrue(sRoleManager.isRoleAvailable(RoleManager.ROLE_SMS));
sContext.startActivity(new Intent()
.setComponent(new ComponentName(APP_28_PACKAGE_NAME,
APP_28_CHANGE_DEFAULT_SMS_ACTIVITY_NAME))
diff --git a/tests/tests/sdkext/Android.bp b/tests/tests/sdkext/Android.bp
new file mode 100644
index 0000000..9ad6c7f
--- /dev/null
+++ b/tests/tests/sdkext/Android.bp
@@ -0,0 +1,30 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test {
+ name: "CtsSdkExtTestCases",
+ defaults: ["cts_defaults"],
+ static_libs: [
+ "androidx.test.rules",
+ "ctstestrunner-axt",
+ ],
+ srcs: [ "src/**/*.java" ],
+ test_config: "CtsSdkExtTestCases.xml",
+ test_suites: [
+ "cts",
+ "mts",
+ "general-tests",
+ ],
+ sdk_version: "system_current",
+}
diff --git a/tests/tests/sdkext/AndroidManifest.xml b/tests/tests/sdkext/AndroidManifest.xml
new file mode 100644
index 0000000..a6391b5
--- /dev/null
+++ b/tests/tests/sdkext/AndroidManifest.xml
@@ -0,0 +1,28 @@
+<?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.os.ext.cts">
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.os.ext.cts"
+ android:label="CTS tests of android.os.ext">
+ <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/sdkext/CtsSdkExtTestCases.xml
new file mode 100644
index 0000000..b22653c
--- /dev/null
+++ b/tests/tests/sdkext/CtsSdkExtTestCases.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<configuration description="Configuration for SdkExt 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" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="android.os.ext.cts" />
+ </test>
+</configuration>
diff --git a/tests/tests/sdkext/TEST_MAPPING b/tests/tests/sdkext/TEST_MAPPING
new file mode 100644
index 0000000..91947f3
--- /dev/null
+++ b/tests/tests/sdkext/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+ "presubmit": [
+ {
+ "name": "CtsSdkExtTestCases"
+ }
+ ]
+}
diff --git a/tests/tests/sdkext/src/android/os/ext/cts/SdkExtensionsTest.java b/tests/tests/sdkext/src/android/os/ext/cts/SdkExtensionsTest.java
new file mode 100644
index 0000000..884f5ef
--- /dev/null
+++ b/tests/tests/sdkext/src/android/os/ext/cts/SdkExtensionsTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.os.ext.cts;
+
+import android.os.Build;
+import android.os.ext.SdkExtensions;
+import junit.framework.TestCase;
+
+public class SdkExtensionsTest extends TestCase {
+
+ /** Verify that getExtensionVersion only accepts valid extension SDKs */
+ public void testBadArgument() throws Exception {
+ // R is the first SDK version with extensions.
+ for (int sdk = -1_000_000; sdk < Build.VERSION_CODES.R; sdk++) {
+ try {
+ SdkExtensions.getExtensionVersion(sdk);
+ fail("expected IllegalArgumentException");
+ } catch (IllegalArgumentException expected) { }
+ }
+ }
+
+ /** Verifies that getExtensionVersion only return existing versions */
+ public void testValidValues() throws Exception {
+ for (int sdk = Build.VERSION_CODES.R; sdk <= 1_000_000; sdk++) {
+ // No extension SDKs versions yet.
+ assertEquals(0, SdkExtensions.getExtensionVersion(sdk));
+ }
+ }
+}
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 67918b2..d1daa5a 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -868,8 +868,11 @@
Thread server = new Thread() {
@Override
public void run() {
- try (ServerSocket serverSocket = new ServerSocket(8080);
- Socket conn = serverSocket.accept()) {
+ try (ServerSocket serverSocket = new ServerSocket(8080) {
+ {setSoTimeout(10_000);} // time out after 10 seconds
+ };
+ Socket conn = serverSocket.accept();
+ ) {
OutputStream outputstream = conn.getOutputStream();
InputStream inputStream = conn.getInputStream();
byte input[] = new byte[65536];
diff --git a/tests/tests/selinux/TEST_MAPPING b/tests/tests/selinux/TEST_MAPPING
new file mode 100644
index 0000000..a8bae77
--- /dev/null
+++ b/tests/tests/selinux/TEST_MAPPING
@@ -0,0 +1,20 @@
+{
+ "presubmit": [
+ {
+ "name": "CtsSelinuxEphemeralTestCases"
+ },
+ {
+ "name": "CtsSelinuxTargetSdk25TestCases"
+ },
+ {
+ "name": "CtsSelinuxTargetSdk27TestCases"
+ },
+ {
+ "name": "CtsSelinuxTargetSdk28TestCases"
+ },
+ {
+ "name": "CtsSelinuxTargetSdkCurrentTestCases"
+ }
+ ]
+}
+
diff --git a/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java
index a14f86a..72bb778 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CallScreeningServiceTest.java
@@ -27,6 +27,7 @@
import android.os.Bundle;
import android.telecom.Call;
import android.telecom.CallScreeningService;
+import android.telecom.Connection;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -59,6 +60,7 @@
MockConnectionService mConnectionService;
private boolean mCallFound;
private ContentResolver mContentResolver;
+ private int mCallerNumberVerificationStatus;
@Override
protected void setUp() throws Exception {
@@ -131,6 +133,7 @@
if (callbacks.lock.tryAcquire(TestUtils.WAIT_FOR_CALL_ADDED_TIMEOUT_S,
TimeUnit.SECONDS)) {
assertTrue(mCallFound);
+
return;
}
} catch (InterruptedException e) {
@@ -141,6 +144,56 @@
fail("No call added to CallScreeningService.");
}
+ /**
+ * Tests passing of number verification status.
+ */
+ public void testVerificationFailed() {
+ if (!shouldTestTelecom(mContext)) {
+ return;
+ }
+
+ CallScreeningServiceCallbacks callbacks = createCallbacks();
+ MockCallScreeningService.setCallbacks(callbacks);
+ addNewIncomingCall(MockConnectionService.VERSTAT_FAILED_NUMBER);
+
+ try {
+ if (callbacks.lock.tryAcquire(TestUtils.WAIT_FOR_CALL_ADDED_TIMEOUT_S,
+ TimeUnit.SECONDS)) {
+ assertTrue(mCallFound);
+ assertEquals(Connection.VERIFICATION_STATUS_FAILED,
+ mCallerNumberVerificationStatus);
+ return;
+ }
+ } catch (InterruptedException e) {
+ }
+ }
+
+ /**
+ * Tests passing of number verification status.
+ */
+ public void testNumberNotVerified() {
+ if (!shouldTestTelecom(mContext)) {
+ return;
+ }
+
+ CallScreeningServiceCallbacks callbacks = createCallbacks();
+ MockCallScreeningService.setCallbacks(callbacks);
+ addNewIncomingCall(MockConnectionService.VERSTAT_NOT_VERIFIED_NUMBER);
+
+ try {
+ if (callbacks.lock.tryAcquire(TestUtils.WAIT_FOR_CALL_ADDED_TIMEOUT_S,
+ TimeUnit.SECONDS)) {
+ assertTrue(mCallFound);
+ assertEquals(Connection.VERIFICATION_STATUS_NOT_VERIFIED,
+ mCallerNumberVerificationStatus);
+ return;
+ }
+ } catch (InterruptedException e) {
+ }
+
+ fail("No call added to CallScreeningService.");
+ }
+
private void addNewIncomingCall(Uri incomingHandle) {
Bundle extras = new Bundle();
extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, incomingHandle);
@@ -152,6 +205,7 @@
@Override
public void onScreenCall(Call.Details callDetails) {
mCallFound = true;
+ mCallerNumberVerificationStatus = callDetails.getCallerNumberVerificationStatus();
CallScreeningService.CallResponse response =
new CallScreeningService.CallResponse.Builder()
.setDisallowCall(true)
diff --git a/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java
index d498de0..7d81184 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CarModeInCallServiceTest.java
@@ -76,10 +76,10 @@
mCarModeIncallServiceControlTwo.reset();
}
+ assertUiMode(Configuration.UI_MODE_TYPE_NORMAL);
+
InstrumentationRegistry.getInstrumentation().getUiAutomation()
.dropShellPermissionIdentity();
-
- assertUiMode(Configuration.UI_MODE_TYPE_NORMAL);
}
/**
diff --git a/tests/tests/telecom/src/android/telecom/cts/ConnectionTest.java b/tests/tests/telecom/src/android/telecom/cts/ConnectionTest.java
index e04393c..6f8f2f4 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ConnectionTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ConnectionTest.java
@@ -389,6 +389,26 @@
assertEquals(videoProvider, connection.getVideoProvider());
}
+ public void testCallerNumberVerificationStatus() {
+ if (!shouldTestTelecom(getContext())) {
+ return;
+ }
+
+ final Semaphore lock = new Semaphore(0);
+ Connection connection = createConnection(lock);
+ waitForStateChange(lock);
+
+ connection.setCallerNumberVerificationStatus(Connection.VERIFICATION_STATUS_FAILED);
+ assertEquals(Connection.VERIFICATION_STATUS_FAILED,
+ connection.getCallerNumberVerificationStatus());
+ connection.setCallerNumberVerificationStatus(Connection.VERIFICATION_STATUS_NOT_VERIFIED);
+ assertEquals(Connection.VERIFICATION_STATUS_NOT_VERIFIED,
+ connection.getCallerNumberVerificationStatus());
+ connection.setCallerNumberVerificationStatus(Connection.VERIFICATION_STATUS_PASSED);
+ assertEquals(Connection.VERIFICATION_STATUS_PASSED,
+ connection.getCallerNumberVerificationStatus());
+ }
+
public void testStateToString() {
if (!shouldTestTelecom(getContext())) {
return;
diff --git a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
index e7dddd2..10cd943 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
@@ -400,7 +400,11 @@
}
private Uri blockNumber(Uri phoneNumberUri) {
- return insertBlockedNumber(mContext, phoneNumberUri.getSchemeSpecificPart());
+ Uri number = insertBlockedNumber(mContext, phoneNumberUri.getSchemeSpecificPart());
+ if (number == null) {
+ fail("Failed to insert into blocked number provider");
+ }
+ return number;
}
private int unblockNumber(Uri uri) {
diff --git a/tests/tests/telecom/src/android/telecom/cts/IncomingCallTest.java b/tests/tests/telecom/src/android/telecom/cts/IncomingCallTest.java
index b13b133..4c579ed 100644
--- a/tests/tests/telecom/src/android/telecom/cts/IncomingCallTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/IncomingCallTest.java
@@ -46,6 +46,45 @@
private static final PhoneAccountHandle TEST_INVALID_HANDLE = new PhoneAccountHandle(
new ComponentName(PACKAGE, COMPONENT), "WRONG_ID");
+ public void testVerstatPassed() throws Exception {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+ setupConnectionService(null, FLAG_REGISTER | FLAG_ENABLE);
+ addAndVerifyNewIncomingCall(MockConnectionService.VERSTAT_PASSED_NUMBER, null);
+ verifyConnectionForIncomingCall();
+
+ Call call = mInCallCallbacks.getService().getLastCall();
+ assertEquals(Connection.VERIFICATION_STATUS_PASSED,
+ call.getDetails().getCallerNumberVerificationStatus());
+ }
+
+ public void testVerstatFailed() throws Exception {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+ setupConnectionService(null, FLAG_REGISTER | FLAG_ENABLE);
+ addAndVerifyNewIncomingCall(MockConnectionService.VERSTAT_FAILED_NUMBER, null);
+ verifyConnectionForIncomingCall();
+
+ Call call = mInCallCallbacks.getService().getLastCall();
+ assertEquals(Connection.VERIFICATION_STATUS_FAILED,
+ call.getDetails().getCallerNumberVerificationStatus());
+ }
+
+ public void testVerstatNotVerified() throws Exception {
+ if (!mShouldTestTelecom) {
+ return;
+ }
+ setupConnectionService(null, FLAG_REGISTER | FLAG_ENABLE);
+ addAndVerifyNewIncomingCall(MockConnectionService.VERSTAT_NOT_VERIFIED_NUMBER, null);
+ verifyConnectionForIncomingCall();
+
+ Call call = mInCallCallbacks.getService().getLastCall();
+ assertEquals(Connection.VERIFICATION_STATUS_NOT_VERIFIED,
+ call.getDetails().getCallerNumberVerificationStatus());
+ }
+
public void testAddNewIncomingCall_CorrectPhoneAccountHandle() throws Exception {
if (!mShouldTestTelecom) {
return;
diff --git a/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java b/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
index abf5288..56c8ed9 100644
--- a/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
+++ b/tests/tests/telecom/src/android/telecom/cts/MockConnectionService.java
@@ -16,6 +16,7 @@
package android.telecom.cts;
+import android.net.Uri;
import android.os.Bundle;
import android.telecom.Connection;
import android.telecom.ConnectionRequest;
@@ -36,6 +37,9 @@
* received.
*/
public class MockConnectionService extends ConnectionService {
+ public static final Uri VERSTAT_NOT_VERIFIED_NUMBER = Uri.fromParts("tel", "777", null);
+ public static final Uri VERSTAT_PASSED_NUMBER = Uri.fromParts("tel", "555", null);
+ public static final Uri VERSTAT_FAILED_NUMBER = Uri.fromParts("tel", "333", null);
public static final String EXTRA_TEST = "com.android.telecom.extra.TEST";
public static final String TEST_VALUE = "we've got it";
public static final int CONNECTION_PRESENTATION = TelecomManager.PRESENTATION_ALLOWED;
@@ -117,6 +121,16 @@
Bundle testExtra = new Bundle();
testExtra.putString(EXTRA_TEST, TEST_VALUE);
connection.putExtras(testExtra);
+ if (VERSTAT_NOT_VERIFIED_NUMBER.equals(request.getAddress())) {
+ connection.setCallerNumberVerificationStatus(
+ Connection.VERIFICATION_STATUS_NOT_VERIFIED);
+ } else if (VERSTAT_PASSED_NUMBER.equals(request.getAddress())) {
+ connection.setCallerNumberVerificationStatus(
+ Connection.VERIFICATION_STATUS_PASSED);
+ } else if (VERSTAT_FAILED_NUMBER.equals(request.getAddress())) {
+ connection.setCallerNumberVerificationStatus(
+ Connection.VERIFICATION_STATUS_FAILED);
+ }
incomingConnections.add(connection);
lock.release();
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/telephony/OWNERS b/tests/tests/telephony/OWNERS
index 73fa25e..d4ae5d0 100644
--- a/tests/tests/telephony/OWNERS
+++ b/tests/tests/telephony/OWNERS
@@ -4,11 +4,10 @@
jackyu@google.com
rgreenwalt@google.com
refuhoo@google.com
-mpq@google.com
jminjie@google.com
shuoq@google.com
hallliu@google.com
tgunn@google.com
breadley@google.com
-paulye@google.com
nazaninb@google.com
+sarahchin@google.com
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..86c8305 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
@@ -28,4 +28,8 @@
boolean isRcsFeatureCreated();
boolean isMmTelFeatureCreated();
void resetState();
-}
\ No newline at end of file
+ void updateImsRegistration(int radioTech);
+ void notifyRcsCapabilitiesStatusChanged(int capability);
+ boolean isRcsCapable(int capability, int radioTech);
+ boolean isRcsAvailable(int capability);
+}
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..1f1c747 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
@@ -20,7 +20,9 @@
import android.os.IBinder;
import android.telephony.ims.cts.ImsUtils;
import android.telephony.ims.cts.TestImsService;
+import android.telephony.ims.feature.RcsFeature.RcsImsCapabilities;
import android.telephony.ims.stub.ImsFeatureConfiguration;
+import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.util.Log;
/**
@@ -40,18 +42,41 @@
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 void updateImsRegistration(int imsRadioTech) {
+ ImsRegistrationImplBase imsReg = TestExternalImsService.this.getImsRegistration();
+ imsReg.onRegistered(imsRadioTech);
+ }
+
+ 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/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/SmsCbMessageTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsCbMessageTest.java
new file mode 100644
index 0000000..6b1ca39
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsCbMessageTest.java
@@ -0,0 +1,232 @@
+/*
+ * 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 org.junit.Assert.assertEquals;
+
+import android.content.ContentValues;
+import android.provider.Telephony;
+import android.telephony.CbGeoUtils;
+import android.telephony.SmsCbCmasInfo;
+import android.telephony.SmsCbEtwsInfo;
+import android.telephony.SmsCbLocation;
+import android.telephony.SmsCbMessage;
+
+import com.android.internal.telephony.gsm.SmsCbConstants;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SmsCbMessageTest {
+
+ private SmsCbMessage mSmsCbMessage;
+
+ private static final int TEST_MESSAGE_FORMAT = SmsCbMessage.MESSAGE_FORMAT_3GPP2;
+ private static final int TEST_GEO_SCOPE = SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE;
+ private static final int TEST_SERIAL = 1234;
+ private static final String TEST_PLMN = "111222";
+ private static final SmsCbLocation TEST_LOCATION = new SmsCbLocation(TEST_PLMN, -1, -1);
+ private static final int TEST_SERVICE_CATEGORY = 4097;
+ private static final String TEST_LANGUAGE = "en";
+ private static final String TEST_BODY = "test body";
+ private static final int TEST_PRIORITY = 0;
+ private static final int TEST_ETWS_WARNING_TYPE =
+ SmsCbConstants.MESSAGE_ID_ETWS_OTHER_EMERGENCY_TYPE;
+ private static final SmsCbEtwsInfo TEST_ETWS_INFO = new SmsCbEtwsInfo(TEST_ETWS_WARNING_TYPE,
+ false, false, false, null);
+ private static final SmsCbCmasInfo TEST_CMAS_INFO =
+ new SmsCbCmasInfo(SmsCbCmasInfo.CMAS_CLASS_REQUIRED_MONTHLY_TEST,
+ SmsCbCmasInfo.CMAS_CATEGORY_OTHER,
+ SmsCbCmasInfo.CMAS_RESPONSE_TYPE_EVACUATE,
+ SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN,
+ SmsCbCmasInfo.CMAS_URGENCY_EXPECTED, SmsCbCmasInfo.CMAS_CERTAINTY_LIKELY);
+
+ private static final int TEST_MAX_WAIT_TIME = 0;
+ private static final List<CbGeoUtils.Geometry> TEST_GEOS = new ArrayList<>();
+ private static final int TEST_RECEIVED_TIME = 11000;
+ private static final int TEST_SLOT = 0;
+ private static final int TEST_SUB_ID = 1;
+
+ @Before
+ public void setUp() {
+ TEST_GEOS.add(new CbGeoUtils.Geometry() {
+ @Override
+ public boolean contains(CbGeoUtils.LatLng p) {
+ return false;
+ }
+ });
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY, TEST_PRIORITY,
+ TEST_ETWS_INFO, null, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ }
+
+ @Test
+ public void testGeographicalScope() {
+ assertEquals(TEST_GEO_SCOPE, mSmsCbMessage.getGeographicalScope());
+ }
+
+ @Test
+ public void testSerialNumber() {
+ assertEquals(TEST_SERIAL, mSmsCbMessage.getSerialNumber());
+ }
+
+ @Test
+ public void testLocation() {
+ assertEquals(TEST_LOCATION, mSmsCbMessage.getLocation());
+ }
+
+ @Test
+ public void testServiceCategory() {
+ assertEquals(TEST_SERVICE_CATEGORY, mSmsCbMessage.getServiceCategory());
+ }
+
+ @Test
+ public void testLanguage() {
+ assertEquals(TEST_LANGUAGE, mSmsCbMessage.getLanguageCode());
+ }
+
+ @Test
+ public void testBody() {
+ assertEquals(TEST_BODY, mSmsCbMessage.getMessageBody());
+ }
+
+ @Test
+ public void testGeometries() {
+ assertEquals(TEST_GEOS, mSmsCbMessage.getGeometries());
+ }
+
+ @Test
+ public void testMaxWaitTime() {
+ assertEquals(TEST_MAX_WAIT_TIME, mSmsCbMessage.getMaximumWaitingDuration());
+ }
+
+ @Test
+ public void testReceivedTime() {
+ assertEquals(TEST_RECEIVED_TIME, mSmsCbMessage.getReceivedTime());
+ }
+
+ @Test
+ public void testSlotIndex() {
+ assertEquals(TEST_SLOT, mSmsCbMessage.getSlotIndex());
+ }
+
+ @Test
+ public void testMessagePriority() {
+ assertEquals(TEST_PRIORITY, mSmsCbMessage.getMessagePriority());
+ }
+
+ @Test
+ public void testMessageFormat() {
+ assertEquals(TEST_MESSAGE_FORMAT, mSmsCbMessage.getMessageFormat());
+ }
+
+ @Test
+ public void testEtwsInfo() {
+ assertEquals(TEST_ETWS_INFO, mSmsCbMessage.getEtwsWarningInfo());
+ }
+
+ @Test
+ public void testCmasInfo() {
+ final SmsCbCmasInfo info =
+ new SmsCbCmasInfo(SmsCbCmasInfo.CMAS_CLASS_REQUIRED_MONTHLY_TEST,
+ SmsCbCmasInfo.CMAS_CATEGORY_OTHER,
+ SmsCbCmasInfo.CMAS_RESPONSE_TYPE_EVACUATE,
+ SmsCbCmasInfo.CMAS_SEVERITY_UNKNOWN,
+ SmsCbCmasInfo.CMAS_URGENCY_EXPECTED, SmsCbCmasInfo.CMAS_CERTAINTY_LIKELY);
+
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY, TEST_PRIORITY,
+ null, info, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(info, mSmsCbMessage.getCmasWarningInfo());
+ }
+
+ @Test
+ public void testEmergency() {
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY,
+ SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY,
+ TEST_ETWS_INFO, null, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(true, mSmsCbMessage.isEmergencyMessage());
+
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY,
+ SmsCbMessage.MESSAGE_PRIORITY_NORMAL,
+ TEST_ETWS_INFO, null, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(false, mSmsCbMessage.isEmergencyMessage());
+ }
+
+ @Test
+ public void testIsEtws() {
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY,
+ SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY,
+ null, TEST_CMAS_INFO, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(false, mSmsCbMessage.isEtwsMessage());
+
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY,
+ SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY,
+ TEST_ETWS_INFO, null, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(true, mSmsCbMessage.isEtwsMessage());
+ }
+
+ @Test
+ public void testIsCmas() {
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY,
+ SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY,
+ TEST_ETWS_INFO, null, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(false, mSmsCbMessage.isCmasMessage());
+
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY,
+ SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY,
+ null, TEST_CMAS_INFO, TEST_MAX_WAIT_TIME, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(true, mSmsCbMessage.isCmasMessage());
+ }
+
+ @Test
+ public void testNeedGeoFencingCheck() {
+ assertEquals(false, mSmsCbMessage.needGeoFencingCheck());
+
+ mSmsCbMessage = new SmsCbMessage(TEST_MESSAGE_FORMAT, TEST_GEO_SCOPE, TEST_SERIAL,
+ TEST_LOCATION, TEST_SERVICE_CATEGORY, TEST_LANGUAGE, TEST_BODY,
+ SmsCbMessage.MESSAGE_PRIORITY_EMERGENCY,
+ null, TEST_CMAS_INFO, 100, TEST_GEOS, TEST_RECEIVED_TIME,
+ TEST_SLOT, TEST_SUB_ID);
+ assertEquals(true, mSmsCbMessage.needGeoFencingCheck());
+ }
+
+ @Test
+ public void testContentValues() {
+ ContentValues cv = mSmsCbMessage.getContentValues();
+ int serial = cv.getAsInteger(Telephony.CellBroadcasts.SERIAL_NUMBER);
+ assertEquals(TEST_SERIAL, serial);
+ }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
index 403ef32..26f6a30 100755
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
@@ -687,6 +687,9 @@
private void blockNumber(String number) {
mBlockedNumberUri = insertBlockedNumber(mContext, number);
+ if (mBlockedNumberUri == null) {
+ fail("Failed to insert into blocked number provider.");
+ }
}
private void unblockNumber(Uri uri) {
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..bbaa423 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -405,12 +405,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 +466,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 e5d3241..baf2c81 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -467,6 +467,8 @@
mTelephonyManager.isVoicemailVibrationEnabled(defaultAccount);
mTelephonyManager.getSubscriptionId(defaultAccount);
mTelephonyManager.getCarrierConfig();
+ ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ (tm) -> tm.isAnyRadioPoweredOn());
TelephonyManager.getDefaultRespondViaMessageApplication(getContext(), false);
}
@@ -611,12 +613,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
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..1772152 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";
@@ -899,6 +907,107 @@
}
@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.updateImsRegistration(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
public void testProvisioningManagerSetConfig() throws Exception {
if (!ImsUtils.shouldTestImsService()) {
return;
@@ -1037,6 +1146,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/TestImsService.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java
index c21d8ba..c793d00 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;
}
}
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/tethering/Android.bp b/tests/tests/tethering/Android.bp
new file mode 100644
index 0000000..0f98125
--- /dev/null
+++ b/tests/tests/tethering/Android.bp
@@ -0,0 +1,44 @@
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+android_test {
+ name: "CtsTetheringTest",
+ defaults: ["cts_defaults"],
+
+ libs: [
+ "android.test.base.stubs",
+ ],
+
+ 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",
+ "general-tests",
+ "mts",
+ ],
+
+}
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/tethering/AndroidTest.xml b/tests/tests/tethering/AndroidTest.xml
new file mode 100644
index 0000000..217d53a
--- /dev/null
+++ b/tests/tests/tethering/AndroidTest.xml
@@ -0,0 +1,29 @@
+<?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="Config for CTS Tethering test cases">
+ <option name="test-suite-tag" value="cts" />
+ <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="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="CtsTetheringTest.apk" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <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..9efb8f3
--- /dev/null
+++ b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
@@ -0,0 +1,222 @@
+/*
+ * 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.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: " + state.mErrored.toArray());
+ }
+ }
+
+ private void assertNoActiveIfaces(final TetherState state) {
+ if (state.mActive != null && state.mActive.size() > 0) {
+ fail("Found active tethering interface: " + 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/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"
+ }
+ ]
+}