am a2c9b1f1: am cffcc4ae: Fix the KeyListeners tests.
* commit 'a2c9b1f1d22384ad1a6af86f4eb905abd5f3d343':
Fix the KeyListeners tests.
diff --git a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
index ef3d751..375ea54 100644
--- a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
+++ b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
@@ -64,8 +64,12 @@
mInstrumentation = getInstrumentation();
mTextView = (TextView) mActivity.findViewById(R.id.keylistener_textview);
- mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
- WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+ mActivity.runOnUiThread(new Runnable() {
+ public void run() {
+ // Ensure that the screen is on for this test.
+ mTextView.setKeepScreenOn(true);
+ }
+ });
assertTrue(mActivity.waitForWindowFocus(5 * DateUtils.SECOND_IN_MILLIS));
}