From 924ef7503970d1485e17988bb9ff3e21bd0557a9 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Wed, 29 Jan 2020 17:26:55 +0100 Subject: [PATCH] Temporary bubble hack for new insets Offset the view instead of using setForwardedInsets which doesn't work anymore with the new insets system. That should resolve itself automatically once we migrate Bubbles off VD. Also, make sure we don't consider a window to be animating when being insets controlled since it breaks syncInputWindows, for example. Bug: 111084606 Test: Open Bubbles test app, open IME. Change-Id: Idb4d32a77e96924e106688c4e11c63e8cff3ae1f --- .../android/systemui/bubbles/BubbleExpandedView.java | 10 +++++++++- .../java/com/android/server/wm/WindowContainer.java | 2 +- .../core/java/com/android/server/wm/WindowState.java | 12 ++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java index cf8b2be1becbf..fa13926447358 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java @@ -20,6 +20,8 @@ import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK; import static android.content.Intent.FLAG_ACTIVITY_NEW_DOCUMENT; import static android.view.Display.INVALID_DISPLAY; +import static android.view.ViewRootImpl.NEW_INSETS_MODE_FULL; +import static android.view.ViewRootImpl.sNewInsetsMode; import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_EXPANDED_VIEW; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; @@ -338,7 +340,13 @@ public class BubbleExpandedView extends LinearLayout implements View.OnClickList ? insets.getDisplayCutout().getSafeInsetBottom() : 0); final int insetsBottom = Math.max(activityViewBottom - keyboardTop, 0); - mActivityView.setForwardedInsets(Insets.of(0, 0, 0, insetsBottom)); + + // TODO: Temporary hack to offset the view until we can properly inset Bubbles again. + if (sNewInsetsMode == NEW_INSETS_MODE_FULL) { + mStackView.animate().translationY(-insetsBottom); + } else { + mActivityView.setForwardedInsets(Insets.of(0, 0, 0, insetsBottom)); + } } } diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 1c876d9cc02f9..3bd2b184ffbfa 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -758,7 +758,7 @@ class WindowContainer extends ConfigurationContainer< * {@see AnimationFlags#PARENTS} * {@see AnimationFlags#CHILDREN} */ - final boolean isAnimating(int flags) { + boolean isAnimating(int flags) { if (mSurfaceAnimator.isAnimating()) { return true; } diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 73984fd49f734..ab679ea72b70b 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4970,6 +4970,18 @@ class WindowState extends WindowContainer implements WindowManagerP mWindowFrames.updateLastInsetValues(); } + @Override + boolean isAnimating(int flags) { + + // If we are an inset provider, all our animations are driven by the inset client, so we + // aren't really animating. + // TODO: Replace this with a proper animation type system. + if (mControllableInsetProvider != null) { + return false; + } + return super.isAnimating(flags); + } + void startAnimation(Animation anim) { // If we are an inset provider, all our animations are driven by the inset client.