From 2e2631572a250ca170af46700780a14f65884e8c Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 7 May 2020 14:18:41 +0200 Subject: [PATCH] Insets: Allow animations when setting SYSTEM_UI_LAYOUT_* flags Test: atest android.server.wm.WindowInsetsAnimationTests#testAnimationCallbacks_withLegacyFlags Fixes: 155955734 Change-Id: Idb35218abb4e17688bfb985abb97ae739a60136b --- core/java/android/view/ViewGroup.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 7935eb1ffc396..e3362aafbcd46 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -7298,7 +7298,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager boolean isOptionalFitSystemWindows = (mViewFlags & OPTIONAL_FITS_SYSTEM_WINDOWS) != 0 || isFrameworkOptionalFitsSystemWindows(); if (isOptionalFitSystemWindows && mAttachInfo != null - && mAttachInfo.mContentOnApplyWindowInsetsListener != null) { + && mAttachInfo.mContentOnApplyWindowInsetsListener != null + && (getWindowSystemUiVisibility() & SYSTEM_UI_LAYOUT_FLAGS) == 0) { return false; } @@ -7322,7 +7323,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager || isFrameworkOptionalFitsSystemWindows(); if (isOptionalFitSystemWindows && mAttachInfo != null && getListenerInfo().mWindowInsetsAnimationCallback == null - && mAttachInfo.mContentOnApplyWindowInsetsListener != null) { + && mAttachInfo.mContentOnApplyWindowInsetsListener != null + && (getWindowSystemUiVisibility() & SYSTEM_UI_LAYOUT_FLAGS) == 0) { mInsetsAnimationDispatchMode = DISPATCH_MODE_STOP; return; }