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