Update scrim if insets are added later.

If insets are set after the activity requests the foreground scrim to be
shown, the scrim will not be correctly added. This is an issue for
fallback recents which requests the foreground scrim right after
initialization.

To fix this, we save the request to show the scrim in a local variable
and check this on inset updates to determine whether we should show the
scrim or not.

Bug: 131853975
Test: Fallback recents now has foreground scrim added correctly
Change-Id: I15a19a3184bbc97a20fbcbba2106fd7221410df0
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
index a53a06e..771c7d7 100644
--- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
+++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java
@@ -154,6 +154,7 @@
     private boolean mTransitionedFromApp;
     private boolean mUsingRemoteAnimation;
     private boolean mStartedEnterAnimation;
+    private boolean mShowStatusBarForegroundScrim;
     private AnimatorSet mLayoutAnimation;
     private final ArraySet<View> mLayingOutViews = new ArraySet<>();
     private Rect mInsets;
@@ -409,7 +410,14 @@
      * @param showStatusBarForegroundScrim true to show the scrim, false to hide
      */
     public void setShowStatusBarForegroundScrim(boolean showStatusBarForegroundScrim) {
-        boolean shouldShow = mInsets.top != 0 && showStatusBarForegroundScrim;
+        mShowStatusBarForegroundScrim = showStatusBarForegroundScrim;
+        if (mShowStatusBarForegroundScrim != showStatusBarForegroundScrim) {
+            updateStatusBarScrim();
+        }
+    }
+
+    private void updateStatusBarScrim() {
+        boolean shouldShow = mInsets.top != 0 && mShowStatusBarForegroundScrim;
         mActivity.getDragLayer().setForeground(shouldShow ? mStatusBarForegroundScrim : null);
     }
 
@@ -838,6 +846,9 @@
         mInsets = insets;
         mTaskRecyclerView.setPadding(insets.left, insets.top, insets.right, insets.bottom);
         mTaskRecyclerView.invalidateItemDecorations();
+        if (mInsets.top != 0) {
+            updateStatusBarScrim();
+        }
     }
 
     /**