From af2c7c42dc29c93e4162b24e245f1d979adb519a Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Tue, 12 May 2020 19:53:18 +0800 Subject: Reset visibilities if mDummyControlTarget is the control target The leash visibility won't be reset while the control target is changed anymore. So we need to reset it when mDummyControlTarget gets the control. Fix: 156342134 Test: Open Camera and see if status bar is visible while receiving a heads up notification. Change-Id: Ieca5b08f4342ec350bb57d333f1e34149050db45 --- .../java/com/android/server/wm/InsetsPolicy.java | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/InsetsPolicy.java b/services/core/java/com/android/server/wm/InsetsPolicy.java index 317bb43adb98..d02be88ef0d4 100644 --- a/services/core/java/com/android/server/wm/InsetsPolicy.java +++ b/services/core/java/com/android/server/wm/InsetsPolicy.java @@ -60,7 +60,37 @@ class InsetsPolicy { private final IntArray mShowingTransientTypes = new IntArray(); /** For resetting visibilities of insets sources. */ - private final InsetsControlTarget mDummyControlTarget = new InsetsControlTarget() { }; + private final InsetsControlTarget mDummyControlTarget = new InsetsControlTarget() { + + @Override + public void notifyInsetsControlChanged() { + boolean hasLeash = false; + final InsetsSourceControl[] controls = + mStateController.getControlsForDispatch(this); + if (controls == null) { + return; + } + for (InsetsSourceControl control : controls) { + final @InternalInsetsType int type = control.getType(); + if (mShowingTransientTypes.indexOf(type) != -1) { + // The visibilities of transient bars will be handled with animations. + continue; + } + final SurfaceControl leash = control.getLeash(); + if (leash != null) { + hasLeash = true; + + // We use alpha to control the visibility here which aligns the logic at + // SurfaceAnimator.createAnimationLeash + mDisplayContent.getPendingTransaction().setAlpha( + leash, InsetsState.getDefaultVisibility(type) ? 1f : 0f); + } + } + if (hasLeash) { + mDisplayContent.scheduleAnimation(); + } + } + }; private WindowState mFocusedWin; private BarWindow mStatusBar = new BarWindow(StatusBarManager.WINDOW_STATUS_BAR); -- cgit v1.2.3-59-g8ed1b