From 84af38145b8566049ab2ee774a4d62fd01a23645 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Tue, 1 Nov 2022 09:16:59 +0900 Subject: [PATCH] Use SOURCE_TOUCHSCREEN as the default last input source. To keep the old behavior in case of API call or a11y events, use SOURCE_TOUCHSCREEN as the last input source to be able to show existing ActionMode UI. Bug: 244175906 Test: atest TextViewTest Change-Id: Ie20b37e851b4600a6ad86ad7fffb9e2d466e0be1 --- core/java/android/widget/TextView.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index b5c58fb4bfc02..019b43f9652ec 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -980,8 +980,11 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener /** * The last input source on this TextView. + * + * Use the SOURCE_TOUCHSCREEN as the default value for backward compatibility. There could be a + * non UI event originated ActionMode initiation, e.g. API call, a11y events, etc. */ - private int mLastInputSource = InputDevice.SOURCE_UNKNOWN; + private int mLastInputSource = InputDevice.SOURCE_TOUCHSCREEN; /** * The TextView does not auto-size text (default).