Show drag handles after finishing batch edit if needed.

Drag handles are blocked from being shown if batch edit mode is active
when onPreDraw is called; however, IME can start and end batch edit
mode regardless of onPreDraw timing.
As a result, drag handles are sometimes not shown even if selection is
created and text action mode is started.

With this CL, drag handles are shown after finishing batch edit mode
if the handles were blocked from being shown in the above case.

Bug: 28366507
Change-Id: I7f099d0626bee70a63bb14bc75eefc2551a52d53
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 106fec0..94fc1f8 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -1465,6 +1465,16 @@
         // sendUpdateSelection knows to avoid sending if the selection did
         // not actually change.
         sendUpdateSelection();
+
+        // Show drag handles if they were blocked by batch edit mode.
+        if (mTextActionMode != null) {
+            final CursorController cursorController = mTextView.hasSelection() ?
+                    getSelectionController() : getInsertionController();
+            if (cursorController != null && !cursorController.isActive()
+                    && !cursorController.isCursorBeingModified()) {
+                cursorController.show();
+            }
+        }
     }
 
     static final int EXTRACT_NOTHING = -2;