Accessiblity focus not following input focus and text nav broken.

1. View is checking if the accessibility focus is its
   descendant it clears the accessibility focus state
   in ViewRootImpl. The check in View was missing the
   case that the descendant may be the view itself. In
   such a case we want the normal clearing code to run.

2. The check whether a view has iterable text for
   accessibility was inverted and text nav was not
   working.

Change-Id: I1a13b6809fb7f205fff76ca09cd449179d06e530
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index a4fcd41..53bb3c6 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6159,7 +6159,8 @@
         ViewRootImpl viewRootImpl = getViewRootImpl();
         if (viewRootImpl != null) {
             View focusHost = viewRootImpl.getAccessibilityFocusedHost();
-            if (focusHost != null && ViewRootImpl.isViewDescendantOf(focusHost, this)) {
+            if (focusHost != null && focusHost != this
+                    && ViewRootImpl.isViewDescendantOf(focusHost, this)) {
                 viewRootImpl.setAccessibilityFocusedHost(null);
             }
         }
@@ -6637,7 +6638,7 @@
 
     private boolean nextAtGranularity(int granularity) {
         CharSequence text = getIterableTextForAccessibility();
-        if (text != null && text.length() > 0) {
+        if (text == null || text.length() == 0) {
             return false;
         }
         TextSegmentIterator iterator = getIteratorForGranularity(granularity);
@@ -6661,7 +6662,7 @@
 
     private boolean previousAtGranularity(int granularity) {
         CharSequence text = getIterableTextForAccessibility();
-        if (text != null && text.length() > 0) {
+        if (text == null || text.length() == 0) {
             return false;
         }
         TextSegmentIterator iterator = getIteratorForGranularity(granularity);