Merge "Gates blur code behind BlurUtils#supportsBlursOnWindows." into ub-launcher3-rvc-dev
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index ebe9e26..2b08dcd 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -32,6 +32,7 @@
 import com.android.launcher3.anim.PendingAnimation;
 import com.android.launcher3.statemanager.StateManager.StateHandler;
 import com.android.launcher3.states.StateAnimationConfig;
+import com.android.systemui.shared.system.BlurUtils;
 import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
 import com.android.systemui.shared.system.SurfaceControlCompat;
 import com.android.systemui.shared.system.TransactionCompat;
@@ -110,6 +111,10 @@
     }
 
     private void ensureDependencies() {
+        if (mWallpaperManager == null) {
+            mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius);
+            mWallpaperManager = new WallpaperManagerCompat(mLauncher);
+        }
         if (mLauncher.getRootView() != null && mOnAttachListener == null) {
             mOnAttachListener = new View.OnAttachStateChangeListener() {
                 @Override
@@ -127,11 +132,6 @@
             };
             mLauncher.getRootView().addOnAttachStateChangeListener(mOnAttachListener);
         }
-        if (mWallpaperManager != null) {
-            return;
-        }
-        mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius);
-        mWallpaperManager = new WallpaperManagerCompat(mLauncher);
     }
 
     /**
@@ -205,7 +205,8 @@
             return;
         }
 
-        if (mSurface == null || !mSurface.isValid()) {
+        boolean supportsBlur = BlurUtils.supportsBlursOnWindows();
+        if (supportsBlur && (mSurface == null || !mSurface.isValid())) {
             return;
         }
         mDepth = depthF;
@@ -214,17 +215,20 @@
         if (windowToken != null) {
             mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth);
         }
-        final int blur;
-        if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
-            // All apps has a solid background. We don't need to draw blurs after it's fully
-            // visible. This will take us out of GPU composition, saving battery and increasing
-            // performance.
-            blur = 0;
-        } else {
-            blur = (int) (mDepth * mMaxBlurRadius);
+
+        if (supportsBlur) {
+            final int blur;
+            if (mLauncher.isInState(LauncherState.ALL_APPS) && mDepth == 1) {
+                // All apps has a solid background. We don't need to draw blurs after it's fully
+                // visible. This will take us out of GPU composition, saving battery and increasing
+                // performance.
+                blur = 0;
+            } else {
+                blur = (int) (mDepth * mMaxBlurRadius);
+            }
+            new TransactionCompat()
+                    .setBackgroundBlurRadius(mSurface, blur)
+                    .apply();
         }
-        new TransactionCompat()
-                .setBackgroundBlurRadius(mSurface, blur)
-                .apply();
     }
 }