[automerger] Merge "Fix expected reverse lookup of Google DNS IP addresses" into marshmallow-cts-dev am: a30d6e5ddb am: 732d8d30e5 am: 669d55b57c
Change-Id: I3611dbe31a1c1d42c22549e065dce570e97bada3
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index 2a57273..d4190b7 100755
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -292,8 +292,7 @@
CVE-2015-6626 \
CVE-2016-2419 \
CVE-2016-2504 \
- CVE-2016-8430 \
- Bug-77238656
+ CVE-2016-8430
# All the files that will end up under the repository/testcases
# directory of the final CTS distribution.
diff --git a/apps/CtsVerifier/res/layout-land/sensor_test.xml b/apps/CtsVerifier/res/layout-land/sensor_test.xml
index f547978..5dbd95a 100644
--- a/apps/CtsVerifier/res/layout-land/sensor_test.xml
+++ b/apps/CtsVerifier/res/layout-land/sensor_test.xml
@@ -13,11 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -55,4 +55,4 @@
<include layout="@layout/snsr_next_button" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout-port/sensor_test.xml b/apps/CtsVerifier/res/layout-port/sensor_test.xml
index b4eca4d..024a3f3 100644
--- a/apps/CtsVerifier/res/layout-port/sensor_test.xml
+++ b/apps/CtsVerifier/res/layout-port/sensor_test.xml
@@ -13,11 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -44,4 +44,4 @@
<include layout="@layout/snsr_next_button"/>
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout-small/sensor_test.xml b/apps/CtsVerifier/res/layout-small/sensor_test.xml
index eefa5fa..96cf30a 100644
--- a/apps/CtsVerifier/res/layout-small/sensor_test.xml
+++ b/apps/CtsVerifier/res/layout-small/sensor_test.xml
@@ -13,12 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView android:id="@+id/log_scroll_view"
- app:layout_box="all"
+ app:ctsv_layout_box="all"
android:fillViewport="true"
android:layout_height="match_parent"
android:layout_width="match_parent">
@@ -42,4 +42,4 @@
</LinearLayout>
</ScrollView>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/ca_boot_notify.xml b/apps/CtsVerifier/res/layout/ca_boot_notify.xml
index 0ceece1..f56209d 100644
--- a/apps/CtsVerifier/res/layout/ca_boot_notify.xml
+++ b/apps/CtsVerifier/res/layout/ca_boot_notify.xml
@@ -14,11 +14,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
@@ -70,4 +70,4 @@
</LinearLayout>
</ScrollView>
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/cainstallnotify_main.xml b/apps/CtsVerifier/res/layout/cainstallnotify_main.xml
index 6cb6160..0182a0f 100644
--- a/apps/CtsVerifier/res/layout/cainstallnotify_main.xml
+++ b/apps/CtsVerifier/res/layout/cainstallnotify_main.xml
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -47,4 +47,4 @@
layout="@layout/pass_fail_buttons" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/car_dock_test_main.xml b/apps/CtsVerifier/res/layout/car_dock_test_main.xml
index c568b54..4a9c47e 100644
--- a/apps/CtsVerifier/res/layout/car_dock_test_main.xml
+++ b/apps/CtsVerifier/res/layout/car_dock_test_main.xml
@@ -13,11 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
@@ -29,4 +29,4 @@
android:layout_gravity="center"
android:text="@string/car_mode_enable" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/fs_main.xml b/apps/CtsVerifier/res/layout/fs_main.xml
index 8a78c81..ad46048 100644
--- a/apps/CtsVerifier/res/layout/fs_main.xml
+++ b/apps/CtsVerifier/res/layout/fs_main.xml
@@ -13,11 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -43,4 +43,4 @@
<include layout="@layout/pass_fail_buttons" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/intent_driven_test.xml b/apps/CtsVerifier/res/layout/intent_driven_test.xml
index bd9e4ca..dbb54c9 100644
--- a/apps/CtsVerifier/res/layout/intent_driven_test.xml
+++ b/apps/CtsVerifier/res/layout/intent_driven_test.xml
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -33,4 +33,4 @@
<include layout="@layout/pass_fail_buttons"/>
</LinearLayout>
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/js_charging.xml b/apps/CtsVerifier/res/layout/js_charging.xml
index 3540a88..d6a20c6 100644
--- a/apps/CtsVerifier/res/layout/js_charging.xml
+++ b/apps/CtsVerifier/res/layout/js_charging.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <ScrollView app:layout_box="all"
+ <ScrollView app:ctsv_layout_box="all"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
@@ -98,4 +98,4 @@
<include layout="@layout/pass_fail_buttons" />
</LinearLayout>
</ScrollView>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/js_connectivity.xml b/apps/CtsVerifier/res/layout/js_connectivity.xml
index b0e2824..0fbd48f 100644
--- a/apps/CtsVerifier/res/layout/js_connectivity.xml
+++ b/apps/CtsVerifier/res/layout/js_connectivity.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <ScrollView app:layout_box="all"
+ <ScrollView app:ctsv_layout_box="all"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
@@ -88,4 +88,4 @@
<include layout="@layout/pass_fail_buttons" />
</LinearLayout>
</ScrollView>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/js_idle.xml b/apps/CtsVerifier/res/layout/js_idle.xml
index 5289b98..732f503 100644
--- a/apps/CtsVerifier/res/layout/js_idle.xml
+++ b/apps/CtsVerifier/res/layout/js_idle.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <ScrollView app:layout_box="all"
+ <ScrollView app:ctsv_layout_box="all"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
@@ -69,4 +69,4 @@
<include layout="@layout/pass_fail_buttons" />
</LinearLayout>
</ScrollView>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/keychain_main.xml b/apps/CtsVerifier/res/layout/keychain_main.xml
index 3f695cd..b134908 100644
--- a/apps/CtsVerifier/res/layout/keychain_main.xml
+++ b/apps/CtsVerifier/res/layout/keychain_main.xml
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout
+<com.android.cts.verifier.BoxInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
@@ -92,4 +92,4 @@
layout="@layout/pass_fail_buttons" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/list_content.xml b/apps/CtsVerifier/res/layout/list_content.xml
index 8670283..e7de596 100644
--- a/apps/CtsVerifier/res/layout/list_content.xml
+++ b/apps/CtsVerifier/res/layout/list_content.xml
@@ -15,14 +15,14 @@
~ See the License for the specific language governing permissions and
~ limitations under the License
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@android:id/list"
- app:layout_box="all"
+ app:ctsv_layout_box="all"
android:layout_width="match_parent"
android:layout_height="match_parent" />
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/location_mode_main.xml b/apps/CtsVerifier/res/layout/location_mode_main.xml
index 1768434..58ac069 100644
--- a/apps/CtsVerifier/res/layout/location_mode_main.xml
+++ b/apps/CtsVerifier/res/layout/location_mode_main.xml
@@ -14,11 +14,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@@ -47,4 +47,4 @@
layout="@layout/pass_fail_buttons" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/pa_main.xml b/apps/CtsVerifier/res/layout/pa_main.xml
index 832af71..b748123 100644
--- a/apps/CtsVerifier/res/layout/pa_main.xml
+++ b/apps/CtsVerifier/res/layout/pa_main.xml
@@ -13,11 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <RelativeLayout app:layout_box="all"
+ <RelativeLayout app:ctsv_layout_box="all"
android:layout_width="match_parent"
android:layout_height="match_parent" >
@@ -33,4 +33,4 @@
android:layout_below="@id/pass_fail_buttons" />
</RelativeLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/pass_fail_list.xml b/apps/CtsVerifier/res/layout/pass_fail_list.xml
index cdd40e1..575e630 100644
--- a/apps/CtsVerifier/res/layout/pass_fail_list.xml
+++ b/apps/CtsVerifier/res/layout/pass_fail_list.xml
@@ -13,12 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -39,4 +39,4 @@
<include layout="@layout/pass_fail_buttons" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/poa_main.xml b/apps/CtsVerifier/res/layout/poa_main.xml
index 41bade0..b3c5588 100644
--- a/apps/CtsVerifier/res/layout/poa_main.xml
+++ b/apps/CtsVerifier/res/layout/poa_main.xml
@@ -13,11 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
- <LinearLayout app:layout_box="all"
+ <LinearLayout app:ctsv_layout_box="all"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
@@ -31,4 +31,4 @@
android:textAppearance="@style/InstructionsFont" />
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/pwa_widgets.xml b/apps/CtsVerifier/res/layout/pwa_widgets.xml
index 6204d3e..7ead0cb 100644
--- a/apps/CtsVerifier/res/layout/pwa_widgets.xml
+++ b/apps/CtsVerifier/res/layout/pwa_widgets.xml
@@ -13,19 +13,19 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
- app:layout_box="all"
+ app:ctsv_layout_box="all"
android:id="@+id/texture_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
- app:layout_box="all"
+ app:ctsv_layout_box="all"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
@@ -59,4 +59,4 @@
</LinearLayout>
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/values/attrs.xml b/apps/CtsVerifier/res/values/attrs.xml
index 71a1ba6..9490c87 100644
--- a/apps/CtsVerifier/res/values/attrs.xml
+++ b/apps/CtsVerifier/res/values/attrs.xml
@@ -15,7 +15,7 @@
-->
<resources>
<declare-styleable name="BoxInsetLayout_Layout">
- <attr name="layout_box">
+ <attr name="ctsv_layout_box">
<flag name="left" value="0x01" />
<flag name="top" value="0x02" />
<flag name="right" value="0x04" />
diff --git a/apps/CtsVerifier/src/android/support/wearable/view/BoxInsetLayout.java b/apps/CtsVerifier/src/com/android/cts/verifier/BoxInsetLayout.java
similarity index 97%
rename from apps/CtsVerifier/src/android/support/wearable/view/BoxInsetLayout.java
rename to apps/CtsVerifier/src/com/android/cts/verifier/BoxInsetLayout.java
index 77d6a21..2edddf8 100644
--- a/apps/CtsVerifier/src/android/support/wearable/view/BoxInsetLayout.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/BoxInsetLayout.java
@@ -14,9 +14,7 @@
* limitations under the License
*/
-package android.support.wearable.view;
-
-import com.android.cts.verifier.R;
+package com.android.cts.verifier;
import android.annotation.TargetApi;
import android.os.Build;
@@ -34,10 +32,10 @@
/**
* BoxInsetLayout is a screen shape-aware FrameLayout that can box its children
* in the center square of a round screen by using the
- * {@code layout_box} attribute. The values for this attribute specify the
+ * {@code ctsv_layout_box} attribute. The values for this attribute specify the
* child's edges to be boxed in:
* {@code left|top|right|bottom} or {@code all}.
- * The {@code layout_box} attribute is ignored on a device with a rectangular
+ * The {@code ctsv_layout_box} attribute is ignored on a device with a rectangular
* screen.
*/
@TargetApi(Build.VERSION_CODES.KITKAT_WATCH)
@@ -383,7 +381,7 @@
}
/**
- * adds {@code layout_box} attribute to layout parameters
+ * adds {@code ctsv_layout_box} attribute to layout parameters
*/
public static class LayoutParams extends FrameLayout.LayoutParams {
@@ -399,7 +397,7 @@
public LayoutParams(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BoxInsetLayout_Layout, 0, 0);
- boxedEdges = a.getInt(R.styleable.BoxInsetLayout_Layout_layout_box, BOX_NONE);
+ boxedEdges = a.getInt(R.styleable.BoxInsetLayout_Layout_ctsv_layout_box, BOX_NONE);
a.recycle();
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
index fdc1bdc..3688aee 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
@@ -160,6 +160,7 @@
List<ResolveInfo> getResolveInfosForParent() {
Intent mainIntent = new Intent(Intent.ACTION_MAIN);
mainIntent.addCategory(CATEGORY_MANUAL_TEST);
+ mainIntent.setPackage(mContext.getPackageName());
PackageManager packageManager = mContext.getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(mainIntent,
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
index 2c3d35d..4a8004a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
@@ -59,7 +59,7 @@
private static final String INFO_DIALOG_MESSAGE_ID = "infoDialogMessageId";
// Interface mostly for making documentation and refactoring easier...
- private interface PassFailActivity {
+ public interface PassFailActivity {
/**
* Hooks up the pass and fail buttons to click listeners that will record the test results.
@@ -268,7 +268,7 @@
}
}
- private static <T extends android.app.Activity & PassFailActivity>
+ protected static <T extends android.app.Activity & PassFailActivity>
void setPassFailClickListeners(final T activity) {
View.OnClickListener clickListener = new View.OnClickListener() {
@Override
@@ -299,7 +299,7 @@
});
}
- private static void setInfo(final android.app.Activity activity, final int titleId,
+ protected static void setInfo(final android.app.Activity activity, final int titleId,
final int messageId, final int viewId) {
// Show the middle "info" button and make it show the info dialog when clicked.
View infoButton = activity.findViewById(R.id.info_button);
@@ -324,12 +324,11 @@
}
}
- private static boolean hasSeenInfoDialog(android.app.Activity activity) {
+ protected static boolean hasSeenInfoDialog(android.app.Activity activity) {
ContentResolver resolver = activity.getContentResolver();
Cursor cursor = null;
try {
- cursor = resolver.query(
- TestResultsProvider.getTestNameUri(activity.getClass().getName()),
+ cursor = resolver.query(TestResultsProvider.getTestNameUri(activity),
new String[] {TestResultsProvider.COLUMN_TEST_INFO_SEEN}, null, null, null);
return cursor.moveToFirst() && cursor.getInt(0) > 0;
} finally {
@@ -339,7 +338,7 @@
}
}
- private static void showInfoDialog(final android.app.Activity activity, int titleId,
+ protected static void showInfoDialog(final android.app.Activity activity, int titleId,
int messageId, int viewId) {
Bundle args = new Bundle();
args.putInt(INFO_DIALOG_TITLE_ID, titleId);
@@ -348,7 +347,7 @@
activity.showDialog(INFO_DIALOG_ID, args);
}
- private static Dialog createDialog(final android.app.Activity activity, int id, Bundle args) {
+ protected static Dialog createDialog(final android.app.Activity activity, int id, Bundle args) {
switch (id) {
case INFO_DIALOG_ID:
return createInfoDialog(activity, id, args);
@@ -357,7 +356,7 @@
}
}
- private static Dialog createInfoDialog(final android.app.Activity activity, int id,
+ protected static Dialog createInfoDialog(final android.app.Activity activity, int id,
Bundle args) {
int viewId = args.getInt(INFO_DIALOG_VIEW_ID);
int titleId = args.getInt(INFO_DIALOG_TITLE_ID);
@@ -386,21 +385,20 @@
return builder.create();
}
- private static void markSeenInfoDialog(android.app.Activity activity) {
+ protected static void markSeenInfoDialog(android.app.Activity activity) {
ContentResolver resolver = activity.getContentResolver();
ContentValues values = new ContentValues(2);
values.put(TestResultsProvider.COLUMN_TEST_NAME, activity.getClass().getName());
values.put(TestResultsProvider.COLUMN_TEST_INFO_SEEN, 1);
int numUpdated = resolver.update(
- TestResultsProvider.getTestNameUri(activity.getClass().getName()),
- values, null, null);
+ TestResultsProvider.getTestNameUri(activity), values, null, null);
if (numUpdated == 0) {
- resolver.insert(TestResultsProvider.RESULTS_CONTENT_URI, values);
+ resolver.insert(TestResultsProvider.getResultContentUri(activity), values);
}
}
/** Set the test result corresponding to the button clicked and finish the activity. */
- private static void setTestResultAndFinish(android.app.Activity activity, String testId,
+ protected static void setTestResultAndFinish(android.app.Activity activity, String testId,
String testDetails, ReportLog reportLog, View target) {
boolean passed;
if (target.getId() == R.id.pass_button) {
@@ -415,7 +413,7 @@
}
/** Set the test result and finish the activity. */
- private static void setTestResultAndFinishHelper(android.app.Activity activity, String testId,
+ protected static void setTestResultAndFinishHelper(android.app.Activity activity, String testId,
String testDetails, boolean passed, ReportLog reportLog) {
if (passed) {
TestResult.setPassedResult(activity, testId, testDetails, reportLog);
@@ -426,7 +424,7 @@
activity.finish();
}
- private static ImageButton getPassButtonView(android.app.Activity activity) {
+ protected static ImageButton getPassButtonView(android.app.Activity activity) {
return (ImageButton) activity.findViewById(R.id.pass_button);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
index 51604cb..cb36a1e 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
@@ -123,7 +123,7 @@
TestResultContentObserver observer = new TestResultContentObserver();
ContentResolver resolver = context.getContentResolver();
- resolver.registerContentObserver(TestResultsProvider.RESULTS_CONTENT_URI, true, observer);
+ resolver.registerContentObserver(TestResultsProvider.getResultContentUri(context), true, observer);
}
public void loadTestResults() {
@@ -196,7 +196,7 @@
ContentResolver resolver = mContext.getContentResolver();
Cursor cursor = null;
try {
- cursor = resolver.query(TestResultsProvider.RESULTS_CONTENT_URI, REFRESH_PROJECTION,
+ cursor = resolver.query(TestResultsProvider.getResultContentUri(mContext), REFRESH_PROJECTION,
null, null, null);
if (cursor.moveToFirst()) {
do {
@@ -222,7 +222,7 @@
@Override
protected Void doInBackground(Void... params) {
ContentResolver resolver = mContext.getContentResolver();
- resolver.delete(TestResultsProvider.RESULTS_CONTENT_URI, "1", null);
+ resolver.delete(TestResultsProvider.getResultContentUri(mContext), "1", null);
return null;
}
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsBackupHelper.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsBackupHelper.java
index 45e528f..2527d57 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsBackupHelper.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsBackupHelper.java
@@ -53,7 +53,7 @@
ContentResolver resolver = mContext.getContentResolver();
Cursor cursor = null;
try {
- cursor = resolver.query(TestResultsProvider.RESULTS_CONTENT_URI,
+ cursor = resolver.query(TestResultsProvider.getResultContentUri(mContext),
null, null, null, null);
int nameIndex = cursor.getColumnIndex(TestResultsProvider.COLUMN_TEST_NAME);
int resultIndex = cursor.getColumnIndex(TestResultsProvider.COLUMN_TEST_RESULT);
@@ -128,7 +128,7 @@
}
ContentResolver resolver = mContext.getContentResolver();
- resolver.bulkInsert(TestResultsProvider.RESULTS_CONTENT_URI, values);
+ resolver.bulkInsert(TestResultsProvider.getResultContentUri(mContext), values);
} else {
Log.e(TAG, "Skipping key: " + data.getKey());
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
index a9f672e..64c04eb 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
@@ -39,13 +39,26 @@
private static final String RESULTS_PATH = "results";
- public static final String AUTHORITY = "com.android.cts.verifier.testresultsprovider";
- public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
- public static final Uri RESULTS_CONTENT_URI =
- Uri.withAppendedPath(CONTENT_URI, RESULTS_PATH);
+ /**
+ * Get the URI from the result content.
+ * @param context
+ * @return Uri
+ */
+ public static Uri getResultContentUri(Context context) {
+ final String packageName = context.getPackageName();
+ final Uri contentUri = Uri.parse("content://" + packageName + ".testresultsprovider");
+ return Uri.withAppendedPath(contentUri, RESULTS_PATH);
+ }
- public static Uri getTestNameUri(String testName) {
- return Uri.withAppendedPath(RESULTS_CONTENT_URI, testName);
+ /**
+ * Get the URI from the test name.
+ * @param context
+ * @param testName
+ * @return Uri
+ */
+ public static Uri getTestNameUri(Context context) {
+ final String testName = context.getClass().getName();
+ return Uri.withAppendedPath(getResultContentUri(context), testName);
}
static final String _ID = "_id";
@@ -69,11 +82,6 @@
private static final int RESULTS_ALL = 1;
private static final int RESULTS_ID = 2;
private static final int RESULTS_TEST_NAME = 3;
- static {
- URI_MATCHER.addURI(AUTHORITY, RESULTS_PATH, RESULTS_ALL);
- URI_MATCHER.addURI(AUTHORITY, RESULTS_PATH + "/#", RESULTS_ID);
- URI_MATCHER.addURI(AUTHORITY, RESULTS_PATH + "/*", RESULTS_TEST_NAME);
- }
private static final String TABLE_NAME = "results";
@@ -83,6 +91,12 @@
@Override
public boolean onCreate() {
+ final String authority = getContext().getPackageName() + ".testresultsprovider";
+
+ URI_MATCHER.addURI(authority, RESULTS_PATH, RESULTS_ALL);
+ URI_MATCHER.addURI(authority, RESULTS_PATH + "/#", RESULTS_ID);
+ URI_MATCHER.addURI(authority, RESULTS_PATH + "/*", RESULTS_TEST_NAME);
+
mOpenHelper = new TestResultsOpenHelper(getContext());
mBackupManager = new BackupManager(getContext());
return false;
@@ -153,7 +167,7 @@
long id = db.insert(TABLE_NAME, null, values);
getContext().getContentResolver().notifyChange(uri, null);
mBackupManager.dataChanged();
- return Uri.withAppendedPath(RESULTS_CONTENT_URI, "" + id);
+ return Uri.withAppendedPath(getResultContentUri(getContext()), "" + id);
}
@Override
@@ -219,13 +233,14 @@
values.put(TestResultsProvider.COLUMN_TEST_DETAILS, testDetails);
values.put(TestResultsProvider.COLUMN_TEST_METRICS, serialize(reportLog));
+ final Uri uri = getResultContentUri(context);
ContentResolver resolver = context.getContentResolver();
- int numUpdated = resolver.update(TestResultsProvider.RESULTS_CONTENT_URI, values,
+ int numUpdated = resolver.update(uri, values,
TestResultsProvider.COLUMN_TEST_NAME + " = ?",
new String[] {testName});
if (numUpdated == 0) {
- resolver.insert(TestResultsProvider.RESULTS_CONTENT_URI, values);
+ resolver.insert(uri, values);
}
}
diff --git a/hostsidetests/security/AndroidTest.xml b/hostsidetests/security/AndroidTest.xml
index 1ac409f..c2811b7 100755
--- a/hostsidetests/security/AndroidTest.xml
+++ b/hostsidetests/security/AndroidTest.xml
@@ -16,7 +16,6 @@
<configuration description="Config for the CTS Security host tests">
<target_preparer class="com.android.cts.tradefed.targetprep.CtsFilePusher">
<option name="cleanup" value="true" />
- <option name="push" value="Bug-77238656->/data/local/tmp/Bug-77238656" />
<option name="push" value="CVE-2016-8430->/data/local/tmp/CVE-2016-8430" />
<option name="push" value="CVE-2016-2504->/data/local/tmp/CVE-2016-2504" />
diff --git a/hostsidetests/security/securityPatch/Bug-77238656/Android.mk b/hostsidetests/security/securityPatch/Bug-77238656/Android.mk
deleted file mode 100644
index 586be3d..0000000
--- a/hostsidetests/security/securityPatch/Bug-77238656/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2018 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT 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 := Bug-77238656
-LOCAL_SRC_FILES := poc.cpp
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
-LOCAL_CTS_TEST_PACKAGE := android.security.cts
-
-LOCAL_SHARED_LIBRARIES := liblog libcamera_metadata
-
-LOCAL_ARM_MODE := arm
-LOCAL_CFLAGS += -Wall -Werror -W -g
-include $(BUILD_CTS_EXECUTABLE)
-
-$(CTS_TESTCASES_OUT)/Bug-77238656 : $(LOCAL_BUILT_MODULE) | $(ACP)
- $(copy-file-to-target)
diff --git a/hostsidetests/security/securityPatch/Bug-77238656/poc.cpp b/hostsidetests/security/securityPatch/Bug-77238656/poc.cpp
deleted file mode 100644
index 0b26d14..0000000
--- a/hostsidetests/security/securityPatch/Bug-77238656/poc.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <utils/Log.h>
-#include "system/camera_metadata.h"
-
-static const uint32_t kPaddingByteOffset = 36;
-
-int main() {
- camera_metadata_t *buffer = nullptr;
- buffer = allocate_camera_metadata(1, 100);
- if (buffer != nullptr) {
- uint8_t *byteBuffer = reinterpret_cast<uint8_t *> (buffer);
- if ((byteBuffer[kPaddingByteOffset] != 0) ||
- (byteBuffer[kPaddingByteOffset + 1] != 0) ||
- (byteBuffer[kPaddingByteOffset + 2] != 0) ||
- (byteBuffer[kPaddingByteOffset + 3] != 0)) {
- ALOGE("Metadata padding is not empty");
- }
- free_camera_metadata(buffer);
- }
-
- return 0;
-}
diff --git a/hostsidetests/security/src/android/host/security/cts/Poc18_07.java b/hostsidetests/security/src/android/host/security/cts/Poc18_07.java
deleted file mode 100644
index e35a38c..0000000
--- a/hostsidetests/security/src/android/host/security/cts/Poc18_07.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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.host.security.cts;
-
-import com.android.cts.util.SecurityTest;
-
-public class Poc18_07 extends SecurityTestCase {
-
- /**
- * b/77238656
- */
- @SecurityTest
- public void testPocBug_77238656() throws Exception {
- final String PROPERTY_GET = "getprop libc.debug.malloc";
- final String PROPERTY_SET = "setprop libc.debug.malloc ";
- enableAdbRoot(getDevice());
- String oldProperty = AdbUtils.runCommandLine(PROPERTY_GET, getDevice());
- AdbUtils.runCommandLine(PROPERTY_SET + "5", getDevice());
- AdbUtils.runCommandLine("logcat -c", getDevice());
- AdbUtils.runPoc("Bug-77238656", getDevice(), 30);
- String logcat = AdbUtils.runCommandLine("logcat -d", getDevice());
- if ((oldProperty == null) || (oldProperty.isEmpty())) {
- AdbUtils.runCommandLine(PROPERTY_SET + "\"\"", getDevice());
- } else {
- AdbUtils.runCommandLine(PROPERTY_SET + "\"" + oldProperty + "\"", getDevice());
- }
- assertNotMatches("[\\s\\n\\S]*Metadata padding is not empty[\\s\\n\\S]*", logcat);
- }
-}
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/VoiceSettingsTestBase.java b/libs/deviceutil/src/android/cts/util/BroadcastTestBase.java
similarity index 69%
rename from tests/tests/voicesettings/src/android/voicesettings/cts/VoiceSettingsTestBase.java
rename to libs/deviceutil/src/android/cts/util/BroadcastTestBase.java
index fe30d90..c4da8f3 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/VoiceSettingsTestBase.java
+++ b/libs/deviceutil/src/android/cts/util/BroadcastTestBase.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.voicesettings.cts;
+package android.cts.util;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -23,36 +23,35 @@
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.os.Bundle;
+import android.cts.util.BroadcastTestStartActivity;
+import android.cts.util.BroadcastUtils;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
-
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-public class VoiceSettingsTestBase extends ActivityInstrumentationTestCase2<TestStartActivity> {
- static final String TAG = "VoiceSettingsTestBase";
+public class BroadcastTestBase extends ActivityInstrumentationTestCase2<
+ BroadcastTestStartActivity> {
+ static final String TAG = "BroadcastTestBase";
protected static final int TIMEOUT_MS = 20 * 1000;
protected Context mContext;
protected Bundle mResultExtras;
private CountDownLatch mLatch;
- private ActivityDoneReceiver mActivityDoneReceiver = null;
- private TestStartActivity mActivity;
- private Utils.TestcaseType mTestCaseType;
+ protected ActivityDoneReceiver mActivityDoneReceiver = null;
+ private BroadcastTestStartActivity mActivity;
+ private BroadcastUtils.TestcaseType mTestCaseType;
protected boolean mHasFeature;
- protected static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
- public VoiceSettingsTestBase() {
- super(TestStartActivity.class);
+ public BroadcastTestBase() {
+ super(BroadcastTestStartActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
- mContext = getInstrumentation().getTargetContext();
- mHasFeature = mContext.getPackageManager().hasSystemFeature(FEATURE_VOICE_RECOGNIZERS);
+ mHasFeature = false;
}
@Override
@@ -75,7 +74,7 @@
final PackageManager manager = mContext.getPackageManager();
assertNotNull(manager);
if (manager.resolveActivity(intent, 0) == null) {
- Log.i(TAG, "No Voice Activity found for the intent: " + intentStr);
+ Log.i(TAG, "No Activity found for the intent: " + intentStr);
return false;
}
return true;
@@ -85,24 +84,24 @@
Intent intent = new Intent();
intent.setAction("android.intent.action.TEST_START_ACTIVITY_" + intentSuffix);
intent.setComponent(new ComponentName(getInstrumentation().getContext(),
- TestStartActivity.class));
+ BroadcastTestStartActivity.class));
setActivityIntent(intent);
mActivity = getActivity();
}
- protected void registerBroadcastReceiver(Utils.TestcaseType testCaseType) throws Exception {
+ protected void registerBroadcastReceiver(BroadcastUtils.TestcaseType testCaseType) throws Exception {
mTestCaseType = testCaseType;
mLatch = new CountDownLatch(1);
mActivityDoneReceiver = new ActivityDoneReceiver();
mContext.registerReceiver(mActivityDoneReceiver,
- new IntentFilter(Utils.BROADCAST_INTENT + testCaseType.toString()));
+ new IntentFilter(BroadcastUtils.BROADCAST_INTENT + testCaseType.toString()));
}
- protected boolean startTestAndWaitForBroadcast(Utils.TestcaseType testCaseType)
- throws Exception {
+ protected boolean startTestAndWaitForBroadcast(BroadcastUtils.TestcaseType testCaseType,
+ String pkg, String cls) throws Exception {
Log.i(TAG, "Begin Testing: " + testCaseType);
registerBroadcastReceiver(testCaseType);
- mActivity.startTest(testCaseType.toString());
+ mActivity.startTest(testCaseType.toString(), pkg, cls);
if (!mLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
fail("Failed to receive broadcast in " + TIMEOUT_MS + "msec");
return false;
@@ -114,11 +113,11 @@
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(
- Utils.BROADCAST_INTENT +
- VoiceSettingsTestBase.this.mTestCaseType.toString())) {
+ BroadcastUtils.BROADCAST_INTENT +
+ BroadcastTestBase.this.mTestCaseType.toString())) {
Bundle extras = intent.getExtras();
- Log.i(TAG, "received_broadcast for " + Utils.toBundleString(extras));
- VoiceSettingsTestBase.this.mResultExtras = extras;
+ Log.i(TAG, "received_broadcast for " + BroadcastUtils.toBundleString(extras));
+ BroadcastTestBase.this.mResultExtras = extras;
mLatch.countDown();
}
}
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/TestStartActivity.java b/libs/deviceutil/src/android/cts/util/BroadcastTestStartActivity.java
similarity index 80%
rename from tests/tests/voicesettings/src/android/voicesettings/cts/TestStartActivity.java
rename to libs/deviceutil/src/android/cts/util/BroadcastTestStartActivity.java
index cef29b1..fda6786 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/TestStartActivity.java
+++ b/libs/deviceutil/src/android/cts/util/BroadcastTestStartActivity.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package android.voicesettings.cts;
+package android.cts.util;
import android.app.Activity;
import android.content.Intent;
@@ -22,10 +22,10 @@
import android.os.Bundle;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
+import android.cts.util.BroadcastUtils;
-public class TestStartActivity extends Activity {
- static final String TAG = "TestStartActivity";
+public class BroadcastTestStartActivity extends Activity {
+ static final String TAG = "BroadcastTestStartActivity";
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -39,13 +39,12 @@
Log.i(TAG, " in onResume");
}
- void startTest(String testCaseType) {
+ void startTest(String testCaseType, String pkg, String cls) {
Intent intent = new Intent();
Log.i(TAG, "received_testcasetype = " + testCaseType);
- intent.putExtra(Utils.TESTCASE_TYPE, testCaseType);
+ intent.putExtra(BroadcastUtils.TESTCASE_TYPE, testCaseType);
intent.setAction("android.intent.action.VIMAIN_" + testCaseType);
- intent.setComponent(new ComponentName("android.voicesettings.service",
- "android.voicesettings.service.VoiceInteractionMain"));
+ intent.setComponent(new ComponentName(pkg, cls));
startActivity(intent);
}
diff --git a/tests/tests/voicesettings/common/src/android/voicesettings/common/Utils.java b/libs/deviceutil/src/android/cts/util/BroadcastUtils.java
similarity index 89%
rename from tests/tests/voicesettings/common/src/android/voicesettings/common/Utils.java
rename to libs/deviceutil/src/android/cts/util/BroadcastUtils.java
index 44514b0..1392df2 100644
--- a/tests/tests/voicesettings/common/src/android/voicesettings/common/Utils.java
+++ b/libs/deviceutil/src/android/cts/util/BroadcastUtils.java
@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package common.src.android.voicesettings.common;
+package android.cts.util;
import android.os.Bundle;
-public class Utils {
+public class BroadcastUtils {
public enum TestcaseType {
ZEN_MODE_ON,
ZEN_MODE_OFF,
@@ -25,10 +25,12 @@
AIRPLANE_MODE_OFF,
BATTERYSAVER_MODE_ON,
BATTERYSAVER_MODE_OFF,
+ THEATER_MODE_ON,
+ THEATER_MODE_OFF
}
public static final String TESTCASE_TYPE = "Testcase_type";
public static final String BROADCAST_INTENT =
- "android.intent.action.FROM_VOICESETTINGS_CTS_TEST_";
+ "android.intent.action.FROM_UTIL_CTS_TEST_";
public static final int NUM_MINUTES_FOR_ZENMODE = 10;
public static final String toBundleString(Bundle bundle) {
diff --git a/tests/tests/voicesettings/common/Android.mk b/libs/view/Android.mk
similarity index 80%
rename from tests/tests/voicesettings/common/Android.mk
rename to libs/view/Android.mk
index 1478ef2..0b121da 100644
--- a/tests/tests/voicesettings/common/Android.mk
+++ b/libs/view/Android.mk
@@ -1,3 +1,4 @@
+#
# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,20 +12,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+#
LOCAL_PATH:= $(call my-dir)
-
include $(CLEAR_VARS)
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := CtsVoiceSettingsCommon
-
+LOCAL_MODULE := cts-view-lib
+LOCAL_MODULE_TAGS := optional
LOCAL_SDK_VERSION := current
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/libs/view/src/com/android/view/Position.java b/libs/view/src/com/android/view/Position.java
new file mode 100644
index 0000000..e0b848c
--- /dev/null
+++ b/libs/view/src/com/android/view/Position.java
@@ -0,0 +1,108 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.view;
+
+/**
+ * Represents coordinates where (x, y) = (0, 0) represents the top-left most point.
+ */
+public class Position {
+ private final float mX;
+ private final float mY;
+
+ public Position(float x, float y) {
+ mX = x;
+ mY = y;
+ }
+
+ public float getX() {
+ return mX;
+ }
+
+ public float getY() {
+ return mY;
+ }
+
+ /**
+ * @return The vector dot product between {@code this} and another {@link Position}.
+ */
+ public double dotProduct(Position other) {
+ return (mX * other.mX) + (mY * other.mY);
+ }
+
+ /**
+ * @return The euclidean distance between {@code this} and the other {@link Position}.
+ */
+ public double distanceTo(Position other) {
+ return Math.sqrt(Math.pow((mX - other.mX), 2) + Math.pow((mY - other.mY), 2));
+ }
+
+ /**
+ * Returns the closest double approximation to the smallest angle swept out by an arc from
+ * {@code this} to the other {@link Position}, given the origin of the arc.
+ *
+ * @param origin The {@link Position} to use as the origin of the arc.
+ * @return The angle swept out, in radians within the range {@code [-pi..pi]}. A negative double
+ * indicates that the smallest angle swept out is in the clockwise direction, and a positive
+ * double indicates otherwise.
+ */
+ public double arcAngleTo(Position other, Position origin) {
+ // Compute the angle of the polar representation of this and other w.r.t. the arc origin.
+ double originToThisAngle = Math.atan2(origin.mY - mY, mX - origin.mX);
+ double originToOtherAngle = Math.atan2(origin.mY - other.mY, other.mX - origin.mX);
+ double difference = originToOtherAngle - originToThisAngle;
+
+ // If the difference exceeds PI or is less then -PI, then we should compensate to
+ // bring the value back into the [-pi..pi] range by removing/adding a full revolution.
+ if (difference < -Math.PI) {
+ difference += 2 * Math.PI;
+ } else if (difference > Math.PI){
+ difference -= 2 * Math.PI;
+ }
+ return difference;
+ }
+
+ /**
+ * Returns the closest double approximation to the angle to the other {@link Position}.
+ *
+ * @return The angle swept out, in radians within the range {@code [-pi..pi]}.
+ */
+ public double angleTo(Position other) {
+ return Math.atan2(other.mY - mY, other.mX - mX);
+ }
+
+ /**
+ * Defines equality between pairs of {@link Position}s.
+ * <p>
+ * Two Position instances are defined to be equal if their x and y coordinates are equal.
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof Position)) {
+ return false;
+ }
+ Position other = (Position) o;
+ return (Float.compare(other.mX, mX) == 0) && (Float.compare(other.mY, mY) == 0);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ result = 31 * result + Float.floatToIntBits(mX);
+ result = 31 * result + Float.floatToIntBits(mY);
+ return result;
+ }
+}
diff --git a/libs/view/src/com/android/view/RenderedSurfaceView.java b/libs/view/src/com/android/view/RenderedSurfaceView.java
new file mode 100644
index 0000000..f42b558
--- /dev/null
+++ b/libs/view/src/com/android/view/RenderedSurfaceView.java
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.view;
+
+import android.content.Context;
+import android.graphics.Canvas;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+
+/**
+ * A {@link SurfaceView} that manages its own rendering thread and uses a {@link SurfaceRenderer} to
+ * dictate what should be drawn for each frame.
+ */
+public class RenderedSurfaceView extends SurfaceView implements SurfaceHolder.Callback {
+
+ private static final int JOIN_TIME_OUT_MS = 1000;
+
+ private SurfaceRenderer mRenderer;
+ private volatile boolean mRunning;
+ private Thread mRenderThread;
+
+ public RenderedSurfaceView(Context context) {
+ super(context);
+
+ mRenderer = null;
+ mRunning = false;
+ getHolder().addCallback(this);
+ }
+
+ /**
+ * Sets the renderer to be used.
+ *
+ * <i>Must</i> be called after instantiation.
+ */
+ public void setRenderer(SurfaceRenderer renderer) {
+ mRenderer = renderer;
+ }
+
+ @Override
+ public void surfaceCreated(SurfaceHolder surfaceHolder) {
+ mRenderThread = new RenderThread();
+ mRunning = true;
+ mRenderThread.start();
+ }
+
+ @Override
+ public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) {
+ // Configuration changes are disabled so surface changes can be ignored.
+ }
+
+ @Override
+ public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
+ mRunning = false;
+ // Wait for rendering thread to halt after it has observed that it should no longer render
+ while (true) {
+ try {
+ mRenderThread.join(JOIN_TIME_OUT_MS);
+ break;
+ } catch (InterruptedException e) {
+ // Ignore spurious wakeup
+ }
+ }
+ mRenderThread = null;
+ }
+
+ /**
+ * Thread to run the rendering loop for this SurfaceView.
+ */
+ private final class RenderThread extends Thread {
+ private static final int SLEEP_TIME_MS = 16;
+
+ @Override
+ public void run() {
+ while (mRunning) {
+ SurfaceHolder holder = getHolder();
+ Canvas surfaceCanvas = holder.lockCanvas();
+ // Draw onto canvas if valid
+ if (surfaceCanvas != null && mRenderer != null) {
+ mRenderer.onDrawFrame(surfaceCanvas);
+ holder.unlockCanvasAndPost(surfaceCanvas);
+ }
+ try {
+ sleep(SLEEP_TIME_MS);
+ } catch (InterruptedException e) {
+ // Stop rendering if interrupted
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/libs/view/src/com/android/view/SurfaceRenderer.java b/libs/view/src/com/android/view/SurfaceRenderer.java
new file mode 100644
index 0000000..4a0dc69
--- /dev/null
+++ b/libs/view/src/com/android/view/SurfaceRenderer.java
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.view;
+
+import android.graphics.Canvas;
+import android.view.SurfaceHolder;
+
+/**
+ * Defines what should be drawn to a given {@link RenderedSurfaceView} for every frame.
+ */
+public interface SurfaceRenderer {
+
+ /**
+ * Draws a single frame onto the canvas of a {@link RenderedSurfaceView}.
+ *
+ * @param surfaceCanvas the locked surface canvas corresponding to a single
+ * {@link SurfaceHolder}.
+ */
+ void onDrawFrame(Canvas surfaceCanvas);
+}
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java b/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java
index b33811e..b8412a6 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/sensorverification/TimestampClockSourceVerificationTest.java
@@ -35,6 +35,7 @@
private final String TAG = "TimestampClockSourceVerificationTest";
private final int MIN_DELTA_BETWEEN_CLOCKS_MS = 2000;
+ private boolean mAdjustUptime = false;
private long getValidTimestamp() {
return SystemClock.elapsedRealtimeNanos();
@@ -42,6 +43,9 @@
private long getInvalidTimestamp() {
long ms = SystemClock.uptimeMillis();
+ if (mAdjustUptime == true) {
+ ms -= MIN_DELTA_BETWEEN_CLOCKS_MS;
+ }
return (ms * 1000000);
}
@@ -50,10 +54,12 @@
long realtimeNs = SystemClock.elapsedRealtimeNanos();
long deltaMs = (realtimeNs/1000000 - uptimeMs);
if (deltaMs < MIN_DELTA_BETWEEN_CLOCKS_MS) {
- throw new Error("Delta between clock sources too small ("
- + deltaMs + "mS), device did not sleep.");
+ Log.i(TAG, "Device has not slept, will use different clock source for test purposes");
+ mAdjustUptime = true;
+ } else {
+ mAdjustUptime = false;
+ Log.i(TAG, "CLOCK_MONOTONIC="+uptimeMs*1000000+", CLOCK_BOOTTIME="+realtimeNs+", delta=" + deltaMs + " mS");
}
- Log.i(TAG, "CLOCK_MONOTONIC="+uptimeMs*1000000+", CLOCK_BOOTTIME="+realtimeNs+", delta=" + deltaMs + " mS");
}
@@ -61,11 +67,11 @@
* Test that the verification passes when there are not missing events.
*/
public void testVerify_pass() throws Throwable {
- // Timestamps in ns, expected in us
- long ts = getValidTimestamp();
- long[] timestamps = {ts-4000000, ts-3000000, ts-2000000, ts-1000000, ts};
try {
verifyClockDelta();
+ long ts = getValidTimestamp();
+ long[] timestamps = {ts-4000000, ts-3000000, ts-2000000, ts-1000000, ts};
+ // Timestamps in ns, expected in us
runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, timestamps, true, new int[]{});
} finally {
}
@@ -76,11 +82,11 @@
* but wrong clock source is used.
*/
public void testVerify_fail() throws Throwable {
- // Timestamps in ns, expected in us
- long ts = getInvalidTimestamp();
- long[] timestamps = {ts-4000000, ts-3000000, ts-2000000, ts-1000000, ts};
try {
verifyClockDelta();
+ long ts = getInvalidTimestamp();
+ long[] timestamps = {ts-4000000, ts-3000000, ts-2000000, ts-1000000, ts};
+ // Timestamps in ns, expected in us
runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, timestamps, false, new int[]{0,1,2,3,4});
} finally {
}
@@ -90,11 +96,11 @@
* Test that the verification passes when there are not missing events but some jitter.
*/
public void testVerify_jitter_pass() throws Throwable {
- // Timestamps in ns, expected in us
- long ts = getValidTimestamp();
- long[] timestamps = {ts-3900000, ts-2950000, ts-2050000, ts-1000000, ts-50000};
try {
verifyClockDelta();
+ long ts = getValidTimestamp();
+ long[] timestamps = {ts-3900000, ts-2950000, ts-2050000, ts-1000000, ts-50000};
+ // Timestamps in ns, expected in us
runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, timestamps, true, new int[]{});
} finally {
}
@@ -104,11 +110,11 @@
* Test that the verification passes when there are not missing events but some jitter.
*/
public void testVerify_jitter_fail() throws Throwable {
- // Timestamps in ns, expected in us
- long ts = getInvalidTimestamp();
- long[] timestamps = {ts-3900000, ts-2950000, ts-2050000, ts-1000000, ts-50000};
try {
verifyClockDelta();
+ long ts = getInvalidTimestamp();
+ long[] timestamps = {ts-3900000, ts-2950000, ts-2050000, ts-1000000, ts-50000};
+ // Timestamps in ns, expected in us
runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, timestamps, false, new int[]{0,1,2,3,4});
} finally {
}
@@ -118,11 +124,11 @@
* Test that the verification does not fail when there are missing events.
*/
public void testVerify_missing_events_pass() throws Throwable {
- // Timestamps in ns, expected in us
- long ts = getValidTimestamp();
- long[] timestamps = {ts-4000000, ts-3000000, ts-1000000, ts};
try {
verifyClockDelta();
+ long ts = getValidTimestamp();
+ long[] timestamps = {ts-4000000, ts-3000000, ts-1000000, ts};
+ // Timestamps in ns, expected in us
runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, timestamps, true, new int[]{});
} finally {
}
@@ -133,12 +139,12 @@
* timestamp
*/
public void testVerify_missing_events_fail() throws Throwable {
- // Timestamps in ns, expected in us
- long ts = getInvalidTimestamp();
- long[] timestamps = {ts-4000000, ts-3000000, ts-2000000, ts-1000000, ts};
try {
verifyClockDelta();
- runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, timestamps, false, new int[]{0,1,2,3,4});
+ long ts = getInvalidTimestamp();
+ long[] timestamps = {ts-4000000, ts-3000000, ts-1000000, ts};
+ // Timestamps in ns, expected in us
+ runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, timestamps, false, new int[]{0,1,2,3});
} finally {
}
}
@@ -147,9 +153,9 @@
* Test that the verification fails when there are no results.
*/
public void testVerify_no_events_fail() throws Throwable {
- // Timestamps in ns, expected in us
try {
verifyClockDelta();
+ // Timestamps in ns, expected in us
runVerification(MIN_DELTA_BETWEEN_CLOCKS_MS*1000, new long[]{}, false, new int[]{});
} finally {
}
diff --git a/tests/tests/net/AndroidManifest.xml b/tests/tests/net/AndroidManifest.xml
index 001e294..848ed99 100644
--- a/tests/tests/net/AndroidManifest.xml
+++ b/tests/tests/net/AndroidManifest.xml
@@ -28,6 +28,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
<application>
<uses-library android:name="android.test.runner" />
diff --git a/tests/tests/net/src/android/net/cts/AirplaneModeTest.java b/tests/tests/net/src/android/net/cts/AirplaneModeTest.java
new file mode 100644
index 0000000..0a3146c
--- /dev/null
+++ b/tests/tests/net/src/android/net/cts/AirplaneModeTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.net.cts;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.provider.Settings;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import java.lang.Thread;
+
+public class AirplaneModeTest extends AndroidTestCase {
+ private static final String TAG = "AirplaneModeTest";
+ private static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
+ private static final String FEATURE_WIFI = "android.hardware.wifi";
+ private static final int TIMEOUT_MS = 10 * 1000;
+ private boolean mHasFeature;
+ private Context mContext;
+ private ContentResolver resolver;
+
+ public void setup() {
+ mContext= getContext();
+ resolver = mContext.getContentResolver();
+ mHasFeature = (mContext.getPackageManager().hasSystemFeature(FEATURE_BLUETOOTH)
+ || mContext.getPackageManager().hasSystemFeature(FEATURE_WIFI));
+ }
+
+ public void testAirplaneMode() {
+ setup();
+ if (!mHasFeature) {
+ Log.i(TAG, "The device doesn't support network bluetooth or wifi feature");
+ return;
+ }
+
+ for (int testCount = 0; testCount < 2; testCount++) {
+ if (!doOneTest()) {
+ fail("Airplane mode failed to change in " + TIMEOUT_MS + "msec");
+ return;
+ }
+ }
+ }
+
+ private boolean doOneTest() {
+ boolean airplaneModeOn = isAirplaneModeOn();
+ setAirplaneModeOn(!airplaneModeOn);
+
+ try {
+ Thread.sleep(TIMEOUT_MS);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Sleep time interrupted.", e);
+ }
+
+ if (airplaneModeOn == isAirplaneModeOn()) {
+ return false;
+ }
+ return true;
+ }
+
+ private void setAirplaneModeOn(boolean enabling) {
+ // Change the system setting for airplane mode
+ Settings.Global.putInt(resolver, Settings.Global.AIRPLANE_MODE_ON, enabling ? 1 : 0);
+ }
+
+ private boolean isAirplaneModeOn() {
+ // Read the system setting for airplane mode
+ return Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
+ }
+}
diff --git a/tests/tests/net/src/android/net/cts/TheaterModeTest.java b/tests/tests/net/src/android/net/cts/TheaterModeTest.java
new file mode 100644
index 0000000..10fca6f
--- /dev/null
+++ b/tests/tests/net/src/android/net/cts/TheaterModeTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.net.cts;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.provider.Settings;
+import android.test.AndroidTestCase;
+import android.util.Log;
+
+import java.lang.Thread;
+
+public class TheaterModeTest extends AndroidTestCase {
+ private static final String TAG = "TheaterModeTest";
+ private static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
+ private static final String FEATURE_WIFI = "android.hardware.wifi";
+ private static final int TIMEOUT_MS = 10 * 1000;
+ private boolean mHasFeature;
+ private Context mContext;
+ private ContentResolver resolver;
+
+ public void setup() {
+ mContext= getContext();
+ resolver = mContext.getContentResolver();
+ mHasFeature = (mContext.getPackageManager().hasSystemFeature(FEATURE_BLUETOOTH)
+ || mContext.getPackageManager().hasSystemFeature(FEATURE_WIFI));
+ }
+
+ public void testTheaterMode() {
+ setup();
+ if (!mHasFeature) {
+ Log.i(TAG, "The device doesn't support network bluetooth or wifi feature");
+ return;
+ }
+
+ for (int testCount = 0; testCount < 2; testCount++) {
+ if (!doOneTest()) {
+ fail("Theater mode failed to change in " + TIMEOUT_MS + "msec");
+ return;
+ }
+ }
+ }
+
+ private boolean doOneTest() {
+ boolean theaterModeOn = isTheaterModeOn();
+
+ setTheaterModeOn(!theaterModeOn);
+ try {
+ Thread.sleep(TIMEOUT_MS);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Sleep time interrupted.", e);
+ }
+
+ if (theaterModeOn == isTheaterModeOn()) {
+ return false;
+ }
+ return true;
+ }
+
+ private void setTheaterModeOn(boolean enabling) {
+ // Change the system setting for theater mode
+ Settings.Global.putInt(resolver, Settings.Global.THEATER_MODE_ON, enabling ? 1 : 0);
+ }
+
+ private boolean isTheaterModeOn() {
+ // Read the system setting for theater mode
+ return Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Global.THEATER_MODE_ON, 0) != 0;
+ }
+}
diff --git a/tests/tests/voicesettings/Android.mk b/tests/tests/voicesettings/Android.mk
index 71fead6..e6bb108 100644
--- a/tests/tests/voicesettings/Android.mk
+++ b/tests/tests/voicesettings/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceSettingsCommon ctstestrunner ctsdeviceutil
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ctsdeviceutil
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/voicesettings/AndroidManifest.xml b/tests/tests/voicesettings/AndroidManifest.xml
index bf938f9..dfd1de5 100644
--- a/tests/tests/voicesettings/AndroidManifest.xml
+++ b/tests/tests/voicesettings/AndroidManifest.xml
@@ -23,7 +23,7 @@
<application>
<uses-library android:name="android.test.runner" />
- <activity android:name="TestStartActivity"
+ <activity android:name="android.cts.util.BroadcastTestStartActivity"
android:label="The Target Activity for VoiceSettings CTS Test">
<intent-filter>
<action android:name="android.intent.action.TEST_START_ACTIVITY_ZEN_MODE" />
diff --git a/tests/tests/voicesettings/service/Android.mk b/tests/tests/voicesettings/service/Android.mk
index 97866d5..d472ade 100644
--- a/tests/tests/voicesettings/service/Android.mk
+++ b/tests/tests/voicesettings/service/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceSettingsCommon ctstestrunner ctsdeviceutil
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ctsdeviceutil
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionService.java b/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionService.java
index 6302b78..1029235 100644
--- a/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionService.java
+++ b/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionService.java
@@ -21,7 +21,7 @@
import android.os.Bundle;
import android.service.voice.VoiceInteractionService;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
+import android.cts.util.BroadcastUtils;
public class MainInteractionService extends VoiceInteractionService {
static final String TAG = "MainInteractionService";
@@ -36,9 +36,9 @@
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
- Log.i(TAG, "onStartCommand received");
mIntent = intent;
- Log.i(TAG, "received_testcasetype = " + mIntent.getStringExtra(Utils.TESTCASE_TYPE));
+ Log.i(TAG, "onStartCommand received_testcasetype = " +
+ mIntent.getStringExtra(BroadcastUtils.TESTCASE_TYPE));
maybeStart();
return START_NOT_STICKY;
}
@@ -51,8 +51,10 @@
Log.i(TAG, "Yay! about to start MainInteractionSession");
if (isActiveService(this, new ComponentName(this, getClass()))) {
Bundle args = new Bundle();
- args.putString(Utils.TESTCASE_TYPE, mIntent.getStringExtra(Utils.TESTCASE_TYPE));
- Log.i(TAG, "xferring_testcasetype = " + args.getString(Utils.TESTCASE_TYPE));
+ args.putString(BroadcastUtils.TESTCASE_TYPE,
+ mIntent.getStringExtra(BroadcastUtils.TESTCASE_TYPE));
+ Log.i(TAG, "xferring_testcasetype = " +
+ args.getString(BroadcastUtils.TESTCASE_TYPE));
showSession(args, 0);
} else {
Log.wtf(TAG, "**** Not starting MainInteractionService because" +
diff --git a/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionSession.java b/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionSession.java
index aff1160..d9a0746 100644
--- a/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionSession.java
+++ b/tests/tests/voicesettings/service/src/android/voicesettings/service/MainInteractionSession.java
@@ -27,14 +27,13 @@
import android.app.VoiceInteractor;
import android.content.Context;
import android.content.Intent;
+import android.cts.util.BroadcastUtils;
+import android.cts.util.BroadcastUtils.TestcaseType;
import android.os.AsyncTask;
import android.os.Bundle;
import android.service.voice.VoiceInteractionSession;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
-import common.src.android.voicesettings.common.Utils.TestcaseType;
-
import java.util.ArrayList;
import java.util.List;
@@ -67,7 +66,7 @@
@Override
public void onShow(Bundle args, int showFlags) {
super.onShow(args, showFlags);
- String testCaseType = args.getString(Utils.TESTCASE_TYPE);
+ String testCaseType = args.getString(BroadcastUtils.TESTCASE_TYPE);
Log.i(TAG, "received_testcasetype = " + testCaseType);
try {
mTestType = TestcaseType.valueOf(testCaseType);
@@ -83,7 +82,8 @@
case ZEN_MODE_ON:
intent = new Intent(ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE);
intent.putExtra(EXTRA_DO_NOT_DISTURB_MODE_ENABLED, true);
- intent.putExtra(EXTRA_DO_NOT_DISTURB_MODE_MINUTES, Utils.NUM_MINUTES_FOR_ZENMODE);
+ intent.putExtra(EXTRA_DO_NOT_DISTURB_MODE_MINUTES,
+ BroadcastUtils.NUM_MINUTES_FOR_ZENMODE);
break;
case ZEN_MODE_OFF:
intent = new Intent(ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE);
@@ -119,14 +119,15 @@
// we probably could verify this also.
Bundle extras = intent.getExtras();
Log.i(TAG, "in onTaskFinished: testcasetype = " + mTestType + ", intent: " +
- intent.toString() + Utils.toBundleString(extras));
- Intent broadcastIntent = new Intent(Utils.BROADCAST_INTENT + mTestType.toString());
+ intent.toString() + BroadcastUtils.toBundleString(extras));
+ Intent broadcastIntent = new Intent(BroadcastUtils.BROADCAST_INTENT +
+ mTestType.toString());
if (extras == null) {
extras = new Bundle();
}
- extras.putString(Utils.TESTCASE_TYPE, mTestType.toString());
+ extras.putString(BroadcastUtils.TESTCASE_TYPE, mTestType.toString());
broadcastIntent.putExtras(extras);
- Log.i(TAG, "sending_broadcast: Bundle = " + Utils.toBundleString(extras) +
+ Log.i(TAG, "sending_broadcast: Bundle = " + BroadcastUtils.toBundleString(extras) +
", intent = " + broadcastIntent.toString());
mContext.sendBroadcast(broadcastIntent);
}
diff --git a/tests/tests/voicesettings/service/src/android/voicesettings/service/VoiceInteractionMain.java b/tests/tests/voicesettings/service/src/android/voicesettings/service/VoiceInteractionMain.java
index adc2980..645b4e9 100644
--- a/tests/tests/voicesettings/service/src/android/voicesettings/service/VoiceInteractionMain.java
+++ b/tests/tests/voicesettings/service/src/android/voicesettings/service/VoiceInteractionMain.java
@@ -22,7 +22,7 @@
import android.os.Bundle;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
+import android.cts.util.BroadcastUtils;
public class VoiceInteractionMain extends Activity {
static final String TAG = "VoiceInteractionMain";
@@ -31,9 +31,9 @@
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent();
- String testCaseType = getIntent().getStringExtra(Utils.TESTCASE_TYPE);
+ String testCaseType = getIntent().getStringExtra(BroadcastUtils.TESTCASE_TYPE);
Log.i(TAG, "received_testcasetype = " + testCaseType);
- intent.putExtra(Utils.TESTCASE_TYPE, testCaseType);
+ intent.putExtra(BroadcastUtils.TESTCASE_TYPE, testCaseType);
intent.setComponent(new ComponentName(this, MainInteractionService.class));
ComponentName serviceName = startService(intent);
Log.i(TAG, "Started service: " + serviceName);
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java b/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java
index adce051..44efc28 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java
+++ b/tests/tests/voicesettings/src/android/voicesettings/cts/AirplaneModeTest.java
@@ -18,18 +18,29 @@
import static android.provider.Settings.ACTION_VOICE_CONTROL_AIRPLANE_MODE;
+import android.cts.util.BroadcastTestBase;
+import android.cts.util.BroadcastUtils;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
-
-public class AirplaneModeTest extends VoiceSettingsTestBase {
+public class AirplaneModeTest extends BroadcastTestBase {
static final String TAG = "AirplaneModeTest";
+ private static final String VOICE_SETTINGS_PACKAGE = "android.voicesettings.service";
+ private static final String VOICE_INTERACTION_CLASS =
+ "android.voicesettings.service.VoiceInteractionMain";
+ protected static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
private static final int AIRPLANE_MODE_IS_OFF = 0;
private static final int AIRPLANE_MODE_IS_ON = 1;
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mContext = getInstrumentation().getTargetContext();
+ mHasFeature = mContext.getPackageManager().hasSystemFeature(FEATURE_VOICE_RECOGNIZERS);
+ }
+
public AirplaneModeTest() {
super();
}
@@ -57,25 +68,25 @@
// mode is currently OFF.
// run a test to turn it on.
// After successful run of the test, run a test to turn it back off.
- if (!runTest(Utils.TestcaseType.AIRPLANE_MODE_ON, AIRPLANE_MODE_IS_ON)) {
+ if (!runTest(BroadcastUtils.TestcaseType.AIRPLANE_MODE_ON, AIRPLANE_MODE_IS_ON)) {
// the test failed. don't test the next one.
return;
}
- runTest(Utils.TestcaseType.AIRPLANE_MODE_OFF, AIRPLANE_MODE_IS_OFF);
+ runTest(BroadcastUtils.TestcaseType.AIRPLANE_MODE_OFF, AIRPLANE_MODE_IS_OFF);
} else {
// mode is currently ON.
// run a test to turn it off.
// After successful run of the test, run a test to turn it back on.
- if (!runTest(Utils.TestcaseType.AIRPLANE_MODE_OFF, AIRPLANE_MODE_IS_OFF)) {
+ if (!runTest(BroadcastUtils.TestcaseType.AIRPLANE_MODE_OFF, AIRPLANE_MODE_IS_OFF)) {
// the test failed. don't test the next one.
return;
}
- runTest(Utils.TestcaseType.AIRPLANE_MODE_ON, AIRPLANE_MODE_IS_ON);
+ runTest(BroadcastUtils.TestcaseType.AIRPLANE_MODE_ON, AIRPLANE_MODE_IS_ON);
}
}
- private boolean runTest(Utils.TestcaseType test, int expectedMode) throws Exception {
- if (!startTestAndWaitForBroadcast(test)) {
+ private boolean runTest(BroadcastUtils.TestcaseType test, int expectedMode) throws Exception {
+ if (!startTestAndWaitForBroadcast(test, VOICE_SETTINGS_PACKAGE, VOICE_INTERACTION_CLASS)) {
return false;
}
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/BatterySaverModeTest.java b/tests/tests/voicesettings/src/android/voicesettings/cts/BatterySaverModeTest.java
index 3a778c0..fe858fc 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/BatterySaverModeTest.java
+++ b/tests/tests/voicesettings/src/android/voicesettings/cts/BatterySaverModeTest.java
@@ -18,19 +18,30 @@
import static android.provider.Settings.ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE;
+import android.cts.util.BroadcastTestBase;
+import android.cts.util.BroadcastUtils;
import android.content.Context;
import android.os.PowerManager;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
-
-public class BatterySaverModeTest extends VoiceSettingsTestBase {
+public class BatterySaverModeTest extends BroadcastTestBase {
static final String TAG = "BatterySaverModeTest";
+ private static final String VOICE_SETTINGS_PACKAGE = "android.voicesettings.service";
+ private static final String VOICE_INTERACTION_CLASS =
+ "android.voicesettings.service.VoiceInteractionMain";
+ protected static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
public BatterySaverModeTest() {
super();
}
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mContext = getInstrumentation().getTargetContext();
+ mHasFeature = mContext.getPackageManager().hasSystemFeature(FEATURE_VOICE_RECOGNIZERS);
+ }
+
public void testAll() throws Exception {
if (!mHasFeature) {
Log.i(TAG, "The device doesn't support feature: " + FEATURE_VOICE_RECOGNIZERS);
@@ -47,25 +58,25 @@
// mode is currently ON.
// run a test to turn it off.
// After successful run of the test, run a test to turn it back on.
- if (!runTest(Utils.TestcaseType.BATTERYSAVER_MODE_OFF, false)) {
+ if (!runTest(BroadcastUtils.TestcaseType.BATTERYSAVER_MODE_OFF, false)) {
// the test failed. don't test the next one.
return;
}
- runTest(Utils.TestcaseType.BATTERYSAVER_MODE_ON, true);
+ runTest(BroadcastUtils.TestcaseType.BATTERYSAVER_MODE_ON, true);
} else {
// mode is currently OFF.
// run a test to turn it on.
// After successful run of the test, run a test to turn it back off.
- if (!runTest(Utils.TestcaseType.BATTERYSAVER_MODE_ON, true)) {
+ if (!runTest(BroadcastUtils.TestcaseType.BATTERYSAVER_MODE_ON, true)) {
// the test failed. don't test the next one.
return;
}
- runTest(Utils.TestcaseType.BATTERYSAVER_MODE_OFF, false);
+ runTest(BroadcastUtils.TestcaseType.BATTERYSAVER_MODE_OFF, false);
}
}
- private boolean runTest(Utils.TestcaseType test, boolean expectedMode) throws Exception {
- if (!startTestAndWaitForBroadcast(test)) {
+ private boolean runTest(BroadcastUtils.TestcaseType test, boolean expectedMode) throws Exception {
+ if (!startTestAndWaitForBroadcast(test, VOICE_SETTINGS_PACKAGE, VOICE_INTERACTION_CLASS)) {
return false;
}
diff --git a/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java b/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java
index 70ff437..f6a164d 100644
--- a/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java
+++ b/tests/tests/voicesettings/src/android/voicesettings/cts/ZenModeTest.java
@@ -20,14 +20,25 @@
import static android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_ENABLED;
import static android.provider.Settings.EXTRA_DO_NOT_DISTURB_MODE_MINUTES;
+import android.cts.util.BroadcastTestBase;
+import android.cts.util.BroadcastUtils;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.util.Log;
-import common.src.android.voicesettings.common.Utils;
-
-public class ZenModeTest extends VoiceSettingsTestBase {
+public class ZenModeTest extends BroadcastTestBase {
static final String TAG = "ZenModeTest";
+ private static final String VOICE_SETTINGS_PACKAGE = "android.voicesettings.service";
+ private static final String VOICE_INTERACTION_CLASS =
+ "android.voicesettings.service.VoiceInteractionMain";
+ protected static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mContext = getInstrumentation().getTargetContext();
+ mHasFeature = mContext.getPackageManager().hasSystemFeature(FEATURE_VOICE_RECOGNIZERS);
+ }
// The following are hidden in frameworks/base/core/java/android/provider/Settings.java
// If they weren't, we could have used them directly here.
@@ -62,25 +73,25 @@
// mode is currently OFF.
// run a test to turn it on.
// After successful run of the test, run a test to turn it back off.
- if (!runTest(Utils.TestcaseType.ZEN_MODE_ON, ZEN_MODE_IS_ALARMS)) {
+ if (!runTest(BroadcastUtils.TestcaseType.ZEN_MODE_ON, ZEN_MODE_IS_ALARMS)) {
// the test failed. don't test the next one.
return;
}
- runTest(Utils.TestcaseType.ZEN_MODE_OFF, ZEN_MODE_IS_OFF);
+ runTest(BroadcastUtils.TestcaseType.ZEN_MODE_OFF, ZEN_MODE_IS_OFF);
} else {
// mode is currently ON.
// run a test to turn it off.
// After successful run of the test, run a test to turn it back on.
- if (!runTest(Utils.TestcaseType.ZEN_MODE_OFF, ZEN_MODE_IS_OFF)) {
+ if (!runTest(BroadcastUtils.TestcaseType.ZEN_MODE_OFF, ZEN_MODE_IS_OFF)) {
// the test failed. don't test the next one.
return;
}
- runTest(Utils.TestcaseType.ZEN_MODE_ON, ZEN_MODE_IS_ALARMS);
+ runTest(BroadcastUtils.TestcaseType.ZEN_MODE_ON, ZEN_MODE_IS_ALARMS);
}
}
- private boolean runTest(Utils.TestcaseType test, int expectedMode) throws Exception {
- if (!startTestAndWaitForBroadcast(test)) {
+ private boolean runTest(BroadcastUtils.TestcaseType test, int expectedMode) throws Exception {
+ if (!startTestAndWaitForBroadcast(test, VOICE_SETTINGS_PACKAGE, VOICE_INTERACTION_CLASS)) {
return false;
}
@@ -88,11 +99,11 @@
int mode = getMode();
Log.i(TAG, "After testing, zen-mode is set to: " + mode);
assertEquals(expectedMode, mode);
- Log.i(TAG, "results_received: " + Utils.toBundleString(mResultExtras));
+ Log.i(TAG, "results_received: " + BroadcastUtils.toBundleString(mResultExtras));
assertNotNull(mResultExtras);
if (expectedMode == ZEN_MODE_IS_ALARMS) {
assertTrue(mResultExtras.getBoolean(EXTRA_DO_NOT_DISTURB_MODE_ENABLED));
- assertEquals(Utils.NUM_MINUTES_FOR_ZENMODE,
+ assertEquals(BroadcastUtils.NUM_MINUTES_FOR_ZENMODE,
mResultExtras.getInt(EXTRA_DO_NOT_DISTURB_MODE_MINUTES));
} else {
assertFalse(mResultExtras.getBoolean(EXTRA_DO_NOT_DISTURB_MODE_ENABLED));