OSDN Git Service

Fix class initialization issue
authorLucas Dupin <dupin@google.com>
Tue, 16 Jul 2019 22:42:48 +0000 (15:42 -0700)
committerLucas Dupin <dupin@google.com>
Tue, 16 Jul 2019 22:42:48 +0000 (15:42 -0700)
We were getting an NPE because the superclass was
calling an overridden method on its constructor,
before the variable could be initialized.

Test: atest ScrimControllerTest
Fixes: 137665467
Change-Id: I8914eac86cac19d92a68a2d55d97dfcee4066ed3

packages/SystemUI/src/com/android/systemui/colorextraction/SysuiColorExtractor.java

index 0e93f42..d3e8b3d 100644 (file)
@@ -77,7 +77,7 @@ public class SysuiColorExtractor extends ColorExtractor implements Dumpable,
     protected void extractWallpaperColors() {
         super.extractWallpaperColors();
         // mTonal is final but this method will be invoked by the base class during its ctor.
-        if (mTonal == null) {
+        if (mTonal == null || mNeutralColorsLock == null) {
             return;
         }
         mTonal.applyFallback(mLockColors == null ? mSystemColors : mLockColors, mNeutralColorsLock);