Merge "Update self-managed CTS verifier test to gracefully handle failures."
diff --git a/apps/CtsVerifier/res/layout/ci_main.xml b/apps/CtsVerifier/res/layout/ci_main.xml
index a464427..21235b0 100644
--- a/apps/CtsVerifier/res/layout/ci_main.xml
+++ b/apps/CtsVerifier/res/layout/ci_main.xml
@@ -14,26 +14,20 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:gravity="bottom"
- android:orientation="vertical" >
-
+<ScrollView
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:fillViewport="true"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
<LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:gravity="bottom"
- android:orientation="horizontal" >
-
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
<LinearLayout
- android:layout_width="0dp"
- android:layout_height="fill_parent"
- android:layout_weight="2"
- android:gravity="bottom"
- android:orientation="vertical" >
-
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
<TextView
android:id="@+id/camera_text"
android:layout_width="wrap_content"
@@ -76,12 +70,8 @@
android:enabled="false"
android:text="@string/ci_start_test_button_caption" />
+ </LinearLayout>
</LinearLayout>
-
- </LinearLayout>
-
+ <include layout="@layout/pass_fail_buttons" />
</LinearLayout>
-
- <include layout="@layout/pass_fail_buttons" />
-
-</LinearLayout>
+</ScrollView>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
index dc73543..d9094e5 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
@@ -22,6 +22,8 @@
import android.util.Log;
+import java.lang.Math;
+
/**
* Records audio data to a stream.
*/
@@ -115,12 +117,10 @@
}
private boolean open_internal(int numChans, int sampleRate) {
- Log.i(TAG, "StreamRecorder.open_internal(chans:" + numChans + ", rate:" + sampleRate);
-
mNumChannels = numChans;
mSampleRate = sampleRate;
- int chanMask = AudioUtils.countToIndexMask(numChans);
+ int chanPosMask = AudioUtils.countToInPositionMask(numChans);
int bufferSizeInBytes = 2048; // Some, non-critical value
try {
@@ -128,7 +128,7 @@
.setAudioFormat(new AudioFormat.Builder()
.setEncoding(AudioFormat.ENCODING_PCM_FLOAT)
.setSampleRate(mSampleRate)
- .setChannelIndexMask(chanMask)
+ .setChannelMask(chanPosMask)
.build())
.setBufferSizeInBytes(bufferSizeInBytes)
.build();
@@ -146,6 +146,11 @@
if (sucess) {
mNumBurstFrames = numBurstFrames;
mBurstBuffer = new float[mNumBurstFrames * mNumChannels];
+ // put some non-zero data in the burst buffer.
+ // this is to verify that the record is putting SOMETHING into each channel.
+ for(int index = 0; index < mBurstBuffer.length; index++) {
+ mBurstBuffer[index] = (float)(Math.random() * 2.0) - 1.0f;
+ }
}
return sucess;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
index ebb5991..e7695cb 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
@@ -45,20 +45,15 @@
private static final boolean DEBUG = false;
private static final String mBuiltInprofiles =
- "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>" +
- "<ProfileList Version=\"1.0.0\">" +
- "<PeripheralProfile ProfileName=\"Headset\" ProfileDescription=\"Microsoft LX-3000\" ProductName=\"USB-Audio - Microsoft LifeChat LX-3000\">" +
- "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"2\" SampleRates=\"44100,48000\" />" +
- "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1\" Encodings=\"2\" SampleRates=\"44100,48000\" />" +
- "<ButtonInfo HasBtnA=\"0\" HasBtnB=\"1\" HasBtnC=\"1\" HasBtnD=\"0\" />" +
- "</PeripheralProfile>" +
+ "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>" +
+ "<ProfileList Version=\"1.0.0\">" +
"<PeripheralProfile ProfileName=\"Audio Interface\" ProfileDescription=\"Presonus AudioVox 44VSL\" ProductName=\"USB-Audio - AudioBox 44 VSL\">" +
- "<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
- "<InputDevInfo ChanCounts=\"1,2,4\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+ "<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+ "<InputDevInfo ChanCounts=\"1,2,4\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"AudioBox 22VSL\" ProfileDescription=\"Presonus AudioBox 22VSL\" ProductName=\"USB-Audio - AudioBox 22 VSL\">" +
- "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
- "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+ "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+ "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"AudioBox USB\" ProfileDescription=\"Presonus AudioBox USB\" ProductName=\"USB-Audio - AudioBox USB\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000\" />" +
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetTestActivity.java
index 25f0a7a..32c4267 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetTestActivity.java
@@ -19,6 +19,8 @@
import com.android.cts.verifier.PassFailButtons;
import com.android.cts.verifier.R;
+import com.android.compatibility.common.util.CddTest;
+
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEventListener;
@@ -29,6 +31,7 @@
/**
* CTS Verifier case for verifying basic widget framework functionality.
*/
+@CddTest(requirement="3.8.2/C-1-2,C-1-3")
public class WidgetTestActivity extends PassFailButtons.Activity {
@Override
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
index a612cee..8b737622 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
@@ -79,6 +79,14 @@
protected static final int FLAG_EPHEMERAL = 0x00000100;
protected static final int FLAG_MANAGED_PROFILE = 0x00000020;
+ /**
+ * The {@link android.os.BatteryManager} flags value representing all charging types; {@link
+ * android.os.BatteryManager#BATTERY_PLUGGED_AC}, {@link
+ * android.os.BatteryManager#BATTERY_PLUGGED_USB}, and {@link
+ * android.os.BatteryManager#BATTERY_PLUGGED_WIRELESS}.
+ */
+ private static final int STAY_ON_WHILE_PLUGGED_IN_FLAGS = 7;
+
protected static interface Settings {
public static final String GLOBAL_NAMESPACE = "global";
public static interface Global {
@@ -138,6 +146,7 @@
removeTestUsers();
// Unlock keyguard before test
wakeupAndDismissKeyguard();
+ stayAwake();
// Go to home.
executeShellCommand("input keyevent KEYCODE_HOME");
}
@@ -807,4 +816,9 @@
executeShellCommand("input keyevent KEYCODE_WAKEUP");
executeShellCommand("wm dismiss-keyguard");
}
+
+ private void stayAwake() throws Exception {
+ executeShellCommand(
+ "settings put global stay_on_while_plugged_in " + STAY_ON_WHILE_PLUGGED_IN_FLAGS);
+ }
}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java b/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
index e68483b..8054933 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
@@ -93,7 +93,7 @@
when(finder.findByAutofillId(id3)).thenReturn("c");
when(finder.findByAutofillId(id4)).thenReturn("d");
- assertThrows(ArrayIndexOutOfBoundsException.class, () -> trans.apply(finder, template, 0));
+ assertThrows(IndexOutOfBoundsException.class, () -> trans.apply(finder, template, 0));
// fail one, fail all
verify(template, never()).setCharSequence(eq(0), any(), any());
diff --git a/tests/tests/appwidget/Android.mk b/tests/tests/appwidget/Android.mk
index 4164e57..52e375a 100644
--- a/tests/tests/appwidget/Android.mk
+++ b/tests/tests/appwidget/Android.mk
@@ -30,7 +30,8 @@
mockito-target-minus-junit4 \
ctstestrunner \
junit \
- legacy-android-test
+ legacy-android-test \
+ compatibility-device-util
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/appwidget/src/android/appwidget/cts/RequestPinAppWidgetTest.java b/tests/tests/appwidget/src/android/appwidget/cts/RequestPinAppWidgetTest.java
index 019fb66..82b3a04 100644
--- a/tests/tests/appwidget/src/android/appwidget/cts/RequestPinAppWidgetTest.java
+++ b/tests/tests/appwidget/src/android/appwidget/cts/RequestPinAppWidgetTest.java
@@ -31,6 +31,8 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
+import com.android.compatibility.common.util.CddTest;
+
public class RequestPinAppWidgetTest extends AppWidgetTestCase {
private static final String LAUNCHER_CLASS = "android.appwidget.cts.packages.Launcher";
@@ -51,6 +53,7 @@
setLauncher(mDefaultLauncher);
}
+ @CddTest(requirement="3.8.2/C-2-2")
private void runPinWidgetTest(final String launcherPkg) throws Exception {
if (!hasAppWidgets()) {
return;
@@ -107,6 +110,7 @@
runPinWidgetTest("android.appwidget.cts.packages.launcher2");
}
+ @CddTest(requirement="3.8.2/C-2-1")
public void verifyIsRequestPinAppWidgetSupported(String launcherPkg, boolean expectedSupport)
throws Exception {
if (!hasAppWidgets()) {
diff --git a/tests/tests/icu/resources/android/icu/cts/expectations/icu-known-failures.txt b/tests/tests/icu/resources/android/icu/cts/expectations/icu-known-failures.txt
index a2e6dc4..e68fcd9 100644
--- a/tests/tests/icu/resources/android/icu/cts/expectations/icu-known-failures.txt
+++ b/tests/tests/icu/resources/android/icu/cts/expectations/icu-known-failures.txt
@@ -16,11 +16,6 @@
bug: "27374606"
},
{
- description: "Fails on host and on device in same way before and after packaging",
- name: "android.icu.dev.test.bidi.TestCompatibility#testCompatibility",
- bug: "23995372"
-},
-{
description: "Checks differences in DecimalFormat classes from ICU4J and JDK but on Android java.text.DecimalFormat is implemented in terms of ICU4J",
name: "android.icu.dev.test.format.NumberFormatTest#TestDataDrivenJDK",
bug: "27711713"
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java
index 9dbf3f3..905c021 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java
@@ -823,8 +823,8 @@
Date keyValidityEndDateForOrigination = new Date(System.currentTimeMillis() + 1000000);
Date keyValidityEndDateForConsumption = new Date(System.currentTimeMillis() + 10000000);
- Date certNotBefore = new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 210);
- Date certNotAfter = new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 210);
+ Date certNotBefore = new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 210);
+ Date certNotAfter = new Date(System.currentTimeMillis() + 1000L * 60 * 60 * 24 * 210);
BigInteger certSerialNumber = new BigInteger("1234567890");
X500Principal certSubject = new X500Principal("cn=hello2");
generator.initialize(new KeyGenParameterSpec.Builder(
diff --git a/tests/tests/libcoreapievolution/Android.mk b/tests/tests/libcoreapievolution/Android.mk
new file mode 100644
index 0000000..439e30d
--- /dev/null
+++ b/tests/tests/libcoreapievolution/Android.mk
@@ -0,0 +1,34 @@
+# Copyright (C) 2018 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH:= $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+# and when built explicitly put it in the data partition
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit legacy-android-test
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsLibcoreApiEvolutionTestCases
+LOCAL_SDK_VERSION := current
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/libcoreapievolution/AndroidManifest.xml b/tests/tests/libcoreapievolution/AndroidManifest.xml
new file mode 100644
index 0000000..0e36e41
--- /dev/null
+++ b/tests/tests/libcoreapievolution/AndroidManifest.xml
@@ -0,0 +1,33 @@
+<?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
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.apievolution.cts">
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.apievolution.cts"
+ android:label="CTS tests for required method signatures on device">
+ <meta-data android:name="listener"
+ android:value="com.android.cts.runner.CtsTestRunListener" />
+ </instrumentation>
+
+</manifest>
+
diff --git a/tests/tests/libcoreapievolution/AndroidTest.xml b/tests/tests/libcoreapievolution/AndroidTest.xml
new file mode 100644
index 0000000..f777701
--- /dev/null
+++ b/tests/tests/libcoreapievolution/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?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.
+-->
+<configuration description="Config for CTS Legacy Libcore test cases">
+ <option name="test-suite-tag" value="cts" />
+ <option name="config-descriptor:metadata" key="component" value="libcore" />
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsLibcoreApiEvolutionTestCases.apk" />
+ </target_preparer>
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="android.apievolution.cts" />
+ <option name="runtime-hint" value="1m" />
+ </test>
+</configuration>
diff --git a/tests/tests/libcoreapievolution/src/android/apievolution/cts/ApiEvolutionTest.java b/tests/tests/libcoreapievolution/src/android/apievolution/cts/ApiEvolutionTest.java
new file mode 100644
index 0000000..a7ba9ad
--- /dev/null
+++ b/tests/tests/libcoreapievolution/src/android/apievolution/cts/ApiEvolutionTest.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.apievolution.cts;
+
+import org.junit.Test;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.text.ParseException;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * A test to ensure that platform bytecode is as expected to enable API evolution.
+ */
+public class ApiEvolutionTest {
+
+ /**
+ * Tests for synthetic methods generated by
+ * {@link dalvik.annotation.codegen.CovariantReturnType}.
+ */
+ @Test
+ public void testCovariantReturnTypeMethods() throws Exception {
+ // Example of the "normal" way round for synthetic methods generated by the toolchain when
+ // a subclass has a more specific return type.
+ // Exceptions are not required to be identical in this case because the synthetic method
+ // mirrors the superclass version.
+ assertSyntheticMethodOverloadExists(
+ Sub.class, "myMethod", new Class[] { Integer.class },
+ String.class, Object.class,
+ false /* requireIdenticalExceptions */);
+
+ // Cases of synthetic platform methods that have been introduced by the platform build tools
+ // in response to the presence of a @CovarientReturnType annotation.
+ // More should be added for every use of the annotation.
+ assertSyntheticMethodOverloadExists(ConcurrentHashMap.class, "keySet", null, Set.class,
+ ConcurrentHashMap.KeySetView.class, true);
+ }
+
+ private static void assertSyntheticMethodOverloadExists(
+ Class<?> clazz, String methodName, Class[] parameterTypes,
+ Class<?> originalReturnType, Class<?> syntheticReturnType,
+ boolean requireIdenticalExceptions) throws Exception {
+
+ if (parameterTypes == null) {
+ parameterTypes = new Class[0];
+ }
+ String fullMethodName = clazz + "." + methodName;
+
+ // Assert we find the original, non-synthetic version using getDeclaredMethod().
+ Method declaredMethod = clazz.getDeclaredMethod(methodName, parameterTypes);
+ assertEquals(originalReturnType, declaredMethod.getReturnType());
+
+ // Assert both versions of the method are returned from getDeclaredMethods().
+ Method original = null;
+ Method synthetic = null;
+ for (Method method : clazz.getDeclaredMethods()) {
+ if (methodMatches(methodName, parameterTypes, method)) {
+ if (method.getReturnType().equals(syntheticReturnType)) {
+ synthetic = method;
+ } else if (method.getReturnType().equals(originalReturnType)) {
+ original = method;
+ }
+ }
+ }
+ assertNotNull("Unable to find original signature: " + fullMethodName
+ + ", returning " + originalReturnType, original);
+ assertNotNull("Unable to find synthetic signature: " + fullMethodName
+ + ", returning " + syntheticReturnType, synthetic);
+
+ // Check modifiers are as expected.
+ assertFalse(original.isSynthetic());
+ assertFalse(original.isBridge());
+ assertTrue(synthetic.isSynthetic());
+ assertTrue(synthetic.isBridge());
+
+ int originalModifiers = original.getModifiers();
+ int syntheticModifiers = synthetic.getModifiers();
+
+ // These masks aren't in the public API but are defined in the dex spec.
+ int syntheticMask = 0x00001000;
+ int bridgeMask = 0x00000040;
+ int mask = syntheticMask | bridgeMask;
+ assertEquals("Method modifiers for " + fullMethodName
+ + " are expected to be identical except for SYNTHETIC and BRIDGE."
+ + " original=" + Modifier.toString(originalModifiers)
+ + ", synthetic=" + Modifier.toString(syntheticModifiers),
+ originalModifiers | mask,
+ syntheticModifiers | mask);
+
+ // Exceptions are not required at method resolution time but we check they're the same in
+ // most cases for completeness.
+ if (requireIdenticalExceptions) {
+ assertArrayEquals("Exceptions for " + fullMethodName + " must be compatible",
+ original.getExceptionTypes(), synthetic.getExceptionTypes());
+ }
+
+ // Android doesn't support runtime type annotations so nothing to do for them.
+
+ // Type parameters are *not* copied because they're not needed at method resolution time.
+ assertEquals(0, synthetic.getTypeParameters().length);
+
+ // Check method annotations.
+ Annotation[] annotations = original.getDeclaredAnnotations();
+ assertArrayEquals("Annotations differ between original and synthetic versions of "
+ + fullMethodName, annotations, synthetic.getDeclaredAnnotations());
+ Annotation[][] parameterAnnotations = original.getParameterAnnotations();
+ // Check parameter annotations.
+ assertArrayEquals("Annotations differ between original and synthetic versions of "
+ + fullMethodName, parameterAnnotations, synthetic.getParameterAnnotations());
+ }
+
+ private static boolean methodMatches(String methodName, Class[] parameterTypes, Method method) {
+ return method.getName().equals(methodName)
+ && Arrays.equals(parameterTypes, method.getParameterTypes());
+ }
+
+ /** Annotation used in return type specialization tests. */
+ @Retention(RetentionPolicy.RUNTIME)
+ private @interface TestAnnotation {}
+
+ /** Base class for return type specialization tests. */
+ private static class Base {
+ protected Object myMethod(Integer p1) throws Exception {
+ return null;
+ }
+ }
+
+ /** Sub class for return type specialization tests. */
+ private static class Sub extends Base {
+ @TestAnnotation
+ @Override
+ protected String myMethod(@TestAnnotation Integer p1) throws ParseException {
+ return null;
+ }
+ }
+}
diff --git a/tests/tests/print/src/android/print/cts/BasePrintTest.java b/tests/tests/print/src/android/print/cts/BasePrintTest.java
old mode 100644
new mode 100755
index a352ca6..e29b17f
--- a/tests/tests/print/src/android/print/cts/BasePrintTest.java
+++ b/tests/tests/print/src/android/print/cts/BasePrintTest.java
@@ -196,13 +196,6 @@
Instrumentation instrumentation = getInstrumentation();
- // Prevent rotation
- getUiDevice().freezeRotation();
- while (!getUiDevice().isNaturalOrientation()) {
- getUiDevice().setOrientationNatural();
- getUiDevice().waitForIdle();
- }
-
// Make sure we start with a clean slate.
Log.d(LOG_TAG, "clearPrintSpoolerData()");
clearPrintSpoolerData();
@@ -267,6 +260,13 @@
assumeTrue(getInstrumentation().getContext().getPackageManager().hasSystemFeature(
PackageManager.FEATURE_PRINTING));
+ // Prevent rotation
+ getUiDevice().freezeRotation();
+ while (!getUiDevice().isNaturalOrientation()) {
+ getUiDevice().setOrientationNatural();
+ getUiDevice().waitForIdle();
+ }
+
// Initialize the latches.
Log.d(LOG_TAG, "init counters");
mCancelOperationCounter = new CallCounter();
@@ -298,6 +298,9 @@
sIdToTest.remove(mTestId);
+ // Allow rotation
+ getUiDevice().unfreezeRotation();
+
Log.d(LOG_TAG, "tearDown() done");
}
@@ -320,9 +323,6 @@
SystemUtil.runShellCommand(instrumentation, "settings put secure "
+ Settings.Secure.DISABLED_PRINT_SERVICES + " null");
- // Allow rotation
- getUiDevice().unfreezeRotation();
-
Log.d(LOG_TAG, "tearDownClass() done");
}
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerClientApiTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerClientApiTest.java
index bab2674..c0f76a6 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerClientApiTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerClientApiTest.java
@@ -32,6 +32,8 @@
import android.net.Uri;
import android.test.suitebuilder.annotation.SmallTest;
+import com.android.compatibility.common.util.CddTest;
+
import junit.framework.AssertionFailedError;
/**
@@ -39,6 +41,7 @@
*
* In this test, we tests the main functionalities of those, without throttling.
*/
+@CddTest(requirement="3.8.1/C-4-1")
@SmallTest
public class ShortcutManagerClientApiTest extends ShortcutManagerCtsTestsBase {
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherApiTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherApiTest.java
index e527bf9..4f25f44 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherApiTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherApiTest.java
@@ -29,6 +29,8 @@
import android.graphics.drawable.Icon;
import android.test.suitebuilder.annotation.SmallTest;
+import com.android.compatibility.common.util.CddTest;
+
@SmallTest
public class ShortcutManagerLauncherApiTest extends ShortcutManagerCtsTestsBase {
@Override
@@ -350,7 +352,7 @@
assertIconDimensions(icon5, getIconAsLauncher(
mLauncherContext1, mPackageContext1.getPackageName(), "ms21", false));
}
-
+ @CddTest(requirement="3.8.1/C-1-2")
public void testGetShortcutIconAdaptive() throws Exception {
final Icon icon1 = Icon.createWithAdaptiveBitmap(BitmapFactory.decodeResource(
getTestContext().getResources(), R.drawable.black_16x64));
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherCallbackTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherCallbackTest.java
index b95599e..7594d5a 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherCallbackTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerLauncherCallbackTest.java
@@ -38,6 +38,9 @@
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Predicate;
+import com.android.compatibility.common.util.CddTest;
+
+@CddTest(requirement="3.8.1/C-2-3")
@SmallTest
public class ShortcutManagerLauncherCallbackTest extends ShortcutManagerCtsTestsBase {
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMaxCountTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMaxCountTest.java
index 3e75b4a..490cc6f 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMaxCountTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMaxCountTest.java
@@ -23,6 +23,9 @@
import android.test.suitebuilder.annotation.SmallTest;
+import com.android.compatibility.common.util.CddTest;
+
+@CddTest(requirement="3.8.1/C-4-1")
@SmallTest
public class ShortcutManagerMaxCountTest extends ShortcutManagerCtsTestsBase {
/**
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMiscTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMiscTest.java
index 95defb8..46c8661 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMiscTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMiscTest.java
@@ -20,6 +20,9 @@
import android.content.pm.ShortcutManager;
import android.test.suitebuilder.annotation.SmallTest;
+import com.android.compatibility.common.util.CddTest;
+
+@CddTest(requirement="3.8.1/C-4-1")
@SmallTest
public class ShortcutManagerMiscTest extends ShortcutManagerCtsTestsBase {
@Override
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMultiLauncherTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMultiLauncherTest.java
index 78dbccd..3a083ad 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMultiLauncherTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerMultiLauncherTest.java
@@ -27,6 +27,9 @@
import android.test.suitebuilder.annotation.SmallTest;
+import com.android.compatibility.common.util.CddTest;
+
+@CddTest(requirement="3.8.1/C-2-3")
@SmallTest
public class ShortcutManagerMultiLauncherTest extends ShortcutManagerCtsTestsBase {
/**
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerNegativeTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerNegativeTest.java
index 0fca1fa..c3d6c1c 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerNegativeTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerNegativeTest.java
@@ -33,6 +33,9 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
+import com.android.compatibility.common.util.CddTest;
+
+@CddTest(requirement="3.8.1/C-4-1")
@SmallTest
public class ShortcutManagerNegativeTest extends ShortcutManagerCtsTestsBase {
private static final String TAG = "ShortcutNegativeCTS";
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerRequestPinTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerRequestPinTest.java
index 756cf80..8f38e18 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerRequestPinTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerRequestPinTest.java
@@ -33,13 +33,16 @@
import android.content.pm.cts.shortcutmanager.common.ReplyUtil;
import android.os.PersistableBundle;
import android.util.Log;
+import com.android.compatibility.common.util.CddTest;
import java.util.HashMap;
import java.util.List;
+@CddTest(requirement="3.8.1/C-4-1")
public class ShortcutManagerRequestPinTest extends ShortcutManagerCtsTestsBase {
private static final String TAG = "ShortcutMRPT";
+ @CddTest(requirement="[3.8.1/C-2-1],[3.8.1/C-3-1]")
public void testIsRequestPinShortcutSupported() {
// Launcher 1 supports it.
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerStartShortcutTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerStartShortcutTest.java
index 9cf1f89..f5b0a9e 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerStartShortcutTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerStartShortcutTest.java
@@ -30,6 +30,9 @@
import java.util.List;
+import com.android.compatibility.common.util.CddTest;
+
+@CddTest(requirement="3.8.1/C-2-3")
@SmallTest
public class ShortcutManagerStartShortcutTest extends ShortcutManagerCtsTestsBase {
private ComponentName mLaunchedActivity;
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerThrottlingTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerThrottlingTest.java
index 55afe48..7628c82 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerThrottlingTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerThrottlingTest.java
@@ -33,11 +33,14 @@
import android.test.suitebuilder.annotation.Suppress;
import android.view.KeyEvent;
+import com.android.compatibility.common.util.CddTest;
+
/**
* The actual test is implemented in the CtsShortcutManagerThrottlingTest module.
* This class uses broadcast receivers to communicate with it, because if we just used an
* instrumentation test, the target process would never been throttled.
*/
+@CddTest(requirement="3.8.1/C-4-1")
@SmallTest
public class ShortcutManagerThrottlingTest extends ShortcutManagerCtsTestsBase {
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerUsageTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerUsageTest.java
index 064ba58..94b5b96 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerUsageTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerUsageTest.java
@@ -27,6 +27,9 @@
import android.test.suitebuilder.annotation.SmallTest;
import android.text.format.Time;
+import com.android.compatibility.common.util.CddTest;
+
+@CddTest(requirement="3.8.1/C-4-1")
@SmallTest
public class ShortcutManagerUsageTest extends ShortcutManagerCtsTestsBase {
private static final String APPOPS_SET_SHELL_COMMAND = "appops set {0} " +
diff --git a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
index 74ed587..a2847d15 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
@@ -31,6 +31,7 @@
import android.telecom.InCallService;
import android.telecom.TelecomManager;
import android.telecom.VideoProfile;
+import android.telephony.TelephonyManager;
import java.util.List;
@@ -627,6 +628,11 @@
return;
}
+ TelephonyManager tm = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
+ if (tm != null && !tm.isSmsCapable()) {
+ return ;
+ }
+
addAndVerifyNewIncomingCall(createTestNumber(), null);
verifyConnectionForIncomingCall();
final MockInCallService inCallService = mInCallCallbacks.getService();
diff --git a/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
index 234e047..c815ddd 100644
--- a/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
@@ -16,6 +16,8 @@
package android.telecom.cts;
+import android.content.Context;
+import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.telecom.CallAudioState;
@@ -29,6 +31,7 @@
import java.util.List;
import java.util.function.Predicate;
+import static android.media.AudioManager.MODE_IN_COMMUNICATION;
import static android.telecom.cts.TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS;
import static android.telecom.cts.TestUtils.waitOnAllHandlers;
@@ -228,6 +231,11 @@
connection.getOnShowIncomingUiInvokeCounter().waitForCount(1);
setActiveAndVerify(connection);
+ // Ensure that the connection defaulted to voip audio mode.
+ assertTrue(connection.getAudioModeIsVoip());
+ // Ensure AudioManager has correct voip mode.
+ verifyAudioMode();
+
// Expect there to be no managed calls at the moment.
assertFalse(mTelecomManager.isInManagedCall());
@@ -293,6 +301,11 @@
setActiveAndVerify(connection);
+ // Ensure that the connection defaulted to voip audio mode.
+ assertTrue(connection.getAudioModeIsVoip());
+ // Ensure AudioManager has correct voip mode.
+ verifyAudioMode();
+
// Expect there to be no managed calls at the moment.
assertFalse(mTelecomManager.isInManagedCall());
// But there should be a call (including self-managed).
@@ -544,4 +557,9 @@
assertIsInCall(false);
assertIsInManagedCall(false);
}
+
+ private void verifyAudioMode() {
+ AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
+ assertEquals(MODE_IN_COMMUNICATION, am.getMode());
+ }
}
diff --git a/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallService.java b/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallService.java
index 81a731f..3481672 100644
--- a/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallService.java
+++ b/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallService.java
@@ -65,6 +65,15 @@
return INVALID_STATE;
}
}
+
+ public int waitDialingState() {
+ while (true) {
+ int state = waitOnStateChanged();
+ if (state == Call.STATE_DIALING || state == INVALID_STATE) {
+ return state;
+ }
+ }
+ }
}
private static final String LOG_TAG="SelfMgAwareICS";
diff --git a/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallServiceTest.java b/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallServiceTest.java
index aa683a2..d0e8e48 100644
--- a/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallServiceTest.java
+++ b/tests/tests/telecom3/src/android/telecom/cts/SelfManagedAwareInCallServiceTest.java
@@ -179,7 +179,7 @@
assertNotNull(callbacks);
// Call will first be dialing.
- assertEquals(Call.STATE_DIALING, callbacks.waitOnStateChanged());
+ assertEquals(Call.STATE_DIALING, callbacks.waitDialingState());
// Set active from the connection side.
connection.setActive();
diff --git a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
index c8718b6..6cf147f 100644
--- a/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/PhoneNumberUtilsTest.java
@@ -339,41 +339,6 @@
assertEquals("6512223333", ttsSpans[0].getArgs().get(TtsSpan.ARG_NUMBER_PARTS));
}
- public void testCompare() {
- assertFalse(PhoneNumberUtils.compare("", ""));
-
- assertTrue(PhoneNumberUtils.compare("911", "911"));
- assertFalse(PhoneNumberUtils.compare("911", "18005550911"));
- assertTrue(PhoneNumberUtils.compare("5555", "5555"));
- assertFalse(PhoneNumberUtils.compare("5555", "180055555555"));
-
- assertTrue(PhoneNumberUtils.compare("+17005554141", "+17005554141"));
- assertTrue(PhoneNumberUtils.compare("+17005554141", "+1 (700).555-4141"));
- assertTrue(PhoneNumberUtils.compare("+17005554141", "+1 (700).555-4141,1234"));
- assertTrue(PhoneNumberUtils.compare("+17005554141", "17005554141"));
- assertTrue(PhoneNumberUtils.compare("+17005554141", "7005554141"));
- assertTrue(PhoneNumberUtils.compare("+17005554141", "5554141"));
- assertTrue(PhoneNumberUtils.compare("17005554141", "5554141"));
- assertTrue(PhoneNumberUtils.compare("+17005554141", "01117005554141"));
- assertTrue(PhoneNumberUtils.compare("+17005554141", "0017005554141"));
- assertTrue(PhoneNumberUtils.compare("17005554141", "0017005554141"));
-
-
- assertTrue(PhoneNumberUtils.compare("+17005554141", "**31#+17005554141"));
-
- assertFalse(PhoneNumberUtils.compare("+1 999 7005554141", "+1 7005554141"));
- assertTrue(PhoneNumberUtils.compare("011 1 7005554141", "7005554141"));
-
- assertFalse(PhoneNumberUtils.compare("011 11 7005554141", "+17005554141"));
-
- assertFalse(PhoneNumberUtils.compare("+17005554141", "7085882300"));
-
- assertTrue(PhoneNumberUtils.compare("+44 207 792 3490", "0 207 792 3490"));
-
- assertFalse(PhoneNumberUtils.compare("+44 207 792 3490", "00 207 792 3490"));
- assertFalse(PhoneNumberUtils.compare("+44 207 792 3490", "011 207 792 3490"));
- }
-
public void testFormatNumberToE164() {
assertNull(PhoneNumberUtils.formatNumber("invalid#", "US"));
assertNull(PhoneNumberUtils.formatNumberToE164("1234567", "US"));
diff --git a/tests/tests/text/src/android/text/cts/MyanmarTest.java b/tests/tests/text/src/android/text/cts/MyanmarTest.java
index 8a71adb..916b451 100644
--- a/tests/tests/text/src/android/text/cts/MyanmarTest.java
+++ b/tests/tests/text/src/android/text/cts/MyanmarTest.java
@@ -19,16 +19,20 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
+import android.content.res.Resources;
import android.graphics.Bitmap;
import android.support.test.InstrumentationRegistry;
import android.support.test.annotation.UiThreadTest;
import android.support.test.filters.SmallTest;
import android.support.test.runner.AndroidJUnit4;
+import android.text.TextUtils;
import android.widget.TextView;
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.Locale;
+
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MyanmarTest {
@@ -38,6 +42,21 @@
@UiThreadTest
@Test
public void testCompositionSemantics() {
+ boolean isMyanmarSupported = false;
+ final String[] localeNames = Resources.getSystem().getStringArray(
+ Resources.getSystem().getIdentifier("supported_locales", "array", "android"));
+ for (String localeName : localeNames) {
+ if (TextUtils.equals("my", Locale.forLanguageTag(localeName).getLanguage())) {
+ isMyanmarSupported = true;
+ break;
+ }
+ }
+ if (!isMyanmarSupported) {
+ // Ignoring since no Myanmar font guarantee if Myanmar is not listed in supported
+ // locales.
+ return;
+ }
+
Context context = InstrumentationRegistry.getTargetContext();
String textA = "\u1019\u102d\u102f";
String textB = "\u1019\u102f\u102d"; // wrong order for Unicode
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index f10e7fd..55e3c40 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -19,11 +19,13 @@
import android.graphics.Bitmap;
import android.net.http.SslError;
import android.os.Build;
+import android.os.Message;
import android.test.ActivityInstrumentationTestCase2;
import android.util.Base64;
import android.util.Log;
import android.webkit.ConsoleMessage;
import android.webkit.SslErrorHandler;
+import android.webkit.WebChromeClient;
import android.webkit.WebIconDatabase;
import android.webkit.WebResourceResponse;
import android.webkit.WebResourceRequest;
@@ -42,6 +44,8 @@
import java.io.FileOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -409,26 +413,38 @@
return;
}
mSettings.setJavaScriptEnabled(true);
+ mSettings.setSupportMultipleWindows(true);
+ startWebServer();
+
+ final WebView childWebView = mOnUiThread.createWebView();
+ final CountDownLatch latch = new CountDownLatch(1);
+ mOnUiThread.setWebChromeClient(new WebChromeClient() {
+ @Override
+ public boolean onCreateWindow(
+ WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
+ WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
+ transport.setWebView(childWebView);
+ resultMsg.sendToTarget();
+ latch.countDown();
+ return true;
+ }
+ });
mSettings.setJavaScriptCanOpenWindowsAutomatically(false);
assertFalse(mSettings.getJavaScriptCanOpenWindowsAutomatically());
- loadAssetUrl(TestHtmlConstants.POPUP_URL);
+ mOnUiThread.loadUrl(mWebServer.getAssetUrl(TestHtmlConstants.POPUP_URL));
new PollingCheck(WEBVIEW_TIMEOUT) {
@Override
protected boolean check() {
return "Popup blocked".equals(mOnUiThread.getTitle());
}
}.run();
+ assertEquals(1, latch.getCount());
mSettings.setJavaScriptCanOpenWindowsAutomatically(true);
assertTrue(mSettings.getJavaScriptCanOpenWindowsAutomatically());
- loadAssetUrl(TestHtmlConstants.POPUP_URL);
- new PollingCheck(WEBVIEW_TIMEOUT) {
- @Override
- protected boolean check() {
- return "Popup allowed".equals(mOnUiThread.getTitle());
- }
- }.run();
+ mOnUiThread.loadUrl(mWebServer.getAssetUrl(TestHtmlConstants.POPUP_URL));
+ assertTrue(latch.await(WEBVIEW_TIMEOUT, TimeUnit.MILLISECONDS));
}
public void testAccessJavaScriptEnabled() throws Exception {
diff --git a/tests/vm/Android.mk b/tests/vm/Android.mk
index d28ec0f..c387a8a 100755
--- a/tests/vm/Android.mk
+++ b/tests/vm/Android.mk
@@ -16,6 +16,9 @@
include $(CLEAR_VARS)
+# b/110155920
+LOCAL_ERROR_PRONE_FLAGS := -Xep:ConstantOverflow:OFF
+
# Don't include this package in any target
LOCAL_MODULE_TAGS := tests
# When built, explicitly put it in the data partition.
diff --git a/tools/vm-tests-tf/Android.mk b/tools/vm-tests-tf/Android.mk
index 8436a26..315d04e 100644
--- a/tools/vm-tests-tf/Android.mk
+++ b/tools/vm-tests-tf/Android.mk
@@ -105,13 +105,8 @@
$(hide) $(JAR) -cf $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar \
$(addprefix -C $(PRIVATE_INTERMEDIATES_CLASSES) , dot/junit/DxUtil.class dot/junit/DxAbstractMain.class dot/junit/AssertionFailedException.class)
$(hide) mkdir -p $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp
-ifneq ($(USE_D8_DESUGAR),true)
- $(hide) $(DX_COMMAND) --dex --output=$(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp \
- $(if $(NO_OPTIMIZE_DX), --no-optimize) $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar
-else
$(hide) $(DX_COMMAND) --output $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp \
$(if $(NO_OPTIMIZE_DX), --debug) $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)-class.jar && rm -f $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).jar
-endif
$(hide) cd $(PRIVATE_INTERMEDIATES_DEXCORE_JAR).tmp && zip -q -r $(abspath $(PRIVATE_INTERMEDIATES_DEXCORE_JAR)) .
$(hide) cp $(PRIVATE_VMTESTS_GENERATED_RESOURCES) $@
$(hide) cd $(PRIVATE_INTERMEDIATES_HOSTJUNIT_FILES)/classes && zip -q -r ../../$(notdir $@) .
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit16/d/T_add_int_lit16_5.java b/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit16/d/T_add_int_lit16_5.java
index f22579d..626c867 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit16/d/T_add_int_lit16_5.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit16/d/T_add_int_lit16_5.java
@@ -18,6 +18,7 @@
public class T_add_int_lit16_5 {
+ @SuppressWarnings("ConstantOverflow")
public int run() {
return 0x7ffffffe + 2;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit8/d/T_add_int_lit8_5.java b/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit8/d/T_add_int_lit8_5.java
index 6691276..8f22f7f 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit8/d/T_add_int_lit8_5.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/add_int_lit8/d/T_add_int_lit8_5.java
@@ -18,6 +18,7 @@
public class T_add_int_lit8_5 {
+ @SuppressWarnings("ConstantOverflow")
public int run() {
return 0x7ffffffe + 2;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit16/d/T_div_int_lit16_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit16/d/T_div_int_lit16_13.java
index bbbab37..1d9a7fd 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit16/d/T_div_int_lit16_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit16/d/T_div_int_lit16_13.java
@@ -18,6 +18,7 @@
public class T_div_int_lit16_13 {
+ @SuppressWarnings("ConstantOverflow")
public int run() {
return 1 / 0;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit8/d/T_div_int_lit8_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit8/d/T_div_int_lit8_13.java
index 2e8cbcb..ed372d3 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit8/d/T_div_int_lit8_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/div_int_lit8/d/T_div_int_lit8_13.java
@@ -18,6 +18,7 @@
public class T_div_int_lit8_13 {
+ @SuppressWarnings("ConstantOverflow")
public int run() {
return 1 / 0;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_1.java b/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_1.java
index 9edf6ea..951250f 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_1.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_1.java
@@ -18,6 +18,7 @@
public class T_move_exception_1 {
+ @SuppressWarnings("ConstantOverflow")
public void run() {
try{
int a = 15/0;
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_2.java b/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_2.java
index ed66c22..718d5c1 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_2.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/move_exception/d/T_move_exception_2.java
@@ -18,6 +18,7 @@
public class T_move_exception_2 {
+ @SuppressWarnings("ConstantOverflow")
public boolean run() {
try {
int a = 15/0;
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/new_instance/d/T_new_instance_3.java b/tools/vm-tests-tf/src/dot/junit/opcodes/new_instance/d/T_new_instance_3.java
index dd8bb15..3b85b03 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/new_instance/d/T_new_instance_3.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/new_instance/d/T_new_instance_3.java
@@ -18,6 +18,7 @@
public class T_new_instance_3 {
+ @SuppressWarnings("ConstantOverflow")
static int i = 123 / 0;
public static int run() {
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/sput/d/T_sput_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/sput/d/T_sput_13.java
index 4693899..61cd6ed 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/sput/d/T_sput_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/sput/d/T_sput_13.java
@@ -17,6 +17,7 @@
package dot.junit.opcodes.sput.d;
class StubInitError {
+ @SuppressWarnings("ConstantOverflow")
static int value = 5 / 0;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_boolean/d/T_sput_boolean_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_boolean/d/T_sput_boolean_13.java
index 20d2977..7192b0f 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_boolean/d/T_sput_boolean_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_boolean/d/T_sput_boolean_13.java
@@ -17,6 +17,7 @@
package dot.junit.opcodes.sput_boolean.d;
class StubInitError {
+ @SuppressWarnings("ConstantOverflow")
static boolean value = 5 / 0 > 0 ? true : false;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_byte/d/T_sput_byte_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_byte/d/T_sput_byte_13.java
index 5270328..a31f919 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_byte/d/T_sput_byte_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_byte/d/T_sput_byte_13.java
@@ -17,6 +17,7 @@
package dot.junit.opcodes.sput_byte.d;
class StubInitError {
+ @SuppressWarnings("ConstantOverflow")
static byte value = (byte)(5 / 0);
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_char/d/T_sput_char_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_char/d/T_sput_char_13.java
index 786f121..6ff35b5 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_char/d/T_sput_char_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_char/d/T_sput_char_13.java
@@ -17,6 +17,7 @@
package dot.junit.opcodes.sput_char.d;
class StubInitError {
+ @SuppressWarnings("ConstantOverflow")
static char value = (char)(5 / 0);
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_object/d/T_sput_object_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_object/d/T_sput_object_13.java
index 9e16873..e66e7b1 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_object/d/T_sput_object_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_object/d/T_sput_object_13.java
@@ -17,6 +17,7 @@
package dot.junit.opcodes.sput_object.d;
class StubInitError {
+ @SuppressWarnings("ConstantOverflow")
static short t = (short)(5 / 0);
static Object value;
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_short/d/T_sput_short_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_short/d/T_sput_short_13.java
index 3750c17..afc2f26 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_short/d/T_sput_short_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_short/d/T_sput_short_13.java
@@ -17,6 +17,7 @@
package dot.junit.opcodes.sput_short.d;
class StubInitError {
+ @SuppressWarnings("ConstantOverflow")
static short value = (short)(5 / 0);
}
diff --git a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_wide/d/T_sput_wide_13.java b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_wide/d/T_sput_wide_13.java
index ab71754..21780d8 100644
--- a/tools/vm-tests-tf/src/dot/junit/opcodes/sput_wide/d/T_sput_wide_13.java
+++ b/tools/vm-tests-tf/src/dot/junit/opcodes/sput_wide/d/T_sput_wide_13.java
@@ -17,6 +17,7 @@
package dot.junit.opcodes.sput_wide.d;
class StubInitError {
+ @SuppressWarnings("ConstantOverflow")
static long value = (long)(5 / 0);
}