OSDN Git Service

Move expensive TextClock operations to onAttach
authorIan Lake <ilake@google.com>
Fri, 10 Mar 2017 21:40:44 +0000 (13:40 -0800)
committerIan Lake <ilake@google.com>
Fri, 10 Mar 2017 21:58:07 +0000 (13:58 -0800)
commitdffe6fdfe1e25e3bad52c00ff6c978deb0327852
tree1e51191bce370df8bec51d0a4dbf1e4b42f42247
parent8aa30c04b89292328177c02ffd37469de699f1ad
Move expensive TextClock operations to onAttach

Registering and unregistering are expensive operations
that should not be done when the visibility of the
TextClock changes. However, we want to ensure that a
non-visible TextClock does not consume extra resources
or cause layout/redraw passes. By keeping the TextClock
registered but avoiding the side effects of onTimeChanged,
we can get the best of both worlds.

Test: manual testing

BUG: 33960344
Change-Id: I3e76246d820363766b78130231d665989fdb4265
core/java/android/widget/TextClock.java