Stop calling IMM#isActive() from TextView#onDraw()

Despite its name, InputMethodManager#isActive(View) internally aquires
IMM lock three times and may even trigger IME focus switching.

To make things simpler and more predictable,

  InputMethodManager#hasActiveInputConnectionInternal(View)

should be used instead, especially for methods like TextView#onDraw().

Bug: 291826769
Test: presubmit
Test: atest CtsInputMethodTestCases
Change-Id: I27f2d66050588c5adc6315160e54486131f3fca2
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index f99f138..ddb0a8b3 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -2101,7 +2101,7 @@
         if (ims != null && ims.mBatchEditNesting == 0) {
             InputMethodManager imm = getInputMethodManager();
             if (imm != null) {
-                if (imm.isActive(mTextView)) {
+                if (imm.hasActiveInputConnection(mTextView)) {
                     if (ims.mContentChanged || ims.mSelectionModeChanged) {
                         // We are in extract mode and the content has changed
                         // in some way... just report complete new text to the