Gilles Debunne 2e37d62926 Remove onPreDrawListeners earlier in TextView
Bug 5556478

Launcher pre-populates its all apps and widget pages with their
content, which includes text. The layout calls some onMeasure methods
that trigger TextView's registerForPreDraw(), which in turns adds a
listener in the ViewTreeObserver.

However, some of these pages may never be actually displayed, leaving
the listeners in the list since onDraw() is never called.

As a result, every frame displayed by launcher is slowned down by this
array copy of 6-18 listeners.

The problem is not Launcher specific since other applications may use
a similar caching mechanism.

The solution is to unsubscribe the listener in onPreDraw.

The drawback is that several successive calls to registerForPreDraw() will
add/remove the some listener object. However, these calls are rare and are
relatively cheap since we're just adding the object in and out of an
ArrayList which should not need to change its size.

Change-Id: Ifb65655a27e302d31a2ad622d18f839aec99689e
2012-01-27 18:39:07 -08:00
2012-01-27 10:35:12 -08:00
2012-01-24 15:41:50 -08:00
2012-01-25 12:42:51 -08:00
2012-01-05 14:39:45 -08:00
2012-01-17 11:57:27 -08:00
2012-01-25 13:17:19 -08:00
Description
No description provided
5.1 GiB
Languages
Java 77.3%
Kotlin 9.2%
PowerBuilder 6.6%
C++ 5.5%
AIDL 1%