summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mady Mellor <madym@google.com> 2021-09-14 22:56:51 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2021-09-14 22:56:51 +0000
commitfd0437eea3e7fcbf0357df1bfdf24fa9fd33fe8e (patch)
treee2e37b49aebdea896825a3a1490bc4eec1d82f6e
parente176359fa4a88063b1786a1bcf69219f50ddbe74 (diff)
parent079d53ccbe8db9551606315a116dcdf893b98891 (diff)
Merge "Only do things if the window inset changed" into sc-v2-dev
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java11
1 files 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 ea04fb6daa9f..c126f32387f0 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;
@@ -188,6 +189,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. */
@@ -628,8 +632,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) {