Fixing a touch event issue.
Moved to event into the bounds of the window.
Added a polling check rather that asserts.
bug: 10884168
Change-Id: I7f1c0def9f566850121cfb80e4b33e68021b4ae8
diff --git a/tests/tests/app/AndroidManifest.xml b/tests/tests/app/AndroidManifest.xml
index d92cfbe..acfc3c8 100644
--- a/tests/tests/app/AndroidManifest.xml
+++ b/tests/tests/app/AndroidManifest.xml
@@ -16,10 +16,9 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.android.cts.app">
+ package="com.android.app.cts">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
- <uses-permission android:name="android.permission.INJECT_EVENTS" />
<application>
<uses-library android:name="android.test.runner" />
</application>
diff --git a/tests/tests/app/src/android/app/cts/DialogTest.java b/tests/tests/app/src/android/app/cts/DialogTest.java
index 68b01ee..fa90494 100644
--- a/tests/tests/app/src/android/app/cts/DialogTest.java
+++ b/tests/tests/app/src/android/app/cts/DialogTest.java
@@ -17,7 +17,6 @@
import com.android.cts.stub.R;
-
import android.app.Dialog;
import android.app.Instrumentation;
import android.content.Context;
@@ -371,10 +370,15 @@
long now = SystemClock.uptimeMillis();
MotionEvent touchMotionEvent = MotionEvent.obtain(now, now, MotionEvent.ACTION_DOWN,
- 0.0f, 0.0f, 0);
+ 1, 100, 0);
mInstrumentation.sendPointerSync(touchMotionEvent);
- assertFalse(d.dispatchTouchEventResult);
+ new PollingCheck(TEST_TIMEOUT) {
+ protected boolean check() {
+ return !d.dispatchTouchEventResult;
+ }
+ }.run();
+
assertMotionEventEquals(touchMotionEvent, d.touchEvent);
assertTrue(d.isOnTouchEventCalled);
@@ -386,11 +390,16 @@
// because closeOnTouchOutside is true.
d.setCanceledOnTouchOutside(true);
- touchMotionEvent = MotionEvent.obtain(now + 1, now, MotionEvent.ACTION_DOWN,
- 0.0f, 0.0f, 0);
+ touchMotionEvent = MotionEvent.obtain(now, now + 1, MotionEvent.ACTION_DOWN,
+ 1, 100, 0);
mInstrumentation.sendPointerSync(touchMotionEvent);
- assertTrue(d.dispatchTouchEventResult);
+ new PollingCheck(TEST_TIMEOUT) {
+ protected boolean check() {
+ return d.dispatchTouchEventResult;
+ }
+ }.run();
+
assertMotionEventEquals(touchMotionEvent, d.touchEvent);
assertTrue(d.isOnTouchEventCalled);