Rename mCursorDrawble to mDrawableForCursor

To go around app bugs caused by assuming that mCursorDrawable is an
array. The apps try to manipulate mCursorDrawable by using
reflection, but crash since they access it incorrectly after it
changed from an array to a single Drawable in
I249befaf70630bef435c8db9039e8aacf233bf7c.

Bug: 66988832
Test: mmm -j frameworks/base
Change-Id: I04fc930d786dd4c74b560d7a25d17353f49ea25b
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 0f61724..19b8c731 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -250,7 +250,7 @@
     SuggestionRangeSpan mSuggestionRangeSpan;
     private Runnable mShowSuggestionRunnable;
 
-    Drawable mCursorDrawable = null;
+    Drawable mDrawableForCursor = null;
 
     private Drawable mSelectHandleLeft;
     private Drawable mSelectHandleRight;
@@ -1678,7 +1678,7 @@
             mCorrectionHighlighter.draw(canvas, cursorOffsetVertical);
         }
 
-        if (highlight != null && selectionStart == selectionEnd && mCursorDrawable != null) {
+        if (highlight != null && selectionStart == selectionEnd && mDrawableForCursor != null) {
             drawCursor(canvas, cursorOffsetVertical);
             // Rely on the drawable entirely, do not draw the cursor line.
             // Has to be done after the IMM related code above which relies on the highlight.
@@ -1873,8 +1873,8 @@
     private void drawCursor(Canvas canvas, int cursorOffsetVertical) {
         final boolean translate = cursorOffsetVertical != 0;
         if (translate) canvas.translate(0, cursorOffsetVertical);
-        if (mCursorDrawable != null) {
-            mCursorDrawable.draw(canvas);
+        if (mDrawableForCursor != null) {
+            mDrawableForCursor.draw(canvas);
         }
         if (translate) canvas.translate(0, -cursorOffsetVertical);
     }
@@ -1933,7 +1933,7 @@
 
     void updateCursorPosition() {
         if (mTextView.mCursorDrawableRes == 0) {
-            mCursorDrawable = null;
+            mDrawableForCursor = null;
             return;
         }
 
@@ -2314,17 +2314,17 @@
     @VisibleForTesting
     @Nullable
     public Drawable getCursorDrawable() {
-        return mCursorDrawable;
+        return mDrawableForCursor;
     }
 
     private void updateCursorPosition(int top, int bottom, float horizontal) {
-        if (mCursorDrawable == null) {
-            mCursorDrawable = mTextView.getContext().getDrawable(
+        if (mDrawableForCursor == null) {
+            mDrawableForCursor = mTextView.getContext().getDrawable(
                     mTextView.mCursorDrawableRes);
         }
-        final int left = clampHorizontalPosition(mCursorDrawable, horizontal);
-        final int width = mCursorDrawable.getIntrinsicWidth();
-        mCursorDrawable.setBounds(left, top - mTempRect.top, left + width,
+        final int left = clampHorizontalPosition(mDrawableForCursor, horizontal);
+        final int width = mDrawableForCursor.getIntrinsicWidth();
+        mDrawableForCursor.setBounds(left, top - mTempRect.top, left + width,
                 bottom + mTempRect.bottom);
     }
 
@@ -4646,9 +4646,9 @@
         @Override
         protected int getCursorOffset() {
             int offset = super.getCursorOffset();
-            if (mCursorDrawable != null) {
-                mCursorDrawable.getPadding(mTempRect);
-                offset += (mCursorDrawable.getIntrinsicWidth()
+            if (mDrawableForCursor != null) {
+                mDrawableForCursor.getPadding(mTempRect);
+                offset += (mDrawableForCursor.getIntrinsicWidth()
                            - mTempRect.left - mTempRect.right) / 2;
             }
             return offset;
@@ -4656,9 +4656,9 @@
 
         @Override
         int getCursorHorizontalPosition(Layout layout, int offset) {
-            if (mCursorDrawable != null) {
+            if (mDrawableForCursor != null) {
                 final float horizontal = getHorizontal(layout, offset);
-                return clampHorizontalPosition(mCursorDrawable, horizontal) + mTempRect.left;
+                return clampHorizontalPosition(mDrawableForCursor, horizontal) + mTempRect.left;
             }
             return super.getCursorHorizontalPosition(layout, offset);
         }
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 791a8fa..24ae03c 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -6281,7 +6281,7 @@
             final int horizontalPadding = getCompoundPaddingLeft();
             final int verticalPadding = getExtendedPaddingTop() + getVerticalOffset(true);
 
-            if (mEditor.mCursorDrawable == null) {
+            if (mEditor.mDrawableForCursor == null) {
                 synchronized (TEMP_RECTF) {
                     /*
                      * The reason for this concern about the thickness of the
@@ -6308,7 +6308,7 @@
                             (int) Math.ceil(verticalPadding + TEMP_RECTF.bottom + thick));
                 }
             } else {
-                final Rect bounds = mEditor.mCursorDrawable.getBounds();
+                final Rect bounds = mEditor.mDrawableForCursor.getBounds();
                 invalidate(bounds.left + horizontalPadding, bounds.top + verticalPadding,
                         bounds.right + horizontalPadding, bounds.bottom + verticalPadding);
             }
@@ -6360,8 +6360,8 @@
             int bottom = mLayout.getLineBottom(lineEnd);
 
             // mEditor can be null in case selection is set programmatically.
-            if (invalidateCursor && mEditor != null && mEditor.mCursorDrawable != null) {
-                final Rect bounds = mEditor.mCursorDrawable.getBounds();
+            if (invalidateCursor && mEditor != null && mEditor.mDrawableForCursor != null) {
+                final Rect bounds = mEditor.mDrawableForCursor.getBounds();
                 top = Math.min(top, bounds.top);
                 bottom = Math.max(bottom, bounds.bottom);
             }