From 8bd920f834b68326e9acdfe96fd0a1abea92e2ee Mon Sep 17 00:00:00 2001 From: Priyank Singh Date: Tue, 4 Jun 2019 15:21:46 -0700 Subject: [PATCH] When the notification shade is shown the functionality to show/hide HUN should be controlled via a config flag. Bug:134767666 Test: Manual Change-Id: Id8097a99e0a2424e66f171e7ed47fe3befae7f8a --- packages/CarSystemUI/res/values/config.xml | 3 +++ .../systemui/statusbar/car/CarStatusBar.java | 13 ++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/CarSystemUI/res/values/config.xml b/packages/CarSystemUI/res/values/config.xml index d946fbc9520ad..467c4a41893d3 100644 --- a/packages/CarSystemUI/res/values/config.xml +++ b/packages/CarSystemUI/res/values/config.xml @@ -29,6 +29,9 @@ false true + + true + true false diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java index 8373761962ac2..65827501a5789 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -163,6 +163,8 @@ public class CarStatusBar extends StatusBar implements private boolean mIsNotificationCardSwiping; // If notification shade is being swiped vertically to close. private boolean mIsSwipingVerticallyToClose; + // Whether heads-up notifications should be shown when shade is open. + private boolean mEnableHeadsUpNotificationWhenNotificationShadeOpen; private final CarPowerStateListener mCarPowerStateListener = (int state) -> { @@ -455,6 +457,8 @@ public class CarStatusBar extends StatusBar implements } }); + mEnableHeadsUpNotificationWhenNotificationShadeOpen = mContext.getResources().getBoolean( + R.bool.config_enableHeadsUpNotificationWhenNotificationShadeOpen); CarHeadsUpNotificationManager carHeadsUpNotificationManager = new CarSystemUIHeadsUpNotificationManager(mContext, mNotificationClickHandlerFactory, mNotificationDataManager); @@ -1257,12 +1261,19 @@ public class CarStatusBar extends StatusBar implements mHeadsUpPanel.setVisibility(View.INVISIBLE); } + @Override + protected void setInternalInsetsInfo(ViewTreeObserver.InternalInsetsInfo info, + HeadsUpEntry currentNotification, boolean panelExpanded) { + super.setInternalInsetsInfo(info, currentNotification, mPanelExpanded); + } + @Override protected void setHeadsUpVisible() { // if the Notifications panel is showing don't show the Heads up - if (mPanelExpanded) { + if (!mEnableHeadsUpNotificationWhenNotificationShadeOpen && mPanelExpanded) { return; } + super.setHeadsUpVisible(); if (mHeadsUpPanel.getVisibility() == View.VISIBLE) { mStatusBarWindowController.setHeadsUpShowing(true);