From d2acc476d07529ad847f41c79af896d9a6f40d80 Mon Sep 17 00:00:00 2001 From: Steven Terrell Date: Wed, 14 Sep 2022 18:22:42 +0000 Subject: [PATCH] Add Ability to Check if Cursor is Blinking adds a method for returning whether the cursor is blinking based on the current value of the mCancelled property in the Blink class. This method is only inteded to be used for testing purposes. Bug: 228354442 Test: manual, method is called in CtsWidgetTestCases:EditTextTest# testSuspendAndResumeBlinkingCursor, testCursorBlinkingOnNewActivity_WithFocus, testCursorNotBlinkingOnNewActivity_WithoutFocus Change-Id: I02849f6e105cbfe7af78dfb34ffbf1ebbb4a82ae --- core/java/android/widget/Editor.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 1cfe11610e475..fadad99f08853 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -2869,6 +2869,17 @@ public class Editor { } } + /** + * + * @return whether the Blink runnable is blinking or not, if null return false. + * @hide + */ + @VisibleForTesting + public boolean isBlinking() { + if (mBlink == null) return false; + return !mBlink.mCancelled; + } + private class Blink implements Runnable { private boolean mCancelled;