From 76495678a4e685f031f532aa8c8e902f54cb5624 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 7 Jul 2015 15:22:54 -0700 Subject: [PATCH] Avoid IPC call with an empty array Don't call setNotificationsShown() from status bar when notifications are hiding. It should only be called when there's some new notification to report as seen. This is just an optimization. Bug: 21785854 Change-Id: I1f6024fea29694201284bd27d4b30460a62f0b57 --- .../systemui/statusbar/phone/PhoneStatusBar.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index a637e24ba8bb4..135e2d2bda00b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -3035,11 +3035,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } final int N = newlyVisible.size(); - String[] newlyVisibleKeyAr = new String[N]; - for (int i = 0; i < N; i++) { - newlyVisibleKeyAr[i] = newlyVisibleAr[i].key; + if (N > 0) { + String[] newlyVisibleKeyAr = new String[N]; + for (int i = 0; i < N; i++) { + newlyVisibleKeyAr[i] = newlyVisibleAr[i].key; + } + + setNotificationsShown(newlyVisibleKeyAr); } - setNotificationsShown(newlyVisibleKeyAr); } // State logging