From 1826d98381cd69fd4fdcf6ad527fec8ece22ec26 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Mon, 6 Mar 2017 20:47:37 -0800 Subject: [PATCH] Fixes an issue where the notification header could be invisible It's not actually necessary to set the visibility of the notification header since it is actually in the ChildrenContainer which already handles the visiblity. This existed from legacy times where it was outside of the viewgroup. When animating the headers, this could actually lead to blank headers. Test: runtest -x packages/SystemUI/tests/src/com/android/systemui/statusbar/ExpandableNotificationRowTest.java Change-Id: I7763b47340a347ed44fc9ce34a98f74c7e55ef8d Fixes: 35993698 --- .../statusbar/ExpandableNotificationRow.java | 1 - .../stack/NotificationChildrenContainer.java | 12 +++--------- .../statusbar/ExpandableNotificationRowTest.java | 11 +++++++++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index fc3bb43e4fed1..00968ee8d0e4e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -1268,7 +1268,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { if (mChildrenContainer != null) { mChildrenContainer.setVisibility(!mShowingPublic && mIsSummaryWithChildren ? VISIBLE : INVISIBLE); - mChildrenContainer.setHeaderVisible(!mShowingPublic && mIsSummaryWithChildren); } // The limits might have changed if the view suddenly became a group or vice versa updateLimits(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index 83cbd722703c2..3978cb2f8397f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -89,7 +89,6 @@ public class NotificationChildrenContainer extends ViewGroup { private ViewState mHeaderViewState; private int mClipBottomAmount; private boolean mIsLowPriority; - private boolean mHeaderVisible = true; private OnClickListener mHeaderClickListener; private boolean mShowingNormalHeader; @@ -794,11 +793,6 @@ public class NotificationChildrenContainer extends ViewGroup { return mNotificationHeaderLowPriority; } - public void setHeaderVisible(boolean visible) { - mHeaderVisible = visible; - updateHeaderVisibility(false /* animate */); - } - private void updateHeaderVisibility(boolean animate) { NotificationHeaderView visibleHeader = mNotificationHeader; NotificationHeaderView hiddenHeader = mNotificationHeaderLowPriority; @@ -809,7 +803,7 @@ public class NotificationChildrenContainer extends ViewGroup { normalHeaderVisible = false; } if (animate) { - if (mHeaderVisible && visibleHeader != null && hiddenHeader != null + if (visibleHeader != null && hiddenHeader != null && mShowingNormalHeader != normalHeaderVisible) { hiddenHeader.setVisibility(VISIBLE); visibleHeader.setVisibility(VISIBLE); @@ -825,7 +819,7 @@ public class NotificationChildrenContainer extends ViewGroup { if (!animate) { if (visibleHeader != null) { getWrapperForView(visibleHeader).setVisible(true); - visibleHeader.setVisibility(mHeaderVisible ? VISIBLE : INVISIBLE); + visibleHeader.setVisibility(VISIBLE); } if (hiddenHeader != null) { getWrapperForView(hiddenHeader).setVisible(false); @@ -855,7 +849,7 @@ public class NotificationChildrenContainer extends ViewGroup { private void updateHeaderTransformation() { - if (mUserLocked && mHeaderVisible && showingAsLowPriority()) { + if (mUserLocked && showingAsLowPriority()) { float fraction = getGroupExpandFraction(); mNotificationHeaderWrapper.transformFrom(mNotificationHeaderWrapperLowPriority, fraction); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ExpandableNotificationRowTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ExpandableNotificationRowTest.java index bf741ec41ac73..b0ca7c7450b6b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/ExpandableNotificationRowTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/ExpandableNotificationRowTest.java @@ -104,4 +104,15 @@ public class ExpandableNotificationRowTest { Assert.assertFalse(mRow.isShowingIcon()); } + @Test + public void testNotificationHeaderVisibleWhenAnimating() { + mRow.setSensitive(true, true); + mRow.addChildNotification(createNotification()); + mRow.addChildNotification(createNotification()); + mRow.setHideSensitive(true, false, 0, 0); + mRow.setHideSensitive(false, true, 0, 0); + Assert.assertTrue( + mRow.getChildrenContainer().getVisibleHeader().getVisibility() == View.VISIBLE); + } + }