[CD Taskbar] Create new taskbars only when we have system decor

Only allow for new taskbars  when wm.shouldShowSystemDecors=true.

Bug: 397250946
Change-Id: I29577224e763ca44a2b1878691dce3e3aa1534ff
Test: m
Flag: com.android.window.flags.enable_taskbar_connected_displays
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index 46802c3..de65676 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -709,15 +709,14 @@
             return;
         }
 
-        // TODO (b/391965805): remove once onDisplayAddSystemDecorations is working.
-        WindowManager wm = getWindowManager(displayId);
-        if (wm == null || !wm.shouldShowSystemDecors(displayId)) {
-            return;
-        }
-
         Context newWindowContext = createWindowContext(displayId);
         if (newWindowContext != null) {
             addWindowContextToMap(displayId, newWindowContext);
+            // TODO (b/391965805): remove once onDisplayAddSystemDecorations is working.
+            WindowManager wm = getWindowManager(displayId);
+            if (wm == null || !wm.shouldShowSystemDecors(displayId)) {
+                return;
+            }
             createTaskbarRootLayout(displayId);
             createNavButtonController(displayId);
             createAndRegisterComponentCallbacks(displayId);