Merge "Log exception when unable to create device report log." into nyc-dev
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ContactsTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ContactsTest.java
index d9e56cb..f0fada4 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ContactsTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ContactsTest.java
@@ -981,7 +981,7 @@
while (cursor.moveToNext()) {
final long directoryId = cursor.getLong(0);
if (!Directory.isEnterpriseDirectoryId(directoryId)
- && Directory.isRemoteDirectory(directoryId)) {
+ && Directory.isRemoteDirectoryId(directoryId)) {
return directoryId;
}
}
@@ -1008,7 +1008,7 @@
while (cursor.moveToNext()) {
final long directoryId = cursor.getLong(0);
if (Directory.isEnterpriseDirectoryId(directoryId)
- && Directory.isRemoteDirectory(directoryId)) {
+ && Directory.isRemoteDirectoryId(directoryId)) {
return directoryId;
}
}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
index d760475..60c2b9b 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
@@ -73,7 +73,11 @@
addRestrictBackgroundWhitelist(mUid);
assertRestrictBackgroundChangedReceived(2);
assertRestrictBackgroundStatus(RESTRICT_BACKGROUND_STATUS_WHITELISTED);
- }
+
+ removeRestrictBackgroundWhitelist(mUid);
+ assertRestrictBackgroundChangedReceived(3);
+ assertRestrictBackgroundStatus(RESTRICT_BACKGROUND_STATUS_ENABLED);
+ }
public void testGetRestrictBackgroundStatus_enabled() throws Exception {
setRestrictBackground(true);
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java b/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
index 435e201..ece09c8 100644
--- a/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
+++ b/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
@@ -60,15 +60,17 @@
}
public void testDataSaverMode_reinstall() throws Exception {
- final int oldUid = getUid(TEST_PKG);
- testDataSaverMode_whitelisted();
+ final int oldUid = getUid(TEST_APP2_PKG);
- uninstallPackage(TEST_PKG, true);
- assertPackageUninstalled(TEST_PKG);
+ // Make sure whitelist is revoked when package is removed
+ addRestrictBackgroundWhitelist(oldUid);
+
+ uninstallPackage(TEST_APP2_PKG, true);
+ assertPackageUninstalled(TEST_APP2_PKG);
assertRestrictBackgroundWhitelist(oldUid, false);
- installPackage(TEST_APK);
- final int newUid = getUid(TEST_PKG);
+ installPackage(TEST_APP2_APK);
+ final int newUid = getUid(TEST_APP2_PKG);
assertRestrictBackgroundWhitelist(oldUid, false);
assertRestrictBackgroundWhitelist(newUid, false);
}
@@ -94,14 +96,14 @@
}
public void testBatterySaverMode_reinstall() throws Exception {
- testBatterySaverMode_whitelisted();
+ addPowerSaveModeWhitelist(TEST_APP2_PKG);
- uninstallPackage(TEST_PKG, true);
- assertPackageUninstalled(TEST_PKG);
- assertPowerSaveModeWhitelist(TEST_PKG, false);
+ uninstallPackage(TEST_APP2_PKG, true);
+ assertPackageUninstalled(TEST_APP2_PKG);
+ assertPowerSaveModeWhitelist(TEST_APP2_PKG, false);
- installPackage(TEST_APK);
- assertPowerSaveModeWhitelist(TEST_PKG, false);
+ installPackage(TEST_APP2_APK);
+ assertPowerSaveModeWhitelist(TEST_APP2_PKG, false);
}
public void testBatterySaverModeNonMetered_disabled() throws Exception {
@@ -160,4 +162,17 @@
fail("Command '" + command + "' did not return '" + expectedResult + "' after " + maxTries
+ " attempts");
}
+
+ protected void addRestrictBackgroundWhitelist(int uid) throws Exception {
+ runCommand("cmd netpolicy add restrict-background-whitelist " + uid);
+ assertRestrictBackgroundWhitelist(uid, true);
+ }
+
+ private void addPowerSaveModeWhitelist(String packageName) throws Exception {
+ Log.i(TAG, "Adding package " + packageName + " to power-save-mode whitelist");
+ // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
+ // need to use netpolicy for whitelisting
+ runCommand("dumpsys deviceidle whitelist +" + packageName);
+ assertPowerSaveModeWhitelist(packageName, true); // Sanity check
+ }
}
diff --git a/hostsidetests/os/Android.mk b/hostsidetests/os/Android.mk
index 3cc1fad..8e334fe 100644
--- a/hostsidetests/os/Android.mk
+++ b/hostsidetests/os/Android.mk
@@ -23,7 +23,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed-prebuilt
+LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed-prebuilt compatibility-host-util cts-migration-lib
LOCAL_CTS_TEST_PACKAGE := android.host.os
diff --git a/hostsidetests/os/src/android/os/cts/OsHostTests.java b/hostsidetests/os/src/android/os/cts/OsHostTests.java
index 73e36c5..d9d3ca4 100644
--- a/hostsidetests/os/src/android/os/cts/OsHostTests.java
+++ b/hostsidetests/os/src/android/os/cts/OsHostTests.java
@@ -16,13 +16,29 @@
package android.os.cts;
+import com.android.compatibility.common.util.AbiUtils;
+import com.android.cts.migration.MigrationHelper;
import com.android.tradefed.build.IBuildInfo;
import com.android.tradefed.device.CollectingOutputReceiver;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IAbi;
+import com.android.tradefed.testtype.IAbiReceiver;
import com.android.tradefed.testtype.IBuildReceiver;
-public class OsHostTests extends DeviceTestCase implements IBuildReceiver {
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class OsHostTests extends DeviceTestCase implements IBuildReceiver, IAbiReceiver {
private static final String TEST_APP_PACKAGE = "android.os.app";
private static final String TEST_NON_EXPORTED_ACTIVITY_CLASS = "TestNonExported";
@@ -30,13 +46,31 @@
"am start -n %s/%s.%s",
TEST_APP_PACKAGE, TEST_APP_PACKAGE, TEST_NON_EXPORTED_ACTIVITY_CLASS);
+ // Testing the intent filter verification mechanism
+ private static final String HOST_VERIFICATION_APK = "CtsHostLinkVerificationApp.apk";
+ private static final String HOST_VERIFICATION_PKG = "com.android.cts.openlinksskeleton";
+ private static final String FILTER_VERIFIER_REGEXP =
+ "Verifying IntentFilter\\..* package:\"" + HOST_VERIFICATION_PKG + "\"";
+ private static final Pattern HOST_PATTERN = Pattern.compile(".*hosts:\"(.*?)\"");
+ // domains that should be validated against given our test apk
+ private static final String HOST_EXPLICIT = "explicit.example.com";
+ private static final String HOST_WILDCARD = "wildcard.tld";
+
/**
* A reference to the device under test.
*/
private ITestDevice mDevice;
+ private IAbi mAbi;
+ private IBuildInfo mCtsBuild;
+
+ @Override
+ public void setAbi(IAbi abi) {
+ mAbi = abi;
+ }
@Override
public void setBuild(IBuildInfo buildInfo) {
+ mCtsBuild = buildInfo;
}
@Override
@@ -60,4 +94,57 @@
assertTrue(output.contains("Permission Denial") && output.contains(" not exported"));
}
+
+ public void testIntentFilterHostValidation() throws Exception {
+ String line = null;
+ try {
+ // Clean slate in case of earlier aborted run
+ mDevice.uninstallPackage(HOST_VERIFICATION_PKG);
+
+ String[] options = { AbiUtils.createAbiFlag(mAbi.getName()) };
+
+ mDevice.executeAdbCommand("logcat", "-c");
+
+ String installResult = getDevice().installPackage(getTestAppFile(HOST_VERIFICATION_APK),
+ false /* = reinstall? */, options);
+
+ assertNull("Couldn't install web intent filter sample apk", installResult);
+
+ String logs = mDevice.executeAdbCommand("logcat", "-v", "brief", "-d");
+ boolean foundVerifierOutput = false;
+ Pattern verifierPattern = Pattern.compile(FILTER_VERIFIER_REGEXP);
+ Scanner scanner = new Scanner(logs);
+ while (scanner.hasNextLine()) {
+ line = scanner.nextLine();
+ Matcher verifierMatcher = verifierPattern.matcher(line);
+ if (verifierMatcher.find()) {
+ Matcher m = HOST_PATTERN.matcher(line);
+ assertTrue(m.find());
+ final String hostgroup = m.group(1);
+ HashSet<String> allHosts = new HashSet<String>(
+ Arrays.asList(hostgroup.split(" ")));
+ assertTrue(allHosts.size() == 2);
+ assertTrue(allHosts.contains(HOST_EXPLICIT));
+ assertTrue(allHosts.contains(HOST_WILDCARD));
+ foundVerifierOutput = true;
+ break;
+ }
+ }
+
+ assertTrue(foundVerifierOutput);
+ } catch (Exception e) {
+ fail("Unable to parse verification results: " + e.getMessage()
+ + " line=" + line);
+ } finally {
+ // Finally, uninstall the app
+ mDevice.uninstallPackage(HOST_VERIFICATION_PKG);
+ }
+ }
+
+ /*
+ * Helper: find a test apk
+ */
+ private File getTestAppFile(String fileName) throws FileNotFoundException {
+ return MigrationHelper.getTestFile(mCtsBuild, fileName);
+ }
}
diff --git a/hostsidetests/os/test-apps/Android.mk b/hostsidetests/os/test-apps/Android.mk
new file mode 100644
index 0000000..4afd486
--- /dev/null
+++ b/hostsidetests/os/test-apps/Android.mk
@@ -0,0 +1,23 @@
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+# tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts
+
+# Build the test APKs using their own makefiles
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
new file mode 100644
index 0000000..76aa570
--- /dev/null
+++ b/hostsidetests/os/test-apps/HostLinkVerificationApp/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+LOCAL_SDK_VERSION := current
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsHostLinkVerificationApp
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts
+
+include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/os/test-apps/HostLinkVerificationApp/AndroidManifest.xml b/hostsidetests/os/test-apps/HostLinkVerificationApp/AndroidManifest.xml
new file mode 100644
index 0000000..9480418
--- /dev/null
+++ b/hostsidetests/os/test-apps/HostLinkVerificationApp/AndroidManifest.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- Declare the contents of this Android application. The namespace
+ attribute brings in the Android platform namespace, and the package
+ supplies a unique name for the application. When writing your
+ own application, the package name must be changed from "com.example.*"
+ to come from a domain that you own or have control over. -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.openlinksskeleton"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <application android:label="Open Links Skeleton" android:hasCode="false" >
+
+ <activity android:name="DummyWebLinkActivity">
+ <intent-filter android:autoVerify="true">
+ <action android:name="android.intent.action.VIEW" />
+ <category android:name="android.intent.category.DEFAULT" />
+ <category android:name="android.intent.category.BROWSABLE" />
+ <data android:scheme="http" />
+ <data android:scheme="https" />
+ <data android:host="explicit.example.com" />
+ <data android:host="*.wildcard.tld" />
+ </intent-filter>
+ </activity>
+
+ </application>
+</manifest>
diff --git a/hostsidetests/services/activitymanager/app/Android.mk b/hostsidetests/services/activitymanager/app/Android.mk
index 481a4ce..e22ace8 100644
--- a/hostsidetests/services/activitymanager/app/Android.mk
+++ b/hostsidetests/services/activitymanager/app/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := test_current
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts
diff --git a/hostsidetests/services/activitymanager/app/src/android/server/app/AlwaysFocusablePipActivity.java b/hostsidetests/services/activitymanager/app/src/android/server/app/AlwaysFocusablePipActivity.java
index 3c6f6a1..b5c736d 100644
--- a/hostsidetests/services/activitymanager/app/src/android/server/app/AlwaysFocusablePipActivity.java
+++ b/hostsidetests/services/activitymanager/app/src/android/server/app/AlwaysFocusablePipActivity.java
@@ -24,8 +24,6 @@
import android.content.Intent;
import android.graphics.Rect;
-import java.lang.reflect.Method;
-
public class AlwaysFocusablePipActivity extends Activity {
static void launchAlwaysFocusablePipActivity(Activity caller) {
@@ -34,21 +32,7 @@
final ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchBounds(new Rect(0, 0, 500, 500));
- try {
- setLaunchStackId(options);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
+ options.setLaunchStackId(4 /* ActivityManager.StackId.PINNED_STACK_ID */);
caller.startActivity(intent, options.toBundle());
}
-
- /** ActivityOptions#setLaunchStackId is a @hidden API so we access it through reflection...*/
- static void setLaunchStackId(ActivityOptions options) throws Exception {
- final Method method = options.getClass().getDeclaredMethod(
- "setLaunchStackId", new Class[] { int.class });
-
- method.setAccessible(true);
- method.invoke(options, 4 /* ActivityManager.StackId.PINNED_STACK_ID */);
- }
}
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/ScanFilterTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/ScanFilterTest.java
index 16e1413..1d78ebb 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/ScanFilterTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/ScanFilterTest.java
@@ -20,6 +20,7 @@
import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.ScanFilter;
import android.bluetooth.le.ScanResult;
+import android.content.pm.PackageManager;
import android.os.Parcel;
import android.os.ParcelUuid;
import android.test.AndroidTestCase;
@@ -55,14 +56,24 @@
};
BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- BluetoothDevice device = adapter.getRemoteDevice(DEVICE_MAC);
- mScanResult = new ScanResult(device, TestUtils.parseScanRecord(scanRecord),
- -10, 1397545200000000L);
- mFilterBuilder = new ScanFilter.Builder();
+ if (adapter == null) {
+ // Bluetooth is not supported
+ assertFalse(mContext.getPackageManager().
+ hasSystemFeature(PackageManager.FEATURE_BLUETOOTH));
+ } else {
+ assertTrue(mContext.getPackageManager().
+ hasSystemFeature(PackageManager.FEATURE_BLUETOOTH));
+ BluetoothDevice device = adapter.getRemoteDevice(DEVICE_MAC);
+ mScanResult = new ScanResult(device, TestUtils.parseScanRecord(scanRecord),
+ -10, 1397545200000000L);
+ mFilterBuilder = new ScanFilter.Builder();
+ }
}
@SmallTest
public void testsetNameFilter() {
+ if (mFilterBuilder == null) return;
+
ScanFilter filter = mFilterBuilder.setDeviceName(LOCAL_NAME).build();
assertEquals(LOCAL_NAME, filter.getDeviceName());
assertTrue("setName filter fails", filter.matches(mScanResult));
@@ -73,6 +84,8 @@
@SmallTest
public void testDeviceAddressFilter() {
+ if (mFilterBuilder == null) return;
+
ScanFilter filter = mFilterBuilder.setDeviceAddress(DEVICE_MAC).build();
assertEquals(DEVICE_MAC, filter.getDeviceAddress());
assertTrue("device filter fails", filter.matches(mScanResult));
@@ -83,6 +96,8 @@
@SmallTest
public void testsetServiceUuidFilter() {
+ if (mFilterBuilder == null) return;
+
ScanFilter filter = mFilterBuilder.setServiceUuid(
ParcelUuid.fromString(UUID1)).build();
assertEquals(UUID1, filter.getServiceUuid().toString());
@@ -104,6 +119,8 @@
@SmallTest
public void testsetServiceDataFilter() {
+ if (mFilterBuilder == null) return;
+
byte[] setServiceData = new byte[] {
0x50, 0x64 };
ParcelUuid serviceDataUuid = ParcelUuid.fromString(UUID2);
@@ -135,6 +152,8 @@
@SmallTest
public void testManufacturerSpecificData() {
+ if (mFilterBuilder == null) return;
+
byte[] manufacturerData = new byte[] {
0x02, 0x15 };
int manufacturerId = 0xE0;
@@ -170,6 +189,8 @@
@SmallTest
public void testReadWriteParcel() {
+ if (mFilterBuilder == null) return;
+
ScanFilter filter = mFilterBuilder.build();
testReadWriteParcelForFilter(filter);
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/ScanResultTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/ScanResultTest.java
index 91da8c3..f323712 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/ScanResultTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/ScanResultTest.java
@@ -19,6 +19,7 @@
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.ScanResult;
+import android.content.pm.PackageManager;
import android.os.Parcel;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
@@ -41,6 +42,9 @@
*/
@SmallTest
public void testScanResultParceling() {
+ if (! mContext.getPackageManager().
+ hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) return;
+
BluetoothDevice device =
BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
ScanResult result = new ScanResult(device, TestUtils.parseScanRecord(SCAN_RECORD), RSSI,
@@ -59,6 +63,9 @@
@SmallTest
public void testDescribeContents() {
+ if (! mContext.getPackageManager().
+ hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) return;
+
BluetoothDevice device =
BluetoothAdapter.getDefaultAdapter().getRemoteDevice(DEVICE_ADDRESS);
ScanResult result = new ScanResult(device, TestUtils.parseScanRecord(SCAN_RECORD), RSSI,
diff --git a/tests/tests/draganddrop/Android.mk b/tests/tests/draganddrop/Android.mk
index 8b59788..5042624 100644
--- a/tests/tests/draganddrop/Android.mk
+++ b/tests/tests/draganddrop/Android.mk
@@ -34,7 +34,7 @@
LOCAL_PACKAGE_NAME := CtsDragAndDropTestCases
-LOCAL_SDK_VERSION := current
+LOCAL_SDK_VERSION := test_current
include $(BUILD_PACKAGE)
diff --git a/tests/tests/draganddrop/dragsource/res/layout/main_activity.xml b/tests/tests/draganddrop/dragsource/res/layout/main_activity.xml
index cac6a082..98c8202 100644
--- a/tests/tests/draganddrop/dragsource/res/layout/main_activity.xml
+++ b/tests/tests/draganddrop/dragsource/res/layout/main_activity.xml
@@ -21,91 +21,11 @@
android:orientation="vertical">
<TextView
- android:id="@+id/dont_grant"
+ android:id="@+id/source"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/dont_grant_label">
- </TextView>
-
- <TextView
- android:id="@+id/grant_read"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/grant_read_label">
- </TextView>
-
- <TextView
- android:id="@+id/grant_write"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/grant_write_label">
- </TextView>
-
- <TextView
- android:id="@+id/grant_read_prefix"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/grant_read_prefix_label">
- </TextView>
-
- <TextView
- android:id="@+id/grant_read_noprefix"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/grant_read_noprefix_label">
- </TextView>
-
- <TextView
- android:id="@+id/grant_read_persistable"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/grant_read_persistable_label">
- </TextView>
-
- <TextView
- android:id="@+id/disallow_global"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#aaa"
- android:text="@string/disallow_global_label">
- </TextView>
-
- <TextView
- android:id="@+id/cancel_soon"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#aaa"
- android:text="@string/cancel_soon_label">
+ android:background="#ddd">
</TextView>
</LinearLayout>
\ No newline at end of file
diff --git a/tests/tests/draganddrop/dragsource/res/values/dimen.xml b/tests/tests/draganddrop/dragsource/res/values/dimen.xml
deleted file mode 100644
index 4923a32..0000000
--- a/tests/tests/draganddrop/dragsource/res/values/dimen.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
- <dimen name="item_margin">6dp</dimen>
- <dimen name="item_padding">6dp</dimen>
-</resources>
diff --git a/tests/tests/draganddrop/dragsource/res/values/strings.xml b/tests/tests/draganddrop/dragsource/res/values/strings.xml
deleted file mode 100644
index 28cd792..0000000
--- a/tests/tests/draganddrop/dragsource/res/values/strings.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
-
- <string name="dont_grant_label">Do not grant permissions</string>
- <string name="disallow_global_label">Disallow global drag</string>
- <string name="cancel_soon_label">Cancel soon after start</string>
- <string name="grant_read_label">Grant read permissions</string>
- <string name="grant_write_label">Grant write permissions</string>
- <string name="grant_read_prefix_label">Grant read+prefix permissions</string>
- <string name="grant_read_noprefix_label">Grant read, no prefix permissions</string>
- <string name="grant_read_persistable_label">Grant read+persistable</string>
-
-</resources>
diff --git a/tests/tests/draganddrop/dragsource/src/android/dnd/cts/dragsource/DragSource.java b/tests/tests/draganddrop/dragsource/src/android/dnd/cts/dragsource/DragSource.java
index bbba70d..df93852 100644
--- a/tests/tests/draganddrop/dragsource/src/android/dnd/cts/dragsource/DragSource.java
+++ b/tests/tests/draganddrop/dragsource/src/android/dnd/cts/dragsource/DragSource.java
@@ -24,6 +24,7 @@
import android.os.Handler;
import android.os.PersistableBundle;
import android.view.View;
+import android.widget.TextView;
public class DragSource extends Activity{
private static final String URI_PREFIX =
@@ -41,30 +42,35 @@
final Uri plainUri = Uri.parse(URI_PREFIX + "/" + MAGIC_VALUE);
- setUpDragSource(R.id.disallow_global, plainUri, 0);
- setUpDragSource(R.id.cancel_soon, plainUri, View.DRAG_FLAG_GLOBAL);
+ setUpDragSource("disallow_global", plainUri, 0);
+ setUpDragSource("cancel_soon", plainUri, View.DRAG_FLAG_GLOBAL);
- setUpDragSource(R.id.dont_grant, plainUri, View.DRAG_FLAG_GLOBAL);
- setUpDragSource(R.id.grant_read, plainUri,
+ setUpDragSource("dont_grant", plainUri, View.DRAG_FLAG_GLOBAL);
+ setUpDragSource("grant_read", plainUri,
View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_GLOBAL_URI_READ);
- setUpDragSource(R.id.grant_write, plainUri,
+ setUpDragSource("grant_write", plainUri,
View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_GLOBAL_URI_WRITE);
- setUpDragSource(R.id.grant_read_persistable, plainUri,
+ setUpDragSource("grant_read_persistable", plainUri,
View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_GLOBAL_URI_READ |
View.DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION);
final Uri prefixUri = Uri.parse(URI_PREFIX);
- setUpDragSource(R.id.grant_read_prefix, prefixUri,
+ setUpDragSource("grant_read_prefix", prefixUri,
View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_GLOBAL_URI_READ |
View.DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION);
- setUpDragSource(R.id.grant_read_noprefix, prefixUri,
+ setUpDragSource("grant_read_noprefix", prefixUri,
View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_GLOBAL_URI_READ);
}
- private void setUpDragSource(final int resourceId, final Uri uri, final int flags) {
- findViewById(resourceId).setOnLongClickListener(new View.OnLongClickListener() {
+ private void setUpDragSource(String mode, final Uri uri, final int flags) {
+ if (!mode.equals(getIntent().getStringExtra("mode"))) {
+ return;
+ }
+ final View source = findViewById(R.id.source);
+ ((TextView) source).setText(mode);
+ source.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(final View v) {
final ClipDescription clipDescription = new ClipDescription("", new String[] {
@@ -78,7 +84,7 @@
new View.DragShadowBuilder(v),
null,
flags);
- if (resourceId == R.id.cancel_soon) {
+ if (mode.equals("cancel_soon")) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
diff --git a/tests/tests/draganddrop/droptarget/res/layout/main_activity.xml b/tests/tests/draganddrop/droptarget/res/layout/main_activity.xml
index 4a5a5b1..509debc 100644
--- a/tests/tests/draganddrop/droptarget/res/layout/main_activity.xml
+++ b/tests/tests/draganddrop/droptarget/res/layout/main_activity.xml
@@ -21,58 +21,11 @@
android:orientation="vertical">
<TextView
- android:id="@+id/dont_request"
+ android:id="@+id/target"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/dont_request_label">
- </TextView>
-
- <TextView
- android:id="@+id/request_read"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/request_read_label">
- </TextView>
-
- <TextView
- android:id="@+id/request_write"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/request_write_label">
- </TextView>
-
- <TextView
- android:id="@+id/request_read_nested"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/request_read_nested_label">
- </TextView>
-
- <TextView
- android:id="@+id/request_take_persistable"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:layout_margin="@dimen/item_margin"
- android:padding="@dimen/item_padding"
- android:background="#ddd"
- android:text="@string/request_take_persistable_label">
+ android:background="#ddd">
</TextView>
<TextView
diff --git a/tests/tests/draganddrop/droptarget/res/values/dimen.xml b/tests/tests/draganddrop/droptarget/res/values/dimen.xml
deleted file mode 100644
index 4923a32..0000000
--- a/tests/tests/draganddrop/droptarget/res/values/dimen.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<resources>
- <dimen name="item_margin">6dp</dimen>
- <dimen name="item_padding">6dp</dimen>
-</resources>
diff --git a/tests/tests/draganddrop/droptarget/res/values/strings.xml b/tests/tests/draganddrop/droptarget/res/values/strings.xml
index 9fa4619..ea0cc34 100644
--- a/tests/tests/draganddrop/droptarget/res/values/strings.xml
+++ b/tests/tests/draganddrop/droptarget/res/values/strings.xml
@@ -15,12 +15,5 @@
-->
<resources>
-
- <string name="dont_request_label">Do not request permissions, read</string>
- <string name="request_read_label">Request permissions, read</string>
- <string name="request_write_label">Request permissions, write</string>
- <string name="request_read_nested_label">Request permissions, read nested</string>
- <string name="request_take_persistable_label">Request permissions, take persistable</string>
<string name="not_available_label">N/A</string>
-
</resources>
diff --git a/tests/tests/draganddrop/droptarget/src/android/dnd/cts/droptarget/DropTarget.java b/tests/tests/draganddrop/droptarget/src/android/dnd/cts/droptarget/DropTarget.java
index 7c157b5..62c7d16 100644
--- a/tests/tests/draganddrop/droptarget/src/android/dnd/cts/droptarget/DropTarget.java
+++ b/tests/tests/draganddrop/droptarget/src/android/dnd/cts/droptarget/DropTarget.java
@@ -40,15 +40,20 @@
View view = getLayoutInflater().inflate(R.layout.main_activity, null);
setContentView(view);
- setUpDropTarget(R.id.dont_request, new OnDragUriReadListener(false));
- setUpDropTarget(R.id.request_read, new OnDragUriReadListener());
- setUpDropTarget(R.id.request_write, new OnDragUriWriteListener());
- setUpDropTarget(R.id.request_read_nested, new OnDragUriReadPrefixListener());
- setUpDropTarget(R.id.request_take_persistable, new OnDragUriTakePersistableListener());
+ setUpDropTarget("dont_request", new OnDragUriReadListener(false));
+ setUpDropTarget("request_read", new OnDragUriReadListener());
+ setUpDropTarget("request_write", new OnDragUriWriteListener());
+ setUpDropTarget("request_read_nested", new OnDragUriReadPrefixListener());
+ setUpDropTarget("request_take_persistable", new OnDragUriTakePersistableListener());
}
- private void setUpDropTarget(final int targetResourceId, OnDragUriListener listener) {
- findViewById(targetResourceId).setOnDragListener(listener);
+ private void setUpDropTarget(String mode, OnDragUriListener listener) {
+ if (!mode.equals(getIntent().getStringExtra("mode"))) {
+ return;
+ }
+ final View target = findViewById(R.id.target);
+ ((TextView) target).setText(mode);
+ target.setOnDragListener(listener);
}
private String checkExtraValue(DragEvent event) {
diff --git a/tests/tests/draganddrop/src/android/dnd/cts/DragAndDropTest.java b/tests/tests/draganddrop/src/android/dnd/cts/DragAndDropTest.java
index a10014a..e91e9c9 100644
--- a/tests/tests/draganddrop/src/android/dnd/cts/DragAndDropTest.java
+++ b/tests/tests/draganddrop/src/android/dnd/cts/DragAndDropTest.java
@@ -26,7 +26,6 @@
import android.support.test.uiautomator.Until;
import android.test.InstrumentationTestCase;
-import java.lang.reflect.Method;
import java.util.concurrent.TimeoutException;
public class DragAndDropTest extends InstrumentationTestCase {
@@ -47,25 +46,14 @@
mDevice = UiDevice.getInstance(getInstrumentation());
}
- /** ActivityOptions#setLaunchStackId is a @hidden API so we access it through reflection. */
- private static void setLaunchStackId(ActivityOptions options, int stackId) throws Exception {
- final Method method = options.getClass().getDeclaredMethod("setLaunchStackId", int.class);
-
- method.setAccessible(true);
- method.invoke(options, stackId);
- }
-
- private void startAppInStack(String packageName, int stackId) {
+ private void startAppInStack(String packageName, int stackId, String mode) {
Context context = getInstrumentation().getContext();
Intent intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
+ intent.putExtra("mode", mode);
ActivityOptions options = ActivityOptions.makeBasic();
- try {
- setLaunchStackId(options, stackId);
- } catch (Exception e) {
- fail(e.getMessage());
- }
+ options.setLaunchStackId(stackId);
context.startActivity(intent, options.toBundle());
// Wait for the app to appear
@@ -84,12 +72,12 @@
mDevice.drag(srcPosition.x, srcPosition.y, tgtPosition.x, tgtPosition.y, 100);
}
- private void doCrossAppDrag(String sourceViewId, String targetViewId, String expectedResult) {
- startAppInStack(DRAG_SOURCE_PKG, DOCKED_STACK_ID);
- Point srcPosition = getVisibleCenter(DRAG_SOURCE_PKG, sourceViewId);
+ private void doCrossAppDrag(String sourceMode, String targetMode, String expectedResult) {
+ startAppInStack(DRAG_SOURCE_PKG, DOCKED_STACK_ID, sourceMode);
+ Point srcPosition = getVisibleCenter(DRAG_SOURCE_PKG, "source");
- startAppInStack(DROP_TARGET_PKG, FREEFORM_WORKSPACE_STACK_ID);
- Point tgtPosition = getVisibleCenter(DROP_TARGET_PKG, targetViewId);
+ startAppInStack(DROP_TARGET_PKG, FREEFORM_WORKSPACE_STACK_ID, targetMode);
+ Point tgtPosition = getVisibleCenter(DROP_TARGET_PKG, "target");
drag(srcPosition, tgtPosition);
diff --git a/tests/tests/print/src/android/print/cts/BasePrintTest.java b/tests/tests/print/src/android/print/cts/BasePrintTest.java
index ec10789..497c63e 100644
--- a/tests/tests/print/src/android/print/cts/BasePrintTest.java
+++ b/tests/tests/print/src/android/print/cts/BasePrintTest.java
@@ -160,6 +160,8 @@
@Override
public void setUp() throws Exception {
+ Log.d(LOG_TAG, "setUp()");
+
super.setUp();
if (!supportsPrinting()) {
return;
@@ -168,7 +170,9 @@
mUiDevice = UiDevice.getInstance(getInstrumentation());
// Make sure we start with a clean slate.
+ Log.d(LOG_TAG, "clearPrintSpoolerData()");
clearPrintSpoolerData();
+ Log.d(LOG_TAG, "disableImes()");
disableImes();
// Workaround for dexmaker bug: https://code.google.com/p/dexmaker/issues/detail?id=2
@@ -177,6 +181,7 @@
.getTargetContext().getCacheDir().getPath());
// Set to US locale.
+ Log.d(LOG_TAG, "set locale");
Resources resources = getInstrumentation().getTargetContext().getResources();
Configuration oldConfiguration = resources.getConfiguration();
if (!oldConfiguration.getLocales().get(0).equals(Locale.US)) {
@@ -188,6 +193,7 @@
}
// Initialize the latches.
+ Log.d(LOG_TAG, "init counters");
mCancelOperationCounter = new CallCounter();
mLayoutCallCounter = new CallCounter();
mFinishCallCounter = new CallCounter();
@@ -198,23 +204,30 @@
mDestroySessionCallCounter = new CallCounter();
// Create the activity for the right locale.
+ Log.d(LOG_TAG, "createActivity()");
createActivity();
+ Log.d(LOG_TAG, "setUp() done");
}
@Override
public void tearDown() throws Exception {
+ Log.d(LOG_TAG, "tearDown()");
+
if (!supportsPrinting()) {
return;
}
// Done with the activity.
+ Log.d(LOG_TAG, "finish activity");
if (!getActivity().isFinishing()) {
getActivity().finish();
}
+ Log.d(LOG_TAG, "enableImes()");
enableImes();
// Restore the locale if needed.
+ Log.d(LOG_TAG, "restore locale");
if (mOldLocale != null) {
Resources resources = getInstrumentation().getTargetContext().getResources();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
@@ -225,9 +238,11 @@
}
// Make sure the spooler is cleaned, this also un-approves all services
+ Log.d(LOG_TAG, "clearPrintSpoolerData()");
clearPrintSpoolerData();
super.tearDown();
+ Log.d(LOG_TAG, "tearDown() done");
}
protected void print(final PrintDocumentAdapter adapter, final PrintAttributes attributes) {
@@ -767,16 +782,24 @@
protected void makeDefaultPrinter(PrintDocumentAdapter adapter, String printerName)
throws Exception {
// Perform a full print operation on the printer
+ Log.d(LOG_TAG, "print");
print(adapter);
+ Log.d(LOG_TAG, "waitForWriteAdapterCallback");
waitForWriteAdapterCallback(1);
+ Log.d(LOG_TAG, "selectPrinter");
selectPrinter(printerName);
+ Log.d(LOG_TAG, "clickPrintButton");
clickPrintButton();
+ Log.d(LOG_TAG, "answerPrintServicesWarning");
answerPrintServicesWarning(true);
+ Log.d(LOG_TAG, "waitForPrinterDiscoverySessionDestroyCallbackCalled");
waitForPrinterDiscoverySessionDestroyCallbackCalled(1);
// Switch to new activity, which should now use the default printer
+ Log.d(LOG_TAG, "getActivity().finish()");
getActivity().finish();
+ Log.d(LOG_TAG, "createActivity");
createActivity();
}
diff --git a/tests/tests/print/src/android/print/cts/PrintAttributesTest.java b/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
index a489499..5459c31 100644
--- a/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
@@ -36,6 +36,7 @@
import android.print.cts.services.StubbablePrinterDiscoverySession;
import android.printservice.PrintJob;
+import android.util.Log;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -47,6 +48,7 @@
* Test that the print attributes are correctly propagated through the print framework
*/
public class PrintAttributesTest extends BasePrintTest {
+ private static final String LOG_TAG = "PrintAttributesTest";
private final String PRINTER_NAME = "Test printer";
private final Margins[] MIN_MARGINS = {
@@ -375,6 +377,7 @@
setUpPrinter(minMargins, mediaSizes, defaultMediaSize, colorModes, defaultColorMode,
duplexModes, defaultDuplexMode, resolutions, defaultResolution);
+ Log.d(LOG_TAG, "makeDefaultPrinter");
// Make printer default. This is necessary as a different default printer might pre-select
// its default attributes and thereby overrides the defaults of the tested printer.
makeDefaultPrinter(adapter, PRINTER_NAME);
@@ -385,9 +388,13 @@
// Start print action and wait for layout, the result is stored in #layoutAttributes,
// @see createMockPrintDocumentAdapter
+ Log.d(LOG_TAG, "print");
print(adapter, suggestedAttributes);
+ Log.d(LOG_TAG, "waitForWriteAdapterCallback");
waitForWriteAdapterCallback(2);
+ Log.d(LOG_TAG, "clickPrintButton");
clickPrintButton();
+ Log.d(LOG_TAG, "waitForPrinterDiscoverySessionDestroyCallbackCalled");
waitForPrinterDiscoverySessionDestroyCallbackCalled(2);
// It does not make sense to suggest minMargins, hence the print framework always picks
diff --git a/tests/tests/print/src/android/print/cts/PrintDocumentActivity.java b/tests/tests/print/src/android/print/cts/PrintDocumentActivity.java
index efe9e8e..56276e8 100644
--- a/tests/tests/print/src/android/print/cts/PrintDocumentActivity.java
+++ b/tests/tests/print/src/android/print/cts/PrintDocumentActivity.java
@@ -18,14 +18,18 @@
import android.app.Activity;
import android.os.Bundle;
+import android.util.Log;
import android.view.WindowManager;
public class PrintDocumentActivity extends Activity {
+ private static final String LOG_TAG = "PrintDocumentActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Log.d(LOG_TAG, "onCreate() " + this);
+
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
@@ -35,6 +39,7 @@
@Override
protected void onDestroy() {
+ Log.d(LOG_TAG, "onDestroy() " + this);
BasePrintTest.onActivityDestroyCalled();
super.onDestroy();
}
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
index 18dc03d..f4cd5a9 100755
--- a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
@@ -68,6 +68,7 @@
"45005", // SKT Mobility
"45002", // SKT Mobility
"45008", // KT Mobility
+ "45028", // KT Safety Network
"45006", // LGT
"311660", // MetroPCS
"310120", // Sprint
diff --git a/tests/tests/text/res/layout/keylistener_layout.xml b/tests/tests/text/res/layout/keylistener_layout.xml
index 0ee015d..84a7a14 100644
--- a/tests/tests/text/res/layout/keylistener_layout.xml
+++ b/tests/tests/text/res/layout/keylistener_layout.xml
@@ -19,5 +19,6 @@
android:id="@+id/keylistener_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:textSize="10dp"
/>
diff --git a/tests/tests/text/src/android/text/cts/EmojiTest.java b/tests/tests/text/src/android/text/cts/EmojiTest.java
index 4882402..4bc586e 100644
--- a/tests/tests/text/src/android/text/cts/EmojiTest.java
+++ b/tests/tests/text/src/android/text/cts/EmojiTest.java
@@ -23,6 +23,7 @@
import android.graphics.Paint;
import android.graphics.Picture;
import android.test.ActivityInstrumentationTestCase2;
+import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
@@ -204,6 +205,7 @@
CaptureTextView(Context context) {
super(context);
+ setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
}
Bitmap capture(char c[]) {
@@ -227,6 +229,7 @@
CaptureEditText(Context context) {
super(context);
+ setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
}
Bitmap capture(char c[]) {
diff --git a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
index 87e1e1a..b82b955 100644
--- a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
@@ -27,6 +27,7 @@
import android.text.method.ArrowKeyMovementMethod;
import android.text.method.MetaKeyKeyListener;
import android.text.method.MovementMethod;
+import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -983,6 +984,7 @@
SpannableString spannable = new SpannableString("Test Content");
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_0);
TextView view = new TextViewNoIme(getActivity());
+ view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
assertFalse(method.onKeyUp(view, spannable, KeyEvent.KEYCODE_0, event));
assertFalse(method.onKeyUp(null, null, 0, null));
@@ -1394,6 +1396,7 @@
private void initTextViewWithNullLayout(CharSequence text) {
mTextView = new TextViewNoIme(getActivity());
+ mTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
mTextView.setText(text, BufferType.EDITABLE);
assertNull(mTextView.getLayout());
mEditable = (Editable) mTextView.getText();
diff --git a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
index d8de43d..03fc1e7 100644
--- a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
@@ -27,6 +27,7 @@
import android.text.method.LinkMovementMethod;
import android.text.method.MovementMethod;
import android.text.style.ClickableSpan;
+import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -66,6 +67,7 @@
// Set the content view with a text view which contains 3 lines,
mView = new TextViewNoIme(getActivity());
+ mView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
mView.setText(CONTENT, BufferType.SPANNABLE);
getInstrumentation().runOnMainSync(new Runnable() {
public void run() {
diff --git a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
index 490a062..1131e6c 100644
--- a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
@@ -26,6 +26,7 @@
import android.test.ActivityInstrumentationTestCase2;
import android.text.Editable;
import android.text.method.PasswordTransformationMethod;
+import android.util.TypedValue;
import android.view.KeyCharacterMap;
import android.view.View;
import android.widget.Button;
@@ -84,6 +85,7 @@
runTestOnUiThread(new Runnable() {
public void run() {
EditText editText = new EditTextNoIme(mActivity);
+ editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
editText.setId(EDIT_TXT_ID);
editText.setTransformationMethod(mMethod);
Button button = new Button(mActivity);
diff --git a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
index e0b8011..ef7de09 100644
--- a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
@@ -19,6 +19,7 @@
import android.test.ActivityInstrumentationTestCase2;
import android.text.method.ReplacementTransformationMethod;
+import android.util.TypedValue;
import android.widget.EditText;
/**
@@ -42,6 +43,7 @@
protected void setUp() throws Exception {
super.setUp();
mEditText = new EditTextNoIme(getActivity());
+ mEditText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
}
public void testGetTransformation() {
diff --git a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
index 3333a88..8419850 100644
--- a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
@@ -25,6 +25,7 @@
import android.text.method.MovementMethod;
import android.text.method.ScrollingMovementMethod;
import android.util.DisplayMetrics;
+import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
@@ -61,6 +62,7 @@
protected void setUp() throws Exception {
super.setUp();
mTextView = new TextViewNoIme(getActivity());
+ mTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
mTextView.setText(THREE_LINES_TEXT, BufferType.EDITABLE);
mSpannable = (Spannable) mTextView.getText();
mScaledTouchSlop = ViewConfiguration.get(getActivity()).getScaledTouchSlop();
@@ -650,6 +652,7 @@
SpannableString spannable = new SpannableString("Test Content");
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_0);
TextView view = new TextViewNoIme(getActivity());
+ view.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
assertFalse(method.onKeyUp(view, spannable, KeyEvent.KEYCODE_0, event));
assertFalse(method.onKeyUp(null, null, 0, null));
diff --git a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
index 2f8789a..0eec6bf 100644
--- a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
@@ -19,6 +19,7 @@
import android.test.ActivityInstrumentationTestCase2;
import android.text.method.SingleLineTransformationMethod;
+import android.util.TypedValue;
import android.widget.EditText;
/**
@@ -54,6 +55,7 @@
assertEquals("hello world\uFEFF", result.toString());
EditText editText = new EditTextNoIme(getActivity());
+ editText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
editText.setText("hello\nworld\r");
// TODO cannot get transformed text from the view
}
diff --git a/tests/tests/text/src/android/text/method/cts/TouchTest.java b/tests/tests/text/src/android/text/method/cts/TouchTest.java
index 8204287..233539c 100644
--- a/tests/tests/text/src/android/text/method/cts/TouchTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TouchTest.java
@@ -25,6 +25,7 @@
import android.text.TextPaint;
import android.text.method.Touch;
import android.util.DisplayMetrics;
+import android.util.TypedValue;
import android.view.MotionEvent;
import android.widget.TextView;
@@ -53,6 +54,8 @@
public void testScrollTo() throws Throwable {
final TextView tv = new TextViewNoIme(mActivity);
+ tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
+
runTestOnUiThread(new Runnable() {
public void run() {
mActivity.setContentView(tv);
@@ -105,6 +108,7 @@
public void testOnTouchEvent() throws Throwable {
final TextView tv = new TextViewNoIme(mActivity);
+ tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
// Create a string that is wider than the screen.
DisplayMetrics metrics = mActivity.getResources().getDisplayMetrics();
diff --git a/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java b/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
index 2409d51..b50f8c9 100644
--- a/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
@@ -498,12 +498,12 @@
assertTrue(promptView.isShown());
assertEquals(ListPopupWindow.POSITION_PROMPT_BELOW, mPopupWindow.getPromptPosition());
- final int[] promptViewOnScreenXY = new int[2];
- promptView.getLocationOnScreen(promptViewOnScreenXY);
-
final ListView listView = mPopupWindow.getListView();
ViewTestUtils.runOnMainAndDrawSync(mInstrumentation, listView, null);
+ final int[] promptViewOnScreenXY = new int[2];
+ promptView.getLocationOnScreen(promptViewOnScreenXY);
+
final View lastListChild = listView.getChildAt(listView.getChildCount() - 1);
final int[] lastChildOnScreenXY = new int[2];
lastListChild.getLocationOnScreen(lastChildOnScreenXY);