From 19f5398e51bb329c904bbfbd45c5d49623253875 Mon Sep 17 00:00:00 2001 From: Heemin Seog Date: Tue, 19 Nov 2019 17:13:33 -0800 Subject: DO NOT MERGE Rearrange listener logic so it can be overriden Bug: 144567659 Test: build, manual Change-Id: I81a5e0c169b0d916a3f86bfc4d63fffd3eb225af --- .../systemui/statusbar/car/CarStatusBar.java | 42 ++++++++++++---------- 1 file changed, 24 insertions(+), 18 deletions(-) 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 be675d32fd3e..41692960ccba 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/CarStatusBar.java @@ -546,24 +546,7 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt mCarUxRestrictionManagerWrapper = new CarUxRestrictionManagerWrapper(); mNotificationDataManager = new NotificationDataManager(); - mNotificationDataManager.setOnUnseenCountUpdateListener( - () -> { - if (mNavigationBarView != null && mNotificationDataManager != null) { - Boolean hasUnseen = - mNotificationDataManager.getUnseenNotificationCount() > 0; - if (mNavigationBarView != null) { - mNavigationBarView.toggleNotificationUnseenIndicator(hasUnseen); - } - - if (mLeftNavigationBarView != null) { - mLeftNavigationBarView.toggleNotificationUnseenIndicator(hasUnseen); - } - - if (mRightNavigationBarView != null) { - mRightNavigationBarView.toggleNotificationUnseenIndicator(hasUnseen); - } - } - }); + mNotificationDataManager.setOnUnseenCountUpdateListener(this::onUnseenCountUpdate); mEnableHeadsUpNotificationWhenNotificationShadeOpen = mContext.getResources().getBoolean( R.bool.config_enableHeadsUpNotificationWhenNotificationShadeOpen); @@ -688,6 +671,29 @@ public class CarStatusBar extends StatusBar implements CarBatteryController.Batt }); } + /** + * This method is called whenever there is an update to the number of unseen notifications. + * This method can be extended by OEMs to customize the desired logic. + */ + protected void onUnseenCountUpdate() { + if (mNavigationBarView != null && mNotificationDataManager != null) { + Boolean hasUnseen = + mNotificationDataManager.getUnseenNotificationCount() > 0; + + if (mNavigationBarView != null) { + mNavigationBarView.toggleNotificationUnseenIndicator(hasUnseen); + } + + if (mLeftNavigationBarView != null) { + mLeftNavigationBarView.toggleNotificationUnseenIndicator(hasUnseen); + } + + if (mRightNavigationBarView != null) { + mRightNavigationBarView.toggleNotificationUnseenIndicator(hasUnseen); + } + } + } + /** * @return true if the notification panel is currently visible */ -- cgit v1.2.3-59-g8ed1b