diff options
| author | Tiger Huang <tigerhuang@google.com> | 2020-03-03 23:03:39 +0800 |
|---|---|---|
| committer | Tiger Huang <tigerhuang@google.com> | 2020-03-04 16:06:19 +0800 |
| commit | b9510efabdf3393502f2f0442e4e0bb7f02e5a80 (patch) | |
| tree | c3261188cd5d4ef295c9ec3782766474a345e0c8 /core/java/android/view/InsetsState.java | |
| parent | 35886c0d472b8cec88c99649eeaab41b5851e8f1 (diff) | |
Prevent causing insets if the system bar is shown forcibly
Forcibly-shown system bars are usually transient. Prevent them from
causing insets can reduce the UI shakiness, and can be compatible with
the behavior in the legacy insets mode.
Fix: 150582388
Test: atest InsetsSourceProviderTest InsetsStateControllerTest
InsetsPolicyTest
Change-Id: I3c0fa4fb7555b2f63e1c4849db7b169489ab64e4
Diffstat (limited to 'core/java/android/view/InsetsState.java')
| -rw-r--r-- | core/java/android/view/InsetsState.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index b740c58ec15f..e4aa41074221 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -342,6 +342,20 @@ public class InsetsState implements Parcelable { } } + /** + * A shortcut for setting the visibility of the source. + * + * @param type The {@link InternalInsetsType} of the source to set the visibility + * @param referenceState The {@link InsetsState} for reference + */ + public void setSourceVisible(@InternalInsetsType int type, InsetsState referenceState) { + InsetsSource source = mSources.get(type); + InsetsSource referenceSource = referenceState.mSources.get(type); + if (source != null && referenceSource != null) { + source.setVisible(referenceSource.isVisible()); + } + } + public void set(InsetsState other) { set(other, false /* copySources */); } |
