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
This commit is contained in:
Kevin 2019-05-09 09:02:27 -07:00
parent 7b48548546
commit b35b7dee18
1 changed files with 12 additions and 1 deletions

View File

@ -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<View> 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();
}
}
/**