diff options
author | Tiger Huang <tigerhuang@google.com> | 2022-03-23 16:08:40 +0800 |
---|---|---|
committer | Tiger Huang <tigerhuang@google.com> | 2022-03-24 12:17:37 +0000 |
commit | 43047efed7fe21c4b149362d9a259fe648d0045d (patch) | |
tree | 636f5d87780a171e21d10b27053ddb192ce9f590 /core | |
parent | 23d65f1d38ae0e5fcb0beb4e38f451c908b55019 (diff) |
Fix setSystemBarsAppearances
We should compare the existing appearance with the new appearance which
is about to be applied to insetsFlags.appearance, not the raw appearance
from the argument, before deciding if we can skip it.
Bug: 224613946
Fix: 226227461
Test: atest WindowInsetsControllerTests#testSetSystemBarsAppearance
Change-Id: I1283089a3dadf4ca2c3136f80d1472a34351306a
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/view/ViewRootInsetsControllerHost.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/view/ViewRootInsetsControllerHost.java b/core/java/android/view/ViewRootInsetsControllerHost.java index efffa2b05a1e..aba79d5b87c3 100644 --- a/core/java/android/view/ViewRootInsetsControllerHost.java +++ b/core/java/android/view/ViewRootInsetsControllerHost.java @@ -171,8 +171,9 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host { public void setSystemBarsAppearance(int appearance, int mask) { mViewRoot.mWindowAttributes.privateFlags |= PRIVATE_FLAG_APPEARANCE_CONTROLLED; final InsetsFlags insetsFlags = mViewRoot.mWindowAttributes.insetsFlags; - if (insetsFlags.appearance != appearance) { - insetsFlags.appearance = (insetsFlags.appearance & ~mask) | (appearance & mask); + final int newAppearance = (insetsFlags.appearance & ~mask) | (appearance & mask); + if (insetsFlags.appearance != newAppearance) { + insetsFlags.appearance = newAppearance; mViewRoot.mWindowAttributesChanged = true; mViewRoot.scheduleTraversals(); } |