Merge "Adding three CTS tests for the time tracking api" into mnc-dev
diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk
index c66341d..21b4027 100644
--- a/CtsTestCaseList.mk
+++ b/CtsTestCaseList.mk
@@ -57,7 +57,12 @@
CtsKeySetSigningBUpgradeB \
CtsKeySetSigningAAndBUpgradeA \
CtsKeySetSigningAAndCUpgradeB \
- CtsKeySetSigningAUpgradeNone
+ CtsKeySetSigningAUpgradeNone \
+ CtsKeySetSharedUserSigningAUpgradeB \
+ CtsKeySetSharedUserSigningBUpgradeB \
+ CtsKeySetSigningABadUpgradeB \
+ CtsKeySetSigningCBadAUpgradeAB \
+ CtsKeySetSigningANoDefUpgradeB
cts_support_packages := \
CtsAccelerationTestStubs \
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 4226bf2..a99408f 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -1337,6 +1337,14 @@
</intent-filter>
</activity>
+ <activity android:name=".managedprovisioning.WorkStatusTestActivity">
+ <intent-filter>
+ <action android:name="com.android.cts.verifier.managedprovisioning.WORK_STATUS_ICON" />
+ <action android:name="com.android.cts.verifier.managedprovisioning.WORK_STATUS_TOAST" />
+ <category android:name="android.intent.category.DEFAULT"></category>
+ </intent-filter>
+ </activity>
+
<activity android:name=".managedprovisioning.WorkNotificationTestActivity">
<intent-filter>
<action android:name="com.android.cts.verifier.managedprovisioning.WORK_NOTIFICATION" />
diff --git a/apps/CtsVerifier/res/drawable/stat_sys_managed_profile_status.xml b/apps/CtsVerifier/res/drawable/stat_sys_managed_profile_status.xml
new file mode 100644
index 0000000..b04059e
--- /dev/null
+++ b/apps/CtsVerifier/res/drawable/stat_sys_managed_profile_status.xml
@@ -0,0 +1,29 @@
+<!--
+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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="23.0dp"
+ android:height="18.0dp"
+ android:viewportWidth="21.0"
+ android:viewportHeight="17.0">
+ <group android:translateX="2.0">
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M9.9,11.6H7v-1.1H2.1v2.8c0,0.8,0.6,1.4,1.4,1.4h9.9c0.8,0,1.4,-0.6,1.4,-1.4v-2.8H9.9V11.6z"/>
+ <path
+ android:fillColor="#FFFFFFFF"
+ android:pathData="M14.1,4.2h-2.5V3.2l-1.1,-1.1H6.3L5.3,3.2v1H2.8C2,4.2,1.4,4.9,1.4,5.6v2.8c0,0.8,0.6,1.4,1.4,1.4H7V8.8h2.8v1.1h4.2 c0.8,0,1.4,-0.6,1.4,-1.4V5.6C15.5,4.9,14.8,4.2,14.1,4.2z M10.6,4.2H6.3V3.2h4.2V4.2z"/>
+ </group>
+</vector>
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 9f8f4c1..675188a 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1361,6 +1361,32 @@
Verify that the notification is badged (see sample badge below). Then mark this test accordingly.
</string>
<string name="provisioning_byod_work_notification_title">This is a work notification</string>
+ <string name="provisioning_byod_work_status_icon">Work status icon is displayed</string>
+ <string name="provisioning_byod_work_status_icon_instruction">
+ Verify that the current status bar does not have a work status icon (see sample icon below).
+ \n\n
+ Please press the Go button to launch a work activity.
+ \n\n
+ Verify that the status bar now has a work status icon. Then mark this test accordingly.
+ </string>
+ <string name="provisioning_byod_work_status_icon_activity">
+ Verify that the current status bar has a work status notification.
+ \n\n
+ Please press finish to return to the tests and then mark this test accordingly.
+ </string>
+ <string name="provisioning_byod_work_status_toast">Work status toast is displayed</string>
+ <string name="provisioning_byod_work_status_toast_instruction">
+ Please press the Go button to launch a work activity.
+ \n\n
+ Follow instructions and then return and mark this test accordingly.
+ </string>
+ <string name="provisioning_byod_work_status_toast_activity">
+ Turn off the screen and wait a few seconds then turn on the screen again.
+ \n\n
+ Verify that a toast was displayed saying you are in the work profile.
+ \n\n
+ Please press finish to return to the tests and then mark this test accordingly.
+ </string>
<string name="provisioning_byod_profile_visible_instruction">
Please press the Go button to open the Settings page.
Navigate to Accounts and confirm that:\n
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
index e41c6d0..112a6e3 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
@@ -77,6 +77,8 @@
private TestItem mDisableNonMarketTest;
private TestItem mEnableNonMarketTest;
private TestItem mWorkNotificationBadgedTest;
+ private TestItem mWorkStatusBarIconTest;
+ private TestItem mWorkStatusBarToastTest;
private TestItem mAppSettingsVisibleTest;
private TestItem mLocationSettingsVisibleTest;
private TestItem mCredSettingsVisibleTest;
@@ -189,6 +191,21 @@
new Intent(WorkNotificationTestActivity.ACTION_WORK_NOTIFICATION),
R.drawable.ic_corp_icon);
+ Intent workStatusIcon = new Intent(WorkStatusTestActivity.ACTION_WORK_STATUS_ICON);
+ workStatusIcon.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mWorkStatusBarIconTest = new TestItemWithIcon(this,
+ R.string.provisioning_byod_work_status_icon,
+ R.string.provisioning_byod_work_status_icon_instruction,
+ workStatusIcon,
+ R.drawable.stat_sys_managed_profile_status);
+
+ Intent workStatusToast = new Intent(WorkStatusTestActivity.ACTION_WORK_STATUS_TOAST);
+ workStatusToast.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mWorkStatusBarToastTest = new TestItem(this,
+ R.string.provisioning_byod_work_status_toast,
+ R.string.provisioning_byod_work_status_toast_instruction,
+ workStatusToast);
+
mDisableNonMarketTest = new TestItem(this, R.string.provisioning_byod_nonmarket_deny,
R.string.provisioning_byod_nonmarket_deny_info,
new Intent(ByodHelperActivity.ACTION_INSTALL_APK)
@@ -246,6 +263,8 @@
// Badge related tests
mTests.add(mWorkAppVisibleTest);
mTests.add(mWorkNotificationBadgedTest);
+ mTests.add(mWorkStatusBarIconTest);
+ mTests.add(mWorkStatusBarToastTest);
// Settings related tests.
mTests.add(mProfileAccountVisibleTest);
@@ -465,6 +484,10 @@
this, WorkNotificationTestActivity.class),
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
+ getPackageManager().setComponentEnabledSetting(new ComponentName(
+ this, WorkStatusTestActivity.class),
+ PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
}
private void showToast(int messageId) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
index e95752e..9154307 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
@@ -56,6 +56,8 @@
filter.addAction(CrossProfileTestActivity.ACTION_CROSS_PROFILE);
filter.addAction(WorkNotificationTestActivity.ACTION_WORK_NOTIFICATION);
filter.addAction(WorkNotificationTestActivity.ACTION_CLEAR_WORK_NOTIFICATION);
+ filter.addAction(WorkStatusTestActivity.ACTION_WORK_STATUS_TOAST);
+ filter.addAction(WorkStatusTestActivity.ACTION_WORK_STATUS_ICON);
dpm.addCrossProfileIntentFilter(getWho(context), filter,
DevicePolicyManager.FLAG_MANAGED_CAN_ACCESS_PARENT);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/WorkStatusTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/WorkStatusTestActivity.java
new file mode 100644
index 0000000..ee9aa44
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/WorkStatusTestActivity.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT 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.managedprovisioning;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.TextView;
+
+import com.android.cts.verifier.R;
+
+/**
+ * Test activity for work status tests.
+ */
+public class WorkStatusTestActivity extends Activity {
+ public static final String ACTION_WORK_STATUS_ICON
+ = "com.android.cts.verifier.managedprovisioning.WORK_STATUS_ICON";
+ public static final String ACTION_WORK_STATUS_TOAST
+ = "com.android.cts.verifier.managedprovisioning.WORK_STATUS_TOAST";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.provisioning_cross_profile);
+
+ findViewById(R.id.button_finish).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ WorkStatusTestActivity.this.finish();
+ }
+ });
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ String action = getIntent().getAction();
+ TextView textView = (TextView) findViewById(R.id.text);
+ if (ACTION_WORK_STATUS_ICON.equals(action)) {
+ textView.setText(R.string.provisioning_byod_work_status_icon_activity);
+ } else if (ACTION_WORK_STATUS_TOAST.equals(action)) {
+ textView.setText(R.string.provisioning_byod_work_status_toast_activity);
+ }
+ }
+}
diff --git a/hostsidetests/appsecurity/src/com/android/cts/appsecurity/KeySetHostTest.java b/hostsidetests/appsecurity/src/com/android/cts/appsecurity/KeySetHostTest.java
index dae5ee7..7f3737d 100644
--- a/hostsidetests/appsecurity/src/com/android/cts/appsecurity/KeySetHostTest.java
+++ b/hostsidetests/appsecurity/src/com/android/cts/appsecurity/KeySetHostTest.java
@@ -66,6 +66,16 @@
"CtsKeySetSigningAAndBUpgradeB.apk";
private static final String A_AND_C_SIGNED_B_UPGRADE =
"CtsKeySetSigningAAndCUpgradeB.apk";
+ private static final String SHARED_USR_A_SIGNED_B_UPGRADE =
+ "CtsKeySetSharedUserSigningAUpgradeB.apk";
+ private static final String SHARED_USR_B_SIGNED_B_UPGRADE =
+ "CtsKeySetSharedUserSigningBUpgradeB.apk";
+ private static final String A_SIGNED_BAD_B_B_UPGRADE =
+ "CtsKeySetSigningABadUpgradeB.apk";
+ private static final String C_SIGNED_BAD_A_AB_UPGRADE =
+ "CtsKeySetSigningCBadAUpgradeAB.apk";
+ private static final String A_SIGNED_NO_B_B_UPGRADE =
+ "CtsKeySetSigningANoDefUpgradeB.apk";
/* package which defines the KEYSET_PERM_NAME signature permission */
private static final String KEYSET_PERM_DEF_PKG =
@@ -432,4 +442,48 @@
testKeyRotationPerm(PERM_DEF_A_SIGNED, PERM_USE_A_SIGNED, PERM_DEF_B_SIGNED,
true, false);
}
-}
\ No newline at end of file
+
+ /*
+ * Check if an apk which indicates it uses a sharedUserId and defines an
+ * upgrade keyset is allowed to rotate to that keyset.
+ */
+ public void testUpgradeSharedUser() throws Exception {
+ String installResult = testPackageUpgrade(KEYSET_PKG, SHARED_USR_A_SIGNED_B_UPGRADE,
+ SHARED_USR_B_SIGNED_B_UPGRADE);
+ assertNotNull("upgrade allowed for app with shareduserid!", installResult);
+ }
+
+ /*
+ * Check that an apk with an upgrade key represented by a bad public key
+ * fails to install.
+ */
+ public void testBadUpgradeBadPubKey() throws Exception {
+ mDevice.uninstallPackage(KEYSET_PKG);
+ String installResult = mDevice.installPackage(getTestAppFile(A_SIGNED_BAD_B_B_UPGRADE),
+ false);
+ assertNotNull("Installation of apk with upgrade key referring to a bad public key succeeded!",
+ installResult);
+ }
+
+ /*
+ * Check that an apk with an upgrade keyset that includes a bad public key fails to install.
+ */
+ public void testBadUpgradeMissingPubKey() throws Exception {
+ mDevice.uninstallPackage(KEYSET_PKG);
+ String installResult = mDevice.installPackage(getTestAppFile(C_SIGNED_BAD_A_AB_UPGRADE),
+ false);
+ assertNotNull("Installation of apk with upgrade key referring to a bad public key succeeded!",
+ installResult);
+ }
+
+ /*
+ * Check that an apk with an upgrade key that has no corresponding public key fails to install.
+ */
+ public void testBadUpgradeNoPubKey() throws Exception {
+ mDevice.uninstallPackage(KEYSET_PKG);
+ String installResult = mDevice.installPackage(getTestAppFile(A_SIGNED_NO_B_B_UPGRADE),
+ false);
+ assertNotNull("Installation of apk with upgrade key referring to a bad public key succeeded!",
+ installResult);
+ }
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
new file mode 100644
index 0000000..207160f
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
@@ -0,0 +1,27 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+#apks signed cts-keyset-test-a
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_SDK_VERSION := current
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_PACKAGE_NAME := CtsKeySetSigningABadUpgradeB
+LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
+LOCAL_DEX_PREOPT := false
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/AndroidManifest.xml
new file mode 100644
index 0000000..e18bde5
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/AndroidManifest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.keysets">
+ <application android:hasCode="false">
+ </application>
+ <key-sets>
+ <key-set android:name="B" >
+ <public-key android:name="keyB"
+ android:value="makebadpubkeyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoeFZqMqTbZiozFTXMkXtSKJRzn2qODZgvVXAAwKTi50xYcbPcHTfKxtif8+q7OCp/50JYDH32bg6wkUunn5+dEaHkxZY8d7uw46tQtl5dNGi+6cc4MezVLCS6nkqNDusAgdvgLU6Fl6SGi02KTp1vkt6CwLO977YJP7kt9ouDRTG7ASJiq3OyRRoOqYHhD9gpsbUq4w+1bXGfuuZujA1dXyovXtvrHUGOdFIEBYOVYGfCcwh3lXPmjNJMlHtKQkurq8/LH7a1B5ocoXCGsyR8YHdlWfrqRAfzgOB1KCnNNmWqskU9LOci3uQn9IDeMEFmAd8FqF8SwV+4Ludk/xWGQIDAQAB" />
+ </key-set>
+ <upgrade-key-set android:name="B"/>
+ </key-sets>
+</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
new file mode 100644
index 0000000..84f3f75
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
@@ -0,0 +1,27 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+#apks signed cts-keyset-test-a
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_SDK_VERSION := current
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_PACKAGE_NAME := CtsKeySetSigningANoDefUpgradeB
+LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
+LOCAL_DEX_PREOPT := false
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/AndroidManifest.xml
new file mode 100644
index 0000000..aac717b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/AndroidManifest.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.keysets">
+ <application android:hasCode="false">
+ </application>
+ <key-sets>
+ <upgrade-key-set android:name="B"/>
+ </key-sets>
+</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
new file mode 100644
index 0000000..7290f06
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
@@ -0,0 +1,27 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+#apks signed cts-keyset-test-a
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_SDK_VERSION := current
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_PACKAGE_NAME := CtsKeySetSigningCBadAUpgradeAB
+LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-c
+LOCAL_DEX_PREOPT := false
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/AndroidManifest.xml
new file mode 100644
index 0000000..8242f6c
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.keysets">
+ <application android:hasCode="false">
+ </application>
+ <key-sets>
+ <key-set android:name="AB" >
+ <public-key android:name="keyA"
+ android:value="makebadpubkeyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwf5zJblvYSB7Ym7or/7GggAAu7mp7RrykPJsXhod8doFhVT5s7eF3A4MCE55vvANP7HvwMw2b+T6qx7Pq0VJtbbSDtlBHBtIc47Pjq0CsDg590BUcgKp7PdJ9J6UVgtzDnV6cGEpXmSag3sY+lqiW04ytPhCVwzYTWGdYe9+TIl47cBrveRfLOlGrcuFQe+zCTmDFqzBKCRHK9b7l5PDWvXXyg65Uu/MBUA/TZWO0fEqOlxZG/nn6DUKQLhPdmJRXWJ3WqMNMhJGD+nKtkmdX703xRqmg4h+6g0S7M9Y3IQ2NUGyw05AYzCguHB/Mv6uVIiW659wpbyb45TgKG3UhQIDAQAB" />
+ <public-key android:name="keyB"
+ android:value="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoeFZqMqTbZiozFTXMkXtSKJRzn2qODZgvVXAAwKTi50xYcbPcHTfKxtif8+q7OCp/50JYDH32bg6wkUunn5+dEaHkxZY8d7uw46tQtl5dNGi+6cc4MezVLCS6nkqNDusAgdvgLU6Fl6SGi02KTp1vkt6CwLO977YJP7kt9ouDRTG7ASJiq3OyRRoOqYHhD9gpsbUq4w+1bXGfuuZujA1dXyovXtvrHUGOdFIEBYOVYGfCcwh3lXPmjNJMlHtKQkurq8/LH7a1B5ocoXCGsyR8YHdlWfrqRAfzgOB1KCnNNmWqskU9LOci3uQn9IDeMEFmAd8FqF8SwV+4Ludk/xWGQIDAQAB" />
+ </key-set>
+ <upgrade-key-set android:name="AB"/>
+ </key-sets>
+</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
new file mode 100644
index 0000000..1d6d5a5
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
@@ -0,0 +1,39 @@
+# Copyright (C) 2014 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+#apks signed cts-keyset-test-a
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_SDK_VERSION := current
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_PACKAGE_NAME := CtsKeySetSharedUserSigningAUpgradeB
+LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
+LOCAL_DEX_PREOPT := false
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
+
+#apks signed cts-keyset-test-b
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_SDK_VERSION := current
+LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_PACKAGE_NAME := CtsKeySetSharedUserSigningBUpgradeB
+LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
+LOCAL_DEX_PREOPT := false
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/AndroidManifest.xml
new file mode 100644
index 0000000..55a1c24
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/AndroidManifest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.keysets"
+ android:sharedUserId="com.android.cts.keysets.shareduser">
+ <application android:hasCode="false">
+ </application>
+ <key-sets>
+ <key-set android:name="B" >
+ <public-key android:name="keyB"
+ android:value="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoeFZqMqTbZiozFTXMkXtSKJRzn2qODZgvVXAAwKTi50xYcbPcHTfKxtif8+q7OCp/50JYDH32bg6wkUunn5+dEaHkxZY8d7uw46tQtl5dNGi+6cc4MezVLCS6nkqNDusAgdvgLU6Fl6SGi02KTp1vkt6CwLO977YJP7kt9ouDRTG7ASJiq3OyRRoOqYHhD9gpsbUq4w+1bXGfuuZujA1dXyovXtvrHUGOdFIEBYOVYGfCcwh3lXPmjNJMlHtKQkurq8/LH7a1B5ocoXCGsyR8YHdlWfrqRAfzgOB1KCnNNmWqskU9LOci3uQn9IDeMEFmAd8FqF8SwV+4Ludk/xWGQIDAQAB" />
+ </key-set>
+ <upgrade-key-set android:name="B"/>
+ </key-sets>
+</manifest>
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
index da96cdc..e727350 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
@@ -68,19 +68,21 @@
}
public void testGetChangingConfigurations() {
+ final int SUPER_CONFIG = 1;
+ final int CONTAINED_DRAWABLE_CONFIG = 2;
+
MockDrawable mockDrawable = new MockDrawable();
ClipDrawable clipDrawable = new ClipDrawable(mockDrawable,
Gravity.BOTTOM, ClipDrawable.HORIZONTAL);
+
assertEquals(0, clipDrawable.getChangingConfigurations());
- clipDrawable.setChangingConfigurations(1);
- assertEquals(1, clipDrawable.getChangingConfigurations());
+ mockDrawable.setChangingConfigurations(CONTAINED_DRAWABLE_CONFIG);
+ assertEquals(CONTAINED_DRAWABLE_CONFIG, clipDrawable.getChangingConfigurations());
- mockDrawable.setChangingConfigurations(2);
- clipDrawable = new ClipDrawable(mockDrawable,
- Gravity.BOTTOM, ClipDrawable.HORIZONTAL);
- clipDrawable.setChangingConfigurations(1);
- assertEquals(3, clipDrawable.getChangingConfigurations());
+ clipDrawable.setChangingConfigurations(SUPER_CONFIG);
+ assertEquals(SUPER_CONFIG | CONTAINED_DRAWABLE_CONFIG,
+ clipDrawable.getChangingConfigurations());
}
public void testGetConstantState() {
@@ -126,16 +128,28 @@
@SuppressWarnings("deprecation")
public void testGetOpacity() {
- BitmapDrawable bmpDrawable =
- new BitmapDrawable(Bitmap.createBitmap(100, 50, Config.RGB_565));
- ClipDrawable clipDrawable = new ClipDrawable(bmpDrawable,
- Gravity.BOTTOM, ClipDrawable.HORIZONTAL);
- assertEquals(PixelFormat.OPAQUE, clipDrawable.getOpacity());
+ MockDrawable dr;
+ ClipDrawable clipDrawable;
- bmpDrawable = new BitmapDrawable(Bitmap.createBitmap(100, 50, Config.RGB_565));
- bmpDrawable.setGravity(Gravity.CENTER);
- clipDrawable = new ClipDrawable(bmpDrawable, Gravity.BOTTOM, ClipDrawable.HORIZONTAL);
- assertEquals(PixelFormat.TRANSLUCENT, clipDrawable.getOpacity());
+ dr = new MockDrawable();
+ dr.setOpacity(PixelFormat.OPAQUE);
+ clipDrawable = new ClipDrawable(dr, Gravity.BOTTOM, ClipDrawable.HORIZONTAL);
+ clipDrawable.setLevel(0);
+ assertEquals("Fully-clipped opaque drawable is transparent",
+ PixelFormat.TRANSPARENT, clipDrawable.getOpacity());
+ clipDrawable.setLevel(5000);
+ assertEquals("Partially-clipped opaque drawable is translucent",
+ PixelFormat.TRANSLUCENT, clipDrawable.getOpacity());
+ clipDrawable.setLevel(10000);
+ assertEquals("Unclipped opaque drawable is opaque",
+ PixelFormat.OPAQUE, clipDrawable.getOpacity());
+
+ dr = new MockDrawable();
+ dr.setOpacity(PixelFormat.TRANSLUCENT);
+ clipDrawable = new ClipDrawable(dr, Gravity.BOTTOM, ClipDrawable.HORIZONTAL);
+ clipDrawable.setLevel(10000);
+ assertEquals("Unclipped translucent drawable is translucent",
+ PixelFormat.TRANSLUCENT, clipDrawable.getOpacity());
}
public void testGetPadding() {
@@ -220,7 +234,7 @@
MockCallback callback = new MockCallback();
mockClipDrawable.setCallback(callback);
- assertEquals(0, mockDrawable.getLevel());
+ assertEquals("Default level is 0", 0, mockDrawable.getLevel());
mockClipDrawable.onLevelChange(1000);
assertEquals(1000, mockDrawable.getLevel());
assertSame(mockClipDrawable, callback.getInvalidateDrawable());
@@ -344,6 +358,7 @@
private class MockDrawable extends Drawable {
private ColorFilter mColorFilter;
private ConstantState mConstantState;
+ private int mOpacity;
private boolean mCalledDraw = false;
private int mAlpha;
@@ -372,7 +387,11 @@
}
public int getOpacity() {
- return 0;
+ return mOpacity;
+ }
+
+ public void setOpacity(int opacity) {
+ mOpacity = opacity;
}
protected void onBoundsChange(Rect bounds) {
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
index 3d758fe..b58e40f 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
@@ -21,6 +21,7 @@
import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;
+import java.util.Arrays;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
@@ -28,6 +29,7 @@
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.ScaleDrawable;
@@ -275,19 +277,23 @@
}
public void testOnStateChange() {
- MockDrawable mockDrawable = new MockDrawable();
- MockScaleDrawable mockScaleDrawable = new MockScaleDrawable(
- mockDrawable, Gravity.CENTER, 100, 200);
+ Drawable d = new MockDrawable();
+ MockScaleDrawable scaleDrawable = new MockScaleDrawable(d, Gravity.CENTER, 100, 200);
+ assertEquals("initial child state is empty", d.getState(), StateSet.WILD_CARD);
- assertFalse(mockScaleDrawable.onStateChange(StateSet.WILD_CARD));
- assertTrue(mockDrawable.hasCalledSetState());
- assertTrue(mockScaleDrawable.hasCalledOnBoundsChange());
+ int[] state = new int[] {1, 2, 3};
+ assertFalse("child did not change", scaleDrawable.onStateChange(state));
+ assertEquals("child state did not change", d.getState(), StateSet.WILD_CARD);
- mockDrawable.reset();
- mockScaleDrawable.reset();
- assertFalse(mockScaleDrawable.onStateChange(null));
- assertTrue(mockDrawable.hasCalledSetState());
- assertTrue(mockScaleDrawable.hasCalledOnBoundsChange());
+ d = mContext.getDrawable(R.drawable.statelistdrawable);
+ scaleDrawable = new MockScaleDrawable(d, Gravity.CENTER, 100, 200);
+ assertEquals("initial child state is empty", d.getState(), StateSet.WILD_CARD);
+ scaleDrawable.onStateChange(state);
+ assertTrue("child state changed", Arrays.equals(state, d.getState()));
+
+ // input null as param
+ scaleDrawable.onStateChange(null);
+ // expected, no Exception thrown out, test success
}
public void testOnLevelChange() {
@@ -413,25 +419,25 @@
parser = res.getXml(R.xml.scaledrawable);
attrs = DrawableTestUtils.getAttributeSet(parser, "scale_nodrawable");
try {
- scaleDrawable.inflate(res, parser, attrs);
- fail("Should throw XmlPullParserException");
+ Drawable.createFromXmlInner(res, parser, attrs);
+ fail("Should throw XmlPullParserException if missing drawable");
} catch (XmlPullParserException e) {
}
try {
- scaleDrawable.inflate(null, parser, attrs);
+ Drawable.createFromXmlInner(null, parser, attrs);
fail("Should throw NullPointerException if resource is null");
} catch (NullPointerException e) {
}
try {
- scaleDrawable.inflate(res, null, attrs);
+ Drawable.createFromXmlInner(res, null, attrs);
fail("Should throw NullPointerException if parser is null");
} catch (NullPointerException e) {
}
try {
- scaleDrawable.inflate(res, parser, null);
+ Drawable.createFromXmlInner(res, parser, null);
fail("Should throw NullPointerException if attribute set is null");
} catch (NullPointerException e) {
}
diff --git a/tests/tests/hardware/Android.mk b/tests/tests/hardware/Android.mk
index 1c144ff..9523d87 100644
--- a/tests/tests/hardware/Android.mk
+++ b/tests/tests/hardware/Android.mk
@@ -34,6 +34,7 @@
src/android/hardware/cts/SensorIntegrationTests.java \
src/android/hardware/cts/SensorBatchingTests.java \
src/android/hardware/cts/SensorTest.java \
+ src/android/hardware/cts/SensorManagerStaticTest.java \
LOCAL_STATIC_JAVA_LIBRARIES := ctsdeviceutil
diff --git a/tests/tests/hardware/src/android/hardware/camera2/cts/rs/raw_converter.rs b/tests/tests/hardware/src/android/hardware/camera2/cts/rs/raw_converter.rs
index c8b353e..fb467bb 100644
--- a/tests/tests/hardware/src/android/hardware/camera2/cts/rs/raw_converter.rs
+++ b/tests/tests/hardware/src/android/hardware/camera2/cts/rs/raw_converter.rs
@@ -169,6 +169,9 @@
case 4: // impossible
case 5: // impossible
default:
+ finalRGB.x = 0.f;
+ finalRGB.y = 0.f;
+ finalRGB.z = 0.f;
LOGD("raw_converter.rs: Logic error in tonemap.", 0);
break;
}
diff --git a/tests/tests/hardware/src/android/hardware/cts/SensorManagerStaticTest.java b/tests/tests/hardware/src/android/hardware/cts/SensorManagerStaticTest.java
new file mode 100644
index 0000000..11ac701
--- /dev/null
+++ b/tests/tests/hardware/src/android/hardware/cts/SensorManagerStaticTest.java
@@ -0,0 +1,776 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package android.hardware.cts;
+
+import junit.framework.Assert;
+
+import android.content.Context;
+import android.hardware.SensorManager;
+import android.os.PowerManager;
+
+import java.util.Random;
+
+public class SensorManagerStaticTest extends SensorTestCase {
+ private static final String TAG = "SensorManagerTest";
+
+ // local float version of PI
+ private static final float FLOAT_PI = (float) Math.PI;
+
+
+ private PowerManager.WakeLock mWakeLock;
+
+ @Override
+ protected void setUp() throws Exception {
+ Context context = getContext();
+ PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
+ mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
+
+ mWakeLock.acquire();
+ }
+
+ @Override
+ protected void tearDown(){
+ if (mWakeLock != null && mWakeLock.isHeld()) {
+ mWakeLock.release();
+ }
+ }
+
+ // SensorManager Tests
+ public void testGetAltitude() throws Exception {
+ float r, q;
+ float altitude;
+
+ // identity property
+ for (r = 0.5f; r < 1.3f; r += 0.1f) {
+
+ altitude = SensorManager.getAltitude(r * SensorManager.PRESSURE_STANDARD_ATMOSPHERE,
+ r * SensorManager.PRESSURE_STANDARD_ATMOSPHERE);
+ assertRoughlyEqual("getAltitude identity property violated.", altitude, 0.0f, 0.1f);
+ }
+
+ // uniform increasing as pressure decreases property
+ float prevAltitude = 1e5f; // 100km ceiling
+ for (r = 0.5f; r < 1.3f; r += 0.01f) {
+ altitude = SensorManager.getAltitude(SensorManager.PRESSURE_STANDARD_ATMOSPHERE,
+ r * SensorManager.PRESSURE_STANDARD_ATMOSPHERE);
+
+ assertTrue("getAltitude result has to decrease as p increase.", prevAltitude > altitude);
+ prevAltitude = altitude;
+ }
+
+ // compare to a reference algorithm
+ final float coef = 1.0f / 5.255f;
+ for (r = 0.8f; r < 1.3f; r += 0.1f) {
+ for (q = 1.1f * r; q > 0.5f * r; q -= 0.1f * r) {
+ float p0 = r * SensorManager.PRESSURE_STANDARD_ATMOSPHERE;
+ float p = q * SensorManager.PRESSURE_STANDARD_ATMOSPHERE;
+
+ float t1 = SensorManager.getAltitude(p0, p);
+ float t2 = 44330.f*(1.0f- (float) Math.pow(p/p0, coef));
+
+ assertRoughlyEqual(
+ String.format("getAltitude comparing to reference algorithm failed. " +
+ "Detail: getAltitude(%f, %f) => %f, reference => %f",
+ p0, p, t1, t2),
+ t1, t2, 100.f);
+ }
+ }
+
+ }
+
+ public void testGetAngleChange() throws Exception {
+ TestDataGenerator data = new TestDataGenerator();
+
+ int i;
+ float [] rotv = new float[3];
+ float [] rotv2 = new float[3];
+
+ // test many instances
+ for (i=0; i<100; ++i) {
+ float [] R1, R12, R2;
+ // azimuth(yaw) pitch roll
+ data.nextRotationAngles(rotv);
+ R1 = mat9VRot(rotv); // random base
+
+ // azimuth(yaw) pitch roll
+ data.nextRotationAngles(rotv);
+ R12 = mat9VRot(rotv);
+ R2 = mat9Mul(R1, R12); // apply another random rotation
+
+ // test different variations of input matrix format
+ switch(i & 3) {
+ case 0:
+ SensorManager.getAngleChange(rotv2, R2, R1);
+ break;
+ case 1:
+ SensorManager.getAngleChange(rotv2, mat9to16(R2), R1);
+ break;
+ case 2:
+ SensorManager.getAngleChange(rotv2, R2, mat9to16(R1));
+ break;
+ case 3:
+ SensorManager.getAngleChange(rotv2, mat9to16(R2), mat9to16(R1));
+ break;
+ }
+
+ // check range
+ assertRotationAnglesValid("getAngleChange result out of range.", rotv2);
+
+ // avoid directly checking the rotation angles to avoid corner cases
+ float [] R12rt = mat9T(mat9VRot(rotv2));
+ float [] RI = mat9Mul(R12rt, R12);
+
+ assertRoughlyEqual(
+ String.format("getAngleChange result is incorrect. Details: case %d, " +
+ "truth = [%f, %f, %f], result = [%f, %f, %f]", i, rotv[0], rotv[1], rotv[2],
+ rotv2[0], rotv2[1], rotv2[2]),
+ RI[0] + RI[4] + RI[8], 3.f, 1e-4f);
+ }
+ }
+
+ public void testGetInclination() throws Exception {
+ TestDataGenerator data = new TestDataGenerator();
+
+ int i;
+ float [] rotv = new float[3];
+ float [] rotv2 = new float[3];
+ float [] rotv3;
+
+ // test many instances
+ for (i = 0; i < 100; ++i) {
+ float [] R;
+ float angle;
+ angle = (data.nextFloat()-0.5f) * FLOAT_PI;
+ R = mat9Rot(SensorManager.AXIS_X, -angle);
+
+ float angler = ((i&1) != 0) ?
+ SensorManager.getInclination(mat9to16(R)) : SensorManager.getInclination(R);
+ assertRoughlyEqual(
+ String.format(
+ "getInclination return incorrect result. Detail: case %d, truth %f, result %f.",
+ i, angle, angler),
+ angle, angler, 1e-4f);
+ }
+ }
+
+ public void testGetOrientation() throws Exception {
+ TestDataGenerator data = new TestDataGenerator();
+
+ int i;
+ float [] rotv = new float[3];
+ float [] rotv2 = new float[3];
+ float [] rotv3;
+
+ // test many instances
+ for (i=0; i<100; ++i) {
+ float [] R;
+ // yaw pitch roll
+ data.nextRotationAngles(rotv);
+ R = mat9VRot(rotv);
+
+ rotv3 = SensorManager.getOrientation( ((i&1) != 0) ? R : mat9to16(R), rotv2);
+ assertTrue("getOrientaion has to return the array passed in argument", rotv3 == rotv2);
+
+ // check range
+ assertRotationAnglesValid("getOrientation result out of range.", rotv2);
+
+ // Avoid directly comparing rotation angles. Instead, compare the rotation matrix.
+ float [] Rr = mat9T(mat9VRot(rotv2));
+ float [] RI = mat9Mul(Rr, R);
+
+ assertRoughlyEqual(
+ String.format("getOrientation result is incorrect. Details: case %d, " +
+ "truth = [%f, %f, %f], result = [%f, %f, %f]", i, rotv[0], rotv[1], rotv[2],
+ rotv2[0], rotv2[1], rotv2[2]),
+ RI[0] + RI[4] + RI[8], 3.f, 1e-4f);
+ }
+ }
+
+ public void testGetQuaternionFromVector() throws Exception {
+ TestDataGenerator data = new TestDataGenerator();
+
+ int i;
+ float [] v;
+ float [] q = new float[4];
+ float [] q2 = new float[4];
+ float [] v3 = new float[3];
+ float [] v4 = new float[4];
+ float [] v5 = new float[5];
+ float [][] vs = new float[][] {v3, v4, v5};
+
+ float [] xyzth = new float[4];
+ for (i = 0; i < 100; ++i) {
+ float c, s;
+
+ data.nextRotationAxisAngle(xyzth);
+
+ c = (float) Math.cos(xyzth[3]);
+ s = (float) Math.sin(xyzth[3]);
+ if (c < 0.f) {
+ c = -c;
+ s = -s;
+ }
+
+ v = vs[i%3];
+ switch(i%3) {
+ case 2:
+ v[4] = data.nextBoolean() ? data.nextFloat() : -1.f;
+ case 1:
+ v[3] = c;
+ case 0:
+ v[0] = s * xyzth[0];
+ v[1] = s * xyzth[1];
+ v[2] = s * xyzth[2];
+ }
+
+ q2[0] = c;
+ q2[1] = v[0];
+ q2[2] = v[1];
+ q2[3] = v[2];
+
+ SensorManager.getQuaternionFromVector(q, v);
+ assertVectorRoughlyEqual(
+ String.format("getQuaternionFromVector returns wrong results, Details: case %d, " +
+ "truth = (%f, %f, %f, %f), result = (%f, %f, %f, %f).",
+ i, q2[0], q2[1], q2[2], q2[3], q[0], q[1], q[2], q[3]),
+ q, q2, 1e-4f);
+ }
+ }
+
+ public void testGetRotationMatrix() throws Exception {
+ TestDataGenerator data = new TestDataGenerator();
+ final float gravity = 9.81f;
+ final float magStrength = 50.f;
+
+ int i;
+ float [] gm = new float[9];
+ float [] rotv = new float[3];
+ float [] gI = null;
+ float [] mI = null;
+ float [] Rr = new float[9];
+ float [] Ir = new float[9];
+
+ gm[6] = gravity; // m/s^2, first column gravity
+
+ // test many instances
+ for (i=0; i<100; ++i) {
+ float [] Rt;
+ float incline;
+ // yaw pitch roll
+ data.nextRotationAngles(rotv);
+ Rt = mat9T(mat9VRot(rotv)); // from world frame to phone frame
+ //Rt = mat9I();
+
+ incline = -0.9f * (data.nextFloat() - 0.5f) * FLOAT_PI; // ~ +-80 degrees
+ //incline = 0.f;
+ gm[4] = magStrength * (float) Math.cos(-incline); // positive means rotate downwards
+ gm[7] = magStrength * (float) Math.sin(-incline);
+
+ float [] gmb = mat9Mul(Rt, gm); // do not care about right most column
+ gI = mat9Axis(gmb, SensorManager.AXIS_X);
+ mI = mat9Axis(gmb, SensorManager.AXIS_Y);
+
+ assertTrue("getRotationMatrix returns false on valid inputs",
+ SensorManager.getRotationMatrix(Rr, Ir, gI, mI));
+
+ float [] n = mat9Mul(Rr, Rt);
+ assertRoughlyEqual(
+ String.format("getRotationMatrix returns incorrect R matrix. " +
+ "Details: case %d, truth R = %s, result R = %s.",
+ i, mat9ToStr(mat9T(Rt)), mat9ToStr(Rr)),
+ n[0] + n[4] + n[8], 3.f, 1e-4f);
+
+
+ // Magnetic incline is defined so that it means the magnetic field lines is formed
+ // by rotate local y axis around -x axis by incline angle. However, I matrix is
+ // defined as (according to document):
+ // [0 m 0] = I * R * geomagnetic,
+ // which means,
+ // I' * [0 m 0] = R * geomagnetic.
+ // Thus, I' = Rot(-x, incline) and I = Rot(-x, incline)' = Rot(x, incline)
+ float [] Ix = mat9Rot(SensorManager.AXIS_X, incline);
+ assertVectorRoughlyEqual(
+ String.format("getRotationMatrix returns incorrect I matrix. " +
+ "Details: case %d, truth I = %s, result I = %s.",
+ i, mat9ToStr(Ix), mat9ToStr(Ir)),
+ Ix, Ir, 1e-4f);
+ }
+
+ // test 16 element inputs
+ float [] Rr2 = new float[16];
+ float [] Ir2 = new float[16];
+
+ assertTrue("getRotationMatrix returns false on valid inputs",
+ SensorManager.getRotationMatrix(Rr2, Ir2, gI, mI));
+
+ assertVectorRoughlyEqual(
+ "getRotationMatrix acts inconsistent with 9- and 16- elements matrix buffer",
+ mat16to9(Rr2), Rr, 1e-4f);
+
+ assertVectorRoughlyEqual(
+ "getRotationMatrix acts inconsistent with 9- and 16- elements matrix buffer",
+ mat16to9(Ir2), Ir, 1e-4f);
+
+ // test null inputs
+ assertTrue("getRotationMatrix does not handle null inputs",
+ SensorManager.getRotationMatrix(Rr, null, gI, mI));
+
+ assertTrue("getRotationMatrix does not handle null inputs",
+ SensorManager.getRotationMatrix(null, Ir, gI, mI));
+
+ assertTrue("getRotationMatrix does not handle null inputs",
+ SensorManager.getRotationMatrix(null, null, gI, mI));
+
+ // test fail cases
+ // free fall, if the acc reading is less than 10% of gravity
+ gI[0] = gI[1] = gI[2] = data.nextFloat() * gravity * 0.05f; // sqrt(3) * 0.05 < 0.1
+ assertFalse("getRotationMatrix does not fail when it supposed to fail (gravity too small)",
+ SensorManager.getRotationMatrix(Rr, Ir, gI, mI));
+
+ // wrong input
+ assertFalse("getRotationMatrix does not fail when it supposed to fail (singular axis)",
+ SensorManager.getRotationMatrix(Rr, Ir, gI, gI));
+ }
+
+ public void testGetRotationMatrixFromVector() throws Exception {
+ TestDataGenerator data = new TestDataGenerator();
+
+ int i;
+ float [] v;
+ float [] q = new float[4];
+
+ float [] v3 = new float[3];
+ float [] v4 = new float[4];
+ float [] v5 = new float[5];
+ float [][] vs = new float[][]{v3, v4, v5};
+
+ float [] m9 = new float[9];
+ float [] m16 = new float[16];
+
+ // format: x y z theta/2
+ float [] xyzth = new float[4];
+ // test the orthogonal property of returned matrix
+ for (i=0; i<20; ++i) {
+ float c, s;
+ data.nextRotationAxisAngle(xyzth);
+
+ c = (float) Math.cos(xyzth[3]);
+ s = (float) Math.sin(xyzth[3]);
+ if (c < 0.f) {
+ c = -c;
+ s = -s;
+ }
+
+ v = vs[i%3];
+ switch(i%3) {
+ case 2:
+ v[4] = data.nextBoolean() ? data.nextFloat() : -1.f;
+ case 1:
+ v[3] = c;
+ case 0:
+ v[0] = s * xyzth[0];
+ v[1] = s * xyzth[1];
+ v[2] = s * xyzth[2];
+ }
+
+ if ((i % 1) != 0) {
+ SensorManager.getRotationMatrixFromVector(m16, v);
+ m9 = mat16to9(m16);
+ }else {
+ SensorManager.getRotationMatrixFromVector(m9, v);
+ }
+
+ float [] n = mat9Mul(m9, mat9T(m9));
+ assertRoughlyEqual("getRotationMatrixFromVector do not return proper matrix",
+ n[0]+ n[4] + n[8], 3.f, 1e-4f);
+ }
+
+ // test if multiple rotation (total 2pi) about an axis result in identity
+ v = v3;
+ float [] Rr = new float[9];
+
+ for (i=0; i<20; ++i) {
+ float j, halfTheta, residualHalfTheta = FLOAT_PI;
+ float [] R = mat9I();
+ float c, s;
+
+ data.nextRotationAxisAngle(xyzth); // half theta is ignored
+
+ j = data.nextInt(5) + 2; // 2 ~ 6 rotations
+
+ while(j-- > 0) {
+ if (j == 0) {
+ halfTheta = residualHalfTheta;
+ } else {
+ halfTheta = data.nextFloat() * FLOAT_PI;
+ }
+
+ c = (float) Math.cos(halfTheta);
+ s = (float) Math.sin(halfTheta);
+ if (c < 0.f) {
+ c = -c;
+ s = -s;
+ }
+
+ v[0] = s * xyzth[0];
+ v[1] = s * xyzth[1];
+ v[2] = s * xyzth[2];
+
+ SensorManager.getRotationMatrixFromVector(Rr, v);
+ R = mat9Mul(Rr, R);
+
+ residualHalfTheta -= halfTheta;
+ }
+
+ assertRoughlyEqual("getRotationMatrixFromVector returns incorrect matrix",
+ R[0] + R[4] + R[8], 3.f, 1e-4f);
+ }
+
+ // test if rotation about trival axis works
+ v = v3;
+ for (i=0; i<20; ++i) {
+ int axis = (i % 3) + 1;
+ float theta = data.nextFloat() * 2.f * FLOAT_PI;
+ float [] R;
+
+ v[0] = v[1] = v[2] = 0.f;
+ v[axis - 1] = (float) Math.sin(theta / 2.f);
+ if ( (float) Math.cos(theta / 2.f) < 0.f) {
+ v[axis-1] = -v[axis-1];
+ }
+
+ SensorManager.getRotationMatrixFromVector(m9, v);
+ R = mat9Rot(axis, theta);
+
+ assertVectorRoughlyEqual(
+ String.format("getRotationMatrixFromVector returns incorrect matrix with "+
+ "simple rotation. Details: case %d, truth R = %s, result R = %s.",
+ i, mat9ToStr(R), mat9ToStr(m9)),
+ R, m9, 1e-4f);
+ }
+ }
+
+ public void testRemapCoordinateSystem() throws Exception {
+ TestDataGenerator data = new TestDataGenerator();
+
+ int i, j, k;
+ float [] rotv = new float[3];
+ float [] Rout = new float[9];
+ float [] Rout2 = new float[16];
+ int a1, a2; // AXIS_X/Y/Z
+ int b1, b2, b3; // AXIS_X/Y/Z w/ or w/o MINUS
+
+ // test a few instances
+ for (i=0; i<10; ++i) {
+ float [] R;
+ // yaw pitch roll
+ data.nextRotationAngles(rotv);
+ R = mat9VRot(rotv);
+
+ // total of 6*4 = 24 variations
+ // 6 = A(3,2)
+ for (j=0; j<9; ++j) {
+ // axis without minus
+ a1 = j/3 + 1;
+ a2 = j%3 + 1;
+
+ // skip cases when two axis are the same
+ if (a1 == a2) continue;
+
+ for (k=0; k<3; ++k) {
+ // test all minus axis combination: ++, +-, -+, --
+ b1 = a1 | (((k & 2) != 0) ? 0x80 : 0);
+ b2 = a2 | (((k & 1) != 0) ? 0x80 : 0);
+ // the third axis
+ b3 = (6 - a1 -a2) |
+ ( (((a2 + 3 - a1) % 3 == 2) ? 0x80 : 0) ^ (b1 & 0x80) ^ (b2 & 0x80));
+
+ // test both input formats
+ if ( (i & 1) != 0 ) {
+ assertTrue(SensorManager.remapCoordinateSystem(R, b1, b2, Rout));
+ } else {
+ assertTrue(SensorManager.remapCoordinateSystem(mat9to16(R), b1, b2, Rout2));
+ Rout = mat16to9(Rout2);
+ }
+
+ float [] v1, v2;
+
+ String detail = String.format(
+ "Details: case %d (%x %x %x), original R = %s, result R = %s.",
+ i, b1, b2, b3, mat9ToStr(R), mat9ToStr(Rout));
+
+ v1 = mat9Axis(R, SensorManager.AXIS_X);
+ v2 = mat9Axis(Rout, b1);
+ assertVectorRoughlyEqual(
+ "remapCoordinateSystem gives incorrect result (x)." + detail,
+ v1, v2, 1e-4f);
+
+ v1 = mat9Axis(R, SensorManager.AXIS_Y);
+ v2 = mat9Axis(Rout, b2);
+ assertVectorRoughlyEqual(
+ "remapCoordinateSystem gives incorrect result (y)." + detail,
+ v1, v2, 1e-4f);
+
+ v1 = mat9Axis(R, SensorManager.AXIS_Z);
+ v2 = mat9Axis(Rout, b3);
+ assertVectorRoughlyEqual(
+ "remapCoordinateSystem gives incorrect result (z)." + detail,
+ v1, v2, 1e-4f);
+ }
+ }
+
+ }
+
+ // test cases when false should be returned
+ assertTrue("remapCoordinateSystem should return false with mismatch size input and output",
+ !SensorManager.remapCoordinateSystem(Rout,
+ SensorManager.AXIS_Y, SensorManager.AXIS_Z, Rout2));
+ assertTrue("remapCoordinateSystem should return false with invalid axis setting",
+ !SensorManager.remapCoordinateSystem(Rout,
+ SensorManager.AXIS_X, SensorManager.AXIS_X, Rout));
+ assertTrue("remapCoordinateSystem should return false with invalid axis setting",
+ !SensorManager.remapCoordinateSystem(Rout,
+ SensorManager.AXIS_X, SensorManager.AXIS_MINUS_X, Rout));
+
+ }
+
+ // Utilities class & functions
+
+ private class TestDataGenerator {
+ // carry out test deterministically without manually picking numbers
+ private final long DEFAULT_SEED = 0xFEDCBA9876543210l;
+
+ private Random mRandom;
+
+ TestDataGenerator(long seed) {
+ mRandom = new Random(seed);
+ }
+
+ TestDataGenerator() {
+ mRandom = new Random(DEFAULT_SEED);
+ }
+
+ void nextRotationAngles(float [] rotv) {
+ assertTrue(rotv.length == 3);
+
+ rotv[0] = (mRandom.nextFloat()-0.5f) * 2.0f * FLOAT_PI; // azimuth(yaw) -pi ~ pi
+ rotv[1] = (mRandom.nextFloat()-0.5f) * FLOAT_PI; // pitch -pi/2 ~ +pi/2
+ rotv[2] = (mRandom.nextFloat()-0.5f) * 2.f * FLOAT_PI; // roll -pi ~ +pi
+ }
+
+ void nextRotationAxisAngle(float [] aa) {
+ assertTrue(aa.length == 4);
+
+ aa[0] = (mRandom.nextFloat() - 0.5f) * 2.f;
+ aa[1] = (mRandom.nextFloat() - 0.5f ) * 2.f * (float) Math.sqrt(1.f - aa[0] * aa[0]);
+ aa[2] = (mRandom.nextBoolean() ? 1.f : -1.f) *
+ (float) Math.sqrt(1.f - aa[0] * aa[0] - aa[1] * aa[1]);
+ aa[3] = mRandom.nextFloat() * FLOAT_PI;
+ }
+
+ int nextInt(int i) {
+ return mRandom.nextInt(i);
+ }
+
+ float nextFloat() {
+ return mRandom.nextFloat();
+ }
+
+ boolean nextBoolean() {
+ return mRandom.nextBoolean();
+ }
+ }
+
+ private static void assertRotationAnglesValid(String message, float[] ra) {
+
+ assertTrue(message, ra.length == 3 &&
+ ra[0] >= -FLOAT_PI && ra[0] <= FLOAT_PI && // azimuth
+ ra[1] >= -FLOAT_PI / 2.f && ra[1] <= FLOAT_PI / 2.f && // pitch
+ ra[2] >= -FLOAT_PI && ra[2] <= FLOAT_PI); // roll
+ }
+
+ private static void assertRoughlyEqual(String message, float a, float b, float bound) {
+ assertTrue(message, Math.abs(a-b) < bound);
+ }
+
+ private static void assertVectorRoughlyEqual(String message, float [] v1, float [] v2,
+ float bound) {
+ assertTrue(message, v1.length == v2.length);
+ int i;
+ float sum = 0.f;
+ for (i=0; i<v1.length; ++i) {
+ sum += (v1[i] - v2[i]) * (v1[i] - v2[i]);
+ }
+ assertRoughlyEqual(message, (float)Math.sqrt(sum), 0.f, bound);
+ }
+
+ private static float [] mat9to16(float [] m) {
+ assertTrue(m.length == 9);
+
+ float [] n = new float[16];
+ int i;
+ for (i=0; i<9; ++i) {
+ n[i+i/3] = m[i];
+ }
+ n[15] = 1.f;
+ return n;
+ }
+
+ private static float [] mat16to9(float [] m) {
+ assertTrue(m.length == 16);
+
+ float [] n = new float[9];
+ int i;
+ for (i=0; i<9; ++i) {
+ n[i] = m[i + i/3];
+ }
+ return n;
+ }
+
+ private static float [] mat9Mul(float [] m, float [] n) {
+ assertTrue(m.length == 9 && n.length == 9);
+
+ float [] r = new float[9];
+ int i, j, k;
+
+ for (i = 0; i < 3; ++i)
+ for (j = 0; j < 3; ++j)
+ for (k = 0; k < 3; ++k)
+ r[i * 3 + j] += m[i * 3 + k] * n[k * 3 + j];
+
+ return r;
+ }
+
+ private static float [] mat9T(float [] m) {
+ assertTrue(m.length == 9);
+
+ int i, j;
+ float [] n = new float[9];
+
+ for (i = 0; i < 3; ++i)
+ for (j = 0; j < 3; ++j)
+ n[i * 3 + j] = m[j * 3 + i];
+
+ return n;
+ }
+
+ private static float [] mat9I() {
+ float [] m = new float[9];
+ m[0] = m[4] = m[8] = 1.f;
+ return m;
+ }
+
+ private static float [] mat9Rot(int axis, float angle) {
+ float [] m = new float[9];
+ switch (axis) {
+ case SensorManager.AXIS_X:
+ m[0] = 1.f;
+ m[4] = m[8] = (float) Math.cos(angle);
+ m[5] = - (m[7] = (float) Math.sin(angle));
+ break;
+ case SensorManager.AXIS_Y:
+ m[4] = 1.f;
+ m[0] = m[8] = (float) Math.cos(angle);
+ m[6] = - (m[2] = (float) Math.sin(angle));
+ break;
+ case SensorManager.AXIS_Z:
+ m[8] = 1.f;
+ m[0] = m[4] = (float) Math.cos(angle);
+ m[1] = - (m[3] = (float) Math.sin(angle));
+ break;
+ default:
+ // should never be here
+ assertTrue(false);
+ }
+ return m;
+ }
+
+ private static float [] mat9VRot(float [] angles) {
+ assertTrue(angles.length == 3);
+ // yaw, android yaw rotate to -z
+ float [] R = mat9Rot(SensorManager.AXIS_Z, -angles[0]);
+ // pitch, android pitch rotate to -x
+ R = mat9Mul(R, mat9Rot(SensorManager.AXIS_X, -angles[1]));
+ // roll
+ R = mat9Mul(R, mat9Rot(SensorManager.AXIS_Y, angles[2]));
+
+ return R;
+ }
+
+ private static float [] mat9Axis(float m[], int axis) {
+ assertTrue(m.length == 9);
+
+ boolean negative = (axis & 0x80) != 0;
+ float [] v = new float[3];
+ int offset;
+
+ offset = (axis & ~0x80) - 1;
+ v[0] = negative ? -m[offset] : m[offset];
+ v[1] = negative ? -m[offset+3] : m[offset+3];
+ v[2] = negative ? -m[offset+6] : m[offset+6];
+ return v;
+ }
+
+ private static float vecInner(float u[], float v[]) {
+ assertTrue(u.length == v.length);
+
+ int i;
+ float sum = 0.f;
+
+ for (i=0; i < v.length; ++i) {
+ sum += u[i]*v[i];
+ }
+ return (float)Math.sqrt(sum);
+ }
+
+ private static String vecToStr(float u[]) {
+ int i;
+ String s;
+ switch (u.length) {
+ case 3:
+ return String.format("[%f, %f, %f]", u[0], u[1], u[2]);
+ case 4:
+ return String.format("(%f, %f, %f, %f)", u[0], u[1], u[2], u[3]);
+ default:
+ s = "[";
+ for (i = 0; i < u.length-1; ++i) {
+ s += String.format("%f, ", u[i]);
+ }
+ s += String.format("%f]", u[i]);
+ return s;
+ }
+ }
+
+ private static String mat9ToStr(float m[]) {
+ assertTrue(m.length == 9);
+ return String.format("[%f, %f, %f; %f, %f, %f; %f, %f, %f]",
+ m[0], m[1], m[2],
+ m[3], m[4], m[5],
+ m[6], m[7], m[8]);
+ }
+
+ private static String mat16ToStr(float m[]) {
+ assertTrue(m.length == 16);
+ return String.format("[%f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f; %f, %f, %f, %f]",
+ m[0], m[1], m[2], m[3],
+ m[4], m[5], m[6], m[7],
+ m[8], m[9], m[10], m[11],
+ m[12], m[13], m[14], m[15]);
+ }
+
+}
+
diff --git a/tests/tests/hardware/src/android/hardware/cts/SensorTest.java b/tests/tests/hardware/src/android/hardware/cts/SensorTest.java
index 6703c47..d76152f 100644
--- a/tests/tests/hardware/src/android/hardware/cts/SensorTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/SensorTest.java
@@ -47,6 +47,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -353,6 +354,40 @@
listener.assertEventsReceivedInHandler();
}
+ /**
+ * Explicit testing the SensorManager.registerListener(SensorEventListener, Sensor, int, int).
+ */
+ @TimeoutReq(minutes=10)
+ public void testBatchAndFlushUseDefaultHandler() throws Exception {
+ Sensor sensor = null;
+ for (Sensor s : mSensorList) {
+ if (s.getReportingMode() == Sensor.REPORTING_MODE_CONTINUOUS) {
+ sensor = s;
+ break;
+ }
+ }
+ if (sensor == null) {
+ throw new SensorTestStateNotSupportedException(
+ "There are no Continuous sensors in the device.");
+ }
+
+ TestSensorEnvironment environment = new TestSensorEnvironment(
+ getContext(),
+ sensor,
+ SensorManager.SENSOR_DELAY_FASTEST,
+ (int) TimeUnit.SECONDS.toMicros(5));
+ mTestSensorManager = new TestSensorManager(environment);
+
+ TestSensorEventListener listener = new TestSensorEventListener(environment, null);
+
+ // specifyHandler <= false, use the SensorManager API without Handler parameter
+ CountDownLatch eventLatch = mTestSensorManager.registerListener(listener, 1, false);
+ listener.waitForEvents(eventLatch, 1);
+ CountDownLatch flushLatch = mTestSensorManager.requestFlush();
+ listener.waitForFlushComplete(flushLatch);
+ listener.assertEventsReceivedInHandler();
+ }
+
// TODO: after L release move to SensorBatchingTests and run in all sensors with default
// verifications enabled
public void testBatchAndFlushWithMutipleSensors() throws Exception {
@@ -568,4 +603,5 @@
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {}
}
+
}
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java b/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java
index 2468bd1..23580de 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorManager.java
@@ -77,6 +77,7 @@
mTestSensorEventListener = listener;
String message = SensorCtsHelper.formatAssertionMessage("registerListener", mEnvironment);
+
boolean result = mSensorManager.registerListener(
mTestSensorEventListener,
mEnvironment.getSensor(),
@@ -94,7 +95,10 @@
* @throws AssertionError if there was an error registering the listener with the
* {@link SensorManager}
*/
- public CountDownLatch registerListener(TestSensorEventListener listener, int eventCount) {
+ public CountDownLatch registerListener(
+ TestSensorEventListener listener,
+ int eventCount,
+ boolean specifyHandler) {
if (mTestSensorEventListener != null) {
Log.w(LOG_TAG, "Listener already registered, returning.");
return null;
@@ -103,17 +107,41 @@
CountDownLatch latch = listener.getLatchForSensorEvents(eventCount);
mTestSensorEventListener = listener;
String message = SensorCtsHelper.formatAssertionMessage("registerListener", mEnvironment);
- boolean result = mSensorManager.registerListener(
- mTestSensorEventListener,
- mEnvironment.getSensor(),
- mEnvironment.getRequestedSamplingPeriodUs(),
- mEnvironment.getMaxReportLatencyUs(),
- mTestSensorEventListener.getHandler());
+
+ boolean result;
+ if (specifyHandler) {
+ result = mSensorManager.registerListener(
+ mTestSensorEventListener,
+ mEnvironment.getSensor(),
+ mEnvironment.getRequestedSamplingPeriodUs(),
+ mEnvironment.getMaxReportLatencyUs(),
+ mTestSensorEventListener.getHandler());
+ } else {
+ result = mSensorManager.registerListener(
+ mTestSensorEventListener,
+ mEnvironment.getSensor(),
+ mEnvironment.getRequestedSamplingPeriodUs(),
+ mEnvironment.getMaxReportLatencyUs());
+ }
Assert.assertTrue(message, result);
return latch;
}
/**
+ * Register the listener. This method will perform a no-op if the sensor is already registered.
+ *
+ * @return A CountDownLatch initialized with eventCount which is used to wait for sensor
+ * events.
+ * @throws AssertionError if there was an error registering the listener with the
+ * {@link SensorManager}
+ */
+ public CountDownLatch registerListener(
+ TestSensorEventListener listener,
+ int eventCount) {
+ return registerListener(listener, eventCount, true);
+ }
+
+ /**
* Unregister the listener. This method will perform a no-op if the sensor is not registered.
*/
public void unregisterListener() {
diff --git a/tests/tests/media/src/android/media/cts/MediaSessionTest.java b/tests/tests/media/src/android/media/cts/MediaSessionTest.java
index 21839f5..7999092 100644
--- a/tests/tests/media/src/android/media/cts/MediaSessionTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaSessionTest.java
@@ -29,6 +29,9 @@
import android.media.session.MediaSessionManager;
import android.media.session.PlaybackState;
import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
import android.os.Parcel;
import android.test.AndroidTestCase;
@@ -36,12 +39,20 @@
import java.util.Set;
public class MediaSessionTest extends AndroidTestCase {
+ // The maximum time to wait for an operation.
+ private static final long TIME_OUT_MS = 5000L;
+ private static final String SESSION_TAG = "test-session";
+ private static final String EXTRAS_KEY = "test-key";
+ private static final String EXTRAS_VALUE = "test-val";
+ private static final String SESSION_EVENT = "test-session-event";
+
private AudioManager mAudioManager;
+ private Handler mHandler = new Handler(Looper.getMainLooper());
@Override
protected void setUp() throws Exception {
super.setUp();
- mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+ mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
}
/**
@@ -49,23 +60,21 @@
* initialized correctly.
*/
public void testCreateSession() throws Exception {
- String tag = "test session";
- MediaSession session = new MediaSession(getContext(), tag);
+ MediaSession session = new MediaSession(getContext(), SESSION_TAG);
assertNotNull(session.getSessionToken());
assertFalse("New session should not be active", session.isActive());
// Verify by getting the controller and checking all its fields
MediaController controller = session.getController();
assertNotNull(controller);
- verifyNewSession(controller, tag);
+ verifyNewSession(controller, SESSION_TAG);
}
/**
* Tests MediaSession.Token created in the constructor of MediaSession.
*/
public void testSessionToken() throws Exception {
- String tag = "test session";
- MediaSession session = new MediaSession(getContext(), tag);
+ MediaSession session = new MediaSession(getContext(), SESSION_TAG);
MediaSession.Token sessionToken = session.getSessionToken();
assertNotNull(sessionToken);
@@ -85,30 +94,28 @@
* controller.
*/
public void testConfigureSession() throws Exception {
- String tag = "test session";
- String key = "test-key";
- String val = "test-val";
- MediaSession session = new MediaSession(getContext(), tag);
+ MediaSession session = new MediaSession(getContext(), SESSION_TAG);
MediaController controller = session.getController();
// test setExtras
Bundle extras = new Bundle();
- extras.putString(key, val);
+ extras.putString(EXTRAS_KEY, EXTRAS_VALUE);
session.setExtras(extras);
Bundle extrasOut = controller.getExtras();
assertNotNull(extrasOut);
- assertEquals(val, extrasOut.get(key));
+ assertEquals(EXTRAS_VALUE, extrasOut.get(EXTRAS_KEY));
// test setFlags
session.setFlags(5);
assertEquals(5, controller.getFlags());
// test setMetadata
- MediaMetadata metadata = new MediaMetadata.Builder().putString(key, val).build();
+ MediaMetadata metadata =
+ new MediaMetadata.Builder().putString(EXTRAS_KEY, EXTRAS_VALUE).build();
session.setMetadata(metadata);
MediaMetadata metadataOut = controller.getMetadata();
assertNotNull(metadataOut);
- assertEquals(val, metadataOut.getString(key));
+ assertEquals(EXTRAS_VALUE, metadataOut.getString(EXTRAS_KEY));
// test setPlaybackState
PlaybackState state = new PlaybackState.Builder().setActions(55).build();
@@ -135,27 +142,27 @@
assertEquals(VolumeProvider.VOLUME_CONTROL_FIXED, info.getVolumeControl());
// test setPlaybackToLocal
- AudioAttributes attrs = new AudioAttributes.Builder().addTag(val).build();
+ AudioAttributes attrs = new AudioAttributes.Builder().addTag(EXTRAS_VALUE).build();
session.setPlaybackToLocal(attrs);
info = controller.getPlaybackInfo();
assertNotNull(info);
assertEquals(MediaController.PlaybackInfo.PLAYBACK_TYPE_LOCAL, info.getPlaybackType());
Set<String> tags = info.getAudioAttributes().getTags();
assertNotNull(tags);
- assertTrue(tags.contains(val));
+ assertTrue(tags.contains(EXTRAS_VALUE));
// test setQueue and setQueueTitle
ArrayList<MediaSession.QueueItem> queue = new ArrayList<MediaSession.QueueItem>();
MediaSession.QueueItem item = new MediaSession.QueueItem(new MediaDescription.Builder()
- .setMediaId(val).setTitle("title").build(), 11);
+ .setMediaId(EXTRAS_VALUE).setTitle("title").build(), 11);
queue.add(item);
session.setQueue(queue);
- session.setQueueTitle(val);
+ session.setQueueTitle(EXTRAS_VALUE);
- assertEquals(val, controller.getQueueTitle());
+ assertEquals(EXTRAS_VALUE, controller.getQueueTitle());
assertEquals(1, controller.getQueue().size());
assertEquals(11, controller.getQueue().get(0).getQueueId());
- assertEquals(val, controller.getQueue().get(0).getDescription().getMediaId());
+ assertEquals(EXTRAS_VALUE, controller.getQueue().get(0).getDescription().getMediaId());
session.setQueue(null);
session.setQueueTitle(null);
@@ -170,6 +177,24 @@
assertEquals(pi, controller.getSessionActivity());
}
+ public void testSendSessionEvent() throws Exception {
+ MediaSession session = new MediaSession(getContext(), SESSION_TAG);
+ MediaController controller = new MediaController(getContext(), session.getSessionToken());
+ Object lock = new Object();
+ MediaControllerCallback callback = new MediaControllerCallback(lock);
+ controller.registerCallback(callback, mHandler);
+
+ Bundle extras = new Bundle();
+ extras.putString(EXTRAS_KEY, EXTRAS_VALUE);
+
+ synchronized (lock) {
+ session.sendSessionEvent(SESSION_EVENT, extras);
+ lock.wait(TIME_OUT_MS);
+ assertEquals(SESSION_EVENT, callback.mEvent);
+ assertEquals(EXTRAS_VALUE, callback.mExtras.getString(EXTRAS_KEY));
+ }
+ }
+
/**
* Verifies that a new session hasn't had any configuration bits set yet.
*
@@ -201,4 +226,23 @@
assertEquals(mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC),
info.getCurrentVolume());
}
+
+ private class MediaControllerCallback extends MediaController.Callback {
+ private Object mLock;
+ private String mEvent;
+ private Bundle mExtras;
+
+ MediaControllerCallback(Object lock) {
+ mLock = lock;
+ }
+
+ @Override
+ public void onSessionEvent(String event, Bundle extras) {
+ synchronized (mLock) {
+ mEvent = event;
+ mExtras = (Bundle) extras.clone();
+ mLock.notify();
+ }
+ }
+ }
}
diff --git a/tests/tests/media/src/android/media/cts/MidiSoloTest.java b/tests/tests/media/src/android/media/cts/MidiSoloTest.java
new file mode 100644
index 0000000..4c1a5e8
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/MidiSoloTest.java
@@ -0,0 +1,203 @@
+/*
+ * 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 android.media.cts;
+
+import java.io.IOException;
+
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.cts.util.CtsAndroidTestCase;
+import android.media.midi.MidiDevice;
+import android.media.midi.MidiDevice.MidiConnection;
+import android.media.midi.MidiDeviceInfo;
+import android.media.midi.MidiDeviceStatus;
+import android.media.midi.MidiInputPort;
+import android.media.midi.MidiManager;
+import android.media.midi.MidiReceiver;
+import android.media.midi.MidiSender;
+import android.os.Handler;
+import android.os.Looper;
+
+/**
+ * Test MIDI when there may be no MIDI devices available. There is not much we
+ * can test without a device.
+ */
+public class MidiSoloTest extends CtsAndroidTestCase {
+ private static final String TAG = "MidiSoloTest";
+ private final static int LOCAL_STORAGE_SIZE = 256;
+
+ // Store received data so we can check it later.
+ class MyMidiReceiver extends MidiReceiver {
+ public int byteCount;
+ public byte[] data = new byte[LOCAL_STORAGE_SIZE];
+
+ public MyMidiReceiver(int maxMessageSize) {
+ super(maxMessageSize);
+ }
+
+ @Override
+ // Abstract method declared in MidiReceiver
+ public void onSend(byte[] msg, int offset, int count, long timestamp)
+ throws IOException {
+ assertTrue("Message too large.", (count <= getMaxMessageSize()));
+ try {
+ System.arraycopy(msg, offset, data, byteCount, count);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new IOException("Exceeded local storage.", e);
+ }
+ byteCount += count;
+ }
+
+ @Override
+ public void onFlush() {
+ byteCount = 0;
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ // setup for each test case.
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ // Test case clean up.
+ super.tearDown();
+ }
+
+ public void testMidiManager() throws Exception {
+ PackageManager pm = getContext().getPackageManager();
+ if (!pm.hasSystemFeature(PackageManager.FEATURE_MIDI)) {
+ return; // Not supported so don't test it.
+ }
+
+ MidiManager midiManager = (MidiManager) getContext().getSystemService(
+ Context.MIDI_SERVICE);
+ assertTrue("MidiManager not supported.", midiManager != null);
+
+ MidiDeviceInfo[] infos = midiManager.getDevices();
+ assertTrue("Device list was null.", infos != null);
+
+ MidiManager.DeviceCallback callback = new MidiManager.DeviceCallback();
+
+ // These should not crash.
+ midiManager.unregisterDeviceCallback(null);
+ midiManager.unregisterDeviceCallback(callback);
+ midiManager.registerDeviceCallback(null, null);
+ midiManager.registerDeviceCallback(callback, null);
+ midiManager.unregisterDeviceCallback(callback);
+ midiManager.registerDeviceCallback(callback, new Handler(Looper.getMainLooper()));
+ midiManager.registerDeviceCallback(callback, new Handler(Looper.getMainLooper()));
+ midiManager.unregisterDeviceCallback(callback);
+ midiManager.unregisterDeviceCallback(callback);
+ midiManager.unregisterDeviceCallback(callback);
+ midiManager.registerDeviceCallback(null, new Handler(Looper.getMainLooper()));
+ midiManager.unregisterDeviceCallback(callback);
+ midiManager.unregisterDeviceCallback(null);
+ }
+
+ public void testMidiReceiver() throws Exception {
+ PackageManager pm = getContext().getPackageManager();
+ if (!pm.hasSystemFeature(PackageManager.FEATURE_MIDI)) {
+ return; // Not supported so don't test it.
+ }
+
+ MidiReceiver receiver = new MidiReceiver() {
+ @Override
+ public void onSend(byte[] msg, int offset, int count,
+ long timestamp) throws IOException {
+ }
+ };
+ assertEquals("MidiReceiver default size wrong.", Integer.MAX_VALUE,
+ receiver.getMaxMessageSize());
+
+ int maxSize = 11;
+ MyMidiReceiver myReceiver = new MyMidiReceiver(maxSize);
+ assertEquals("MidiReceiver set size wrong.", maxSize,
+ myReceiver.getMaxMessageSize());
+
+ // Fill array with predictable data.
+ byte[] bar = new byte[200];
+ for (int i = 0; i < bar.length; i++) {
+ bar[i] = (byte) (i ^ 15);
+ }
+ // Small message with no offset.
+ int offset = 0;
+ int count = 3;
+ checkReceivedData(myReceiver, bar, offset, count);
+
+ // Small with an offset.
+ offset = 50;
+ count = 3;
+ checkReceivedData(myReceiver, bar, offset, count);
+
+ // Entire array.
+ offset = 0;
+ count = bar.length;
+ checkReceivedData(myReceiver, bar, offset, count);
+
+ offset = 20;
+ count = 100;
+ checkReceivedData(myReceiver, bar, offset, count);
+ }
+
+ public void testMidiReceiverException() throws Exception {
+ PackageManager pm = getContext().getPackageManager();
+ if (!pm.hasSystemFeature(PackageManager.FEATURE_MIDI)) {
+ return; // Not supported so don't test it.
+ }
+
+ int maxSize = 11;
+ MyMidiReceiver myReceiver = new MyMidiReceiver(maxSize);
+ assertEquals("MidiReceiver set size wrong.", maxSize,
+ myReceiver.getMaxMessageSize());
+
+ // Fill array with predictable data.
+ byte[] bar = new byte[200];
+ int offset = 0;
+ int count = bar.length;
+ myReceiver.flush(); // reset byte counter
+ IOException exception = null;
+ // Send too much data and intentionally cause an IOException.
+ try {
+ int sent = 0;
+ while (sent < LOCAL_STORAGE_SIZE) {
+ myReceiver.send(bar, offset, count);
+ sent += count;
+ }
+ } catch (IOException e) {
+ exception = e;
+ }
+ assertTrue("We should have caught an IOException", exception != null);
+ }
+
+ // Does the data we sent match the data received by the MidiReceiver?
+ private void checkReceivedData(MyMidiReceiver myReceiver, byte[] bar,
+ int offset, int count) throws IOException {
+ myReceiver.flush(); // reset byte counter
+ assertEquals("MidiReceiver flush ", 0, myReceiver.byteCount);
+ myReceiver.send(bar, offset, count);
+ // Did we get all the data
+ assertEquals("MidiReceiver count ", count, myReceiver.byteCount);
+ for (int i = 0; i < count; i++) {
+ assertEquals("MidiReceiver byte " + i + " + " + offset,
+ bar[i + offset], myReceiver.data[i]);
+ }
+ }
+}
diff --git a/tests/tests/media/src/android/media/cts/ParamsTest.java b/tests/tests/media/src/android/media/cts/ParamsTest.java
index 4e42004..5e32828 100644
--- a/tests/tests/media/src/android/media/cts/ParamsTest.java
+++ b/tests/tests/media/src/android/media/cts/ParamsTest.java
@@ -20,6 +20,7 @@
import android.media.PlaybackParams;
import android.media.SyncParams;
+import android.os.Parcel;
import android.test.AndroidTestCase;
/**
@@ -346,6 +347,28 @@
}
}
+ public void testPlaybackParamsDescribeContents() {
+ PlaybackParams p = new PlaybackParams();
+ assertEquals(0, p.describeContents());
+ }
+ public void testPlaybackParamsWriteToParcel() {
+ PlaybackParams p = new PlaybackParams();
+ p.setAudioFallbackMode(PlaybackParams.AUDIO_FALLBACK_MODE_FAIL);
+ p.setAudioStretchMode(PlaybackParams.AUDIO_STRETCH_MODE_VOICE);
+ p.setPitch(.5f);
+ p.setSpeed(.0001f);
+
+ Parcel parcel = Parcel.obtain();
+ p.writeToParcel(parcel, 0 /* flags */);
+ parcel.setDataPosition(0);
+ PlaybackParams q = PlaybackParams.CREATOR.createFromParcel(parcel);
+
+ assertEquals(p.getAudioFallbackMode(), q.getAudioFallbackMode());
+ assertEquals(p.getAudioStretchMode(), q.getAudioStretchMode());
+ assertEquals(p.getPitch(), q.getPitch());
+ assertEquals(p.getSpeed(), q.getSpeed());
+ parcel.recycle();
+ }
}
diff --git a/tests/tests/permission/src/android/permission/cts/ContactsProviderTest.java b/tests/tests/permission/src/android/permission/cts/ContactsProviderTest.java
index 51e54df..d815a1d 100644
--- a/tests/tests/permission/src/android/permission/cts/ContactsProviderTest.java
+++ b/tests/tests/permission/src/android/permission/cts/ContactsProviderTest.java
@@ -16,12 +16,7 @@
package android.permission.cts;
-import android.os.RemoteException;
-import android.content.ContentProviderClient;
-import android.content.ContentResolver;
import android.content.ContentValues;
-import android.database.Cursor;
-import android.provider.Contacts;
import android.provider.ContactsContract;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
@@ -71,7 +66,7 @@
* Verifies that query(ContactsContract.Profile.CONTENT_URI) requires
* Permission.
* <p>
- * Requires Permission: {@link android.Manifest.permission#READ_PROFILE}.
+ * Requires Permission: {@link android.Manifest.permission#READ_CONTACTS}.
*/
@SmallTest
public void testQueryProfile() {
@@ -91,7 +86,7 @@
* permission, but trying to do it without the permission should throw a
* SecurityException anyway.
* <p>
- * Requires Permission: {@link android.Manifest.permission#WRITE_PROFILE}.
+ * Requires Permission: {@link android.Manifest.permission#WRITE_CONTACTS}.
*/
@SmallTest
public void testInsertProfile() {
@@ -109,7 +104,7 @@
* Verifies that update(ContactsContract.Profile.CONTENT_URI) requires
* Permission.
* <p>
- * Requires Permission: {@link android.Manifest.permission#WRITE_PROFILE}.
+ * Requires Permission: {@link android.Manifest.permission#WRITE_CONTACTS}.
*/
@SmallTest
public void testUpdateProfile() {
diff --git a/tests/tests/permission2/AndroidManifest.xml b/tests/tests/permission2/AndroidManifest.xml
index c0b78c4..984d124 100755
--- a/tests/tests/permission2/AndroidManifest.xml
+++ b/tests/tests/permission2/AndroidManifest.xml
@@ -45,6 +45,12 @@
<!-- need app that has RECORD_AUDIO but not CAPTURE_AUDIO_OUTPUT -->
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
+ <!-- need app that has READ_CONTACTS but not READ_PROFILE -->
+ <uses-permission android:name="android.permission.READ_CONTACTS"/>
+
+ <!-- need app that has WRITE_CONTACTS but not WRITE_PROFILE -->
+ <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
+
<!-- need a permission that would ordinarily be granted, but has a maxSdkVersion that
causes it to be withheld under the current API level -->
<uses-permission
diff --git a/tests/tests/permission2/src/android/permission2/cts/ContactsProviderTest.java b/tests/tests/permission2/src/android/permission2/cts/ContactsProviderTest.java
new file mode 100644
index 0000000..5a04079
--- /dev/null
+++ b/tests/tests/permission2/src/android/permission2/cts/ContactsProviderTest.java
@@ -0,0 +1,92 @@
+/*
+ * 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 android.permission2.cts;
+
+import android.content.ContentValues;
+import android.provider.ContactsContract;
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * Verify that deprecated contacts permissions are not enforced.
+ */
+public class ContactsProviderTest extends AndroidTestCase {
+
+ /**
+ * Verifies that query(ContactsContract.Contacts.CONTENT_URI) only requires
+ * permission {@link android.Manifest.permission#READ_CONTACTS}.
+ */
+ @SmallTest
+ public void testQueryContacts() {
+ getContext().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
+ null, null, null, null);
+ }
+
+ /**
+ * Verifies that insert(ContactsContract.Contacts.CONTENT_URI) only requires
+ * permission {@link android.Manifest.permission#WRITE_CONTACTS}.
+ */
+ @SmallTest
+ public void testInsertContacts() {
+ try {
+ getContext().getContentResolver().insert(ContactsContract.Contacts.CONTENT_URI,
+ new ContentValues());
+ } catch (SecurityException e) {
+ fail("insert(ContactsContract.Contacts.CONTENT_URI) threw SecurityException");
+ } catch (UnsupportedOperationException e) {
+ // It is okay for this fail in this manner.
+ }
+ }
+
+ /**
+ * Verifies that query(ContactsContract.Profile.CONTENT_URI) only requires
+ * permission {@link android.Manifest.permission#READ_CONTACTS}.
+ */
+ @SmallTest
+ public void testQueryProfile() {
+ getContext().getContentResolver().query(ContactsContract.Profile.CONTENT_URI,
+ null, null, null, null);
+ }
+
+ /**
+ * Verifies that insert(ContactsContract.Profile.CONTENT_URI) only requires
+ * permission {@link android.Manifest.permission#WRITE_CONTACTS}. The provider won't
+ * actually let us execute this. But at least it shouldn't throw a security exception.
+ */
+ @SmallTest
+ public void testInsertProfile() {
+ try {
+ getContext().getContentResolver().insert(ContactsContract.Profile.CONTENT_URI,
+ new ContentValues(0));
+ } catch (SecurityException e) {
+ fail("insert(ContactsContract.Profile.CONTENT_URI) threw SecurityException");
+ } catch (UnsupportedOperationException e) {
+ // It is okay for this fail in this manner.
+ }
+ }
+
+ /**
+ * Verifies that update(ContactsContract.Profile.CONTENT_URI) only requires
+ * permission {@link android.Manifest.permission#WRITE_CONTACTS}.
+ */
+ @SmallTest
+ public void testUpdateProfile() {
+ getContext().getContentResolver().update(ContactsContract.Profile.CONTENT_URI,
+ new ContentValues(0), null, null);
+ }
+}
diff --git a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
index c17583f..9f1e3a5 100644
--- a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
@@ -160,6 +160,7 @@
.setResolution(new Resolution("300x300", "300x300", 300, 300))
.setMinMargins(Margins.NO_MARGINS)
.setColorMode(PrintAttributes.COLOR_MODE_COLOR)
+ .setDuplexMode(PrintAttributes.DUPLEX_MODE_LONG_EDGE)
.build();
verifyLayoutCall(inOrder, adapter, secondOldAttributes, secondNewAttributes, true);
@@ -588,6 +589,7 @@
.setResolution(new Resolution("PDF resolution", "PDF resolution", 300, 300))
.setMinMargins(new Margins(0, 0, 0, 0))
.setColorMode(PrintAttributes.COLOR_MODE_COLOR)
+ .setDuplexMode(PrintAttributes.DUPLEX_MODE_LONG_EDGE)
.build();
verifyLayoutCall(inOrder, adapter, secondOldAttributes, secondNewAttributes, true);
@@ -598,6 +600,7 @@
.setResolution(new Resolution("PDF resolution", "PDF resolution", 300, 300))
.setMinMargins(new Margins(0, 0, 0, 0))
.setColorMode(PrintAttributes.COLOR_MODE_MONOCHROME)
+ .setDuplexMode(PrintAttributes.DUPLEX_MODE_LONG_EDGE)
.build();
verifyLayoutCall(inOrder, adapter, thirdOldAttributes, thirdNewAttributes, true);
@@ -729,7 +732,9 @@
PrintAttributes secondNewAttributes = new PrintAttributes.Builder()
.setMediaSize(MediaSize.ISO_A3)
.setResolution(new Resolution("300x300", "300x300", 300, 300))
- .setMinMargins(Margins.NO_MARGINS).setColorMode(PrintAttributes.COLOR_MODE_COLOR)
+ .setMinMargins(Margins.NO_MARGINS)
+ .setColorMode(PrintAttributes.COLOR_MODE_COLOR)
+ .setDuplexMode(PrintAttributes.DUPLEX_MODE_LONG_EDGE)
.build();
verifyLayoutCall(inOrder, adapter, secondOldAttributes, secondNewAttributes, true);
@@ -960,7 +965,9 @@
PrintAttributes secondNewAttributes = new PrintAttributes.Builder()
.setMediaSize(MediaSize.ISO_A3)
.setResolution(new Resolution("300x300", "300x300", 300, 300))
- .setMinMargins(Margins.NO_MARGINS).setColorMode(PrintAttributes.COLOR_MODE_COLOR)
+ .setMinMargins(Margins.NO_MARGINS)
+ .setColorMode(PrintAttributes.COLOR_MODE_COLOR)
+ .setDuplexMode(PrintAttributes.DUPLEX_MODE_LONG_EDGE)
.build();
verifyLayoutCall(inOrder, adapter, secondOldAttributes, secondNewAttributes, true);
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicBLAS.java b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicBLAS.java
index f6b3176..eeef6e7 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicBLAS.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicBLAS.java
@@ -22,6 +22,7 @@
public class IntrinsicBLAS extends IntrinsicBase {
private ScriptIntrinsicBLAS mBLAS;
+ private boolean mInitialized = false;
private ArrayList<Allocation> mMatrixS;
private final float alphaS = 1.0f;
@@ -63,35 +64,34 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- mBLAS = ScriptIntrinsicBLAS.create(mRS);
//now populate the test Matrixes and Vectors.
- mMatrixS = new ArrayList<Allocation>();
- mMatrixD = new ArrayList<Allocation>();
- mMatrixC = new ArrayList<Allocation>();
- mMatrixZ = new ArrayList<Allocation>();
- for (int x : mDim) {
- for (int y : mDim) {
- mMatrixS.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F32(mRS), x, y)));
- mMatrixD.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F64(mRS), x, y)));
- mMatrixC.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F32_2(mRS), x, y)));
- mMatrixZ.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F64_2(mRS), x, y)));
+ if (!mInitialized) {
+ mBLAS = ScriptIntrinsicBLAS.create(mRS);
+ mMatrixS = new ArrayList<Allocation>();
+ mMatrixD = new ArrayList<Allocation>();
+ mMatrixC = new ArrayList<Allocation>();
+ mMatrixZ = new ArrayList<Allocation>();
+ for (int x : mDim) {
+ for (int y : mDim) {
+ mMatrixS.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F32(mRS), x, y)));
+ mMatrixD.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F64(mRS), x, y)));
+ mMatrixC.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F32_2(mRS), x, y)));
+ mMatrixZ.add(Allocation.createTyped(mRS, Type.createXY(mRS, Element.F64_2(mRS), x, y)));
+ }
}
+ //also need Allocation with mismatch Element.
+ Allocation misAlloc = Allocation.createTyped(mRS, Type.createXY(mRS, Element.U8(mRS), 1, 1));
+ mMatrixS.add(misAlloc);
+ mMatrixD.add(misAlloc);
+ mMatrixC.add(misAlloc);
+ mMatrixZ.add(misAlloc);
+ mInitialized = true;
}
- //also need Allocation with mismatch Element.
- Allocation misAlloc = Allocation.createTyped(mRS, Type.createXY(mRS, Element.U8(mRS), 1, 1));
- mMatrixS.add(misAlloc);
- mMatrixD.add(misAlloc);
- mMatrixC.add(misAlloc);
- mMatrixZ.add(misAlloc);
}
@Override
protected void tearDown() throws Exception {
- if (mBLAS != null) {
- mBLAS.destroy();
- mBLAS = null;
- }
super.tearDown();
}
@@ -135,6 +135,13 @@
return true;
}
+ private boolean validateVecInput(Allocation X) {
+ if (X.getType().getY() > 2) {
+ //for testing vector, need a mismatch Y for complete test coverage.
+ return false;
+ }
+ return true;
+ }
private boolean validateGEMV(Element e, int TransA, Allocation A, Allocation X, int incX, Allocation Y, int incY) {
if (!validateTranspose(TransA)) {
@@ -172,7 +179,13 @@
private void xGEMV_API_test(int trans, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateGEMV(elemA, trans, matA, vecX, incX, vecY, incY)) {
try {
@@ -218,9 +231,7 @@
public void L2_xGEMV_API(ArrayList<Allocation> mMatrix) {
for (int trans : mTranspose) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xGEMV_API_test(trans, incX, incY, mMatrix);
- }
+ xGEMV_API_test(trans, incX, incX, mMatrix);
}
}
}
@@ -245,7 +256,13 @@
private void xGBMV_API_test(int trans, int KL, int KU, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateGEMV(elemA, trans, matA, vecX, incX, vecY, incY) && KU >= 0 && KL >= 0) {
try {
@@ -291,10 +308,8 @@
public void L2_xGBMV_API(ArrayList<Allocation> mMatrix) {
for (int trans : mTranspose) {
for (int incX : mInc) {
- for (int incY : mInc) {
- for (int K : mK) {
- xGBMV_API_test(trans, K, K, incX, incY, mMatrix);
- }
+ for (int K : mK) {
+ xGBMV_API_test(trans, K, K, incX, incX, mMatrix);
}
}
}
@@ -320,7 +335,13 @@
private void xHEMV_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYR2(elemA, Uplo, vecX, incX, vecY, incY, matA)) {
try {
@@ -352,9 +373,7 @@
public void L2_xHEMV_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xHEMV_API_test(Uplo, incX, incY, mMatrix);
- }
+ xHEMV_API_test(Uplo, incX, incX, mMatrix);
}
}
}
@@ -371,7 +390,13 @@
private void xHBMV_API_test(int Uplo, int K, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYR2(elemA, Uplo, vecX, incX, vecY, incY, matA) && K >= 0) {
try {
@@ -404,9 +429,7 @@
for (int Uplo : mUplo) {
for (int K : mK) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xHBMV_API_test(Uplo, K, incX, incY, mMatrix);
- }
+ xHBMV_API_test(Uplo, K, incX, incX, mMatrix);
}
}
}
@@ -424,7 +447,13 @@
private void xHPMV_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSPR2(elemA, Uplo, vecX, incX, vecY, incY, matA)) {
try {
@@ -456,9 +485,7 @@
public void L2_xHPMV_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xHPMV_API_test(Uplo, incX, incY, mMatrix);
- }
+ xHPMV_API_test(Uplo, incX, incX, mMatrix);
}
}
}
@@ -507,7 +534,13 @@
private void xSYMV_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYMV(elemA, Uplo, matA, vecX, incX, vecY, incY)) {
try {
@@ -539,9 +572,7 @@
public void L2_xSYMV_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xSYMV_API_test(Uplo, incX, incY, mMatrix);
- }
+ xSYMV_API_test(Uplo, incX, incX, mMatrix);
}
}
}
@@ -559,7 +590,13 @@
private void xSBMV_API_test(int Uplo, int K, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYMV(elemA, Uplo, matA, vecX, incX, vecY, incY) && K >= 0) {
try {
@@ -592,9 +629,7 @@
for (int Uplo : mUplo) {
for (int K : mK) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xSBMV_API_test(Uplo, K, incX, incY, mMatrix);
- }
+ xSBMV_API_test(Uplo, K, incX, incX, mMatrix);
}
}
}
@@ -649,7 +684,13 @@
private void xSPMV_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSPMV(elemA, Uplo, matA, vecX, incX, vecY, incY)) {
try {
@@ -681,9 +722,7 @@
public void L2_xSPMV_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xSPMV_API_test(Uplo, incX, incY, mMatrix);
- }
+ xSPMV_API_test(Uplo, incX, incX, mMatrix);
}
}
}
@@ -733,6 +772,9 @@
private void xTRMV_API_test(int Uplo, int TransA, int Diag, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateTRMV(elemA, Uplo, TransA, Diag, matA, vecX, incX)) {
try {
@@ -807,6 +849,9 @@
private void xTBMV_API_test(int Uplo, int TransA, int Diag, int K, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateTRMV(elemA, Uplo, TransA, Diag, matA, vecX, incX) && K >= 0) {
try {
@@ -919,6 +964,9 @@
private void xTPMV_API_test(int Uplo, int TransA, int Diag, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateTPMV(elemA, Uplo, TransA, Diag, matA, vecX, incX)) {
try {
@@ -992,6 +1040,9 @@
private void xTRSV_API_test(int Uplo, int TransA, int Diag, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateTRMV(elemA, Uplo, TransA, Diag, matA, vecX, incX)) {
try {
@@ -1065,6 +1116,9 @@
private void xTBSV_API_test(int Uplo, int TransA, int Diag, int K, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateTRMV(elemA, Uplo, TransA, Diag, matA, vecX, incX) && K >= 0) {
try {
@@ -1140,6 +1194,9 @@
private void xTPSV_API_test(int Uplo, int TransA, int Diag, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateTPMV(elemA, Uplo, TransA, Diag, matA, vecX, incX)) {
try {
@@ -1245,7 +1302,13 @@
private void xGER_API_test(int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateGER(elemA, vecX, incX, vecY, incY, matA)) {
try {
@@ -1321,7 +1384,13 @@
private void xGERU_API_test(int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateGERU(elemA, vecX, incX, vecY, incY, matA)) {
try {
@@ -1370,7 +1439,13 @@
private void xGERC_API_test(int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateGERU(elemA, vecX, incX, vecY, incY, matA)) {
try {
@@ -1420,6 +1495,9 @@
private void xHER_API_test(int Uplo, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYR(elemA, Uplo, vecX, incX, matA)) {
try {
@@ -1467,6 +1545,9 @@
private void xHPR_API_test(int Uplo, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSPR(elemA, Uplo, vecX, incX, matA)) {
try {
@@ -1514,7 +1595,13 @@
private void xHER2_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYR2(elemA, Uplo, vecX, incX, vecY, incY, matA)) {
try {
@@ -1546,9 +1633,7 @@
public void L2_xHER2_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xHER2_API_test(Uplo, incX, incY, mMatrix);
- }
+ xHER2_API_test(Uplo, incX, incX, mMatrix);
}
}
}
@@ -1566,7 +1651,13 @@
private void xHPR2_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSPR2(elemA, Uplo, vecX, incX, vecY, incY, matA)) {
try {
@@ -1598,9 +1689,7 @@
public void L2_xHPR2_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xHPR2_API_test(Uplo, incX, incY, mMatrix);
- }
+ xHPR2_API_test(Uplo, incX, incX, mMatrix);
}
}
}
@@ -1645,6 +1734,9 @@
private void xSYR_API_test(int Uplo, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYR(elemA, Uplo, vecX, incX, matA)) {
try {
@@ -1726,6 +1818,9 @@
private void xSPR_API_test(int Uplo, int incX, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSPR(elemA, Uplo, vecX, incX, matA)) {
try {
@@ -1805,7 +1900,13 @@
private void xSYR2_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSYR2(elemA, Uplo, vecX, incX, vecY, incY, matA)) {
try {
@@ -1837,9 +1938,7 @@
public void L2_xSYR2_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xSYR2_API_test(Uplo, incX, incY, mMatrix);
- }
+ xSYR2_API_test(Uplo, incX, incX, mMatrix);
}
}
}
@@ -1891,7 +1990,13 @@
private void xSPR2_API_test(int Uplo, int incX, int incY, ArrayList<Allocation> mMatrix) {
for (Allocation matA : mMatrix) {
for (Allocation vecX : mMatrix) {
+ if (!validateVecInput(vecX)) {
+ continue;
+ }
for (Allocation vecY : mMatrix) {
+ if (!validateVecInput(vecY)) {
+ continue;
+ }
Element elemA = matA.getType().getElement();
if (validateSPR2(elemA, Uplo, vecX, incX, vecY, incY, matA)) {
try {
@@ -1923,9 +2028,7 @@
public void L2_xSPR2_API(ArrayList<Allocation> mMatrix) {
for (int Uplo : mUplo) {
for (int incX : mInc) {
- for (int incY : mInc) {
- xSPR2_API_test(Uplo, incX, incY, mMatrix);
- }
+ xSPR2_API_test(Uplo, incX, incX, mMatrix);
}
}
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
index 24e56d7..c8b3640 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/IntrinsicResize.java
@@ -24,7 +24,7 @@
static final int inX = 307;
static final int inY = 157;
- private void testReszie(int w, int h, Element.DataType dt, int vecSize, float scaleX, float scaleY) {
+ private void testResize(int w, int h, Element.DataType dt, int vecSize, float scaleX, float scaleY) {
Element e = makeElement(dt, vecSize);
@@ -98,343 +98,343 @@
public void test_U8_4_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
checkError();
}
public void test_U8_3_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
checkError();
}
public void test_U8_2_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
checkError();
}
public void test_U8_1_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
checkError();
}
public void test_U8_4_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
checkError();
}
public void test_U8_3_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
checkError();
}
public void test_U8_2_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
checkError();
}
public void test_U8_1_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
checkError();
}
public void test_U8_4_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
checkError();
}
public void test_U8_3_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
checkError();
}
public void test_U8_2_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
checkError();
}
public void test_U8_1_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
checkError();
}
public void test_U8_4_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
checkError();
}
public void test_U8_3_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
checkError();
}
public void test_U8_2_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
checkError();
}
public void test_U8_1_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
checkError();
}
public void test_U8_4_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
checkError();
}
public void test_U8_3_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
checkError();
}
public void test_U8_2_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
checkError();
}
public void test_U8_1_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
checkError();
}
public void test_U8_4_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
checkError();
}
public void test_U8_3_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
checkError();
}
public void test_U8_2_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
checkError();
}
public void test_U8_1_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
checkError();
}
public void test_U8_4_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
checkError();
}
public void test_U8_3_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
checkError();
}
public void test_U8_2_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
checkError();
}
public void test_U8_1_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
checkError();
}
public void test_U8_4_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
checkError();
}
public void test_U8_3_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
checkError();
}
public void test_U8_2_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
checkError();
}
public void test_U8_1_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
checkError();
}
public void test_U8_4_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
checkError();
}
public void test_U8_3_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
checkError();
}
public void test_U8_2_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
checkError();
}
public void test_U8_1_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
checkError();
}
public void test_U8_4_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
checkError();
}
public void test_U8_3_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
checkError();
}
public void test_U8_2_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
checkError();
}
public void test_U8_1_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
checkError();
}
public void test_F32_4_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
checkError();
}
public void test_F32_3_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
checkError();
}
public void test_F32_2_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
checkError();
}
public void test_F32_1_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
checkError();
}
public void test_F32_4_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
checkError();
}
public void test_F32_3_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
checkError();
}
public void test_F32_2_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
checkError();
}
public void test_F32_1_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
checkError();
}
public void test_F32_4_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
checkError();
}
public void test_F32_3_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
checkError();
}
public void test_F32_2_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
checkError();
}
public void test_F32_1_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
checkError();
}
public void test_F32_4_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
checkError();
}
public void test_F32_3_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
checkError();
}
public void test_F32_2_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
checkError();
}
public void test_F32_1_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
checkError();
}
public void test_F32_4_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
checkError();
}
public void test_F32_3_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
checkError();
}
public void test_F32_2_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
checkError();
}
public void test_F32_1_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
checkError();
}
public void test_F32_4_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
checkError();
}
public void test_F32_3_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
checkError();
}
public void test_F32_2_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
checkError();
}
public void test_F32_1_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
checkError();
}
public void test_F32_4_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
checkError();
}
public void test_F32_3_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
checkError();
}
public void test_F32_2_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
checkError();
}
public void test_F32_1_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
checkError();
}
public void test_F32_4_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
checkError();
}
public void test_F32_3_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
checkError();
}
public void test_F32_2_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
checkError();
}
public void test_F32_1_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
checkError();
}
public void test_F32_4_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
checkError();
}
public void test_F32_3_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
checkError();
}
public void test_F32_2_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
checkError();
}
public void test_F32_1_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
checkError();
}
public void test_F32_4_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
checkError();
}
public void test_F32_3_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
checkError();
}
public void test_F32_2_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
checkError();
}
public void test_F32_1_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
checkError();
}
diff --git a/tests/tests/rscpp/src/android/cts/rscpp/RSResizeTest.java b/tests/tests/rscpp/src/android/cts/rscpp/RSResizeTest.java
index b4864b5..51ae26e 100644
--- a/tests/tests/rscpp/src/android/cts/rscpp/RSResizeTest.java
+++ b/tests/tests/rscpp/src/android/cts/rscpp/RSResizeTest.java
@@ -34,7 +34,7 @@
native boolean resizeTest(String path, int w, int h, float scaleX, float scaleY,
boolean useByte, int vecSize, byte[] inB, byte[] outB,
float[] inF, float[] outF);
- private void testReszie(int w, int h, Element.DataType dt, int vecSize, float scaleX, float scaleY) {
+ private void testResize(int w, int h, Element.DataType dt, int vecSize, float scaleX, float scaleY) {
boolean useByte = false;
if (dt == Element.DataType.UNSIGNED_8) {
@@ -91,263 +91,263 @@
}
public void test_U8_4_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
}
public void test_U8_3_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
}
public void test_U8_2_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
}
public void test_U8_1_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
}
public void test_U8_4_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
}
public void test_U8_3_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
}
public void test_U8_2_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
}
public void test_U8_1_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
}
public void test_U8_4_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
}
public void test_U8_3_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
}
public void test_U8_2_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
}
public void test_U8_1_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
}
public void test_U8_4_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
}
public void test_U8_3_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
}
public void test_U8_2_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
}
public void test_U8_1_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
}
public void test_U8_4_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
}
public void test_U8_3_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
}
public void test_U8_2_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
}
public void test_U8_1_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
}
public void test_U8_4_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 1.f, 1.f);
}
public void test_U8_3_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 1.f, 1.f);
}
public void test_U8_2_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 1.f, 1.f);
}
public void test_U8_1_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 1.f, 1.f);
}
public void test_U8_4_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 2.f);
}
public void test_U8_3_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 2.f);
}
public void test_U8_2_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 2.f);
}
public void test_U8_1_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 2.f);
}
public void test_U8_4_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 2.f);
}
public void test_U8_3_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 2.f);
}
public void test_U8_2_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 2.f);
}
public void test_U8_1_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 2.f);
}
public void test_U8_4_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 2.f, 0.5f);
}
public void test_U8_3_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 2.f, 0.5f);
}
public void test_U8_2_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 2.f, 0.5f);
}
public void test_U8_1_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 2.f, 0.5f);
}
public void test_U8_4_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 4, 0.5f, 0.5f);
}
public void test_U8_3_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 3, 0.5f, 0.5f);
}
public void test_U8_2_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 2, 0.5f, 0.5f);
}
public void test_U8_1_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.UNSIGNED_8, 1, 0.5f, 0.5f);
}
public void test_F32_4_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
}
public void test_F32_3_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
}
public void test_F32_2_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
}
public void test_F32_1_SCALE10_10_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
}
public void test_F32_4_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
}
public void test_F32_3_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
}
public void test_F32_2_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
}
public void test_F32_1_SCALE20_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
}
public void test_F32_4_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
}
public void test_F32_3_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
}
public void test_F32_2_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
}
public void test_F32_1_SCALE05_20_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
}
public void test_F32_4_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
}
public void test_F32_3_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
}
public void test_F32_2_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
}
public void test_F32_1_SCALE20_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
}
public void test_F32_4_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
}
public void test_F32_3_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
}
public void test_F32_2_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
}
public void test_F32_1_SCALE05_05_inSqure() {
- testReszie(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
+ testResize(inX, inX, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
}
public void test_F32_4_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 1.f, 1.f);
}
public void test_F32_3_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 1.f, 1.f);
}
public void test_F32_2_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 1.f, 1.f);
}
public void test_F32_1_SCALE10_10_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 1.f, 1.f);
}
public void test_F32_4_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 2.f);
}
public void test_F32_3_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 2.f);
}
public void test_F32_2_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 2.f);
}
public void test_F32_1_SCALE20_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 2.f);
}
public void test_F32_4_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 2.f);
}
public void test_F32_3_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 2.f);
}
public void test_F32_2_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 2.f);
}
public void test_F32_1_SCALE05_20_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 2.f);
}
public void test_F32_4_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 2.f, 0.5f);
}
public void test_F32_3_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 2.f, 0.5f);
}
public void test_F32_2_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 2.f, 0.5f);
}
public void test_F32_1_SCALE20_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 2.f, 0.5f);
}
public void test_F32_4_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 4, 0.5f, 0.5f);
}
public void test_F32_3_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 3, 0.5f, 0.5f);
}
public void test_F32_2_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 2, 0.5f, 0.5f);
}
public void test_F32_1_SCALE05_05_inRectangle() {
- testReszie(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
+ testResize(inX, inY, Element.DataType.FLOAT_32, 1, 0.5f, 0.5f);
}
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
index 4dcca0d..81006c1 100644
--- a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
@@ -345,7 +345,7 @@
// exercising the underlying PhoneNumberUtil or constraining localization changes.
Spannable spannable = new SpannableString("Hello 6502223333");
// Execute
- PhoneNumberUtils.addPhoneTtsSpan(spannable, 5, spannable.length() - 1);
+ PhoneNumberUtils.addPhoneTtsSpan(spannable, 5, spannable.length());
// Verify: the Spannable is annotated with a TtsSpan in the correct location.
TtsSpan[] ttsSpans = spannable.getSpans(5, spannable.length() - 1, TtsSpan.class);
assertEquals(1, ttsSpans.length);
diff --git a/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java b/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
index c14bb03..706ad8d 100644
--- a/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
@@ -189,8 +189,7 @@
public void testAccessHeight() {
mPopupWindow = new PopupWindow(mActivity);
- // default is 0
- assertEquals(0, mPopupWindow.getHeight());
+ assertEquals(WindowManager.LayoutParams.WRAP_CONTENT, mPopupWindow.getHeight());
int height = getDisplay().getHeight() / 2;
mPopupWindow.setHeight(height);
@@ -224,7 +223,7 @@
public void testAccessWidth() {
mPopupWindow = new PopupWindow(mActivity);
- assertEquals(0, mPopupWindow.getWidth());
+ assertEquals(WindowManager.LayoutParams.WRAP_CONTENT, mPopupWindow.getWidth());
int width = getDisplay().getWidth() / 2;
mPopupWindow.setWidth(width);
@@ -418,7 +417,7 @@
mPopupWindow.setOutsideTouchable(true);
WindowManager.LayoutParams p = (WindowManager.LayoutParams)
- mPopupWindow.getContentView().getLayoutParams();
+ mPopupWindow.getContentView().getRootView().getLayoutParams();
assertEquals(0, WindowManager.LayoutParams.FLAG_IGNORE_CHEEK_PRESSES & p.flags);
assertEquals(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
@@ -748,7 +747,7 @@
mPopupWindow = new PopupWindow(new TextView(mActivity));
showPopup();
- ViewGroup.LayoutParams p = mPopupWindow.getContentView().getLayoutParams();
+ ViewGroup.LayoutParams p = mPopupWindow.getContentView().getRootView().getLayoutParams();
assertEquals(0, p.width);
assertEquals(0, p.height);