diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index 11e02e03c4e46..6a0ec3368f19c 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -909,6 +909,11 @@ public class InsetsState implements Parcelable { if (source == null && otherSource == null) { continue; } + if (excludeInvisibleImeFrames && i == ITYPE_IME + && ((source == null && !otherSource.isVisible()) + || (otherSource == null && !source.isVisible()))) { + continue; + } if (source == null || otherSource == null) { return false; }