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

Skip to content
Commit 3c9940c6 authored by Chandru S's avatar Chandru S
Browse files

Fix for the lock icon issue

The root cause is a race condition between when we change the padding, when the drawable is scaled and when the view drawn.

 1. We update the drawable state by invoking setImageState.
 2. This internally invokes configureBounds that scales the drawable
 3. at this point padding = 0, Drawable width = 121 drawable height = 171,  vwidth = 202 vheight = 202, Image is scaled by 1.6694214 and then translated -42 px in the y axis
 4. We set the padding to 51 right after this.
 5. The view and the drawable is drawn using the incorrect transformation matrix.
 6. Next round of layout computations happen, `setFrame` is invoked, which invokes configureBounds, now the new padding is used and the correct scale is calculated as 0.8264463 and then dy translation as -21 px.
 7. However, draw is never invoked again for the ImageView (based on logs), the new transformation matrix is never used. I suspect this is due to some draw optimization in View.java that doesn't seem to take into account the change to the drawable scaling change.

This change guarantees that whenever configureBounds is invoked through the setImageState flow, it will always use the correct padding, or we invalidate the ImageView so that we force re-draw.

An alternative fix for this issue is to fix the bug in View/ImageView, but it seems like a riskier change: ag/30583102
CL that has the additional logging changes: ag/30507216

Fixes: 359154646
Test: patch in ag/30554546, which consistently creates the lock icon issue on reboot, issue is not reproducible after this fix. Logs confirm the fix as well
Flag: EXEMPT bugfix
Change-Id: I277a084d0e6e65f9e8fcd926f9a5cd2b083d6d1d
parent b80a5aec
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment