Rename AccessibilityGestureInfo

Rename AccessibilityGesutreInfo to AccessibilityGestureEvent

Bug: 139127300
Test: AccessibilityGestureDetectorTest
Change-Id: I2ba23c41760786e853fe7656316e086f8bc285ad
diff --git a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityGestureInfoTest.java b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityGestureEventTest.java
similarity index 72%
rename from tests/accessibility/src/android/view/accessibility/cts/AccessibilityGestureInfoTest.java
rename to tests/accessibility/src/android/view/accessibility/cts/AccessibilityGestureEventTest.java
index 0d851cf..abf9be8 100644
--- a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityGestureInfoTest.java
+++ b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityGestureEventTest.java
@@ -20,7 +20,7 @@
 import static org.junit.Assert.assertSame;
 
 import android.accessibility.cts.common.AccessibilityDumpOnFailureRule;
-import android.accessibilityservice.AccessibilityGestureInfo;
+import android.accessibilityservice.AccessibilityGestureEvent;
 import android.accessibilityservice.AccessibilityService;
 import android.os.Parcel;
 import android.platform.test.annotations.Presubmit;
@@ -34,11 +34,11 @@
 import org.junit.runner.RunWith;
 
 /**
- * Class for testing {@link android.accessibilityservice.AccessibilityGestureInfo}.
+ * Class for testing {@link android.accessibilityservice.AccessibilityGestureEvent}.
  */
 @Presubmit
 @RunWith(AndroidJUnit4.class)
