Merge "Skip JNI Tests for None CPU ABI" into honeycomb-mr1
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 60127fe..7423472 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -26,6 +26,8 @@
# These test cases will be analyzed by the CTS API coverage tools.
CTS_COVERAGE_TEST_CASE_LIST := \
+ CtsAccelerationTestCases \
+ CtsAccelerationTestStubs \
CtsAccessibilityServiceTestCases \
CtsAccountManagerTestCases \
CtsAdminTestCases \
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 969c2a7..d8cbce0 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -107,6 +107,7 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_networking" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.bluetooth" />
</activity>
<activity android:name=".bluetooth.BluetoothToggleActivity"
@@ -162,8 +163,30 @@
</intent-filter>
<meta-data android:name="test_category" android:value="@string/bt_device_communication" />
<meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
- </activity>
+ </activity>
+
+ <activity android:name=".bluetooth.ConnectionAccessServerActivity"
+ android:label="@string/bt_connection_access_server"
+ android:configChanges="keyboardHidden|orientation">
+ <intent-filter>
+ <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/bt_device_communication" />
+ <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+ <activity android:name=".bluetooth.ConnectionAccessClientActivity"
+ android:label="@string/bt_connection_access_client"
+ android:configChanges="keyboardHidden|orientation">
+ <intent-filter>
+ <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/bt_device_communication" />
+ <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
+ </activity>
+
<activity android:name=".bluetooth.DevicePickerActivity"
android:label="@string/bt_device_picker"
android:configChanges="keyboardHidden|orientation" />
@@ -208,6 +231,7 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_sensors" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.sensor.accelerometer" />
</activity>
<activity android:name=".sensors.GyroscopeTestActivity" android:label="@string/snsr_gyro_test"
@@ -217,6 +241,7 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_sensors" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.sensor.gyroscope" />
</activity>
<activity android:name=".audioquality.AudioQualityVerifierActivity"
@@ -226,6 +251,7 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_audio" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
</activity>
<activity android:name=".audioquality.CalibrateVolumeActivity"
@@ -244,6 +270,7 @@
<category android:name="android.cts.intent.category.MANUAL_TEST" />
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_hardware" />
+ <meta-data android:name="test_required_features" android:value="android.hardware.usb.accessory" />
</activity>
</application>
diff --git a/apps/CtsVerifier/res/layout/bt_connection_access.xml b/apps/CtsVerifier/res/layout/bt_connection_access.xml
new file mode 100644
index 0000000..ae373f4
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/bt_connection_access.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
+
+ <ScrollView android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ >
+ <TextView android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/bt_ca_tips"
+ style="@style/InstructionsFont"
+ />
+ </ScrollView>
+
+ <LinearLayout android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ >
+ <Button android:id="@+id/bt_make_discoverable_button"
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:drawableTop="@android:drawable/ic_menu_mylocation"
+ android:text="@string/bt_make_discoverable"
+ android:visibility="gone"
+ />
+ <Button android:id="@+id/bt_pick_server_button"
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:drawableTop="@android:drawable/ic_menu_mylocation"
+ android:text="@string/bt_pick_server"
+ android:visibility="gone"
+ />
+ <Button android:id="@+id/bt_settings"
+ android:layout_width="1dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:drawableTop="@android:drawable/ic_menu_preferences"
+ android:text="@string/bt_settings"
+ />
+ </LinearLayout>
+
+ <include layout="@layout/pass_fail_buttons" />
+
+</LinearLayout>
diff --git a/apps/CtsVerifier/res/layout/bt_toggle.xml b/apps/CtsVerifier/res/layout/bt_toggle.xml
index 3a07514..71def84 100644
--- a/apps/CtsVerifier/res/layout/bt_toggle.xml
+++ b/apps/CtsVerifier/res/layout/bt_toggle.xml
@@ -24,7 +24,7 @@
android:layout_alignParentTop="true"
android:gravity="center"
android:text="@string/bt_toggle_instructions"
- android:textSize="24dip"
+ style="@style/InstructionsFont"
/>
<ToggleButton android:id="@+id/bt_toggle_button"
diff --git a/apps/CtsVerifier/res/layout/bt_main.xml b/apps/CtsVerifier/res/layout/pass_fail_list.xml
similarity index 77%
rename from apps/CtsVerifier/res/layout/bt_main.xml
rename to apps/CtsVerifier/res/layout/pass_fail_list.xml
index cb65412..3c1f9d0 100644
--- a/apps/CtsVerifier/res/layout/bt_main.xml
+++ b/apps/CtsVerifier/res/layout/pass_fail_list.xml
@@ -14,10 +14,10 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
@@ -25,6 +25,11 @@
android:layout_weight="1"
/>
+ <TextView android:id="@id/android:empty"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ />
+
<include layout="@layout/pass_fail_buttons" />
</LinearLayout>
diff --git a/apps/CtsVerifier/res/layout/sv_main.xml b/apps/CtsVerifier/res/layout/sv_main.xml
deleted file mode 100644
index 8402b42..0000000
--- a/apps/CtsVerifier/res/layout/sv_main.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <ListView android:id="@id/android:list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#000000"
- android:layout_weight="1"
- android:drawSelectorOnTop="false"/>
-
- <TextView android:id="@id/android:empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#000000"
- android:text="@string/sv_no_data"/>
-
- <include layout="@layout/pass_fail_buttons" />
-
-</LinearLayout>
diff --git a/apps/CtsVerifier/res/values/colors.xml b/apps/CtsVerifier/res/values/colors.xml
deleted file mode 100644
index 220ba29..0000000
--- a/apps/CtsVerifier/res/values/colors.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-/*
-**
-** Copyright 2008, The Android Open Source Project
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
--->
-<resources>
- <color name="green">#00FF00</color>
- <color name="red">#FF0000</color>
-</resources>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 8cb17c1..3af663d 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -117,9 +117,6 @@
\n\n1. a candidate device implementation running the software build to be tested
\n\n2. a separate device implementation already known to be compatible</string>
- <string name="bt_not_available_title">Bluetooth is not available?</string>
- <string name="bt_not_available_message">If your device is supposed to have Bluetooth, your API implementation is not behaving correctly!</string>
-
<string name="bt_control">Bluetooth Control</string>
<string name="bt_device_communication">Device Communication</string>
@@ -130,16 +127,43 @@
<string name="bt_disabling">Disabling Bluetooth...</string>
<string name="bt_disabling_error">Could not disable Bluetooth...</string>
+ <string name="bt_connection_access_server">Connection Access Server</string>
+ <string name="bt_connection_access_client">Connection Access Client</string>
+ <string name="bt_connection_access_server_info">
+ Start the CTS Verifier on another device, start the Bluetooth test, and choose
+ \"Connection Access Client\" to setup the test.
+ \n\nFirst, unpair the devices via Bluetooth settings. Then connect the devices together
+ using the \"Make Discoverable\" and \"Pick Server\" buttons.
+ \n\nA connection access request should appear on the server and enable the pass button.
+ </string>
+ <string name="bt_connection_access_client_info">
+ Start the CTS Verifier on another device, start the Bluetooth test, and choose
+ \"Connection Access Server\" to complete the test.
+ \n\nMake the device acting as the server discoverable and connect to it via the
+ \"Pick Server\" button. Check that the server displays the connection access request
+ dialog. The client device does not need to do anything else.
+ </string>
+ <string name="bt_ca_dialog">Was the connection access request dialog shown?</string>
+ <string name="bt_ca_tips">
+ Tap the \"Bluetooth Settings\" button and check that both devices are not paired
+ before running the test.
+ \n\nUse the \"Make Discoverable\" and \"Pick Server\" buttons to connect the two Bluetooth
+ devices together and start the test.
+ </string>
+
<string name="bt_secure_server">Secure Server</string>
<string name="bt_secure_server_instructions">Start the CTS Verifier on another device, start the Bluetooth test, and choose \"Secure Client\" to complete the test.</string>
<string name="bt_insecure_server">Insecure Server</string>
<string name="bt_insecure_server_instructions">Start the CTS Verifier on another device, start the Bluetooth test, and choose \"Insecure Client\" to complete the test.</string>
<string name="bt_waiting">Waiting for client...</string>
+ <string name="bt_listening">Listening...</string>
<string name="bt_connecting">Connecting...</string>
+ <string name="bt_connected">Connected</string>
<string name="bt_received_messages">Received Messages</string>
<string name="bt_sent_messages">Sent Messages</string>
<string name="bt_no_messages">No messages</string>
<string name="bt_make_discoverable">Make Discoverable</string>
+ <string name="bt_pick_server">Pick Server</string>
<string name="bt_insecure_pairing_error_title">Pairing dialog shown?</string>
<string name="bt_insecure_pairing_error_message">Insecure connections should not show the pairing dialog!</string>
diff --git a/apps/CtsVerifier/res/values/styles.xml b/apps/CtsVerifier/res/values/styles.xml
index ce20ba0..51f996d 100644
--- a/apps/CtsVerifier/res/values/styles.xml
+++ b/apps/CtsVerifier/res/values/styles.xml
@@ -3,6 +3,9 @@
<style name="WelcomeFont" parent="@android:style/TextAppearance.Large">
<item name="android:textColor">#9fbf3b</item>
</style>
+ <style name="InstructionsFont" parent="@android:style/TextAppearance.Large">
+ <item name="android:padding">10dp</item>
+ </style>
<style name="VersionFont" parent="@android:style/TextAppearance.Large">
<item name="android:textColor">#ffffff</item>
</style>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
index fdea120..1f19cbe 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
@@ -28,6 +28,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -59,6 +60,14 @@
* <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BluetoothTestActivity" />
* </pre>
* </li>
+ * <li>OPTIONAL: Add a meta data attribute to indicate what features are required to run the
+ * test. If the device does not have all of the required features then it will not appear
+ * in the test list. Use a colon (:) to specify multiple required features.
+ * <pre>
+ * <meta-data android:name="test_required_features" android:value="android.hardware.sensor.accelerometer" />
+ * </pre>
+ * </li>
+ *
* </ol>
*/
public class ManifestTestListAdapter extends TestListAdapter {
@@ -67,6 +76,8 @@
private static final String TEST_PARENT_META_DATA = "test_parent";
+ private static final String TEST_REQUIRED_FEATURES_META_DATA = "test_required_features";
+
private Context mContext;
private String mTestParent;
@@ -94,16 +105,17 @@
List<TestListItem> allRows = new ArrayList<TestListItem>();
for (String testCategory : testCategories) {
- allRows.add(TestListItem.newCategory(testCategory));
-
- List<TestListItem> tests = testsByCategory.get(testCategory);
- Collections.sort(tests, new Comparator<TestListItem>() {
- @Override
- public int compare(TestListItem item, TestListItem otherItem) {
- return item.title.compareTo(otherItem.title);
- }
- });
- allRows.addAll(tests);
+ 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);
+ }
+ });
+ allRows.addAll(tests);
+ }
}
return allRows;
}
@@ -120,7 +132,7 @@
List<ResolveInfo> matchingList = new ArrayList<ResolveInfo>();
for (int i = 0; i < size; i++) {
ResolveInfo info = list.get(i);
- String parent = getTestParent(mContext, info.activityInfo.metaData);
+ String parent = getTestParent(info.activityInfo.metaData);
if ((mTestParent == null && parent == null)
|| (mTestParent != null && mTestParent.equals(parent))) {
matchingList.add(info);
@@ -139,7 +151,8 @@
String title = getTitle(mContext, info.activityInfo);
String testName = info.activityInfo.name;
Intent intent = getActivityIntent(info.activityInfo);
- TestListItem item = TestListItem.newTest(title, testName, intent);
+ String[] requiredFeatures = getRequiredFeatures(info.activityInfo.metaData);
+ TestListItem item = TestListItem.newTest(title, testName, intent, requiredFeatures);
String testCategory = getTestCategory(mContext, info.activityInfo.metaData);
addTestToCategory(testsByCategory, testCategory, item);
@@ -160,10 +173,23 @@
}
}
- static String getTestParent(Context context, Bundle metaData) {
+ static String getTestParent(Bundle metaData) {
return metaData != null ? metaData.getString(TEST_PARENT_META_DATA) : null;
}
+ static String[] getRequiredFeatures(Bundle metaData) {
+ if (metaData == null) {
+ return null;
+ } else {
+ String value = metaData.getString(TEST_REQUIRED_FEATURES_META_DATA);
+ if (value == null) {
+ return null;
+ } else {
+ return value.split(":");
+ }
+ }
+ }
+
static String getTitle(Context context, ActivityInfo activityInfo) {
if (activityInfo.labelRes != 0) {
return context.getString(activityInfo.labelRes);
@@ -189,4 +215,23 @@
testsByCategory.put(testCategory, tests);
tests.add(item);
}
+
+ List<TestListItem> filterTests(List<TestListItem> tests) {
+ List<TestListItem> filteredTests = new ArrayList<TestListItem>(tests);
+ PackageManager packageManager = mContext.getPackageManager();
+ Iterator<TestListItem> iterator = filteredTests.iterator();
+ while (iterator.hasNext()) {
+ TestListItem item = iterator.next();
+ String[] requiredFeatures = item.requiredFeatures;
+ if (requiredFeatures != null) {
+ for (int i = 0; i < requiredFeatures.length; i++) {
+ if (!packageManager.hasSystemFeature(requiredFeatures[i])) {
+ iterator.remove();
+ break;
+ }
+ }
+ }
+ }
+ return filteredTests;
+ }
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
index f7db56d..33c9b62 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
@@ -16,15 +16,19 @@
package com.android.cts.verifier;
+import android.app.AlertDialog;
import android.content.Context;
import android.os.AsyncTask;
+import android.os.Build;
import android.os.Environment;
-import android.widget.Toast;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
@@ -60,12 +64,13 @@
}
File reportPath = new File(Environment.getExternalStorageDirectory(), "ctsVerifierReports");
reportPath.mkdirs();
- File reportFile = new File(reportPath,
- "ctsVerifierReport-" + System.currentTimeMillis() + ".zip");
+
+ String baseName = getReportBaseName();
+ File reportFile = new File(reportPath, baseName + ".zip");
ZipOutputStream out = null;
try {
out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(reportFile)));
- ZipEntry entry = new ZipEntry("ctsVerifierReport.xml");
+ ZipEntry entry = new ZipEntry(baseName + ".xml");
out.putNextEntry(entry);
out.write(contents);
} catch (IOException e) {
@@ -84,8 +89,22 @@
return mContext.getString(R.string.report_saved, reportFile.getPath());
}
+ private String getReportBaseName() {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd-HH.mm.ss", Locale.ENGLISH);
+ String date = dateFormat.format(new Date());
+ return "ctsVerifierReport"
+ + "-" + date
+ + "-" + Build.MANUFACTURER
+ + "-" + Build.PRODUCT
+ + "-" + Build.DEVICE
+ + "-" + Build.ID;
+ }
+
@Override
protected void onPostExecute(String result) {
- Toast.makeText(mContext, result, Toast.LENGTH_LONG).show();
+ new AlertDialog.Builder(mContext)
+ .setMessage(result)
+ .setPositiveButton(android.R.string.ok, null)
+ .show();
}
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
index 36b1d6a..3f84f51 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
@@ -77,22 +77,24 @@
/** Intent used to launch the activity from the list. Null for categories. */
final Intent intent;
- public static TestListItem newTest(String title, String testName, Intent intent) {
- return new TestListItem(title, testName, intent);
+ /** Features necessary to run this test. */
+ final String[] requiredFeatures;
+
+ public static TestListItem newTest(String title, String testName, Intent intent,
+ String[] requiredFeatures) {
+ return new TestListItem(title, testName, intent, requiredFeatures);
}
public static TestListItem newCategory(String title) {
- return new TestListItem(title, null, null);
+ return new TestListItem(title, null, null, null);
}
- private TestListItem(String title, String testName, Intent intent) {
+ private TestListItem(String title, String testName, Intent intent,
+ String[] requiredFeatures) {
this.title = title;
this.testName = testName;
this.intent = intent;
- }
-
- public Intent getIntent() {
- return intent;
+ this.requiredFeatures = requiredFeatures;
}
boolean isTest() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothChatService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothChatService.java
index 05c50e3..6eb587f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothChatService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothChatService.java
@@ -49,6 +49,13 @@
public static final String DEVICE_NAME = "device_name";
public static final String TOAST = "toast";
+ static final UUID SECURE_UUID =
+ UUID.fromString("8591d757-18ee-45e1-9b12-92875d06ba23");
+ static final UUID INSECURE_UUID =
+ UUID.fromString("301c214f-91a2-43bf-a795-09d1198a81a7");
+ static final UUID HANDSFREE_INSECURE_UUID =
+ UUID.fromString("0000111F-0000-1000-8000-00805F9B34FB");
+
// Debugging
private static final String TAG = "CtsBluetoothChatService";
private static final boolean D = true;
@@ -57,15 +64,10 @@
private static final String NAME_SECURE = "CtsBluetoothChatSecure";
private static final String NAME_INSECURE = "CtsBluetoothChatInsecure";
- // Unique UUID for this application
- private static final UUID MY_UUID_SECURE =
- UUID.fromString("8591d757-18ee-45e1-9b12-92875d06ba23");
- private static final UUID MY_UUID_INSECURE =
- UUID.fromString("301c214f-91a2-43bf-a795-09d1198a81a7");
-
// Member fields
private final BluetoothAdapter mAdapter;
private final Handler mHandler;
+ private final UUID mUuid;
private AcceptThread mSecureAcceptThread;
private AcceptThread mInsecureAcceptThread;
private ConnectThread mConnectThread;
@@ -83,10 +85,11 @@
* @param context The UI Activity Context
* @param handler A Handler to send messages back to the UI Activity
*/
- public BluetoothChatService(Context context, Handler handler) {
+ public BluetoothChatService(Context context, Handler handler, UUID uuid) {
mAdapter = BluetoothAdapter.getDefaultAdapter();
mState = STATE_NONE;
mHandler = handler;
+ mUuid = uuid;
}
/**
@@ -279,11 +282,9 @@
// Create a new listening server socket
try {
if (secure) {
- tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE,
- MY_UUID_SECURE);
+ tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME_SECURE, mUuid);
} else {
- tmp = mAdapter.listenUsingInsecureRfcommWithServiceRecord(
- NAME_INSECURE, MY_UUID_INSECURE);
+ tmp = mAdapter.listenUsingInsecureRfcommWithServiceRecord(NAME_INSECURE, mUuid);
}
} catch (IOException e) {
Log.e(TAG, "Socket Type: " + mSocketType + " listen() failed", e);
@@ -368,11 +369,9 @@
// given BluetoothDevice
try {
if (secure) {
- tmp = device.createRfcommSocketToServiceRecord(
- MY_UUID_SECURE);
+ tmp = device.createRfcommSocketToServiceRecord(mUuid);
} else {
- tmp = device.createInsecureRfcommSocketToServiceRecord(
- MY_UUID_INSECURE);
+ tmp = device.createInsecureRfcommSocketToServiceRecord(mUuid);
}
} catch (IOException e) {
Log.e(TAG, "Socket Type: " + mSocketType + "create() failed", e);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
index 4ddfa51..9895f02 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BluetoothTestActivity.java
@@ -20,9 +20,6 @@
import com.android.cts.verifier.PassFailButtons;
import com.android.cts.verifier.R;
-import android.app.AlertDialog;
-import android.bluetooth.BluetoothAdapter;
-import android.content.DialogInterface;
import android.os.Bundle;
public class BluetoothTestActivity extends PassFailButtons.TestListActivity {
@@ -30,29 +27,10 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.bt_main);
+ setContentView(R.layout.pass_fail_list);
setPassFailButtonClickListeners();
setInfoResources(R.string.bluetooth_test, R.string.bluetooth_test_info, -1);
setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName()));
-
- if (BluetoothAdapter.getDefaultAdapter() == null) {
- showNoBluetoothDialog();
- }
- }
-
- private void showNoBluetoothDialog() {
- new AlertDialog.Builder(this)
- .setIcon(android.R.drawable.ic_dialog_alert)
- .setTitle(R.string.bt_not_available_title)
- .setMessage(R.string.bt_not_available_message)
- .setCancelable(false)
- .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- finish();
- }
- })
- .show();
}
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/ConnectionAccessClientActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/ConnectionAccessClientActivity.java
new file mode 100644
index 0000000..5befdaf
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/ConnectionAccessClientActivity.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.cts.verifier.bluetooth;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothDevice;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.provider.Settings;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class ConnectionAccessClientActivity extends PassFailButtons.Activity {
+
+ private static final int ENABLE_BLUETOOTH_REQUEST = 1;
+ private static final int PICK_SERVER_DEVICE_REQUEST = 2;
+
+ private BluetoothAdapter mBluetoothAdapter;
+ private BluetoothChatService mChatService;
+ private String mDeviceAddress;
+ private Button mPickServerButton;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+ setContentView(R.layout.bt_connection_access);
+ setInfoResources(R.string.bt_connection_access_client,
+ R.string.bt_connection_access_client_info, 0);
+ setPassFailButtonClickListeners();
+
+ View settings = findViewById(R.id.bt_settings);
+ settings.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
+ }
+ });
+
+ mPickServerButton = (Button) findViewById(R.id.bt_pick_server_button);
+ mPickServerButton.setVisibility(View.VISIBLE);
+ mPickServerButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ startDevicePickerActivity();
+ }
+ });
+
+ mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (!mBluetoothAdapter.isEnabled()) {
+ mPickServerButton.setEnabled(false);
+ startEnableBluetoothActivity();
+ }
+ }
+
+ private void startDevicePickerActivity() {
+ Intent intent = new Intent(this, DevicePickerActivity.class);
+ startActivityForResult(intent, PICK_SERVER_DEVICE_REQUEST);
+ }
+
+ private void startEnableBluetoothActivity() {
+ Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
+ startActivityForResult(intent, ENABLE_BLUETOOTH_REQUEST);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ switch (requestCode) {
+ case ENABLE_BLUETOOTH_REQUEST:
+ if (resultCode == RESULT_OK) {
+ mPickServerButton.setEnabled(true);
+ } else {
+ setResult(RESULT_CANCELED);
+ finish();
+ }
+ break;
+
+ case PICK_SERVER_DEVICE_REQUEST:
+ if (resultCode == RESULT_OK) {
+ mDeviceAddress = data.getStringExtra(DevicePickerActivity.EXTRA_DEVICE_ADDRESS);
+ startChartService();
+ }
+ break;
+ }
+ }
+
+ private void startChartService() {
+ mChatService = new BluetoothChatService(this, new ChatHandler(),
+ BluetoothChatService.HANDSFREE_INSECURE_UUID);
+ BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(mDeviceAddress);
+ mChatService.connect(device, false);
+ }
+
+ private class ChatHandler extends Handler {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+ case BluetoothChatService.MESSAGE_STATE_CHANGE:
+ handleStateChange(msg);
+ break;
+
+ case BluetoothChatService.MESSAGE_DEVICE_NAME:
+ handleDeviceName(msg);
+ break;
+
+ case BluetoothChatService.MESSAGE_TOAST:
+ handleToast(msg);
+ break;
+ }
+ }
+ }
+
+ private void handleStateChange(Message msg) {
+ int state = msg.arg1;
+ switch (state) {
+ case BluetoothChatService.STATE_CONNECTING:
+ setProgressBarIndeterminateVisibility(true);
+ Toast.makeText(this, R.string.bt_connecting, Toast.LENGTH_SHORT).show();
+ break;
+
+ case BluetoothChatService.STATE_CONNECTED:
+ setProgressBarIndeterminateVisibility(false);
+ Toast.makeText(this, R.string.bt_connected, Toast.LENGTH_SHORT).show();
+ break;
+
+ case BluetoothChatService.STATE_NONE:
+ setProgressBarIndeterminateVisibility(false);
+ break;
+ }
+ }
+
+ private void handleDeviceName(Message msg) {
+ mDeviceAddress = msg.getData().getString(BluetoothChatService.DEVICE_NAME);
+ }
+
+ private void handleToast(Message msg) {
+ String toast = msg.getData().getString(BluetoothChatService.TOAST);
+ Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/ConnectionAccessServerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/ConnectionAccessServerActivity.java
new file mode 100644
index 0000000..19c46af
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/ConnectionAccessServerActivity.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.cts.verifier.bluetooth;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import android.app.AlertDialog;
+import android.bluetooth.BluetoothAdapter;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.provider.Settings;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.Window;
+import android.widget.Button;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class ConnectionAccessServerActivity extends PassFailButtons.Activity {
+
+ private static final String ACTION_CONNECTION_ACCESS_REQUEST =
+ "android.bluetooth.device.action.CONNECTION_ACCESS_REQUEST";
+
+ private static final int ENABLE_BLUETOOTH_REQUEST = 1;
+
+ private BluetoothAdapter mBluetoothAdapter;
+ private ConnectionAccessRequestReceiver mConnectionAccessRequestReceiver;
+ private BluetoothChatService mChatService;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+ setContentView(R.layout.bt_connection_access);
+ setInfoResources(R.string.bt_connection_access_server,
+ R.string.bt_connection_access_server_info, 0);
+ setPassFailButtonClickListeners();
+ getPassButton().setEnabled(false);
+
+ View settings = findViewById(R.id.bt_settings);
+ settings.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
+ }
+ });
+
+ Button makeDiscoverableButton = (Button) findViewById(R.id.bt_make_discoverable_button);
+ makeDiscoverableButton.setVisibility(View.VISIBLE);
+ makeDiscoverableButton.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ makeDiscoverable();
+ }
+ });
+
+ mConnectionAccessRequestReceiver = new ConnectionAccessRequestReceiver();
+ IntentFilter intentFilter = new IntentFilter(ACTION_CONNECTION_ACCESS_REQUEST);
+ registerReceiver(mConnectionAccessRequestReceiver, intentFilter);
+
+ mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
+ if (mBluetoothAdapter.isEnabled()) {
+ startChatService();
+ } else {
+ Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
+ startActivityForResult(intent, ENABLE_BLUETOOTH_REQUEST);
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ switch (requestCode) {
+ case ENABLE_BLUETOOTH_REQUEST:
+ if (resultCode == RESULT_OK) {
+ startChatService();
+ } else {
+ setResult(RESULT_CANCELED);
+ finish();
+ }
+ break;
+ }
+ }
+
+ private void startChatService() {
+ mChatService = new BluetoothChatService(this, new ChatHandler(),
+ BluetoothChatService.HANDSFREE_INSECURE_UUID);
+ boolean secure = false;
+ mChatService.start(secure);
+ }
+
+ private void makeDiscoverable() {
+ if (mBluetoothAdapter.getScanMode() !=
+ BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE) {
+ Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
+ intent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 30);
+ startActivity(intent);
+ }
+ }
+
+ private class ChatHandler extends Handler {
+ @Override
+ public void handleMessage(Message msg) {
+ super.handleMessage(msg);
+ switch (msg.what) {
+ case BluetoothChatService.MESSAGE_STATE_CHANGE:
+ handleStateChange(msg);
+ break;
+
+ case BluetoothChatService.MESSAGE_TOAST:
+ handleToast(msg);
+ break;
+ }
+ }
+ }
+
+ private void handleStateChange(Message msg) {
+ int state = msg.arg1;
+ switch (state) {
+ case BluetoothChatService.STATE_LISTEN:
+ setProgressBarIndeterminateVisibility(true);
+ Toast.makeText(this, R.string.bt_listening, Toast.LENGTH_SHORT).show();
+ break;
+ }
+ }
+
+ private void handleToast(Message msg) {
+ String toast = msg.getData().getString(BluetoothChatService.TOAST);
+ Toast.makeText(this, toast, Toast.LENGTH_LONG).show();
+ }
+
+ class ConnectionAccessRequestReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ new AlertDialog.Builder(ConnectionAccessServerActivity.this)
+ .setMessage(R.string.bt_ca_dialog)
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ getPassButton().setEnabled(true);
+ }
+ })
+ .setNegativeButton(android.R.string.cancel,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ getPassButton().setEnabled(false);
+ }
+ })
+ .show();
+ }
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ if (mChatService != null) {
+ mChatService.stop();
+ }
+ unregisterReceiver(mConnectionAccessRequestReceiver);
+ }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureClientActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureClientActivity.java
index 6dfbbea..da1f369 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureClientActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureClientActivity.java
@@ -18,6 +18,6 @@
public class InsecureClientActivity extends MessageTestActivity {
public InsecureClientActivity() {
- super(false, false);
+ super(false, false, BluetoothChatService.INSECURE_UUID);
}
-}
\ No newline at end of file
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureServerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureServerActivity.java
index 3526e04..31ae7d8 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureServerActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/InsecureServerActivity.java
@@ -18,6 +18,6 @@
public class InsecureServerActivity extends MessageTestActivity {
public InsecureServerActivity() {
- super(false, true);
+ super(false, true, BluetoothChatService.INSECURE_UUID);
}
}
\ No newline at end of file
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java
index 28a711a..c730aed 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/MessageTestActivity.java
@@ -40,6 +40,7 @@
import android.widget.TextView;
import android.widget.Toast;
+import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -71,15 +72,18 @@
private AlertDialog mInstructionsDialog;
private String mDeviceAddress;
- private boolean mSecure;
- private boolean mServer;
+
+ private final boolean mSecure;
+ private final boolean mServer;
+ private final UUID mUuid;
private String mRemoteDeviceName = "";
private StringBuilder mMessageBuffer = new StringBuilder();
- MessageTestActivity(boolean secure, boolean server) {
+ MessageTestActivity(boolean secure, boolean server, UUID uuid) {
mSecure = secure;
mServer = server;
+ mUuid = uuid;
}
@Override
@@ -166,7 +170,7 @@
}
private void startChatService() {
- mChatService = new BluetoothChatService(this, new ChatHandler());
+ mChatService = new BluetoothChatService(this, new ChatHandler(), mUuid);
if (mServer) {
mChatService.start(mSecure);
} else {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureClientActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureClientActivity.java
index 799f0b8..ad908b5 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureClientActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureClientActivity.java
@@ -18,6 +18,6 @@
public class SecureClientActivity extends MessageTestActivity {
public SecureClientActivity() {
- super(true, false);
+ super(true, false, BluetoothChatService.SECURE_UUID);
}
}
\ No newline at end of file
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureServerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureServerActivity.java
index 25e26e6..df50026 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureServerActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/SecureServerActivity.java
@@ -18,6 +18,6 @@
public class SecureServerActivity extends MessageTestActivity {
public SecureServerActivity() {
- super(true, true);
+ super(true, true, BluetoothChatService.SECURE_UUID);
}
}
\ No newline at end of file
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
index fa0cf29..d575e5f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
@@ -25,6 +25,7 @@
import android.content.Intent;
import android.database.DataSetObserver;
import android.os.Bundle;
+import android.widget.TextView;
import java.io.Serializable;
@@ -125,10 +126,13 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.sv_main);
+ setContentView(R.layout.pass_fail_list);
setPassFailButtonClickListeners();
setInfoResources(R.string.streaming_video, R.string.streaming_video_info, -1);
+ TextView empty = (TextView) findViewById(android.R.id.empty);
+ empty.setText(R.string.sv_no_data);
+
getPassButton().setEnabled(false);
setTestListAdapter(getStreamAdapter());
}
@@ -159,7 +163,8 @@
private void addStreamToTests(ArrayTestListAdapter streams, Stream stream) {
Intent i = new Intent(StreamingVideoActivity.this, PlayVideoActivity.class);
i.putExtra(PlayVideoActivity.EXTRA_STREAM, stream);
- streams.add(TestListItem.newTest(stream.name, PlayVideoActivity.getTestId(stream.code), i));
+ streams.add(TestListItem.newTest(stream.name, PlayVideoActivity.getTestId(stream.code),
+ i, null));
}
private void updatePassButton() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java
index 826b82c..7d99c2d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/suid/SuidFilesActivity.java
@@ -16,6 +16,7 @@
package com.android.cts.verifier.suid;
+import com.android.cts.verifier.PassFailButtons;
import com.android.cts.verifier.R;
import com.android.cts.verifier.TestResult;
import com.android.cts.verifier.os.FileUtils;
@@ -23,7 +24,6 @@
import android.app.Activity;
import android.app.AlertDialog;
-import android.app.ListActivity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
@@ -45,7 +45,7 @@
import java.util.Set;
/** {@link Activity} that tries to find suid files. */
-public class SuidFilesActivity extends ListActivity {
+public class SuidFilesActivity extends PassFailButtons.ListActivity {
private static final String TAG = SuidFilesActivity.class.getSimpleName();
@@ -63,7 +63,9 @@
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setResult(RESULT_CANCELED);
+ setContentView(R.layout.pass_fail_list);
+ setPassFailButtonClickListeners();
+ getPassButton().setEnabled(false);
mAdapter = new SuidFilesAdapter();
setListAdapter(mAdapter);
@@ -256,7 +258,7 @@
// Alert the user that nothing was found rather than showing an empty list view.
if (passed) {
- TestResult.setPassedResult(SuidFilesActivity.this, getClass().getName());
+ getPassButton().setEnabled(true);
new AlertDialog.Builder(SuidFilesActivity.this)
.setTitle(R.string.congratulations)
.setMessage(R.string.no_suid_files)
@@ -267,8 +269,6 @@
}
})
.show();
- } else {
- TestResult.setFailedResult(SuidFilesActivity.this, getClass().getName());
}
}
}
diff --git a/development/ide/eclipse/.classpath b/development/ide/eclipse/.classpath
index 7375ad8..01d5c73 100644
--- a/development/ide/eclipse/.classpath
+++ b/development/ide/eclipse/.classpath
@@ -9,12 +9,14 @@
<classpathentry kind="src" path="cts/tests/ProcessTest/ShareUidApp/src"/>
<classpathentry kind="src" path="cts/tests/SignatureTest/src"/>
<classpathentry kind="src" path="cts/tests/SignatureTest/tests/src"/>
+ <classpathentry kind="src" path="cts/tests/acceleration/src"/>
<classpathentry kind="src" path="cts/tests/accessibilityservice/src"/>
<classpathentry kind="src" path="cts/tests/appsecurity-tests/src"/>
<classpathentry kind="src" path="cts/tests/appsecurity-tests/test-apps/AppWithData/src"/>
<classpathentry kind="src" path="cts/tests/core/runner/src"/>
<classpathentry kind="src" path="cts/tests/deviceadmin/src"/>
<classpathentry kind="src" path="cts/tests/src"/>
+ <classpathentry kind="src" path="cts/tests/tests/acceleration/src"/>
<classpathentry kind="src" path="cts/tests/tests/accessibilityservice/src"/>
<classpathentry kind="src" path="cts/tests/tests/accounts/src"/>
<classpathentry kind="src" path="cts/tests/tests/admin/src"/>
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 369df8a..bda156f 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -66,6 +66,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.DUMP" />
<uses-permission android:name="android.permission.NFC" />
+ <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<!-- Used for PackageManager test, don't delete this INTERNET permission -->
<uses-permission android:name="android.permission.INTERNET" />
diff --git a/tests/acceleration/Android.mk b/tests/acceleration/Android.mk
new file mode 100644
index 0000000..6e30f59
--- /dev/null
+++ b/tests/acceleration/Android.mk
@@ -0,0 +1,31 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsAccelerationTestStubs
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tests/acceleration/AndroidManifest.xml b/tests/acceleration/AndroidManifest.xml
new file mode 100644
index 0000000..0c51d49
--- /dev/null
+++ b/tests/acceleration/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<!--
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.acceleration.stub">
+
+ <application android:hardwareAccelerated="true" android:debuggable="true">
+ <activity android:name="android.acceleration.cts.HardwareAcceleratedActivity" />
+ <activity android:name="android.acceleration.cts.SoftwareAcceleratedActivity"
+ android:hardwareAccelerated="false" />
+ <activity android:name="android.acceleration.cts.WindowFlagHardwareAcceleratedActivity"
+ android:hardwareAccelerated="false" />
+ </application>
+
+</manifest>
+
diff --git a/tests/acceleration/res/layout/acceleration.xml b/tests/acceleration/res/layout/acceleration.xml
new file mode 100644
index 0000000..8dc027a
--- /dev/null
+++ b/tests/acceleration/res/layout/acceleration.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ >
+ <android.acceleration.cts.AcceleratedView android:id="@+id/hardware_accelerated_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layerType="hardware"
+ />
+ <android.acceleration.cts.AcceleratedView android:id="@+id/software_accelerated_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layerType="software"
+ />
+ <!-- Acceleration will be set via manual setLayerType calls from the activity. -->
+ <android.acceleration.cts.AcceleratedView android:id="@+id/manual_hardware_accelerated_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+ <android.acceleration.cts.AcceleratedView android:id="@+id/manual_software_accelerated_view"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ />
+</LinearLayout>
diff --git a/tests/acceleration/src/android/acceleration/cts/AcceleratedView.java b/tests/acceleration/src/android/acceleration/cts/AcceleratedView.java
new file mode 100644
index 0000000..7d749a1
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/AcceleratedView.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.util.AttributeSet;
+import android.view.View;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class AcceleratedView extends View {
+
+ private final CountDownLatch mDrawLatch = new CountDownLatch(1);
+
+ private boolean mIsHardwareAccelerated;
+
+ public AcceleratedView(Context context) {
+ super(context);
+ }
+
+ public AcceleratedView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public AcceleratedView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ super.onDraw(canvas);
+ synchronized (this) {
+ mIsHardwareAccelerated = canvas.isHardwareAccelerated();
+ }
+ mDrawLatch.countDown();
+ }
+
+ public boolean isCanvasHardwareAccelerated() {
+ try {
+ if (mDrawLatch.await(1, TimeUnit.SECONDS)) {
+ synchronized (this) {
+ return mIsHardwareAccelerated;
+ }
+ } else {
+ throw new IllegalStateException("View was not drawn...");
+ }
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/BaseAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/BaseAcceleratedActivity.java
new file mode 100644
index 0000000..8ef6a8e
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/BaseAcceleratedActivity.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+import com.android.cts.acceleration.stub.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+
+abstract class BaseAcceleratedActivity extends Activity {
+
+ private AcceleratedView mHardwareAcceleratedView;
+ private AcceleratedView mSoftwareAcceleratedView;
+
+ private AcceleratedView mManualHardwareAcceleratedView;
+ private AcceleratedView mManualSoftwareAcceleratedView;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.acceleration);
+
+ mHardwareAcceleratedView = (AcceleratedView) findViewById(R.id.hardware_accelerated_view);
+ mSoftwareAcceleratedView = (AcceleratedView) findViewById(R.id.software_accelerated_view);
+
+ mManualHardwareAcceleratedView =
+ (AcceleratedView) findViewById(R.id.manual_hardware_accelerated_view);
+ mManualSoftwareAcceleratedView =
+ (AcceleratedView) findViewById(R.id.manual_software_accelerated_view);
+
+ mManualHardwareAcceleratedView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ mManualSoftwareAcceleratedView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+ }
+
+ public AcceleratedView getHardwareAcceleratedView() {
+ return mHardwareAcceleratedView;
+ }
+
+ public AcceleratedView getSoftwareAcceleratedView() {
+ return mSoftwareAcceleratedView;
+ }
+
+ public AcceleratedView getManualHardwareAcceleratedView() {
+ return mManualHardwareAcceleratedView;
+ }
+
+ public AcceleratedView getManualSoftwareAcceleratedView() {
+ return mManualSoftwareAcceleratedView;
+ }
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/HardwareAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/HardwareAcceleratedActivity.java
new file mode 100644
index 0000000..bb26202
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/HardwareAcceleratedActivity.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+public class HardwareAcceleratedActivity extends BaseAcceleratedActivity {
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/SoftwareAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/SoftwareAcceleratedActivity.java
new file mode 100644
index 0000000..0a6a3df
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/SoftwareAcceleratedActivity.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+public class SoftwareAcceleratedActivity extends BaseAcceleratedActivity {
+}
diff --git a/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAcceleratedActivity.java b/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAcceleratedActivity.java
new file mode 100644
index 0000000..9def8b7
--- /dev/null
+++ b/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAcceleratedActivity.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+import android.os.Bundle;
+import android.view.WindowManager;
+
+public class WindowFlagHardwareAcceleratedActivity extends BaseAcceleratedActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
+ WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
+ }
+}
diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp
new file mode 100644
index 0000000..c0bef56
--- /dev/null
+++ b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
index 5bbc320..601dda1 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
index 335cad1..571ff44 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
index 44f8190..5772810 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
index 8931b9d..36cd1b1 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
index a29c2e1..63e25b8 100644
--- a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
index d57a212..c5bae27 100644
--- a/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
index 9e1b977..5f7c928 100644
--- a/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
+++ b/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4
Binary files differ
diff --git a/tests/tests/acceleration/Android.mk b/tests/tests/acceleration/Android.mk
new file mode 100644
index 0000000..3e2acac
--- /dev/null
+++ b/tests/tests/acceleration/Android.mk
@@ -0,0 +1,33 @@
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_JAVA_LIBRARIES := android.test.runner
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsAccelerationTestCases
+
+LOCAL_INSTRUMENTATION_FOR := CtsAccelerationTestStubs
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tests/tests/acceleration/AndroidManifest.xml b/tests/tests/acceleration/AndroidManifest.xml
new file mode 100644
index 0000000..8a2f955
--- /dev/null
+++ b/tests/tests/acceleration/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.acceleration">
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.test.InstrumentationTestRunner"
+ android:targetPackage="com.android.cts.acceleration.stub"
+ android:label="Tests for the Hardware Acceleration APIs." />
+
+</manifest>
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java
new file mode 100644
index 0000000..d2f1d9f
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.pm.ConfigurationInfo;
+import android.content.pm.FeatureInfo;
+import android.test.ActivityInstrumentationTestCase2;
+import android.view.View;
+
+abstract class BaseAccelerationTest<B extends BaseAcceleratedActivity>
+ extends ActivityInstrumentationTestCase2<B> {
+
+ protected B mActivity;
+
+ /** View with android:layerType="hardware" set */
+ protected AcceleratedView mHardwareView;
+
+ /** View with android:layerType="software" set */
+ protected AcceleratedView mSoftwareView;
+
+ /** View with setLayerType(HARDWARE) called */
+ protected AcceleratedView mManualHardwareView;
+
+ /** View with setLayerType(SOFTWARE) called */
+ protected AcceleratedView mManualSoftwareView;
+
+ BaseAccelerationTest(Class<B> clazz) {
+ super(clazz);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mActivity = getActivity();
+ mHardwareView = mActivity.getHardwareAcceleratedView();
+ mSoftwareView = mActivity.getSoftwareAcceleratedView();
+ mManualHardwareView = mActivity.getManualHardwareAcceleratedView();
+ mManualSoftwareView = mActivity.getManualSoftwareAcceleratedView();
+ }
+
+ public void testNotAttachedView() {
+ // Views that are not attached can't be attached to an accelerated window.
+ View view = new View(mActivity);
+ assertFalse(view.isHardwareAccelerated());
+ }
+
+ protected static int getGlEsVersion(Context context) {
+ ActivityManager activityManager =
+ (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo();
+ if (configInfo.reqGlEsVersion != ConfigurationInfo.GL_ES_VERSION_UNDEFINED) {
+ return getMajorVersion(configInfo.reqGlEsVersion);
+ } else {
+ return 1; // Lack of property means OpenGL ES version 1
+ }
+ }
+
+ /** @see FeatureInfo#getGlEsVersion() */
+ private static int getMajorVersion(int glEsVersion) {
+ return ((glEsVersion & 0xffff0000) >> 16);
+ }
+}
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java
new file mode 100644
index 0000000..eddd34f
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+/**
+ * Test that uses an Activity with hardware acceleration enabled.
+ */
+public class HardwareAccelerationTest
+ extends BaseAccelerationTest<HardwareAcceleratedActivity> {
+
+ public HardwareAccelerationTest() {
+ super(HardwareAcceleratedActivity.class);
+ }
+
+ public void testIsHardwareAccelerated() {
+ // Hardware acceleration should be available on devices with GL ES 2 or higher...
+ if (getGlEsVersion(mActivity) >= 2) {
+ // Both of the views are attached to a hardware accelerated window
+ assertTrue(mHardwareView.isHardwareAccelerated());
+ assertTrue(mSoftwareView.isHardwareAccelerated());
+ assertTrue(mManualHardwareView.isHardwareAccelerated());
+ assertTrue(mManualSoftwareView.isHardwareAccelerated());
+
+ assertTrue(mHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+ assertTrue(mManualHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+ } else {
+ assertFalse(mHardwareView.isHardwareAccelerated());
+ assertFalse(mSoftwareView.isHardwareAccelerated());
+ assertFalse(mManualHardwareView.isHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isHardwareAccelerated());
+
+ assertFalse(mHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+ }
+ }
+}
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java
new file mode 100644
index 0000000..146fa6a
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+/**
+ * Test that uses an Activity with hardware acceleration explicitly disabled
+ * and makes sure that all views are rendered using software acceleration.
+ */
+public class SoftwareAccelerationTest
+ extends BaseAccelerationTest<SoftwareAcceleratedActivity> {
+
+ public SoftwareAccelerationTest() {
+ super(SoftwareAcceleratedActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mActivity = getActivity();
+ }
+
+ public void testIsHardwareAccelerated() {
+ // Both of the views are not attached to a hardware accelerated window
+ assertFalse(mHardwareView.isHardwareAccelerated());
+ assertFalse(mSoftwareView.isHardwareAccelerated());
+ assertFalse(mManualHardwareView.isHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isHardwareAccelerated());
+
+ assertFalse(mHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+ }
+}
diff --git a/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java
new file mode 100644
index 0000000..bfbbe63
--- /dev/null
+++ b/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.acceleration.cts;
+
+/**
+ * Test that uses an Activity with hardware acceleration enabled.
+ */
+public class WindowFlagHardwareAccelerationTest
+ extends BaseAccelerationTest<WindowFlagHardwareAcceleratedActivity> {
+
+ public WindowFlagHardwareAccelerationTest() {
+ super(WindowFlagHardwareAcceleratedActivity.class);
+ }
+
+ public void testIsHardwareAccelerated() {
+ // Hardware acceleration should be available on devices with GL ES 2 or higher...
+ if (getGlEsVersion(mActivity) >= 2) {
+ // Both of the views are attached to a hardware accelerated window
+ assertTrue(mHardwareView.isHardwareAccelerated());
+ assertTrue(mSoftwareView.isHardwareAccelerated());
+ assertTrue(mManualHardwareView.isHardwareAccelerated());
+ assertTrue(mManualSoftwareView.isHardwareAccelerated());
+
+ assertTrue(mHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+ assertTrue(mManualHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+ } else {
+ assertFalse(mHardwareView.isHardwareAccelerated());
+ assertFalse(mSoftwareView.isHardwareAccelerated());
+ assertFalse(mManualHardwareView.isHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isHardwareAccelerated());
+
+ assertFalse(mHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mSoftwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualHardwareView.isCanvasHardwareAccelerated());
+ assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated());
+ }
+ }
+}
diff --git a/tests/tests/app/src/android/app/cts/WallpaperManagerTest.java b/tests/tests/app/src/android/app/cts/WallpaperManagerTest.java
new file mode 100644
index 0000000..62e00e9
--- /dev/null
+++ b/tests/tests/app/src/android/app/cts/WallpaperManagerTest.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app.cts;
+
+import android.app.WallpaperManager;
+import android.test.AndroidTestCase;
+
+public class WallpaperManagerTest extends AndroidTestCase {
+
+ private WallpaperManager mWallpaperManager;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mWallpaperManager = WallpaperManager.getInstance(mContext);
+ }
+
+ public void testSuggestDesiredDimensions() {
+ mWallpaperManager.suggestDesiredDimensions(320, 480);
+ int desiredMinimumWidth = mWallpaperManager.getDesiredMinimumWidth();
+ int desiredMinimumHeight = mWallpaperManager.getDesiredMinimumHeight();
+ assertEquals(320, desiredMinimumWidth);
+ assertEquals(480, desiredMinimumHeight);
+ }
+}
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index c519224..34e0eb1 100644
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -16,23 +16,19 @@
package android.content.cts;
-import dalvik.annotation.TestLevel;
-import dalvik.annotation.TestTargetClass;
-import dalvik.annotation.TestTargetNew;
-
import android.app.SearchManager;
import android.content.ContentUris;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
+import android.provider.AlarmClock;
import android.provider.MediaStore;
import android.provider.Settings;
import android.test.AndroidTestCase;
import java.util.List;
-@TestTargetClass(Intent.class)
public class AvailableIntentsTest extends AndroidTestCase {
private static final String NORMAL_URL = "http://www.google.com/";
private static final String SECURE_URL = "https://www.google.com/";
@@ -53,11 +49,6 @@
* Test ACTION_VIEW when url is http://web_address,
* it will open a browser window to the URL specified.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testViewNormalUrl() {
Uri uri = Uri.parse(NORMAL_URL);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -68,11 +59,6 @@
* Test ACTION_VIEW when url is https://web_address,
* it will open a browser window to the URL specified.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testViewSecureUrl() {
Uri uri = Uri.parse(SECURE_URL);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
@@ -83,11 +69,6 @@
* Test ACTION_WEB_SEARCH when url is http://web_address,
* it will open a browser window to the URL specified.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testWebSearchNormalUrl() {
Uri uri = Uri.parse(NORMAL_URL);
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
@@ -99,11 +80,6 @@
* Test ACTION_WEB_SEARCH when url is https://web_address,
* it will open a browser window to the URL specified.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testWebSearchSecureUrl() {
Uri uri = Uri.parse(SECURE_URL);
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
@@ -115,11 +91,6 @@
* Test ACTION_WEB_SEARCH when url is empty string,
* google search will be applied for the plain text.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testWebSearchPlainText() {
String searchString = "where am I?";
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
@@ -130,11 +101,6 @@
/**
* Test ACTION_CALL when uri is a phone number, it will call the entered phone number.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testCallPhoneNumber() {
Uri uri = Uri.parse("tel:2125551212");
Intent intent = new Intent(Intent.ACTION_CALL, uri);
@@ -144,11 +110,6 @@
/**
* Test ACTION_DIAL when uri is a phone number, it will dial the entered phone number.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testDialPhoneNumber() {
PackageManager packageManager = mContext.getPackageManager();
if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -161,11 +122,6 @@
/**
* Test ACTION_DIAL when uri is a phone number, it will dial the entered phone number.
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class, android.net.Uri.class}
- )
public void testDialVoicemail() {
PackageManager packageManager = mContext.getPackageManager();
if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -178,11 +134,6 @@
/**
* Test start camera by intent
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class}
- )
public void testCamera() {
PackageManager packageManager = mContext.getPackageManager();
if (packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)
@@ -208,11 +159,6 @@
/**
* Test add event in calendar
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class}
- )
public void testCalendarAddAppointment() {
Intent addAppointmentIntent = new Intent(Intent.ACTION_EDIT);
addAppointmentIntent.setType("vnd.android.cursor.item/event");
@@ -222,11 +168,6 @@
/**
* Test view call logs
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class}
- )
public void testContactsCallLogs() {
PackageManager packageManager = mContext.getPackageManager();
if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -239,11 +180,6 @@
/**
* Test view music playback
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class}
- )
public void testMusicPlayback() {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(ContentUris.withAppendedId(
@@ -254,11 +190,6 @@
/**
* Test launch inbox view of Mms application
*/
- @TestTargetNew(
- level = TestLevel.COMPLETE,
- method = "Intent",
- args = {java.lang.String.class}
- )
public void testViewMessageInbox() {
PackageManager packageManager = mContext.getPackageManager();
if (packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
@@ -270,4 +201,12 @@
assertCanBeHandled(intent);
}
}
+
+ public void testAlarmClock() {
+ Intent intent = new Intent(AlarmClock.ACTION_SET_ALARM);
+ intent.putExtra(AlarmClock.EXTRA_MESSAGE, "Custom message");
+ intent.putExtra(AlarmClock.EXTRA_HOUR, 12);
+ intent.putExtra(AlarmClock.EXTRA_MINUTES, 0);
+ assertCanBeHandled(intent);
+ }
}
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index f8f76ca..ad8e008 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -286,7 +286,7 @@
public void testLocalVideo_3gp_H263_176x144_300kbps_25fps_AAC_Stereo_128kbps_22050Hz()
throws Exception {
playVideoTest(
- R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz, 176, 144);
+ R.raw.video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz, 176, 144);
}
public void testCallback() throws Throwable {
diff --git a/tests/tests/security/src/android/security/cts/BannedFilesTest.java b/tests/tests/security/src/android/security/cts/BannedFilesTest.java
index 7a9c761..017bac0 100644
--- a/tests/tests/security/src/android/security/cts/BannedFilesTest.java
+++ b/tests/tests/security/src/android/security/cts/BannedFilesTest.java
@@ -23,6 +23,18 @@
public class BannedFilesTest extends TestCase {
/**
+ * setuid or setgid "ip" command can be used to modify the
+ * routing tables of a device, potentially allowing a malicious
+ * program to intercept all network traffic to and from
+ * the device.
+ */
+ public void testNoSetuidIp() {
+ assertNotSetugid("/system/bin/ip");
+ assertNotSetugid("/system/xbin/ip");
+ assertNotSetugid("/vendor/bin/ip");
+ }
+
+ /**
* setuid or setgid tcpdump can be used maliciously to monitor
* all traffic in and out of the device.
*/
@@ -31,6 +43,8 @@
assertNotSetugid("/system/bin/tcpdump-arm");
assertNotSetugid("/system/xbin/tcpdump");
assertNotSetugid("/system/xbin/tcpdump-arm");
+ assertNotSetugid("/vendor/bin/tcpdump");
+ assertNotSetugid("/vendor/bin/tcpdump-arm");
}
private static void assertNotSetugid(String file) {
diff --git a/tests/tests/security/src/android/security/cts/CertificateTest.java b/tests/tests/security/src/android/security/cts/CertificateTest.java
index d52111a..1a6f421 100644
--- a/tests/tests/security/src/android/security/cts/CertificateTest.java
+++ b/tests/tests/security/src/android/security/cts/CertificateTest.java
@@ -48,7 +48,7 @@
Set<String> deviceCertificates = getDeviceCertificates();
deviceCertificates.retainAll(blockCertificates);
- assertTrue("Bad certificates: " + deviceCertificates, deviceCertificates.isEmpty());
+ assertTrue("Blocked certificates: " + deviceCertificates, deviceCertificates.isEmpty());
}
private Set<String> getExpectedCertificates() {
diff --git a/tests/tests/security/src/android/security/cts/VoldExploitTest.java b/tests/tests/security/src/android/security/cts/VoldExploitTest.java
index 12b4392..1f0929f 100644
--- a/tests/tests/security/src/android/security/cts/VoldExploitTest.java
+++ b/tests/tests/security/src/android/security/cts/VoldExploitTest.java
@@ -56,12 +56,6 @@
return;
}
- // Verify that all processes listening for netlink messages
- // currently exist.
- for (int i : pids) {
- assertTrue(new File("/proc/" + i + "/cmdline").exists());
- }
-
NetlinkSocket ns = NetlinkSocket.create();
for (int i : pids) {
for (String j : devices) {
@@ -175,7 +169,7 @@
for (List<String> i : netlink) {
// The PID is in column 3
int pid = Integer.decode(i.get(2));
- if (pid > 0) {
+ if (new File("/proc/" + pid + "/cmdline").exists()) {
retval.add(pid);
}
}
diff --git a/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java b/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
index 830e91f..2cf6b58 100755
--- a/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
+++ b/tests/tests/view/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
@@ -356,7 +356,8 @@
mConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_7));
}
else {
- mConnection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_Q));
+ mInstrumentation.sendStringSync("q");
+ mInstrumentation.waitForIdleSync();
}
new DelayedCheck() {
@Override
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java
index 7d952a3..9ae2197 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/targetprep/CtsSetup.java
@@ -37,6 +37,7 @@
private static final String RUNNER_APK_NAME = "android.core.tests.runner.apk";
// TODO: read this from configuration file rather than hardcoding
private static final String TEST_STUBS_APK = "CtsTestStubs.apk";
+ private static final String ACCELERATION_TEST_STUBS_APK = "CtsAccelerationTestStubs.apk";
/**
* Factory method to create a {@link CtsBuildHelper}.
@@ -93,6 +94,7 @@
private void installCtsPrereqs(ITestDevice device, CtsBuildHelper ctsBuild)
throws DeviceNotAvailableException, TargetSetupError, FileNotFoundException {
installApk(device, ctsBuild.getTestApp(TEST_STUBS_APK));
+ installApk(device, ctsBuild.getTestApp(ACCELERATION_TEST_STUBS_APK));
installApk(device, ctsBuild.getTestApp(RUNNER_APK_NAME));
}
}