OSDN Git Service

Improve the performance when loading image wallpaper colors
authorwilsonshih <wilsonshih@google.com>
Wed, 13 Feb 2019 04:20:01 +0000 (12:20 +0800)
committerwilsonshih <wilsonshih@google.com>
Tue, 19 Feb 2019 02:06:22 +0000 (10:06 +0800)
commit0e490d9e77c2ede86e34074d30af2d9c4c754e72
tree6579d2e98e7fda3f965d2cc6791170afabde3f8b
parent623a9c6dc744320691a482288f2a196ce9957b77
Improve the performance when loading image wallpaper colors

When SystemUI start up, ColorExtractor will get wallpaper colors so
status bar can use it to update theme, however, this will also block
SystemUI start up process if the wallpaper is image wallpaper.
In order to break the latency, we can extract getWallpaperColors
method from ColorExtractor's contructor, and do it at another thread,
so it won't block SystemUI start up.

Bug: 124279857
Test: atest ColorExtractorTest
Test: Manual test change theme feature can work normally.

Change-Id: I8589b28a17b0a2b33b4bbbda2265080af983f26a
core/java/com/android/internal/colorextraction/ColorExtractor.java
packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java
tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java