Merge "Only do things if the window inset changed" into sc-v2-dev

This commit is contained in:
Mady Mellor
2021-09-14 22:56:51 +00:00
committed by Android (Google) Code Review

View File

@@ -69,6 +69,7 @@ import android.util.SparseArray;
import android.util.SparseSetArray; import android.util.SparseSetArray;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.WindowInsets;
import android.view.WindowManager; import android.view.WindowManager;
import android.window.WindowContainerTransaction; import android.window.WindowContainerTransaction;
@@ -188,6 +189,9 @@ public class BubbleController {
/** Saved direction, used to detect layout direction changes @link #onConfigChanged}. */ /** Saved direction, used to detect layout direction changes @link #onConfigChanged}. */
private int mLayoutDirection = View.LAYOUT_DIRECTION_UNDEFINED; private int mLayoutDirection = View.LAYOUT_DIRECTION_UNDEFINED;
/** Saved insets, used to detect WindowInset changes. */
private WindowInsets mWindowInsets;
private boolean mInflateSynchronously; private boolean mInflateSynchronously;
/** True when user is in status bar unlock shade. */ /** True when user is in status bar unlock shade. */
@@ -628,8 +632,11 @@ public class BubbleController {
mBubbleData.getOverflow().initialize(this); mBubbleData.getOverflow().initialize(this);
mWindowManager.addView(mStackView, mWmLayoutParams); mWindowManager.addView(mStackView, mWmLayoutParams);
mStackView.setOnApplyWindowInsetsListener((view, windowInsets) -> { mStackView.setOnApplyWindowInsetsListener((view, windowInsets) -> {
if (!windowInsets.equals(mWindowInsets)) {
mWindowInsets = windowInsets;
mBubblePositioner.update(); mBubblePositioner.update();
mStackView.onDisplaySizeChanged(); mStackView.onDisplaySizeChanged();
}
return windowInsets; return windowInsets;
}); });
} catch (IllegalStateException e) { } catch (IllegalStateException e) {