Fix calculation for swipe margin of error

Change-Id: If33dd8de5d9891a6d82d26767bdf3814d032db58
diff --git a/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java b/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
index 705c777..ce6c02d 100644
--- a/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
+++ b/tests/uiautomator/src/com/android/cts/uiautomatortest/CtsUiAutomatorTest.java
@@ -810,16 +810,17 @@
         assertTrue("Pinch must be in center of target view", p2s.y == screenRect.centerY());
 
         assertTrue("Touch-down X coordinate for pointer 1 is invalid",
-                withinMarginOfError(0.05f, screenRect.centerX(), p1s.x));
+                withinMarginOfError(0.1f, screenRect.centerX(), p1s.x));
 
         assertTrue("Touch-down X coordinate for pointer 2 is invalid",
-                withinMarginOfError(0.05f, screenRect.centerX(), p2s.x));
+                withinMarginOfError(0.1f, screenRect.centerX(), p2s.x));
 
         assertTrue("Touch-up X coordinate for pointer 1 is invalid",
-                withinMarginOfError(0.05f, screenRect.left, p1e.x));
+                withinMarginOfError(0.1f, screenRect.centerX() - screenRect.left,
+                        screenRect.centerX() - p1e.x));
 
         assertTrue("Touch-up X coordinate for pointer 2 is invalid",
-                withinMarginOfError(0.05f, screenRect.right, p2e.x));
+                withinMarginOfError(0.1f, screenRect.right, p2e.x));
     }
 
     /**
@@ -863,16 +864,17 @@
         assertTrue("Pinch must be in center of target view", p2s.y == screenRect.centerY());
 
         assertTrue("Touch-down X coordinate for pointer 1 is invalid",
-                withinMarginOfError(0.05f, screenRect.left, p1s.x));
+                withinMarginOfError(0.1f, screenRect.centerX() - screenRect.left,
+                        screenRect.centerX() -  p1s.x));
 
         assertTrue("Touch-down X coordinate for pointer 2 is invalid",
-                withinMarginOfError(0.05f, screenRect.right, p2s.x));
+                withinMarginOfError(0.1f, screenRect.right, p2s.x));
 
         assertTrue("Touch-up X coordinate for pointer 1 is invalid",
-                withinMarginOfError(0.05f, screenRect.centerX(), p1e.x));
+                withinMarginOfError(0.1f, screenRect.centerX(), p1e.x));
 
         assertTrue("Touch-up X coordinate for pointer 2 is invalid",
-                withinMarginOfError(0.05f, screenRect.centerX(), p2e.x));
+                withinMarginOfError(0.1f, screenRect.centerX(), p2e.x));
     }
 
     /**