diff options
author | wilsonshih <wilsonshih@google.com> | 2019-02-13 12:20:01 +0800 |
---|---|---|
committer | wilsonshih <wilsonshih@google.com> | 2019-02-19 10:06:22 +0800 |
commit | 0e490d9e77c2ede86e34074d30af2d9c4c754e72 (patch) | |
tree | 6579d2e98e7fda3f965d2cc6791170afabde3f8b /tests/Internal | |
parent | 623a9c6dc744320691a482288f2a196ce9957b77 (diff) |
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
Diffstat (limited to 'tests/Internal')
-rw-r--r-- | tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java index cb6a83d2644b..39608a40b416 100644 --- a/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java +++ b/tests/Internal/src/com/android/internal/colorextraction/ColorExtractorTest.java @@ -56,7 +56,7 @@ public class ColorExtractorTest { @Test public void ColorExtractor_extractWhenInitialized() { ExtractionType type = mock(Tonal.class); - new ColorExtractor(mContext, type); + new ColorExtractor(mContext, type, true); // 1 for lock and 1 for system verify(type, times(2)) .extractInto(any(), any(), any(), any()); @@ -83,7 +83,7 @@ public class ColorExtractorTest { outGradientColorsDark.set(colorsExpectedDark); outGradientColorsExtraDark.set(colorsExpectedExtraDark); }; - ColorExtractor extractor = new ColorExtractor(mContext, type); + ColorExtractor extractor = new ColorExtractor(mContext, type, true); GradientColors colors = extractor.getColors(WallpaperManager.FLAG_SYSTEM, ColorExtractor.TYPE_NORMAL); @@ -98,7 +98,7 @@ public class ColorExtractorTest { public void addOnColorsChangedListener_invokesListener() { ColorExtractor.OnColorsChangedListener mockedListeners = mock(ColorExtractor.OnColorsChangedListener.class); - ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext)); + ColorExtractor extractor = new ColorExtractor(mContext, new Tonal(mContext), true); extractor.addOnColorsChangedListener(mockedListeners); extractor.onColorsChanged(new WallpaperColors(Color.valueOf(Color.RED), null, null), |