Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 3d479ed2 authored by Steven Terrell's avatar Steven Terrell Committed by Cherrypicker Worker
Browse files

Fix cursor not blinking when view re-added to layout

This fixes a bug where if the EditText view has or had focus and then
is removed from the layout and re-added the cursor does not resume
blinking.

There was a change several months ago that prevented the cursor from
blinking when the window is no longer visible.  That change added a
check in shouldBlink to verify that the window is visible.  This
created a situation where the window might not be visible when
makeBlink is called from onFocusChanged and as a result mBlink is
never instantiated. This resulted in the cursor not blinking after an
app starts. The fix was to call makeBlink again when onAttachToWindow
is called.  The Window is visible at this point and the cursor blinks
as expected.

The reason the code change below is needed is in the case where a view
is removed and added back after the mBlink object has been
instantiated. A call to unCancel is needed to ensure that the cursor
resumes blinking as expected. This was identified in this change
aosp/2540031.

The change also guards against the window not visible case as outlined
above.

Bug: 278907680
Test: Added following CTS test:
      testCursorResumeBlinking_AfterFocusedView_DynamicallyRemovedAdded
      testCursorBlinking_ViewDynamically_RemovedAdded_NeverHadFocus
      testCursorSuspendBlinking_ViewDynamicallyRemoved
      testCursorNotBlinking_ViewDynamicallyAdded_NoFocus
      testCursorBlinking_ViewDynamicallyAdded_WithFocus
(cherry picked from https://android-review.googlesource.com/q/commit:61d982884fa0e14dc5f58e872f182bb5c1b04afd)
Merged-In: I07afc7ef1a707549240479015a00a66db814afb7
Change-Id: I07afc7ef1a707549240479015a00a66db814afb7
Cherrypick from AOSP master to udc-dev.
parent 74240559
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment