summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-prod (mdb) <android-build-team-robot@google.com>2019-02-22 00:13:09 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-02-22 00:13:09 +0000
commit15cd835391403d0d52b3cd1774e6a718fceca103 (patch)
tree9fec4bb742b5f414e7b7ade9581a9d750cfb53fb
parenta1b3e828d8d081ec4ebb0217160486066ea2abaf (diff)
parent38af141e57b7456e6c581752ae45e2163f11a0a5 (diff)
downloadcts-sparse-5328310-L88100000275585315.tar.gz
Merge "Snap for 5327547 from a8619c3dd3773c592894e5ab22d49c30477c7c03 to oreo-mr1-cts-release" into oreo-mr1-cts-releasesparse-5328310-L88100000275585315
-rw-r--r--apps/CtsVerifier/AndroidManifest.xml2
-rw-r--r--apps/CtsVerifier/res/layout-small-dpad/widget_layout.xml97
-rw-r--r--apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java3
-rw-r--r--hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java41
-rw-r--r--hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java27
-rw-r--r--hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java4
-rw-r--r--tests/app/src/android/app/cts/SystemFeaturesTest.java8
-rw-r--r--tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java4
-rw-r--r--tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java3
-rw-r--r--tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java3
-rw-r--r--tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java3
-rw-r--r--tests/autofillservice/src/android/autofillservice/cts/UiBot.java25
-rw-r--r--tests/tests/systemui/Android.mk3
-rw-r--r--tests/tests/systemui/src/android/systemui/cts/LightBarTests.java4
-rw-r--r--tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java3
-rw-r--r--tests/tests/transition/res/layout/scene1.xml8
-rw-r--r--tests/tests/transition/res/layout/scene10.xml16
-rw-r--r--tests/tests/transition/res/layout/scene11.xml4
-rw-r--r--tests/tests/transition/res/layout/scene12.xml16
-rw-r--r--tests/tests/transition/res/layout/scene13.xml20
-rw-r--r--tests/tests/transition/res/layout/scene14.xml29
-rw-r--r--tests/tests/transition/res/layout/scene2.xml8
-rw-r--r--tests/tests/transition/res/layout/scene3.xml8
-rw-r--r--tests/tests/transition/res/layout/scene6.xml8
-rw-r--r--tests/tests/transition/res/layout/scene7.xml4
-rw-r--r--tests/tests/transition/res/layout/scene8.xml8
-rw-r--r--tests/tests/transition/res/layout/scene9.xml2
-rw-r--r--tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java23
-rw-r--r--tests/tests/transition/src/android/transition/cts/TransitionTest.java2
-rw-r--r--tests/tests/view/res/values-ldpi/dimens.xml20
-rw-r--r--tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java2
-rw-r--r--tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java2
-rw-r--r--tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java58
-rw-r--r--tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java23
-rw-r--r--tools/cts-tradefed/Android.mk2
35 files changed, 379 insertions, 114 deletions
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 68e4df0bf9f..abc1f09610a 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,7 +18,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.cts.verifier"
android:versionCode="5"
- android:versionName="8.1_r13">
+ android:versionName="8.1_r14">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="27"/>
diff --git a/apps/CtsVerifier/res/layout-small-dpad/widget_layout.xml b/apps/CtsVerifier/res/layout-small-dpad/widget_layout.xml
new file mode 100644
index 00000000000..518be889de0
--- /dev/null
+++ b/apps/CtsVerifier/res/layout-small-dpad/widget_layout.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="@dimen/widget_margin_top"
+ android:layout_marginBottom="@dimen/widget_margin_bottom"
+ android:layout_marginLeft="@dimen/widget_margin_left"
+ android:layout_marginRight="@dimen/widget_margin_right"
+ android:padding="1dp"
+ android:background="#fff">
+
+ <LinearLayout
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingLeft="4dp"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
+ android:paddingRight="4dp"
+ android:layout_gravity="center"
+ android:background="#fff">
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="top|left"
+ android:layout_marginBottom="8dp"
+ android:fontFamily="sans-serif"
+ android:textSize="16sp"
+ android:text="@string/widget_name"
+ android:freezesText="true"/>
+
+ <TextView
+ android:id="@+id/instruction"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:fontFamily="sans-serif-light"
+ android:textSize="14sp"
+ android:freezesText="true"/>
+
+ <TextView
+ android:id="@+id/data"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginBottom="12dp"
+ android:layout_gravity="center_horizontal"
+ android:fontFamily="sans-serif-light"
+ android:textSize="14sp"/>
+
+ <ListView
+ android:id="@+id/list"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:layout_marginBottom="12dp"
+ android:padding="1dp"
+ android:background="#fff"
+ android:visibility="gone"/>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom|center_horizontal"
+ android:orientation="horizontal">
+ <Button
+ android:id="@+id/fail"
+ android:layout_marginRight="8dp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="100dp"
+ android:text="@string/widget_fail" />
+ <Button
+ android:id="@+id/pass"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:minWidth="100dp"
+ android:text="@string/widget_pass" />
+ </LinearLayout>
+
+ </LinearLayout>
+</FrameLayout>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
index b8529b7bee2..bd9ebdaff69 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
@@ -327,7 +327,8 @@ public class ItsService extends Service implements SensorEventListener {
// Initialize memory quota on this device
for (String camId : devices) {
CameraCharacteristics chars = mCameraManager.getCameraCharacteristics(camId);
- Size maxYuvSize = ItsUtils.getYuvOutputSizes(chars)[0];
+ Size maxYuvSize = ItsUtils.getMaxOutputSize(
+ chars, ImageFormat.YUV_420_888);
// 4 bytes per pixel for RGBA8888 Bitmap and at least 3 Bitmaps per CDD
int quota = maxYuvSize.getWidth() * maxYuvSize.getHeight() * 4 * 3;
if (quota > mMemoryQuota) {
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
index ce799228248..780a90c4ba4 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
@@ -20,6 +20,7 @@ import static junit.framework.Assert.assertTrue;
import android.app.ActivityManager;
import android.app.admin.DevicePolicyManager;
+import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -30,6 +31,7 @@ import android.support.test.uiautomator.UiDevice;
import android.util.Log;
import org.junit.Before;
+import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,6 +47,7 @@ public class LockTaskHostDrivenTest {
private static final String TAG = LockTaskHostDrivenTest.class.getName();
+ private static final int ACTIVITY_RESUMED_TIMEOUT_MILLIS = 20000; // 20 seconds
private static final String PACKAGE_NAME = LockTaskHostDrivenTest.class.getPackage().getName();
private static final ComponentName ADMIN_COMPONENT =
new ComponentName(PACKAGE_NAME, BaseDeviceOwnerTest.BasicAdminReceiver.class.getName());
@@ -57,14 +60,45 @@ public class LockTaskHostDrivenTest {
private ActivityManager mActivityManager;
private DevicePolicyManager mDevicePolicyManager;
+ private volatile boolean mIsActivityResumed;
+ private final Object mActivityResumedLock = new Object();
+
+ private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ String action = intent.getAction();
+ Log.d(TAG, "onReceive: " + action);
+ if (LockTaskUtilityActivity.RESUME_ACTION.equals(action)) {
+ synchronized (mActivityResumedLock) {
+ mIsActivityResumed = true;
+ mActivityResumedLock.notify();
+ }
+ } else if (LockTaskUtilityActivity.PAUSE_ACTION.equals(action)) {
+ synchronized (mActivityResumedLock) {
+ mIsActivityResumed = false;
+ mActivityResumedLock.notify();
+ }
+ }
+ }
+ };
+
@Before
public void setUp() {
mContext = InstrumentationRegistry.getContext();
mDevicePolicyManager = mContext.getSystemService(DevicePolicyManager.class);
mActivityManager = mContext.getSystemService(ActivityManager.class);
mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+ IntentFilter filter = new IntentFilter();
+ filter.addAction(LockTaskUtilityActivity.RESUME_ACTION);
+ filter.addAction(LockTaskUtilityActivity.PAUSE_ACTION);
+ mContext.registerReceiver(mReceiver, filter);
}
+ @After
+ public void tearDown() {
+ mContext.unregisterReceiver(mReceiver);
+ }
+
@Test
public void startLockTask() throws Exception {
Log.d(TAG, "startLockTask on host-driven test (no cleanup)");
@@ -77,6 +111,13 @@ public class LockTaskHostDrivenTest {
public void testLockTaskIsActiveAndCantBeInterrupted() throws Exception {
mUiDevice.waitForIdle();
+ // We need to wait until the LockTaskActivity is ready
+ // since com.android.cts.deviceowner can be killed by AMS for reason "start instr".
+ synchronized (mActivityResumedLock) {
+ if (!mIsActivityResumed) {
+ mActivityResumedLock.wait(ACTIVITY_RESUMED_TIMEOUT_MILLIS);
+ }
+ }
checkLockedActivityIsRunning();
mUiDevice.pressBack();
diff --git a/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java b/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java
index c8981c5019d..129d4129874 100644
--- a/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java
+++ b/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java
@@ -102,8 +102,33 @@ public class StoragedDumpsysTest extends BaseDumpsysTest {
}
if (parts[0].equals(DEVICE_SIDE_TEST_PACKAGE)) {
- assertTrue((Integer.parseInt(parts[6]) >= 4096 && Integer.parseInt(parts[8]) >= 4096) ||
+ /*
+ * order of parts in StoragedService::dumpUidRecords
+ * [0] DEVICE_SIDE_TEST_PACKAGE
+ * [1] read foreground charger_off
+ * [2] write foreground charger_off
+ * [3] read background charger_off
+ * [4] write background charger_off
+ * [5] read foreground charger_on
+ * [6] write foreground charger_on
+ * [7] read background charger_on
+ * [8] write background charger_on
+ */
+ if ((Integer.parseInt(parts[6]) >= 8192 && Integer.parseInt(parts[8]) == 0) ||
+ (Integer.parseInt(parts[2]) >= 8192 && Integer.parseInt(parts[4]) == 0)) {
+ System.out.print("WARNING: Background I/O was attributed to the "
+ + "foreground. This could indicate a broken or malfunctioning "
+ + "ActivityManager or UsageStatsService.\n");
+ } else if ((Integer.parseInt(parts[2]) >= 4096 && Integer.parseInt(parts[4]) >= 4096) ||
+ Integer.parseInt(parts[4]) >= 8192) {
+ System.out.print("WARNING: charger on I/O was attributed to "
+ + "charger off. This could indicate a broken or malfunctioning "
+ + "ADB USB connection, or device that refuses to charge at the "
+ + "typical 500mA because it is less than 0.05C.\n");
+ } else {
+ assertTrue((Integer.parseInt(parts[6]) >= 4096 && Integer.parseInt(parts[8]) >= 4096) ||
Integer.parseInt(parts[8]) >= 8192);
+ }
hasTestIO = true;
}
}
diff --git a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
index 05e0d953d57..169e651b758 100644
--- a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
+++ b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
@@ -44,6 +44,8 @@ import java.util.regex.Pattern;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
+import com.android.compatibility.common.util.CddTest;
+
/**
* Test to check non-modifiable themes have not been changed.
*/
@@ -141,7 +143,7 @@ public class ThemeHostTest extends DeviceTestCase {
super.tearDown();
}
-
+ @CddTest(requirement="3.8.6/C-1-1,C-1-2")
public void testThemes() throws Exception {
if (checkHardwareTypeSkipTest(mDevice.executeShellCommand(HARDWARE_TYPE_CMD).trim())) {
Log.logAndDisplay(LogLevel.INFO, LOG_TAG, "Skipped themes test for watch / TV");
diff --git a/tests/app/src/android/app/cts/SystemFeaturesTest.java b/tests/app/src/android/app/cts/SystemFeaturesTest.java
index 1a7a66dd39f..f75342dc5cf 100644
--- a/tests/app/src/android/app/cts/SystemFeaturesTest.java
+++ b/tests/app/src/android/app/cts/SystemFeaturesTest.java
@@ -486,14 +486,12 @@ public class SystemFeaturesTest extends InstrumentationTestCase {
@CddTest(requirement="7.7.2/C-2-1")
public void testUsbAccessory() {
- // USB accessory mode is only a requirement for devices with USB ports supporting
- // peripheral mode. As there is no public API to distinguish a device with only host
- // mode support from having both peripheral and host support, the test may have
- // false negatives.
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) &&
!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEVISION) &&
!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH) &&
- !mPackageManager.hasSystemFeature(PackageManager.FEATURE_EMBEDDED)) {
+ !mPackageManager.hasSystemFeature(PackageManager.FEATURE_EMBEDDED) &&
+ mPackageManager.hasSystemFeature(PackageManager.FEATURE_MICROPHONE) &&
+ mPackageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)) {
// USB accessory mode is only a requirement for devices with USB ports supporting
// peripheral mode. As there is no public API to distinguish a device with only host
// mode support from having both peripheral and host support, the test may have
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
index e74e75a7dc9..4453a0e7c20 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
@@ -17,6 +17,8 @@ package android.autofillservice.cts;
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeTrue;
+
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Intent;
@@ -62,6 +64,8 @@ abstract class CustomDescriptionWithLinkTestCase extends AutoFillServiceTestCase
*/
@Test
public final void testTapLink_changeOrientationThenTapBack() throws Exception {
+ assumeTrue("Screen rotation not supported", sUiBot.isScreenRotationSupported());
+
sUiBot.setScreenResolution();
sUiBot.setScreenOrientation(UiBot.PORTRAIT);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
index 0e59e2f19f4..8eea0959d8f 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
@@ -24,6 +24,8 @@ import static android.autofillservice.cts.InstrumentedAutoFillService.waitUntilD
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeTrue;
+
import android.app.assist.AssistStructure;
import android.util.Log;
import android.view.autofill.AutofillId;
@@ -79,6 +81,7 @@ public class DuplicateIdActivityTest extends AutoFillServiceTestCase {
@Test
public void testDoNotRestoreDuplicateAutofillIds() throws Exception {
+ assumeTrue("Screen rotation not supported", sUiBot.isScreenRotationSupported());
enableService();
sReplier.addResponse(new CannedFillResponse.Builder()
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
index abf5c6a7a64..f092ad94fee 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
@@ -34,6 +34,8 @@ import static android.service.autofill.SaveInfo.SAVE_DATA_TYPE_PASSWORD;
import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertWithMessage;
+import static org.junit.Assume.assumeTrue;
+
import android.app.PendingIntent;
import android.app.assist.AssistStructure;
import android.content.Intent;
@@ -108,6 +110,7 @@ public class SessionLifecycleTest extends AutoFillServiceTestCase {
@Test
public void testDatasetAuthResponseWhileAutofilledAppIsLifecycled() throws Exception {
+ assumeTrue("Screen rotation not supported", sUiBot.isScreenRotationSupported());
// Set service.
enableService();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java
index 24b5e4c60a3..4abccc9b777 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SimpleSaveActivityTest.java
@@ -28,6 +28,8 @@ import static android.service.autofill.SaveInfo.SAVE_DATA_TYPE_PASSWORD;
import static com.google.common.truth.Truth.assertWithMessage;
+import static org.junit.Assume.assumeTrue;
+
import android.autofillservice.cts.CannedFillResponse.CannedDataset;
import android.autofillservice.cts.InstrumentedAutoFillService.SaveRequest;
import android.autofillservice.cts.SimpleSaveActivity.FillExpectation;
@@ -168,6 +170,7 @@ public class SimpleSaveActivityTest extends CustomDescriptionWithLinkTestCase {
@Test
public void testSave_afterRotation() throws Exception {
+ assumeTrue("Screen rotation not supported", sUiBot.isScreenRotationSupported());
sUiBot.setScreenOrientation(UiBot.PORTRAIT);
try {
saveTest(true);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/UiBot.java b/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
index ae8833f7676..f54f8759d0c 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
@@ -79,6 +79,9 @@ final class UiBot {
"autofill_picker_accessibility_title";
private static final String RESOURCE_STRING_SAVE_SNACKBAR_ACCESSIBILITY_TITLE =
"autofill_save_accessibility_title";
+ private static final String RESOURCE_BOOLEAN_CONFIG_FORCE_DEFAULT_ORIENTATION =
+ "config_forceDefaultOrientation";
+
private static final String TAG = "AutoFillCtsUiBot";
@@ -717,4 +720,24 @@ final class UiBot {
runShellCommand("wm density reset");
runShellCommand("wm size reset");
}
-}
+
+ private boolean getBoolean(String id) {
+ final Resources resources = mContext.getResources();
+ final int booleanId = resources.getIdentifier(id, "bool", "android");
+ return resources.getBoolean(booleanId);
+ }
+
+ /**
+ * Returns {@code true} if display rotation is supported, {@code false} otherwise.
+ */
+ public boolean isScreenRotationSupported() {
+ try {
+ return !getBoolean(RESOURCE_BOOLEAN_CONFIG_FORCE_DEFAULT_ORIENTATION);
+ } catch (Resources.NotFoundException e) {
+ Log.d(TAG, "Resource not found: "
+ + RESOURCE_BOOLEAN_CONFIG_FORCE_DEFAULT_ORIENTATION
+ + ". Assume rotation supported");
+ return true;
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/tests/systemui/Android.mk b/tests/tests/systemui/Android.mk
index 6ba1e77c05f..b096ced89ca 100644
--- a/tests/tests/systemui/Android.mk
+++ b/tests/tests/systemui/Android.mk
@@ -30,7 +30,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
ctstestrunner \
android-support-test \
legacy-android-test \
- ub-uiautomator
+ ub-uiautomator \
+ compatibility-device-util
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
index dfce5515c11..4ca087323a9 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
@@ -39,6 +39,8 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import com.android.compatibility.common.util.CddTest;
+
/**
* Test for light status bar.
*
@@ -56,7 +58,6 @@ public class LightBarTests extends LightBarTestBase {
* margin to accommodate for that when comparing colors.
*/
private static final int COLOR_COMPONENT_ERROR_MARGIN = 20;
-
private final String NOTIFICATION_TAG = "TEST_TAG";
private final String NOTIFICATION_CHANNEL_ID = "test_channel";
private final String NOTIFICATION_GROUP_KEY = "test_group";
@@ -66,6 +67,7 @@ public class LightBarTests extends LightBarTestBase {
public ActivityTestRule<LightBarActivity> mActivityRule = new ActivityTestRule<>(
LightBarActivity.class);
+ @CddTest(requirement="3.8.6/C-2-2")
@Test
public void testLightStatusBarIcons() throws Throwable {
assumeHasColoredStatusBar(mActivityRule);
diff --git a/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java b/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
index b15a4e8801f..dad1bc65f0a 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
@@ -89,7 +89,8 @@ public class SimRestrictedApisTest extends AndroidTestCase {
public void testIccOpenLogicalChannel() {
try {
if (isSimCardPresent()) {
- TelephonyManager.getDefault().iccOpenLogicalChannel("");
+ TelephonyManager.getDefault().iccCloseLogicalChannel(
+ TelephonyManager.getDefault().iccOpenLogicalChannel("").getChannel());
fail("Expected SecurityException. App doesn't have carrier privileges.");
}
} catch (SecurityException expected) {
diff --git a/tests/tests/transition/res/layout/scene1.xml b/tests/tests/transition/res/layout/scene1.xml
index 140bb8d935b..35e45bb296b 100644
--- a/tests/tests/transition/res/layout/scene1.xml
+++ b/tests/tests/transition/res/layout/scene1.xml
@@ -19,13 +19,13 @@
android:layout_height="match_parent"
android:transitionName="holder"
android:id="@+id/holder">
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#F00"
android:transitionName="red"
android:id="@+id/redSquare" />
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:transitionName="green"
android:id="@+id/greenSquare"
diff --git a/tests/tests/transition/res/layout/scene10.xml b/tests/tests/transition/res/layout/scene10.xml
index 5403354190f..2fc90015781 100644
--- a/tests/tests/transition/res/layout/scene10.xml
+++ b/tests/tests/transition/res/layout/scene10.xml
@@ -22,29 +22,29 @@
android:transitionName="holder"
android:id="@+id/holder">
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#F00"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:id="@+id/redSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/greenSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#00F"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:id="@+id/blueSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#FF0"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
diff --git a/tests/tests/transition/res/layout/scene11.xml b/tests/tests/transition/res/layout/scene11.xml
index dc6ef1969e2..3c90df9fdc9 100644
--- a/tests/tests/transition/res/layout/scene11.xml
+++ b/tests/tests/transition/res/layout/scene11.xml
@@ -23,6 +23,6 @@
<ImageView
android:id="@+id/redSquare"
android:src="#F00"
- android:layout_width="10dp"
- android:layout_height="10dp"/>
+ android:layout_width="30dp"
+ android:layout_height="30dp"/>
</RelativeLayout>
diff --git a/tests/tests/transition/res/layout/scene12.xml b/tests/tests/transition/res/layout/scene12.xml
index 559ab39afe4..239901e62c7 100644
--- a/tests/tests/transition/res/layout/scene12.xml
+++ b/tests/tests/transition/res/layout/scene12.xml
@@ -23,23 +23,23 @@
android:orientation="horizontal"
android:id="@+id/holder">
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#F00"
android:id="@+id/redSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:id="@+id/greenSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#00F"
android:id="@+id/blueSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#FF0"
android:id="@+id/yellowSquare"/>
</LinearLayout>
diff --git a/tests/tests/transition/res/layout/scene13.xml b/tests/tests/transition/res/layout/scene13.xml
index e6a4cafdddc..c7c05759c9b 100644
--- a/tests/tests/transition/res/layout/scene13.xml
+++ b/tests/tests/transition/res/layout/scene13.xml
@@ -22,34 +22,34 @@
android:transitionName="holder"
android:id="@+id/holder">
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#F00"
android:layout_centerInParent="true"
android:transitionName="redSquare"
android:id="@+id/redSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#000"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:id="@+id/blackSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:layout_toRightOf="@id/blackSquare"
android:id="@+id/greenSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#00F"
android:layout_toRightOf="@id/greenSquare"
android:id="@+id/blueSquare"/>
<View
- android:layout_width="10dp"
- android:layout_height="10dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#FF0"
android:layout_toRightOf="@id/blueSquare"
android:id="@+id/yellowSquare"/>
diff --git a/tests/tests/transition/res/layout/scene14.xml b/tests/tests/transition/res/layout/scene14.xml
new file mode 100644
index 00000000000..2ccf8bbc0ed
--- /dev/null
+++ b/tests/tests/transition/res/layout/scene14.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:transitionName="holder"
+ android:id="@+id/holder">
+ <ImageView
+ android:id="@+id/redSquare"
+ android:src="#F00"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
+ android:visibility="gone"/>
+</RelativeLayout>
diff --git a/tests/tests/transition/res/layout/scene2.xml b/tests/tests/transition/res/layout/scene2.xml
index 541ec044abc..9e928018d2b 100644
--- a/tests/tests/transition/res/layout/scene2.xml
+++ b/tests/tests/transition/res/layout/scene2.xml
@@ -19,13 +19,13 @@
android:layout_height="match_parent"
android:transitionName="holder"
android:id="@+id/holder">
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:transitionName="green"
android:id="@+id/greenSquare" />
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#F00"
android:transitionName="red"
android:id="@+id/redSquare"
diff --git a/tests/tests/transition/res/layout/scene3.xml b/tests/tests/transition/res/layout/scene3.xml
index 01fb78d783f..08c98a3cc49 100644
--- a/tests/tests/transition/res/layout/scene3.xml
+++ b/tests/tests/transition/res/layout/scene3.xml
@@ -18,12 +18,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/holder">
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:id="@+id/greenSquare" />
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#F00"
android:id="@+id/redSquare"
android:layout_toRightOf="@+id/greenSquare" />
diff --git a/tests/tests/transition/res/layout/scene6.xml b/tests/tests/transition/res/layout/scene6.xml
index 8cffee5c766..e3a010bfc0e 100644
--- a/tests/tests/transition/res/layout/scene6.xml
+++ b/tests/tests/transition/res/layout/scene6.xml
@@ -19,13 +19,13 @@
android:layout_height="match_parent"
android:transitionName="holder"
android:id="@+id/holder">
- <View android:layout_width="30dp"
- android:layout_height="30dp"
+ <View android:layout_width="50dp"
+ android:layout_height="50dp"
android:background="#0F0"
android:transitionName="green"
android:id="@+id/greenSquare" />
- <View android:layout_width="30dp"
- android:layout_height="30dp"
+ <View android:layout_width="50dp"
+ android:layout_height="50dp"
android:background="#F00"
android:transitionName="red"
android:id="@+id/redSquare"
diff --git a/tests/tests/transition/res/layout/scene7.xml b/tests/tests/transition/res/layout/scene7.xml
index 72c74e861ff..d91b959d2bb 100644
--- a/tests/tests/transition/res/layout/scene7.xml
+++ b/tests/tests/transition/res/layout/scene7.xml
@@ -19,8 +19,8 @@
android:layout_height="match_parent"
android:transitionName="holder"
android:id="@+id/holder">
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:transitionName="green"
android:id="@+id/greenSquare" />
diff --git a/tests/tests/transition/res/layout/scene8.xml b/tests/tests/transition/res/layout/scene8.xml
index 69674ee777f..5b5c5747c1e 100644
--- a/tests/tests/transition/res/layout/scene8.xml
+++ b/tests/tests/transition/res/layout/scene8.xml
@@ -19,13 +19,13 @@
android:layout_height="match_parent"
android:transitionName="holder"
android:id="@+id/holder">
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#F00"
android:transitionName="red"
android:id="@+id/greenSquare" />
- <View android:layout_width="10dp"
- android:layout_height="10dp"
+ <View android:layout_width="30dp"
+ android:layout_height="30dp"
android:background="#0F0"
android:transitionName="green"
android:id="@+id/redSquare"
diff --git a/tests/tests/transition/res/layout/scene9.xml b/tests/tests/transition/res/layout/scene9.xml
index 2eb3762fc16..66e1be39d9b 100644
--- a/tests/tests/transition/res/layout/scene9.xml
+++ b/tests/tests/transition/res/layout/scene9.xml
@@ -20,7 +20,7 @@
android:transitionName="holder"
android:id="@+id/holder">
<FrameLayout
- android:layout_marginTop="50dp"
+ android:layout_marginTop="70dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java b/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
index d11051ff131..397b010ad87 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
@@ -43,8 +43,8 @@ import org.junit.runner.RunWith;
@MediumTest
@RunWith(AndroidJUnit4.class)
public class ChangeBoundsTest extends BaseTransitionTest {
- private static final int SMALL_SQUARE_SIZE_DP = 10;
- private static final int LARGE_SQUARE_SIZE_DP = 30;
+ private static final int SMALL_SQUARE_SIZE_DP = 30;
+ private static final int LARGE_SQUARE_SIZE_DP = 50;
private static final int SMALL_OFFSET_DP = 2;
ChangeBounds mChangeBounds;
@@ -325,21 +325,27 @@ public class ChangeBoundsTest extends BaseTransitionTest {
width = view.getWidth();
height = view.getHeight();
}
- validateDim(name, "width", dimensions.x, width);
- validateDim(name, "height", dimensions.y, height);
- dimensions.set(width, height);
+ int newWidth = validateDim(name, "width", dimensions.x, width);
+ int newHeight = validateDim(name, "height", dimensions.y, height);
+ dimensions.set(newWidth, newHeight);
}
- private void validateDim(String name, String dimen, int lastDim, int newDim) {
+ private int validateDim(String name, String dimen, int lastDim, int newDim) {
+ int dim = newDim;
if (lastDim != -1) {
+ // We must give a pixel's buffer because the top-left and
+ // bottom-right may move independently, causing a rounding error
+ // in size change.
if (mGrow) {
assertTrue(name + " new " + dimen + " " + newDim
+ " is less than previous " + lastDim,
- newDim >= lastDim);
+ newDim >= lastDim - 1);
+ dim = Math.max(lastDim, newDim);
} else {
assertTrue(name + " new " + dimen + " " + newDim
+ " is more than previous " + lastDim,
- newDim <= lastDim);
+ newDim <= lastDim + 1);
+ dim = Math.min(lastDim, newDim);
}
if (newDim != lastDim) {
mDidChangeSize = true;
@@ -349,6 +355,7 @@ public class ChangeBoundsTest extends BaseTransitionTest {
newDim <= mMax);
assertTrue(name + " " + dimen + " " + newDim + " must be >= " + mMin,
newDim >= mMin);
+ return dim;
}
@Override
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionTest.java b/tests/tests/transition/src/android/transition/cts/TransitionTest.java
index 9ba201aa1ac..ad819fd6b59 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionTest.java
@@ -566,7 +566,7 @@ public class TransitionTest extends BaseTransitionTest {
startTransition(R.layout.scene8);
// scene 8 swaps the ids, but not the names. No transition should happen.
- waitForEnd(0);
+ waitForEnd(1000);
// now change the match order to prefer the id
mTransition.setMatchOrder(new int[] {Transition.MATCH_ID, Transition.MATCH_NAME});
diff --git a/tests/tests/view/res/values-ldpi/dimens.xml b/tests/tests/view/res/values-ldpi/dimens.xml
new file mode 100644
index 00000000000..5b79a3e9333
--- /dev/null
+++ b/tests/tests/view/res/values-ldpi/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!-- 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.
+-->
+<resources>
+ <dimen name="hover_target_margin">6dp</dimen>
+ <dimen name="hover_target_size">12dp</dimen>
+ <dimen name="hover_target_size_double">24dp</dimen>
+</resources>
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java b/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
index 69e1e7f8372..054de455cfc 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
@@ -65,6 +65,8 @@ public class PixelCopyViewProducerActivity extends Activity implements OnDrawLis
mContent = new ColoredGrid(this);
setContentView(mContent);
+ View view = this.getWindow().getDecorView();
+ view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
mContent.getViewTreeObserver().addOnDrawListener(this);
mContent.setOnApplyWindowInsetsListener(this);
}
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java b/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java
index f6970956eba..d8a512d72c4 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java
@@ -64,6 +64,8 @@ public class PixelCopyWideGamutViewProducerActivity extends Activity implements
mContent = new WideGamutBitmapView(this);
setContentView(mContent);
+ View view = this.getWindow().getDecorView();
+ view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
mContent.getViewTreeObserver().addOnDrawListener(this);
}
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index 55e3c4077be..112ac1b313f 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -105,10 +105,9 @@ public class WebSettingsTest extends ActivityInstrumentationTestCase2<WebViewCts
* compatibility definition (tokens in angle brackets are variables, tokens in square
* brackets are optional):
* <p/>
- * Mozilla/5.0 (Linux;[ U;] Android <version>;[ <language>-<country>;]
- * [<devicemodel>;] Build/<buildID>; wv) AppleWebKit/<major>.<minor> (KHTML, like Gecko)
- * Version/<major>.<minor> Chrome/<major>.<minor>.<branch>.<build>[ Mobile]
- * Safari/<major>.<minor>
+ * Mozilla/5.0 (Linux; Android <version>; [<devicemodel>;] [Build/<buildID>;] wv)
+ * AppleWebKit/<major>.<minor> (KHTML, like Gecko) Version/<major>.<minor>
+ * Chrome/<major>.<minor>.<branch>.<build>[ Mobile] Safari/<major>.<minor>
*/
public void testUserAgentString_default() {
if (!NullWebViewUtils.isWebViewAvailable()) {
@@ -116,43 +115,34 @@ public class WebSettingsTest extends ActivityInstrumentationTestCase2<WebViewCts
}
final String actualUserAgentString = mSettings.getUserAgentString();
Log.i(LOG_TAG, String.format("Checking user agent string %s", actualUserAgentString));
+
+ String expectedRelease, expectedModel;
+ if ("REL".equals(Build.VERSION.CODENAME)) {
+ expectedRelease = Pattern.quote(Build.VERSION.RELEASE);
+ expectedModel = Pattern.quote(Build.MODEL);
+ } else {
+ // Non-release builds don't include real release version/model, be lenient.
+ expectedRelease = expectedModel = "[^;]+";
+ }
+
+ // Build expected regex inserting the appropriate variables, as this is easier to
+ // understand and get right than matching any possible useragent and comparing the
+ // variables afterward.
final String patternString =
- "Mozilla/5\\.0 \\(Linux;( U;)? Android ([^;]+);( (\\w+)-(\\w+);)?" +
- "\\s?(.*)\\sBuild/(.+); wv\\) AppleWebKit/(\\d+)\\.(\\d+) " +
- "\\(KHTML, like Gecko\\) " +
- "Version/\\d+\\.\\d+ Chrome/\\d+\\.\\d+\\.\\d+\\.\\d+( Mobile)? " +
- "Safari/(\\d+)\\.(\\d+)";
- // Groups used:
- // 1 - SSL encryption strength token " U;" (optional)
- // 2 - Android version
- // 3 - full locale string (optional)
- // 4 - country
- // 5 - language
- // 6 - device model (optional)
- // 7 - build ID
- // 8 - AppleWebKit major version number
- // 9 - AppleWebKit minor version number
- // 10 - " Mobile" string (optional)
- // 11 - Safari major version number
- // 12 - Safari minor version number
+ Pattern.quote("Mozilla/5.0 (Linux; Android ") + expectedRelease + "; " +
+ "(" + expectedModel + "; )?" + // Optional
+ "(Build/" + Pattern.quote(Build.ID) + "; )?" + // Optional
+ Pattern.quote("wv) ") +
+ "AppleWebKit/\\d+\\.\\d+ " +
+ Pattern.quote("(KHTML, like Gecko) Version/4.0 ") +
+ "Chrome/\\d+\\.\\d+\\.\\d+\\.\\d+ " +
+ "(Mobile )?Safari/\\d+\\.\\d+";
Log.i(LOG_TAG, String.format("Trying to match pattern %s", patternString));
final Pattern userAgentExpr = Pattern.compile(patternString);
Matcher patternMatcher = userAgentExpr.matcher(actualUserAgentString);
assertTrue(String.format("User agent string did not match expected pattern. \nExpected " +
"pattern:\n%s\nActual:\n%s", patternString, actualUserAgentString),
patternMatcher.find());
- if (patternMatcher.group(3) != null) {
- Locale currentLocale = Locale.getDefault();
- assertEquals(currentLocale.getLanguage().toLowerCase(), patternMatcher.group(4));
- assertEquals(currentLocale.getCountry().toLowerCase(), patternMatcher.group(5));
- }
- if ("REL".equals(Build.VERSION.CODENAME)) {
- // Model is only added in release builds
- assertEquals(Build.MODEL, patternMatcher.group(6));
- // Release version is valid only in release builds
- assertEquals(Build.VERSION.RELEASE, patternMatcher.group(2));
- }
- assertEquals(Build.ID, patternMatcher.group(7));
}
public void testAccessUserAgentString() throws Exception {
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java
index 0708568d161..c900a0d9228 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java
@@ -731,12 +731,23 @@ public class WebViewSslTest extends ActivityInstrumentationTestCase2<WebViewCtsA
mOnUiThread.clearSslPreferences();
mOnUiThread.loadUrlAndWaitForCompletion(url);
// Page NOT loaded OK...
- // In this case, we must NOT have received the onReceivedSslError callback as that is for
- // recoverable (e.g. server auth) errors, whereas failing mandatory client auth is non-
- // recoverable and should drop straight through to a load error.
- assertFalse(webViewClient.wasOnReceivedSslErrorCalled());
- assertFalse(TestHtmlConstants.HELLO_WORLD_TITLE.equals(mOnUiThread.getTitle()));
- assertEquals(WebViewClient.ERROR_FAILED_SSL_HANDSHAKE, webViewClient.onReceivedErrorCode());
+ //
+ // In this test, we expect both a recoverable and non-recoverable error:
+ //
+ // 1. WebView does not trust the test server's certificate. This is a recoverable error, so
+ // WebView invokes #onReceivedSslError (and the WebViewClient calls #proceed). We don't
+ // specifically intend to test this part of the scenario, but we can't easily mock out
+ // WebView's certificate roots.
+ // 2. WebView proceeds with the handshake without providing client authentication. The
+ // server fails the client. This is non-recoverable, so WebView invokes
+ // #onReceivedError.
+ //
+ // We only assert the second error, since earlier WebView versions had a bug in which
+ // WebView hit error 2 first, which prevented it from hitting error 1.
+ assertFalse("Title should not be updated, since page load should have failed",
+ TestHtmlConstants.HELLO_WORLD_TITLE.equals(mOnUiThread.getTitle()));
+ assertEquals("Expected ERROR_FAILED_SSL_HANDSHAKE in onReceivedError",
+ WebViewClient.ERROR_FAILED_SSL_HANDSHAKE, webViewClient.onReceivedErrorCode());
}
public void testProceedClientCertRequest() throws Throwable {
diff --git a/tools/cts-tradefed/Android.mk b/tools/cts-tradefed/Android.mk
index 41460dc6a7b..2403df1495e 100644
--- a/tools/cts-tradefed/Android.mk
+++ b/tools/cts-tradefed/Android.mk
@@ -29,7 +29,7 @@ LOCAL_SUITE_BUILD_NUMBER := $(BUILD_NUMBER_FROM_FILE)
LOCAL_SUITE_TARGET_ARCH := $(TARGET_ARCH)
LOCAL_SUITE_NAME := CTS
LOCAL_SUITE_FULLNAME := "Compatibility Test Suite"
-LOCAL_SUITE_VERSION := 8.1_r13
+LOCAL_SUITE_VERSION := 8.1_r14
LOCAL_STATIC_JAVA_LIBRARIES += cts-tradefed-harness
LOCAL_MODULE := cts-tradefed