summaryrefslogtreecommitdiff
path: root/core/java/android/view/InsetsState.java
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2020-03-02 20:22:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-03-02 20:22:34 +0000
commit96cc10c2deabbfb063cf649401d89f2762eb7d1e (patch)
treeb84e3bcab740079609662cbcbfd27cf7d31c247c /core/java/android/view/InsetsState.java
parent432e0c744003eead66f5765067f43f30cdac122a (diff)
parent580aef5a82c80317549eaeda81b646a0a44ec860 (diff)
Merge "Various inset fixes" into rvc-dev
Diffstat (limited to 'core/java/android/view/InsetsState.java')
-rw-r--r--core/java/android/view/InsetsState.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java
index c877c454be91..b740c58ec15f 100644
--- a/core/java/android/view/InsetsState.java
+++ b/core/java/android/view/InsetsState.java
@@ -147,10 +147,13 @@ public class InsetsState implements Parcelable {
* Calculates {@link WindowInsets} based on the current source configuration.
*
* @param frame The frame to calculate the insets relative to.
+ * @param ignoringVisibilityState {@link InsetsState} used to calculate
+ * {@link WindowInsets#getInsetsIgnoringVisibility(int)} information, or pass
+ * {@code null} to use this state to calculate that information.
* @return The calculated insets.
*/
- public WindowInsets calculateInsets(Rect frame, boolean isScreenRound,
- boolean alwaysConsumeSystemBars, DisplayCutout cutout,
+ public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState,
+ boolean isScreenRound, boolean alwaysConsumeSystemBars, DisplayCutout cutout,
@Nullable Rect legacyContentInsets, @Nullable Rect legacyStableInsets,
int legacySoftInputMode, int legacySystemUiFlags,
@Nullable @InternalInsetsSide SparseIntArray typeSideMap) {
@@ -188,8 +191,15 @@ public class InsetsState implements Parcelable {
// IME won't be reported in max insets as the size depends on the EditorInfo of the IME
// target.
if (source.getType() != ITYPE_IME) {
- processSource(source, relativeFrameMax, true /* ignoreVisibility */,
- typeMaxInsetsMap, null /* typeSideMap */, null /* typeVisibilityMap */);
+ InsetsSource ignoringVisibilitySource = ignoringVisibilityState != null
+ ? ignoringVisibilityState.getSource(type)
+ : source;
+ if (ignoringVisibilitySource == null) {
+ continue;
+ }
+ processSource(ignoringVisibilitySource, relativeFrameMax,
+ true /* ignoreVisibility */, typeMaxInsetsMap, null /* typeSideMap */,
+ null /* typeVisibilityMap */);
}
}
final int softInputAdjustMode = legacySoftInputMode & SOFT_INPUT_MASK_ADJUST;
@@ -297,6 +307,10 @@ public class InsetsState implements Parcelable {
return mSources.computeIfAbsent(type, InsetsSource::new);
}
+ public @Nullable InsetsSource peekSource(@InternalInsetsType int type) {
+ return mSources.get(type);
+ }
+
public void setDisplayFrame(Rect frame) {
mDisplayFrame.set(frame);
}