History log of /packages/apps/UnifiedEmail/src/com/android/mail/utils/DrawIdler.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
144bfe739b93afdee0a1700a34806b0b287e5887 11-Jun-2013 Andy Huang <ath@google.com> yielding cache construction to reduce scroll+refresh jank

Background caching of conversation objects triggers GC_FOR_ALLOC, which
blocks the main thread and causes jank. We do want to cache to improve
scroll framerate, but we also want to avoid causing GCs while drawing is
in progress.

Add cancel-handling to the cache's async task, and connect it to a new
DrawIdler class that monitors a view hierarchy for draws. Together, they
cause any drawing to pause background caching until 100ms of drawing
silence.

If you scroll before the cache is filled, scroll framerate will not
benefit from the cache, so it will be somewhat lower. Previously,
caching would continue during the scroll, so depending on where you are
in the list, it may have been faster, except that it was punctuated by
annoying GC pauses. The framerate now will be generally more even now,
although it may be lower if you scroll before the cache is allowed to be
filled.

The DrawIdler is 1:1 owned by the Activity/Controller, but a single
Cursor may be shared across Activity instances (e.g. rotate). So connect
each DrawIdler to the shared cursor in onLoadFinished. This works
because the rotated Activity's onLoadFinished is called *after* the
first Activity's onDestroy.

Bug: 9032162
Change-Id: I217dac012f2d74f47a158aee3bd2de78d9b14171
/packages/apps/UnifiedEmail/src/com/android/mail/utils/DrawIdler.java