Revert "Fixed poor behavior of position-based focus order"

This reverts commit 5fd69c38642a1c632e09dc0f6f9e462538909fbb.

Reason for revert: still doesn't seem to meet sorting contract

Change-Id: Ib4eb06fec50b93add49bfd50459c8997bc6f4acc
Bug: 36031778
(cherry picked from commit e46675263f81377d7fb521c9e947258ecada1a44)
diff --git a/core/java/android/view/FocusFinder.java b/core/java/android/view/FocusFinder.java
index ad06141..61c9201 100644
--- a/core/java/android/view/FocusFinder.java
+++ b/core/java/android/view/FocusFinder.java
@@ -732,17 +732,27 @@
             getRect(first, mFirstRect);
             getRect(second, mSecondRect);
 
-            boolean overlapsVertically = (mFirstRect.top < mSecondRect.top
-                    && mFirstRect.bottom > mSecondRect.top)
-                    || (mFirstRect.top > mSecondRect.top
-                    && mFirstRect.top < mSecondRect.bottom);
-            boolean alignedVertically = (mFirstRect.left > mSecondRect.left)
-                    == (mFirstRect.right < mSecondRect.right);
-            if (overlapsVertically && !alignedVertically) {
-                int rtl = mIsLayoutRtl ? -1 : 1;
-                return rtl * (mFirstRect.left - mSecondRect.left);
+            if (mFirstRect.top < mSecondRect.top) {
+                return -1;
+            } else if (mFirstRect.top > mSecondRect.top) {
+                return 1;
+            } else if (mFirstRect.left < mSecondRect.left) {
+                return mIsLayoutRtl ? 1 : -1;
+            } else if (mFirstRect.left > mSecondRect.left) {
+                return mIsLayoutRtl ? -1 : 1;
+            } else if (mFirstRect.bottom < mSecondRect.bottom) {
+                return -1;
+            } else if (mFirstRect.bottom > mSecondRect.bottom) {
+                return 1;
+            } else if (mFirstRect.right < mSecondRect.right) {
+                return mIsLayoutRtl ? 1 : -1;
+            } else if (mFirstRect.right > mSecondRect.right) {
+                return mIsLayoutRtl ? -1 : 1;
             } else {
-                return mFirstRect.top - mSecondRect.top;
+                // The view are distinct but completely coincident so we consider
+                // them equal for our purposes.  Since the sort is stable, this
+                // means that the views will retain their layout order relative to one another.
+                return 0;
             }
         }