-public class AccessibilityGestureInfoTest {
+public class AccessibilityGestureEventTest {
 
     @Rule
     public final AccessibilityDumpOnFailureRule mDumpOnFailureRule =
@@ -52,18 +52,18 @@
     public void testMarshaling() {
 
         // Fully populate the gesture info to marshal.
-        AccessibilityGestureInfo sentGestureInfo = new AccessibilityGestureInfo(
+        AccessibilityGestureEvent sentGestureEvent = new AccessibilityGestureEvent(
                 SENT_GESTURE, TARGET_DISPLAY);
 
         // Marshal and unmarshal the gesture info.
         Parcel parcel = Parcel.obtain();
-        sentGestureInfo.writeToParcel(parcel, 0);
+        sentGestureEvent.writeToParcel(parcel, 0);
         parcel.setDataPosition(0);
-        AccessibilityGestureInfo receivedGestureInfo =
-                AccessibilityGestureInfo.CREATOR.createFromParcel(parcel);
+        AccessibilityGestureEvent receivedGestureEvent =
+                AccessibilityGestureEvent.CREATOR.createFromParcel(parcel);
 
         // Make sure all fields properly marshaled.
-        assertEqualsGestureInfo(sentGestureInfo, receivedGestureInfo);
+        assertEqualsGestureEvent(sentGestureEvent, receivedGestureEvent);
 
         parcel.recycle();
     }
@@ -75,7 +75,7 @@
     @SmallTest
     @Test
     public void testGetterMethods() {
-        AccessibilityGestureInfo actualGesture = new AccessibilityGestureInfo(SENT_GESTURE,
+        AccessibilityGestureEvent actualGesture = new AccessibilityGestureEvent(SENT_GESTURE,
                 TARGET_DISPLAY);
 
         assertEquals("getGestureId is different from parameter of constructor", SENT_GESTURE,
@@ -90,20 +90,20 @@
     @SmallTest
     @Test
     public void testDescribeContents() {
-        AccessibilityGestureInfo gesture1 = new AccessibilityGestureInfo(SENT_GESTURE,TARGET_DISPLAY);
+        AccessibilityGestureEvent event1 = new AccessibilityGestureEvent(SENT_GESTURE,TARGET_DISPLAY);
         assertSame("accessibility gesture infos always return 0 for this method.", 0,
-                gesture1.describeContents());
-        AccessibilityGestureInfo gesture2 = new AccessibilityGestureInfo(
+                event1.describeContents());
+        AccessibilityGestureEvent event2 = new AccessibilityGestureEvent(
                 AccessibilityService.GESTURE_SWIPE_LEFT, TARGET_DISPLAY);
         assertSame("accessibility gesture infos always return 0 for this method.", 0,
-                gesture2.describeContents());
+                event2.describeContents());
     }
 
-    private void assertEqualsGestureInfo(AccessibilityGestureInfo sentGestureInfo,
-            AccessibilityGestureInfo receivedGestureInfo) {
-        assertEquals("getDisplayId has incorrectValue", sentGestureInfo.getDisplayId(),
-                receivedGestureInfo.getDisplayId());
-        assertEquals("getGestureId has incorrectValue", sentGestureInfo.getGestureId(),
-                receivedGestureInfo.getGestureId());
+    private void assertEqualsGestureEvent(AccessibilityGestureEvent sentGestureEvent,
+            AccessibilityGestureEvent receivedGestureEvent) {
+        assertEquals("getDisplayId has incorrectValue", sentGestureEvent.getDisplayId(),
+                receivedGestureEvent.getDisplayId());
+        assertEquals("getGestureId has incorrectValue", sentGestureEvent.getGestureId(),
+                receivedGestureEvent.getGestureId());
     }
 }
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
index b28b419..28e8f67 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
@@ -27,11 +27,10 @@
 
 import android.accessibility.cts.common.AccessibilityDumpOnFailureRule;
 import android.accessibility.cts.common.InstrumentedAccessibilityServiceTestRule;
-import android.accessibilityservice.AccessibilityGestureInfo;
+import android.accessibilityservice.AccessibilityGestureEvent;
 import android.accessibilityservice.AccessibilityService;
 import android.accessibilityservice.GestureDescription;
 import android.accessibilityservice.GestureDescription.StrokeDescription;
-import android.accessibilityservice.cts.utils.DisplayUtils;
 import android.app.Instrumentation;
 import android.content.Context;
 import android.content.pm.PackageManager;
@@ -253,10 +252,10 @@
             assertEquals(gestureId, mService.getGesture(0));
         }
 
-        AccessibilityGestureInfo expectedGestureInfo = new AccessibilityGestureInfo(gestureId,
+        AccessibilityGestureEvent expectedGestureEvent = new AccessibilityGestureEvent(gestureId,
                 displayId);
         assertEquals(1, mService.getGestureInfoSize());
-        assertEquals(expectedGestureInfo.toString(), mService.getGestureInfo(0).toString());
+        assertEquals(expectedGestureEvent.toString(), mService.getGestureInfo(0).toString());
     }
 
     /** Create a path from startPoint, moving by delta1, then delta2. (delta2 may be null.) */
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/GestureDetectionStubAccessibilityService.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/GestureDetectionStubAccessibilityService.java
index 1bc62f6..049bae1 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/GestureDetectionStubAccessibilityService.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/GestureDetectionStubAccessibilityService.java
@@ -17,7 +17,7 @@
 import static org.junit.Assert.fail;
 
 import android.accessibility.cts.common.InstrumentedAccessibilityService;
-import android.accessibilityservice.AccessibilityGestureInfo;
+import android.accessibilityservice.AccessibilityGestureEvent;
 import android.view.accessibility.AccessibilityEvent;
 
 import java.util.ArrayList;
@@ -30,7 +30,7 @@
     // Member variables
     protected final Object mLock = new Object();
     private ArrayList<Integer> mCollectedGestures = new ArrayList();
-    private ArrayList<AccessibilityGestureInfo> mCollectedGestureInfos = new ArrayList();
+    private ArrayList<AccessibilityGestureEvent> mCollectedGestureEvents = new ArrayList();
     protected ArrayList<Integer> mCollectedEvents = new ArrayList();
 
     @Override
@@ -42,11 +42,11 @@
     }
 
     @Override
-    public boolean onGesture(AccessibilityGestureInfo gestureInfo) {
-        super.onGesture(gestureInfo);
-        synchronized (mCollectedGestureInfos) {
-            mCollectedGestureInfos.add(gestureInfo);
-            mCollectedGestureInfos.notifyAll(); // Stop waiting for gesture.
+    public boolean onGesture(AccessibilityGestureEvent gestureEvent) {
+        super.onGesture(gestureEvent);
+        synchronized (mCollectedGestureEvents) {
+            mCollectedGestureEvents.add(gestureEvent);
+            mCollectedGestureEvents.notifyAll(); // Stop waiting for gesture.
         }
         return true;
     }
@@ -55,8 +55,8 @@
         synchronized (mCollectedGestures) {
             mCollectedGestures.clear();
         }
-        synchronized (mCollectedGestureInfos) {
-            mCollectedGestureInfos.clear();
+        synchronized (mCollectedGestureEvents) {
+            mCollectedGestureEvents.clear();
         }
     }
 
@@ -72,15 +72,15 @@
         }
     }
 
-    /** Waits for {@link #onGesture(AccessibilityGestureInfo)} to collect next gesture. */
+    /** Waits for {@link #onGesture(AccessibilityGestureEvent)} to collect next gesture. */
     public void waitUntilGestureInfo() {
-        synchronized (mCollectedGestureInfos) {
-            //Assume the size of mCollectedGestures is changed before mCollectedGestureInfos.
-            if (mCollectedGestureInfos.size() > 0) {
+        synchronized (mCollectedGestureEvents) {
+            //Assume the size of mCollectedGestures is changed before mCollectedGestureEvents.
+            if (mCollectedGestureEvents.size() > 0) {
                 return;
             }
             try {
-                mCollectedGestureInfos.wait(GESTURE_RECOGNIZE_TIMEOUT_MS);
+                mCollectedGestureEvents.wait(GESTURE_RECOGNIZE_TIMEOUT_MS);
             } catch (InterruptedException e) {
                 throw new RuntimeException(e);
             }
@@ -88,14 +88,14 @@
     }
 
     public int getGestureInfoSize() {
-        synchronized (mCollectedGestureInfos) {
-            return mCollectedGestureInfos.size();
+        synchronized (mCollectedGestureEvents) {
+            return mCollectedGestureEvents.size();
         }
     }
 
-    public AccessibilityGestureInfo getGestureInfo(int index) {
-        synchronized (mCollectedGestureInfos) {
-            return mCollectedGestureInfos.get(index);
+    public AccessibilityGestureEvent getGestureInfo(int index) {
+        synchronized (mCollectedGestureEvents) {
+            return mCollectedGestureEvents.get(index);
         }
     }