From 079d53ccbe8db9551606315a116dcdf893b98891 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Tue, 14 Sep 2021 12:48:53 -0700 Subject: Only do things if the window inset changed Test: manual - expand the stack, select the overflow, collapse the stack => verify that there isn't a weird animation Bug: 199781565 Change-Id: I408ae5e32a0f9f335fda6a6743134bc52e348d4e --- .../src/com/android/wm/shell/bubbles/BubbleController.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java index 9dafefebf62b..f3611689ff1f 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java @@ -69,6 +69,7 @@ import android.util.SparseArray; import android.util.SparseSetArray; import android.view.View; import android.view.ViewGroup; +import android.view.WindowInsets; import android.view.WindowManager; import android.window.WindowContainerTransaction; @@ -189,6 +190,9 @@ public class BubbleController { /** Saved direction, used to detect layout direction changes @link #onConfigChanged}. */ private int mLayoutDirection = View.LAYOUT_DIRECTION_UNDEFINED; + /** Saved insets, used to detect WindowInset changes. */ + private WindowInsets mWindowInsets; + private boolean mInflateSynchronously; /** True when user is in status bar unlock shade. */ @@ -629,8 +633,11 @@ public class BubbleController { mBubbleData.getOverflow().initialize(this); mWindowManager.addView(mStackView, mWmLayoutParams); mStackView.setOnApplyWindowInsetsListener((view, windowInsets) -> { - mBubblePositioner.update(); - mStackView.onDisplaySizeChanged(); + if (!windowInsets.equals(mWindowInsets)) { + mWindowInsets = windowInsets; + mBubblePositioner.update(); + mStackView.onDisplaySizeChanged(); + } return windowInsets; }); } catch (IllegalStateException e) { -- cgit v1.2.3-59-g8ed1b