Ensure some taskbar states are initialized correctly

- Update FLAG_IN_APP to account for setup state to ensure that the
  stashed state is correct. This needs to be done in the stash
  controller since SUW is the home activity on startup and the
  launcher state controller will not be initialized until after
  SUW finishes
- Initialize the launcher state and resumed flags in case Launcher
  restarts while another app is resumed

Bug: 204384193
Test: Run through SUW, ensure the background is not visible
Change-Id: I5ce061ad16e79226c8428339ccd0b5ac55c07205
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index e2ba459..7a50d0b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -111,6 +111,11 @@
         onIconAlignmentRatioChangedForAppAndHomeTransition();
 
         mLauncher.getStateManager().addStateListener(mStateListener);
+
+        // Initialize to the current launcher state
+        updateStateForFlag(FLAG_RESUMED, launcher.hasBeenResumed());
+        mLauncherState = launcher.getStateManager().getState();
+        applyState(0);
     }
 
     public void onDestroy() {
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
index 5c31e05..afb4c9a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java
@@ -171,9 +171,13 @@
 
         boolean isManuallyStashedInApp = supportsManualStashing()
                 && mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF);
+        boolean isInSetup = !mActivity.isUserSetupComplete() || sharedState.setupUIVisible;
         updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp);
-        updateStateForFlag(FLAG_STASHED_IN_APP_SETUP,
-                !mActivity.isUserSetupComplete() || sharedState.setupUIVisible);
+        updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup);
+        if (isInSetup) {
+            // Update the in-app state to ensure isStashed() reflects right state during SUW
+            updateStateForFlag(FLAG_IN_APP, true);
+        }
         applyState();
 
         notifyStashChange(/* visible */ false, /* stashed */ isStashedInApp());