Apply the clockIconDrawable's time in its constructor.

It is NOT guaranteed that drawInner will be called before a
ClockIconDrawable UX is shown on screen. To test this, I tinted the
ClockIconDrawable's foreground blue in its constructor, and red in its
drawInner method. If drawInner was always called before showing the
ClockIconDrawable on screen, it would be expected that all visible
ClockIconDrawables would have red tinted foregrounds. Instead, only 1
ClockIconDrawable is tinted red, and the rest are tinted blue. Here is
a screenshot: https://screenshot.googleplex.com/5saGse4nazp98QB.png.
Therefore, it can be concluded that drawInner is NOT guaranteed to run
before showing a ClockIconDrawable on screen. To failsafe against the
event that drawInner is not called before showing a ClockIconDrawable's
UX on screen, we set the time immediately in ClockIconDrawable's constructor. This method takes less than 1 ms to run and so there is no performance hit for putting this line of code here.

Bug: 188377749
Test: Verified that the time doesn't jump backwards to an incorrect time
when a user taps on the clock icon, then rapidly swipes back. It stays
at the same time as it was before the user tapped on the clock icon.

Change-Id: I67328c973d97974bcea340943f7ce02c55550d8e
1 file changed
tree: f10e837e6886fcd6402c082c296bf68a30cfec27
  1. iconloaderlib/
  2. searchuilib/