Merge "Fix CursorAnchorInfo insertion marker location when cursor is clamped" into udc-qpr-dev am: 5e81476be9 am: 54d0ebfa2a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24802396

Change-Id: I39a0eb3d33647d0f0bc1e9b7caccf893d79dd0f0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index ac0e493..a0d0656 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -14151,7 +14151,8 @@
                             selectionStart, OffsetMapping.MAP_STRATEGY_CURSOR);
                     final int line = layout.getLineForOffset(offsetTransformed);
                     final float insertionMarkerX =
-                            layout.getPrimaryHorizontal(offsetTransformed)
+                            layout.getPrimaryHorizontal(
+                                            offsetTransformed, layout.shouldClampCursor(line))
                                     + viewportToContentHorizontalOffset;
                     final float insertionMarkerTop = layout.getLineTop(line)
                             + viewportToContentVerticalOffset;