Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 14 | * limitations under the License. |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 15 | */ |
| 16 | |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 17 | package com.android.systemui.statusbar.notification.logging; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 18 | |
Steve Elliott | 981cca1 | 2020-05-14 11:59:49 -0400 | [diff] [blame] | 19 | import static com.android.systemui.statusbar.notification.stack.NotificationSectionsManagerKt.BUCKET_ALERTING; |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 20 | |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 21 | import static org.junit.Assert.assertArrayEquals; |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 22 | import static org.junit.Assert.assertEquals; |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 23 | import static org.junit.Assert.assertFalse; |
| 24 | import static org.junit.Assert.assertTrue; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 25 | import static org.mockito.ArgumentMatchers.any; |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 26 | import static org.mockito.Mockito.doAnswer; |
Jason Monk | d97204c | 2018-12-21 15:49:04 -0500 | [diff] [blame] | 27 | import static org.mockito.Mockito.mock; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 28 | import static org.mockito.Mockito.never; |
| 29 | import static org.mockito.Mockito.times; |
| 30 | import static org.mockito.Mockito.verify; |
| 31 | import static org.mockito.Mockito.when; |
| 32 | |
| 33 | import android.app.Notification; |
| 34 | import android.os.Handler; |
| 35 | import android.os.Looper; |
| 36 | import android.os.UserHandle; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 37 | import android.testing.AndroidTestingRunner; |
| 38 | import android.testing.TestableLooper; |
| 39 | |
Brett Chabot | 84151d9 | 2019-02-27 15:37:59 -0800 | [diff] [blame] | 40 | import androidx.test.filters.SmallTest; |
| 41 | |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 42 | import com.android.internal.logging.InstanceId; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 43 | import com.android.internal.statusbar.IStatusBarService; |
| 44 | import com.android.internal.statusbar.NotificationVisibility; |
| 45 | import com.android.systemui.SysuiTestCase; |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 46 | import com.android.systemui.statusbar.NotificationListener; |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 47 | import com.android.systemui.statusbar.StatusBarState; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 48 | import com.android.systemui.statusbar.StatusBarStateControllerImpl; |
Ned Burns | 761af0d | 2019-01-03 13:51:29 -0500 | [diff] [blame] | 49 | import com.android.systemui.statusbar.notification.NotificationEntryListener; |
Jason Monk | a716bac | 2018-12-05 15:48:21 -0500 | [diff] [blame] | 50 | import com.android.systemui.statusbar.notification.NotificationEntryManager; |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 51 | import com.android.systemui.statusbar.notification.collection.NotificationEntry; |
Beverly | 79c89ec | 2019-12-13 10:33:01 -0500 | [diff] [blame] | 52 | import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 53 | import com.android.systemui.statusbar.notification.logging.nano.Notifications; |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 54 | import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow; |
| 55 | import com.android.systemui.statusbar.notification.stack.NotificationListContainer; |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 56 | import com.android.systemui.util.concurrency.FakeExecutor; |
| 57 | import com.android.systemui.util.time.FakeSystemClock; |
Jason Monk | a716bac | 2018-12-05 15:48:21 -0500 | [diff] [blame] | 58 | |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 59 | import com.google.android.collect.Lists; |
| 60 | |
| 61 | import org.junit.Before; |
| 62 | import org.junit.Test; |
| 63 | import org.junit.runner.RunWith; |
Ned Burns | 761af0d | 2019-01-03 13:51:29 -0500 | [diff] [blame] | 64 | import org.mockito.ArgumentCaptor; |
| 65 | import org.mockito.Captor; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 66 | import org.mockito.Mock; |
| 67 | import org.mockito.Mockito; |
| 68 | import org.mockito.MockitoAnnotations; |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 69 | |
| 70 | import java.util.concurrent.ConcurrentLinkedQueue; |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 71 | import java.util.concurrent.Executor; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 72 | |
| 73 | @SmallTest |
| 74 | @RunWith(AndroidTestingRunner.class) |
Jason Monk | a716bac | 2018-12-05 15:48:21 -0500 | [diff] [blame] | 75 | @TestableLooper.RunWithLooper |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 76 | public class NotificationLoggerTest extends SysuiTestCase { |
| 77 | private static final String TEST_PACKAGE_NAME = "test"; |
| 78 | private static final int TEST_UID = 0; |
| 79 | |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 80 | @Mock private NotificationListContainer mListContainer; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 81 | @Mock private IStatusBarService mBarService; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 82 | @Mock private ExpandableNotificationRow mRow; |
Tony Mak | 202f25d | 2019-01-07 14:40:39 +0000 | [diff] [blame] | 83 | @Mock private NotificationLogger.ExpansionStateLogger mExpansionStateLogger; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 84 | |
Eliot Courtney | 8f56b0e | 2017-12-14 18:54:28 +0900 | [diff] [blame] | 85 | // Dependency mocks: |
| 86 | @Mock private NotificationEntryManager mEntryManager; |
| 87 | @Mock private NotificationListener mListener; |
Ned Burns | 761af0d | 2019-01-03 13:51:29 -0500 | [diff] [blame] | 88 | @Captor private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor; |
Eliot Courtney | 8f56b0e | 2017-12-14 18:54:28 +0900 | [diff] [blame] | 89 | |
Ned Burns | f81c4c4 | 2019-01-07 14:10:43 -0500 | [diff] [blame] | 90 | private NotificationEntry mEntry; |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 91 | private TestableNotificationLogger mLogger; |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 92 | private ConcurrentLinkedQueue<AssertionError> mErrorQueue = new ConcurrentLinkedQueue<>(); |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 93 | private FakeExecutor mUiBgExecutor = new FakeExecutor(new FakeSystemClock()); |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 94 | private NotificationPanelLoggerFake mNotificationPanelLoggerFake = |
| 95 | new NotificationPanelLoggerFake(); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 96 | |
| 97 | @Before |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 98 | public void setUp() { |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 99 | MockitoAnnotations.initMocks(this); |
Eliot Courtney | 8f56b0e | 2017-12-14 18:54:28 +0900 | [diff] [blame] | 100 | mDependency.injectTestDependency(NotificationEntryManager.class, mEntryManager); |
| 101 | mDependency.injectTestDependency(NotificationListener.class, mListener); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 102 | |
Ned Burns | 636c379 | 2019-09-11 16:59:07 -0400 | [diff] [blame] | 103 | mEntry = new NotificationEntryBuilder() |
| 104 | .setPkg(TEST_PACKAGE_NAME) |
| 105 | .setOpPkg(TEST_PACKAGE_NAME) |
| 106 | .setUid(TEST_UID) |
| 107 | .setNotification(new Notification()) |
| 108 | .setUser(UserHandle.CURRENT) |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 109 | .setInstanceId(InstanceId.fakeInstanceId(1)) |
Ned Burns | 636c379 | 2019-09-11 16:59:07 -0400 | [diff] [blame] | 110 | .build(); |
Evan Laird | 9449285 | 2018-10-25 13:43:01 -0400 | [diff] [blame] | 111 | mEntry.setRow(mRow); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 112 | |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 113 | mLogger = new TestableNotificationLogger(mListener, mUiBgExecutor, |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 114 | mEntryManager, mock(StatusBarStateControllerImpl.class), mBarService, |
Tony Mak | 202f25d | 2019-01-07 14:40:39 +0000 | [diff] [blame] | 115 | mExpansionStateLogger); |
Jason Monk | 297c04e | 2018-08-23 17:16:59 -0400 | [diff] [blame] | 116 | mLogger.setUpWithContainer(mListContainer); |
Ned Burns | 761af0d | 2019-01-03 13:51:29 -0500 | [diff] [blame] | 117 | verify(mEntryManager).addNotificationEntryListener(mEntryListenerCaptor.capture()); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | @Test |
| 121 | public void testOnChildLocationsChangedReportsVisibilityChanged() throws Exception { |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 122 | NotificationVisibility[] newlyVisibleKeys = { |
Ned Burns | 00b4b2d | 2019-10-17 22:09:27 -0400 | [diff] [blame] | 123 | NotificationVisibility.obtain(mEntry.getKey(), 0, 1, true) |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 124 | }; |
| 125 | NotificationVisibility[] noLongerVisibleKeys = {}; |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 126 | doAnswer(invocation -> { |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 127 | try { |
| 128 | assertArrayEquals(newlyVisibleKeys, |
| 129 | (NotificationVisibility[]) invocation.getArguments()[0]); |
| 130 | assertArrayEquals(noLongerVisibleKeys, |
| 131 | (NotificationVisibility[]) invocation.getArguments()[1]); |
| 132 | } catch (AssertionError error) { |
| 133 | mErrorQueue.offer(error); |
| 134 | } |
| 135 | return null; |
| 136 | } |
| 137 | ).when(mBarService).onNotificationVisibilityChanged(any(NotificationVisibility[].class), |
| 138 | any(NotificationVisibility[].class)); |
| 139 | |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 140 | when(mListContainer.isInVisibleLocation(any())).thenReturn(true); |
Evan Laird | 181de62 | 2019-10-24 09:53:02 -0400 | [diff] [blame] | 141 | when(mEntryManager.getVisibleNotifications()).thenReturn(Lists.newArrayList(mEntry)); |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 142 | mLogger.getChildLocationsChangedListenerForTest().onChildLocationsChanged(); |
Jason Monk | 6dceace | 2018-05-15 20:24:07 -0400 | [diff] [blame] | 143 | TestableLooper.get(this).processAllMessages(); |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 144 | mUiBgExecutor.runAllReady(); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 145 | |
Chris Wren | 2e89e8d | 2018-05-17 18:55:42 -0400 | [diff] [blame] | 146 | if(!mErrorQueue.isEmpty()) { |
| 147 | throw mErrorQueue.poll(); |
| 148 | } |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 149 | |
| 150 | // |mEntry| won't change visibility, so it shouldn't be reported again: |
| 151 | Mockito.reset(mBarService); |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 152 | mLogger.getChildLocationsChangedListenerForTest().onChildLocationsChanged(); |
Jason Monk | 6dceace | 2018-05-15 20:24:07 -0400 | [diff] [blame] | 153 | TestableLooper.get(this).processAllMessages(); |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 154 | mUiBgExecutor.runAllReady(); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 155 | |
| 156 | verify(mBarService, never()).onNotificationVisibilityChanged(any(), any()); |
| 157 | } |
| 158 | |
| 159 | @Test |
| 160 | public void testStoppingNotificationLoggingReportsCurrentNotifications() |
| 161 | throws Exception { |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 162 | when(mListContainer.isInVisibleLocation(any())).thenReturn(true); |
Evan Laird | 181de62 | 2019-10-24 09:53:02 -0400 | [diff] [blame] | 163 | when(mEntryManager.getVisibleNotifications()).thenReturn(Lists.newArrayList(mEntry)); |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 164 | mLogger.getChildLocationsChangedListenerForTest().onChildLocationsChanged(); |
Jason Monk | 6dceace | 2018-05-15 20:24:07 -0400 | [diff] [blame] | 165 | TestableLooper.get(this).processAllMessages(); |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 166 | mUiBgExecutor.runAllReady(); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 167 | Mockito.reset(mBarService); |
| 168 | |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 169 | setStateAsleep(); |
| 170 | mLogger.onDozingChanged(false); // Wake to lockscreen |
| 171 | mLogger.onDozingChanged(true); // And go back to sleep, turning off logging |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 172 | mUiBgExecutor.runAllReady(); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 173 | // The visibility objects are recycled by NotificationLogger, so we can't use specific |
| 174 | // matchers here. |
| 175 | verify(mBarService, times(1)).onNotificationVisibilityChanged(any(), any()); |
| 176 | } |
| 177 | |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 178 | private void setStateAsleep() { |
| 179 | mLogger.onPanelExpandedChanged(true); |
| 180 | mLogger.onDozingChanged(true); |
| 181 | mLogger.onStateChanged(StatusBarState.KEYGUARD); |
| 182 | } |
| 183 | |
| 184 | private void setStateAwake() { |
| 185 | mLogger.onPanelExpandedChanged(false); |
| 186 | mLogger.onDozingChanged(false); |
| 187 | mLogger.onStateChanged(StatusBarState.SHADE); |
| 188 | } |
| 189 | |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 190 | @Test |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 191 | public void testLogPanelShownOnWake() { |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 192 | when(mEntryManager.getVisibleNotifications()).thenReturn(Lists.newArrayList(mEntry)); |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 193 | setStateAsleep(); |
| 194 | mLogger.onDozingChanged(false); // Wake to lockscreen |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 195 | assertEquals(1, mNotificationPanelLoggerFake.getCalls().size()); |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 196 | assertTrue(mNotificationPanelLoggerFake.get(0).isLockscreen); |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 197 | assertEquals(1, mNotificationPanelLoggerFake.get(0).list.notifications.length); |
| 198 | Notifications.Notification n = mNotificationPanelLoggerFake.get(0).list.notifications[0]; |
| 199 | assertEquals(TEST_PACKAGE_NAME, n.packageName); |
| 200 | assertEquals(TEST_UID, n.uid); |
| 201 | assertEquals(1, n.instanceId); |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 202 | assertFalse(n.isGroupSummary); |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 203 | assertEquals(1 + BUCKET_ALERTING, n.section); |
| 204 | } |
| 205 | |
| 206 | @Test |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 207 | public void testLogPanelShownOnShadePull() { |
| 208 | when(mEntryManager.getVisibleNotifications()).thenReturn(Lists.newArrayList(mEntry)); |
| 209 | setStateAwake(); |
| 210 | // Now expand panel |
| 211 | mLogger.onPanelExpandedChanged(true); |
| 212 | assertEquals(1, mNotificationPanelLoggerFake.getCalls().size()); |
| 213 | assertFalse(mNotificationPanelLoggerFake.get(0).isLockscreen); |
| 214 | assertEquals(1, mNotificationPanelLoggerFake.get(0).list.notifications.length); |
| 215 | Notifications.Notification n = mNotificationPanelLoggerFake.get(0).list.notifications[0]; |
| 216 | assertEquals(TEST_PACKAGE_NAME, n.packageName); |
| 217 | assertEquals(TEST_UID, n.uid); |
| 218 | assertEquals(1, n.instanceId); |
| 219 | assertFalse(n.isGroupSummary); |
| 220 | assertEquals(1 + BUCKET_ALERTING, n.section); |
| 221 | } |
| 222 | |
| 223 | |
| 224 | @Test |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 225 | public void testLogPanelShownHandlesNullInstanceIds() { |
| 226 | // Construct a NotificationEntry like mEntry, but with a null instance id. |
| 227 | NotificationEntry entry = new NotificationEntryBuilder() |
| 228 | .setPkg(TEST_PACKAGE_NAME) |
| 229 | .setOpPkg(TEST_PACKAGE_NAME) |
| 230 | .setUid(TEST_UID) |
| 231 | .setNotification(new Notification()) |
| 232 | .setUser(UserHandle.CURRENT) |
| 233 | .build(); |
| 234 | entry.setRow(mRow); |
| 235 | |
| 236 | when(mEntryManager.getVisibleNotifications()).thenReturn(Lists.newArrayList(entry)); |
Will Brockman | d93cb57 | 2020-05-08 17:26:39 -0400 | [diff] [blame] | 237 | setStateAsleep(); |
| 238 | mLogger.onDozingChanged(false); // Wake to lockscreen |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 239 | assertEquals(1, mNotificationPanelLoggerFake.getCalls().size()); |
| 240 | assertEquals(1, mNotificationPanelLoggerFake.get(0).list.notifications.length); |
| 241 | Notifications.Notification n = mNotificationPanelLoggerFake.get(0).list.notifications[0]; |
| 242 | assertEquals(0, n.instanceId); |
| 243 | } |
| 244 | |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 245 | private class TestableNotificationLogger extends NotificationLogger { |
| 246 | |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 247 | TestableNotificationLogger(NotificationListener notificationListener, |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 248 | Executor uiBgExecutor, |
Jason Monk | d97204c | 2018-12-21 15:49:04 -0500 | [diff] [blame] | 249 | NotificationEntryManager entryManager, |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 250 | StatusBarStateControllerImpl statusBarStateController, |
Tony Mak | 202f25d | 2019-01-07 14:40:39 +0000 | [diff] [blame] | 251 | IStatusBarService barService, |
| 252 | ExpansionStateLogger expansionStateLogger) { |
Dave Mankoff | c7cf9fc | 2019-12-19 15:43:20 -0500 | [diff] [blame] | 253 | super(notificationListener, uiBgExecutor, entryManager, statusBarStateController, |
Will Brockman | 492b381 | 2020-03-03 16:29:36 +0000 | [diff] [blame] | 254 | expansionStateLogger, mNotificationPanelLoggerFake); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 255 | mBarService = barService; |
Jason Monk | 6dceace | 2018-05-15 20:24:07 -0400 | [diff] [blame] | 256 | // Make this on the current thread so we can wait for it during tests. |
| 257 | mHandler = Handler.createAsync(Looper.myLooper()); |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 258 | } |
| 259 | |
Gus Prevas | ca1b6f7 | 2018-12-28 10:53:11 -0500 | [diff] [blame] | 260 | OnChildLocationsChangedListener |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 261 | getChildLocationsChangedListenerForTest() { |
| 262 | return mNotificationLocationsChangedListener; |
| 263 | } |
Eliot Courtney | 3985ad5 | 2017-11-17 16:51:52 +0900 | [diff] [blame] | 264 | } |
| 265 | } |