From b35b7dee18be3f2715e75a2aafe6bfaaa3815f65 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 9 May 2019 09:02:27 -0700 Subject: [PATCH] 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 --- .../android/quickstep/views/IconRecentsView.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java index a53a06e86b..771c7d7fa7 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 @@ public final class IconRecentsView extends FrameLayout implements Insettable { private boolean mTransitionedFromApp; private boolean mUsingRemoteAnimation; private boolean mStartedEnterAnimation; + private boolean mShowStatusBarForegroundScrim; private AnimatorSet mLayoutAnimation; private final ArraySet mLayingOutViews = new ArraySet<>(); private Rect mInsets; @@ -409,7 +410,14 @@ public final class IconRecentsView extends FrameLayout implements Insettable { * @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 @@ public final class IconRecentsView extends FrameLayout implements Insettable { mInsets = insets; mTaskRecyclerView.setPadding(insets.left, insets.top, insets.right, insets.bottom); mTaskRecyclerView.invalidateItemDecorations(); + if (mInsets.top != 0) { + updateStatusBarScrim(); + } } /**