From c9274ff9046b83e1cf114f6e3b7ce0819cedf0a9 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Wed, 9 May 2018 17:40:20 -0700 Subject: [PATCH] Only set text when it actually changes Bug: 77823972 Test: runtest systemui-jank -c android.platform.systemui.tests.jank.SystemUiJankTests -m testUnlock Change-Id: Ie056d3c0d9bf413f10864356ba1f57913b87d066 --- .../stack/NotificationStackScrollLayout.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 7370c4c1c0d1f..743216dee8eba 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -112,7 +112,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; -import java.util.Objects; import java.util.function.BiConsumer; /** @@ -4070,23 +4069,20 @@ public class NotificationStackScrollLayout extends ViewGroup int newVisibility = visible ? VISIBLE : GONE; boolean changedVisibility = oldVisibility != newVisibility; - if (changedVisibility || newVisibility != GONE) { + if (changedVisibility) { if (newVisibility != GONE) { - int oldText = mEmptyShadeView.getTextResource(); - int newText; - if (mStatusBar.areNotificationsHidden()) { - newText = R.string.dnd_suppressing_shade_text; - } else { - newText = R.string.empty_shade_text; - } - if (changedVisibility || !Objects.equals(oldText, newText)) { - mEmptyShadeView.setText(newText); - showFooterView(mEmptyShadeView); - } + showFooterView(mEmptyShadeView); } else { hideFooterView(mEmptyShadeView, true); } } + + int oldTextRes = mEmptyShadeView.getTextResource(); + int newTextRes = mStatusBar.areNotificationsHidden() + ? R.string.dnd_suppressing_shade_text : R.string.empty_shade_text; + if (oldTextRes != newTextRes) { + mEmptyShadeView.setText(newTextRes); + } } public void updateFooterView(boolean visible, boolean showDismissView) {