Merge "Fix header not set on initialization" into oc-dev

am: 388ceaa37a

Change-Id: Ia706458360372059715ea86873dbbefc854731d6
This commit is contained in:
Lucas Dupin
2017-05-31 16:02:16 +00:00
committed by android-build-merger
2 changed files with 21 additions and 3 deletions

View File

@@ -300,7 +300,7 @@ public class NotificationChildrenContainer extends ViewGroup {
mNotificationHeaderWrapper.notifyContentUpdated(mContainingNotification);
recreateLowPriorityHeader(builder);
recreateAmbientHeader(builder);
resetHeaderVisibilityIfNeeded(mNotificationHeader, calculateDesiredHeader());
updateHeaderVisibility(false /* animate */);
updateChildrenHeaderAppearance();
}
@@ -833,6 +833,11 @@ public class NotificationChildrenContainer extends ViewGroup {
return mNotificationHeaderLowPriority;
}
@VisibleForTesting
public ViewGroup getCurrentHeaderView() {
return mCurrentHeader;
}
public void notifyShowAmbientChanged() {
updateHeaderVisibility(false);
}
@@ -869,7 +874,12 @@ public class NotificationChildrenContainer extends ViewGroup {
desiredHeader.setVisibility(VISIBLE);
}
if (currentHeader != null) {
getWrapperForView(currentHeader).setVisible(false);
// Wrapper can be null if we were a low priority notification
// and just destroyed it by calling setIsLowPriority(false)
NotificationViewWrapper wrapper = getWrapperForView(currentHeader);
if (wrapper != null) {
wrapper.setVisible(false);
}
currentHeader.setVisibility(INVISIBLE);
}
}
@@ -878,7 +888,7 @@ public class NotificationChildrenContainer extends ViewGroup {
resetHeaderVisibilityIfNeeded(mNotificationHeaderAmbient, desiredHeader);
resetHeaderVisibilityIfNeeded(mNotificationHeaderLowPriority, desiredHeader);
mCurrentHeader = currentHeader;
mCurrentHeader = desiredHeader;
}
private void resetHeaderVisibilityIfNeeded(View header, View desiredHeader) {

View File

@@ -60,4 +60,12 @@ public class NotificationChildrenContainerTest extends SysuiTestCase {
Assert.assertTrue(lowPriorityHeaderView.getParent() == null);
Assert.assertTrue(childrenContainer.getLowPriorityHeaderView() == null);
}
@Test
public void testRecreateNotificationHeader_hasHeader() {
NotificationChildrenContainer childrenContainer = mGroup.getChildrenContainer();
childrenContainer.recreateNotificationHeader(null);
Assert.assertNotNull("Children container must have a header after recreation",
childrenContainer.getCurrentHeaderView());
}
}