Fix PointerCaptureTest#testEventDispatch
PointerCaptureCtsActivity used to use a captionless theme
which caused some of the views to overlap with the status bar
and injecting pointer events into such views would cause
a security exception. Using a default theme prevents that.
Removed logging recently added to track down the problem.
Bug:64538494
Test: android.view.cts.PointerCaptureTest
Change-Id: I8797ab2eb9d24769aa3b6b48c869b455c28ad9b3
diff --git a/tests/tests/view/AndroidManifest.xml b/tests/tests/view/AndroidManifest.xml
index 7af3b42..9cac6e4 100644
--- a/tests/tests/view/AndroidManifest.xml
+++ b/tests/tests/view/AndroidManifest.xml
@@ -335,7 +335,7 @@
<activity android:name="android.view.cts.PointerCaptureCtsActivity"
android:screenOrientation="locked"
- android:theme="@style/WhiteBackgroundTheme">
+ android:label="PointerCaptureCtsActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
diff --git a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
index 96e68ad..bb14589 100644
--- a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
+++ b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
@@ -26,7 +26,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.inOrder;
@@ -40,7 +39,6 @@
import android.support.test.filters.SmallTest;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
@@ -61,7 +59,6 @@
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PointerCaptureTest {
- private static final String TAG = "PointerCaptureTest";
private static final long TIMEOUT_DELTA = 10000;
private Instrumentation mInstrumentation;
@@ -125,17 +122,12 @@
}
private void injectMotionEvent(MotionEvent event) {
- try {
- if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
- // Regular mouse event.
- mInstrumentation.sendPointerSync(event);
- } else {
- // Relative mouse event belongs to SOURCE_CLASS_TRACKBALL.
- mInstrumentation.sendTrackballEventSync(event);
- }
- } catch (Exception e) {
- Log.e(TAG, "injectMotionEvent failed: " + event, e);
- fail(e.getMessage());
+ if ((event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) {
+ // Regular mouse event.
+ mInstrumentation.sendPointerSync(event);
+ } else {
+ // Relative mouse event belongs to SOURCE_CLASS_TRACKBALL.
+ mInstrumentation.sendTrackballEventSync(event);
}
}