Merge "Retruns true for hasSelection in reversed selection case" into udc-dev am: aa93568740

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

Change-Id: I2e40cfa2566a8b03650c6794717a2969566aa8ab
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Seigo Nonaka
2023-05-05 15:01:46 +00:00
committed by Automerger Merge Worker

View File

@@ -11808,8 +11808,17 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
public boolean hasSelection() {
final int selectionStart = getSelectionStart();
final int selectionEnd = getSelectionEnd();
final int selectionMin;
final int selectionMax;
if (selectionStart < selectionEnd) {
selectionMin = selectionStart;
selectionMax = selectionEnd;
} else {
selectionMin = selectionEnd;
selectionMax = selectionStart;
}
return selectionStart >= 0 && selectionEnd > 0 && selectionStart != selectionEnd;
return selectionMin >= 0 && selectionMax > 0 && selectionMin != selectionMax;
}
String getSelectedText() {