Merge "Adjust timestamp scale" into jb-mr2-dev
diff --git a/hostsidetests/monkey/Android.mk b/hostsidetests/monkey/Android.mk
index 8a73df3..45d2e37 100644
--- a/hostsidetests/monkey/Android.mk
+++ b/hostsidetests/monkey/Android.mk
@@ -24,7 +24,8 @@
LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed-prebuilt ddmlib-prebuilt junit
-LOCAL_CTS_TEST_PACKAGE := android.monkey
+# prefix zzz intentional to run this last
+LOCAL_CTS_TEST_PACKAGE := zzz.android.monkey
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/monkey/src/com/android/cts/monkey/AbstractMonkeyTest.java b/hostsidetests/monkey/src/com/android/cts/monkey/AbstractMonkeyTest.java
index 8580a9d..9c27b62 100644
--- a/hostsidetests/monkey/src/com/android/cts/monkey/AbstractMonkeyTest.java
+++ b/hostsidetests/monkey/src/com/android/cts/monkey/AbstractMonkeyTest.java
@@ -17,7 +17,7 @@
/**
* Base monkey command with flags to avoid side effects like airplane mode.
*/
- static final String MONKEY_CMD = "monkey --pct-touch 0 --pct-motion 0 --pct-majornav 0 --pct-syskeys 0 --pct-anyevent 0";
+ static final String MONKEY_CMD = "monkey --pct-touch 0 --pct-motion 0 --pct-majornav 0 --pct-syskeys 0 --pct-anyevent 0 --pct-rotation 0";
CtsBuildHelper mBuild;
ITestDevice mDevice;
diff --git a/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
index 2f629d6..a0e03f5 100644
--- a/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
@@ -21,6 +21,7 @@
import android.app.Activity;
import android.app.Instrumentation;
+import android.cts.util.PollingCheck;
import android.os.SystemClock;
import android.test.ActivityInstrumentationTestCase2;
import android.text.Editable;
@@ -54,6 +55,12 @@
mActivity = getActivity();
mInstrumentation = getInstrumentation();
mTextView = (TextView) mActivity.findViewById(R.id.keylistener_textview);
+ new PollingCheck(1000) {
+ @Override
+ protected boolean check() {
+ return mTextView.hasWindowFocus();
+ }
+ }.run();
}
public void testBackspace() {
diff --git a/tools/device-setup/TestDeviceSetup/Android.mk b/tools/device-setup/TestDeviceSetup/Android.mk
index f6c1079..efa50bf 100644
--- a/tools/device-setup/TestDeviceSetup/Android.mk
+++ b/tools/device-setup/TestDeviceSetup/Android.mk
@@ -26,7 +26,7 @@
LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_SDK_VERSION := 16
+LOCAL_SDK_VERSION := 17
LOCAL_PACKAGE_NAME := TestDeviceSetup
diff --git a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
index 565ac7f..49e96a0 100644
--- a/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
+++ b/tools/device-setup/TestDeviceSetup/src/android/tests/getinfo/DeviceInfoInstrument.java
@@ -77,7 +77,7 @@
WindowManager wm = (WindowManager) getContext().getSystemService(
Context.WINDOW_SERVICE);
Display d = wm.getDefaultDisplay();
- d.getMetrics(metrics);
+ d.getRealMetrics(metrics);
addResult(RESOLUTION, String.format("%sx%s", metrics.widthPixels, metrics.heightPixels));
addResult(SCREEN_DENSITY, metrics.density);
addResult(SCREEN_X_DENSITY, metrics.xdpi);
diff --git a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
index 27f7c21..c6977e5 100644
--- a/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
+++ b/tools/tradefed-host/src/com/android/cts/tradefed/testtype/CtsTest.java
@@ -150,9 +150,9 @@
"Interval between each reboot in min.")
private int mRebootIntervalMin = 30;
- @Option(name = "screenshot-on-ui-failure", description =
- "take a screenshot if a test fails with a message indicating a UI obstruction.")
- private boolean mScreenshotOnUiFailures = false;
+ @Option(name = "screenshot-on-failure", description =
+ "take a screenshot on every test failure.")
+ private boolean mScreenshotOnFailures = false;
@Option(name = "logcat-on-failure", description =
"take a logcat snapshot on every test failure. Unlike --bugreport, this can capture" +
@@ -249,13 +249,12 @@
}
/**
- * A {@link ResultForwarder} that will forward a screenshot when it detects a failed test due
- * to a UI obstruction.
+ * A {@link ResultForwarder} that will forward a screenshot on test failures.
*/
- private static class FailedUiTestScreenshotGenerator extends ResultForwarder {
+ private static class FailedTestScreenshotGenerator extends ResultForwarder {
private ITestDevice mDevice;
- public FailedUiTestScreenshotGenerator(ITestInvocationListener listener,
+ public FailedTestScreenshotGenerator(ITestInvocationListener listener,
ITestDevice device) {
super(listener);
mDevice = device;
@@ -265,18 +264,15 @@
public void testFailed(TestFailure status, TestIdentifier test, String trace) {
super.testFailed(status, test, trace);
- if (trace.contains(
- "Injecting to another application requires INJECT_EVENTS permission")) {
- try {
- InputStreamSource screenSource = mDevice.getScreenshot();
- super.testLog(String.format("screenshot-%s_%s", test.getClassName(),
- test.getTestName()), LogDataType.PNG, screenSource);
- screenSource.cancel();
- } catch (DeviceNotAvailableException e) {
- // TODO: rethrow this somehow
- CLog.e("Device %s became unavailable while capturing screenshot, %s",
- mDevice.getSerialNumber(), e.toString());
- }
+ try {
+ InputStreamSource screenSource = mDevice.getScreenshot();
+ super.testLog(String.format("screenshot-%s_%s", test.getClassName(),
+ test.getTestName()), LogDataType.PNG, screenSource);
+ screenSource.cancel();
+ } catch (DeviceNotAvailableException e) {
+ // TODO: rethrow this somehow
+ CLog.e("Device %s became unavailable while capturing screenshot, %s",
+ mDevice.getSerialNumber(), e.toString());
}
}
}
@@ -412,8 +408,8 @@
getDevice());
listener = bugListener;
}
- if (mScreenshotOnUiFailures) {
- FailedUiTestScreenshotGenerator screenListener = new FailedUiTestScreenshotGenerator(
+ if (mScreenshotOnFailures) {
+ FailedTestScreenshotGenerator screenListener = new FailedTestScreenshotGenerator(
listener, getDevice());
listener = screenListener;
}