Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.systemui.statusbar.phone; |
| 18 | |
| 19 | import static org.junit.Assert.assertFalse; |
| 20 | import static org.junit.Assert.assertTrue; |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 21 | import static org.mockito.Mockito.doReturn; |
| 22 | import static org.mockito.Mockito.spy; |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 23 | import static org.mockito.Mockito.times; |
| 24 | import static org.mockito.Mockito.verify; |
| 25 | import static org.mockito.Mockito.when; |
| 26 | |
| 27 | import android.app.Notification; |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 28 | import android.service.notification.StatusBarNotification; |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 29 | import android.testing.AndroidTestingRunner; |
| 30 | import android.testing.TestableLooper; |
| 31 | |
Brett Chabot | 84151d9 | 2019-02-27 15:37:59 -0800 | [diff] [blame] | 32 | import androidx.test.filters.SmallTest; |
| 33 | |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 34 | import com.android.systemui.SysuiTestCase; |
| 35 | import com.android.systemui.statusbar.AmbientPulseManager; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 36 | import com.android.systemui.statusbar.notification.NotificationEntryListener; |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 37 | import com.android.systemui.statusbar.notification.NotificationEntryManager; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 38 | import com.android.systemui.statusbar.notification.collection.NotificationEntry; |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 39 | import com.android.systemui.statusbar.policy.HeadsUpManager; |
| 40 | |
| 41 | import org.junit.Before; |
| 42 | import org.junit.Rule; |
| 43 | import org.junit.Test; |
| 44 | import org.junit.runner.RunWith; |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 45 | import org.mockito.ArgumentCaptor; |
| 46 | import org.mockito.Captor; |
| 47 | import org.mockito.Mock; |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 48 | import org.mockito.junit.MockitoJUnit; |
| 49 | import org.mockito.junit.MockitoRule; |
| 50 | |
| 51 | import java.util.HashMap; |
| 52 | |
| 53 | @SmallTest |
| 54 | @RunWith(AndroidTestingRunner.class) |
| 55 | @TestableLooper.RunWithLooper |
| 56 | public class NotificationGroupAlertTransferHelperTest extends SysuiTestCase { |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 57 | @Rule public MockitoRule rule = MockitoJUnit.rule(); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 58 | |
| 59 | private NotificationGroupAlertTransferHelper mGroupAlertTransferHelper; |
| 60 | private NotificationGroupManager mGroupManager; |
| 61 | private AmbientPulseManager mAmbientPulseManager; |
| 62 | private HeadsUpManager mHeadsUpManager; |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 63 | @Mock private NotificationEntryManager mNotificationEntryManager; |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 64 | @Captor |
| 65 | private ArgumentCaptor<NotificationEntryListener> mListenerCaptor; |
| 66 | private NotificationEntryListener mNotificationEntryListener; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 67 | private final HashMap<String, NotificationEntry> mPendingEntries = new HashMap<>(); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 68 | private final NotificationGroupTestHelper mGroupTestHelper = |
| 69 | new NotificationGroupTestHelper(mContext); |
| 70 | |
| 71 | |
| 72 | @Before |
| 73 | public void setup() { |
| 74 | mAmbientPulseManager = new AmbientPulseManager(mContext); |
| 75 | mDependency.injectTestDependency(AmbientPulseManager.class, mAmbientPulseManager); |
| 76 | mHeadsUpManager = new HeadsUpManager(mContext) {}; |
| 77 | |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 78 | when(mNotificationEntryManager.getPendingNotificationsIterator()) |
| 79 | .thenReturn(mPendingEntries.values()); |
| 80 | |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 81 | mGroupManager = new NotificationGroupManager(); |
| 82 | mDependency.injectTestDependency(NotificationGroupManager.class, mGroupManager); |
| 83 | mGroupManager.setHeadsUpManager(mHeadsUpManager); |
| 84 | |
| 85 | mGroupAlertTransferHelper = new NotificationGroupAlertTransferHelper(); |
| 86 | mGroupAlertTransferHelper.setHeadsUpManager(mHeadsUpManager); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 87 | |
Ned Burns | 3d6b396 | 2018-12-07 21:26:00 -0500 | [diff] [blame] | 88 | mGroupAlertTransferHelper.bind(mNotificationEntryManager, mGroupManager); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 89 | verify(mNotificationEntryManager).addNotificationEntryListener(mListenerCaptor.capture()); |
| 90 | mNotificationEntryListener = mListenerCaptor.getValue(); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 91 | mHeadsUpManager.addListener(mGroupAlertTransferHelper); |
| 92 | mAmbientPulseManager.addListener(mGroupAlertTransferHelper); |
| 93 | } |
| 94 | |
| 95 | @Test |
| 96 | public void testSuppressedSummaryHeadsUpTransfersToChild() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 97 | NotificationEntry summaryEntry = mGroupTestHelper.createSummaryNotification(); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 98 | mHeadsUpManager.showNotification(summaryEntry); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 99 | NotificationEntry childEntry = mGroupTestHelper.createChildNotification(); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 100 | |
| 101 | // Summary will be suppressed because there is only one child. |
| 102 | mGroupManager.onEntryAdded(summaryEntry); |
| 103 | mGroupManager.onEntryAdded(childEntry); |
| 104 | |
| 105 | // A suppressed summary should transfer its alert state to the child. |
| 106 | assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key)); |
| 107 | assertTrue(mHeadsUpManager.isAlerting(childEntry.key)); |
| 108 | } |
| 109 | |
| 110 | @Test |
| 111 | public void testSuppressedSummaryHeadsUpTransfersToChildButBackAgain() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 112 | NotificationEntry summaryEntry = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 113 | mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 114 | NotificationEntry childEntry = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 115 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 116 | NotificationEntry childEntry2 = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 117 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
| 118 | mHeadsUpManager.showNotification(summaryEntry); |
| 119 | // Trigger a transfer of alert state from summary to child. |
| 120 | mGroupManager.onEntryAdded(summaryEntry); |
| 121 | mGroupManager.onEntryAdded(childEntry); |
| 122 | |
| 123 | // Add second child notification so that summary is no longer suppressed. |
| 124 | mPendingEntries.put(childEntry2.key, childEntry2); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 125 | mNotificationEntryListener.onPendingEntryAdded(childEntry2); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 126 | mGroupManager.onEntryAdded(childEntry2); |
| 127 | |
| 128 | // The alert state should transfer back to the summary as there is now more than one |
| 129 | // child and the summary should no longer be suppressed. |
| 130 | assertTrue(mHeadsUpManager.isAlerting(summaryEntry.key)); |
| 131 | assertFalse(mHeadsUpManager.isAlerting(childEntry.key)); |
| 132 | } |
| 133 | |
| 134 | @Test |
| 135 | public void testSuppressedSummaryHeadsUpDoesntTransferBackOnDozingChanged() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 136 | NotificationEntry summaryEntry = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 137 | mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 138 | NotificationEntry childEntry = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 139 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 140 | NotificationEntry childEntry2 = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 141 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
| 142 | mHeadsUpManager.showNotification(summaryEntry); |
| 143 | // Trigger a transfer of alert state from summary to child. |
| 144 | mGroupManager.onEntryAdded(summaryEntry); |
| 145 | mGroupManager.onEntryAdded(childEntry); |
| 146 | |
| 147 | // Set dozing to true. |
| 148 | mGroupAlertTransferHelper.onDozingChanged(true); |
| 149 | |
| 150 | // Add second child notification so that summary is no longer suppressed. |
| 151 | mPendingEntries.put(childEntry2.key, childEntry2); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 152 | mNotificationEntryListener.onPendingEntryAdded(childEntry2); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 153 | mGroupManager.onEntryAdded(childEntry2); |
| 154 | |
| 155 | // Dozing changed so no reason to re-alert summary. |
| 156 | assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key)); |
| 157 | } |
| 158 | |
| 159 | @Test |
| 160 | public void testSuppressedSummaryHeadsUpTransferDoesNotAlertChildIfUninflated() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 161 | NotificationEntry summaryEntry = mGroupTestHelper.createSummaryNotification(); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 162 | mHeadsUpManager.showNotification(summaryEntry); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 163 | NotificationEntry childEntry = mGroupTestHelper.createChildNotification(); |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 164 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 165 | .thenReturn(false); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 166 | |
| 167 | mGroupManager.onEntryAdded(summaryEntry); |
| 168 | mGroupManager.onEntryAdded(childEntry); |
| 169 | |
| 170 | // Alert is immediately removed from summary, but we do not show child yet either as its |
| 171 | // content is not inflated. |
| 172 | assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key)); |
| 173 | assertFalse(mHeadsUpManager.isAlerting(childEntry.key)); |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 174 | assertTrue(mGroupAlertTransferHelper.isAlertTransferPending(childEntry)); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 175 | } |
| 176 | |
| 177 | @Test |
| 178 | public void testSuppressedSummaryHeadsUpTransferAlertsChildOnInflation() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 179 | NotificationEntry summaryEntry = mGroupTestHelper.createSummaryNotification(); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 180 | mHeadsUpManager.showNotification(summaryEntry); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 181 | NotificationEntry childEntry = mGroupTestHelper.createChildNotification(); |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 182 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 183 | .thenReturn(false); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 184 | |
| 185 | mGroupManager.onEntryAdded(summaryEntry); |
| 186 | mGroupManager.onEntryAdded(childEntry); |
| 187 | |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 188 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 189 | .thenReturn(true); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 190 | mNotificationEntryListener.onEntryReinflated(childEntry); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 191 | |
| 192 | // Alert is immediately removed from summary, and we show child as its content is inflated. |
| 193 | assertFalse(mHeadsUpManager.isAlerting(summaryEntry.key)); |
| 194 | assertTrue(mHeadsUpManager.isAlerting(childEntry.key)); |
| 195 | } |
| 196 | |
| 197 | @Test |
| 198 | public void testSuppressedSummaryHeadsUpTransferBackAbortsChildInflation() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 199 | NotificationEntry summaryEntry = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 200 | mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 201 | NotificationEntry childEntry = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 202 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 203 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 204 | .thenReturn(false); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 205 | NotificationEntry childEntry2 = |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 206 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
| 207 | mHeadsUpManager.showNotification(summaryEntry); |
| 208 | // Trigger a transfer of alert state from summary to child. |
| 209 | mGroupManager.onEntryAdded(summaryEntry); |
| 210 | mGroupManager.onEntryAdded(childEntry); |
| 211 | |
| 212 | // Add second child notification so that summary is no longer suppressed. |
| 213 | mPendingEntries.put(childEntry2.key, childEntry2); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 214 | mNotificationEntryListener.onPendingEntryAdded(childEntry2); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 215 | mGroupManager.onEntryAdded(childEntry2); |
| 216 | |
| 217 | // Child entry finishes its inflation. |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 218 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 219 | .thenReturn(true); |
Gus Prevas | d65c2db | 2018-12-18 17:13:38 -0500 | [diff] [blame] | 220 | mNotificationEntryListener.onEntryReinflated(childEntry); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 221 | |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 222 | verify(childEntry.getRow(), times(1)).freeContentViewWhenSafe(mHeadsUpManager |
| 223 | .getContentFlag()); |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 224 | assertFalse(mHeadsUpManager.isAlerting(childEntry.key)); |
| 225 | } |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 226 | |
| 227 | @Test |
| 228 | public void testCleanUpPendingAlertInfo() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 229 | NotificationEntry summaryEntry = |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 230 | mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 231 | NotificationEntry childEntry = |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 232 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 233 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 234 | .thenReturn(false); |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 235 | mHeadsUpManager.showNotification(summaryEntry); |
| 236 | // Trigger a transfer of alert state from summary to child. |
| 237 | mGroupManager.onEntryAdded(summaryEntry); |
| 238 | mGroupManager.onEntryAdded(childEntry); |
| 239 | |
Ned Burns | ef2ef6c | 2019-01-02 16:48:08 -0500 | [diff] [blame] | 240 | mNotificationEntryListener.onEntryRemoved(childEntry, null, false); |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 241 | |
| 242 | assertFalse(mGroupAlertTransferHelper.isAlertTransferPending(childEntry)); |
| 243 | } |
| 244 | |
| 245 | @Test |
| 246 | public void testUpdateGroupChangeDoesNotTransfer() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 247 | NotificationEntry summaryEntry = |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 248 | mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 249 | NotificationEntry childEntry = |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 250 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 251 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 252 | .thenReturn(false); |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 253 | mHeadsUpManager.showNotification(summaryEntry); |
| 254 | // Trigger a transfer of alert state from summary to child. |
| 255 | mGroupManager.onEntryAdded(summaryEntry); |
| 256 | mGroupManager.onEntryAdded(childEntry); |
| 257 | |
| 258 | // Notify that entry changed groups. |
| 259 | StatusBarNotification oldNotification = childEntry.notification; |
| 260 | StatusBarNotification newSbn = spy(childEntry.notification.clone()); |
| 261 | doReturn("other_group").when(newSbn).getGroupKey(); |
| 262 | childEntry.notification = newSbn; |
| 263 | mGroupManager.onEntryUpdated(childEntry, oldNotification); |
| 264 | |
| 265 | assertFalse(mGroupAlertTransferHelper.isAlertTransferPending(childEntry)); |
| 266 | } |
| 267 | |
| 268 | @Test |
| 269 | public void testUpdateChildToSummaryDoesNotTransfer() { |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 270 | NotificationEntry summaryEntry = |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 271 | mGroupTestHelper.createSummaryNotification(Notification.GROUP_ALERT_SUMMARY); |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 272 | NotificationEntry childEntry = |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 273 | mGroupTestHelper.createChildNotification(Notification.GROUP_ALERT_SUMMARY); |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 274 | when(childEntry.getRow().isInflationFlagSet(mHeadsUpManager.getContentFlag())) |
| 275 | .thenReturn(false); |
Kevin | 4b8bbda | 2018-11-19 14:36:31 -0800 | [diff] [blame] | 276 | mHeadsUpManager.showNotification(summaryEntry); |
| 277 | // Trigger a transfer of alert state from summary to child. |
| 278 | mGroupManager.onEntryAdded(summaryEntry); |
| 279 | mGroupManager.onEntryAdded(childEntry); |
| 280 | |
| 281 | // Update that child to a summary. |
| 282 | StatusBarNotification oldNotification = childEntry.notification; |
| 283 | childEntry.notification = mGroupTestHelper.createSummaryNotification( |
| 284 | Notification.GROUP_ALERT_SUMMARY).notification; |
| 285 | mGroupManager.onEntryUpdated(childEntry, oldNotification); |
| 286 | |
| 287 | assertFalse(mGroupAlertTransferHelper.isAlertTransferPending(childEntry)); |
| 288 | } |
Kevin | 01a53cb | 2018-11-09 18:19:54 -0800 | [diff] [blame] | 289 | } |