Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [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 |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.systemui.statusbar.phone; |
| 18 | |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 19 | import static android.app.NotificationManager.IMPORTANCE_HIGH; |
| 20 | |
| 21 | import static junit.framework.Assert.assertFalse; |
| 22 | import static junit.framework.Assert.assertTrue; |
| 23 | |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 24 | import static org.mockito.Matchers.any; |
| 25 | import static org.mockito.Matchers.anyBoolean; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 26 | import static org.mockito.Matchers.anyString; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 27 | import static org.mockito.Mockito.doAnswer; |
| 28 | import static org.mockito.Mockito.mock; |
| 29 | import static org.mockito.Mockito.when; |
| 30 | |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 31 | import android.app.Notification; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 32 | import android.metrics.LogMaker; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 33 | import android.os.Handler; |
| 34 | import android.os.HandlerThread; |
| 35 | import android.os.IPowerManager; |
| 36 | import android.os.Looper; |
| 37 | import android.os.PowerManager; |
| 38 | import android.os.UserHandle; |
| 39 | import android.service.notification.StatusBarNotification; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 40 | import android.support.test.filters.SmallTest; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 41 | import android.support.test.metricshelper.MetricsAsserts; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 42 | import android.support.test.runner.AndroidJUnit4; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 43 | import android.util.DisplayMetrics; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 44 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 45 | import com.android.internal.logging.MetricsLogger; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 46 | import com.android.internal.logging.nano.MetricsProto.MetricsEvent; |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 47 | import com.android.internal.logging.testing.FakeMetricsLogger; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 48 | import com.android.keyguard.KeyguardHostView.OnDismissAction; |
| 49 | import com.android.systemui.SysuiTestCase; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 50 | import com.android.systemui.recents.misc.SystemServicesProxy; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 51 | import com.android.systemui.statusbar.ActivatableNotificationView; |
| 52 | import com.android.systemui.statusbar.KeyguardIndicationController; |
| 53 | import com.android.systemui.statusbar.NotificationData; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 54 | import com.android.systemui.statusbar.policy.HeadsUpManager; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 55 | import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 56 | |
| 57 | import org.junit.Before; |
| 58 | import org.junit.Test; |
| 59 | import org.junit.runner.RunWith; |
| 60 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 61 | @SmallTest |
| 62 | @RunWith(AndroidJUnit4.class) |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 63 | public class StatusBarTest extends SysuiTestCase { |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 64 | |
| 65 | StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 66 | UnlockMethodCache mUnlockMethodCache; |
| 67 | KeyguardIndicationController mKeyguardIndicationController; |
| 68 | NotificationStackScrollLayout mStackScroller; |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 69 | StatusBar mStatusBar; |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 70 | FakeMetricsLogger mMetricsLogger; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 71 | HeadsUpManager mHeadsUpManager; |
| 72 | NotificationData mNotificationData; |
| 73 | PowerManager mPowerManager; |
| 74 | SystemServicesProxy mSystemServicesProxy; |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame^] | 75 | NotificationPanelView mNotificationPanelView; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 76 | private DisplayMetrics mDisplayMetrics = new DisplayMetrics(); |
| 77 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 78 | @Before |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 79 | public void setup() throws Exception { |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 80 | mStatusBarKeyguardViewManager = mock(StatusBarKeyguardViewManager.class); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 81 | mUnlockMethodCache = mock(UnlockMethodCache.class); |
| 82 | mKeyguardIndicationController = mock(KeyguardIndicationController.class); |
| 83 | mStackScroller = mock(NotificationStackScrollLayout.class); |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 84 | mMetricsLogger = new FakeMetricsLogger(); |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 85 | mHeadsUpManager = mock(HeadsUpManager.class); |
| 86 | mNotificationData = mock(NotificationData.class); |
| 87 | mSystemServicesProxy = mock(SystemServicesProxy.class); |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame^] | 88 | mNotificationPanelView = mock(NotificationPanelView.class); |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 89 | IPowerManager powerManagerService = mock(IPowerManager.class); |
| 90 | HandlerThread handlerThread = new HandlerThread("TestThread"); |
| 91 | handlerThread.start(); |
| 92 | mPowerManager = new PowerManager(mContext, powerManagerService, |
| 93 | new Handler(handlerThread.getLooper())); |
| 94 | when(powerManagerService.isInteractive()).thenReturn(true); |
| 95 | |
Jason Monk | 8c09ac7 | 2017-03-16 11:53:40 -0400 | [diff] [blame] | 96 | mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 97 | mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache, |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 98 | mKeyguardIndicationController, mStackScroller, mHeadsUpManager, |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame^] | 99 | mNotificationData, mPowerManager, mSystemServicesProxy, mNotificationPanelView); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 100 | |
| 101 | doAnswer(invocation -> { |
| 102 | OnDismissAction onDismissAction = (OnDismissAction) invocation.getArguments()[0]; |
| 103 | onDismissAction.onDismiss(); |
| 104 | return null; |
| 105 | }).when(mStatusBarKeyguardViewManager).dismissWithAction(any(), any(), anyBoolean()); |
| 106 | |
| 107 | doAnswer(invocation -> { |
| 108 | Runnable runnable = (Runnable) invocation.getArguments()[0]; |
| 109 | runnable.run(); |
| 110 | return null; |
| 111 | }).when(mStatusBarKeyguardViewManager).addAfterKeyguardGoneRunnable(any()); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 112 | |
| 113 | when(mStackScroller.getActivatedChild()).thenReturn(null); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 114 | } |
| 115 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 116 | @Test |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 117 | public void executeRunnableDismissingKeyguard_nullRunnable_showingAndOccluded() { |
| 118 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 119 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(true); |
| 120 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 121 | mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 122 | } |
| 123 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 124 | @Test |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 125 | public void executeRunnableDismissingKeyguard_nullRunnable_showing() { |
| 126 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 127 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 128 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 129 | mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 130 | } |
| 131 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 132 | @Test |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 133 | public void executeRunnableDismissingKeyguard_nullRunnable_notShowing() { |
| 134 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); |
| 135 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 136 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 137 | mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 138 | } |
| 139 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 140 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 141 | public void lockscreenStateMetrics_notShowing() { |
| 142 | // uninteresting state, except that fingerprint must be non-zero |
| 143 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 144 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 145 | // interesting state |
| 146 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); |
| 147 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 148 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(false); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 149 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 150 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 151 | MetricsAsserts.assertHasLog("missing hidden insecure lockscreen log", |
| 152 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 153 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 154 | .setType(MetricsEvent.TYPE_CLOSE) |
| 155 | .setSubtype(0)); |
| 156 | } |
| 157 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 158 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 159 | public void lockscreenStateMetrics_notShowing_secure() { |
| 160 | // uninteresting state, except that fingerprint must be non-zero |
| 161 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 162 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 163 | // interesting state |
| 164 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); |
| 165 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 166 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(true); |
| 167 | |
| 168 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 169 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 170 | MetricsAsserts.assertHasLog("missing hidden secure lockscreen log", |
| 171 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 172 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 173 | .setType(MetricsEvent.TYPE_CLOSE) |
| 174 | .setSubtype(1)); |
| 175 | } |
| 176 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 177 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 178 | public void lockscreenStateMetrics_isShowing() { |
| 179 | // uninteresting state, except that fingerprint must be non-zero |
| 180 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 181 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 182 | // interesting state |
| 183 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 184 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 185 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(false); |
| 186 | |
| 187 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 188 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 189 | MetricsAsserts.assertHasLog("missing insecure lockscreen showing", |
| 190 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 191 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 192 | .setType(MetricsEvent.TYPE_OPEN) |
| 193 | .setSubtype(0)); |
| 194 | } |
| 195 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 196 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 197 | public void lockscreenStateMetrics_isShowing_secure() { |
| 198 | // uninteresting state, except that fingerprint must be non-zero |
| 199 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 200 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 201 | // interesting state |
| 202 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 203 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 204 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(true); |
| 205 | |
| 206 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 207 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 208 | MetricsAsserts.assertHasLog("missing secure lockscreen showing log", |
| 209 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 210 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 211 | .setType(MetricsEvent.TYPE_OPEN) |
| 212 | .setSubtype(1)); |
| 213 | } |
| 214 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 215 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 216 | public void lockscreenStateMetrics_isShowingBouncer() { |
| 217 | // uninteresting state, except that fingerprint must be non-zero |
| 218 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 219 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 220 | // interesting state |
| 221 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 222 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); |
| 223 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(true); |
| 224 | |
| 225 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 226 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 227 | MetricsAsserts.assertHasLog("missing bouncer log", |
| 228 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 229 | new LogMaker(MetricsEvent.BOUNCER) |
| 230 | .setType(MetricsEvent.TYPE_OPEN) |
| 231 | .setSubtype(1)); |
| 232 | } |
| 233 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 234 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 235 | public void onActivatedMetrics() { |
| 236 | ActivatableNotificationView view = mock(ActivatableNotificationView.class); |
| 237 | mStatusBar.onActivated(view); |
| 238 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 239 | MetricsAsserts.assertHasLog("missing lockscreen note tap log", |
| 240 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 241 | new LogMaker(MetricsEvent.ACTION_LS_NOTE) |
| 242 | .setType(MetricsEvent.TYPE_ACTION)); |
| 243 | } |
| 244 | |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 245 | @Test |
| 246 | public void testShouldPeek_nonSuppressedGroupSummary() { |
| 247 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 248 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 249 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false); |
| 250 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 251 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 252 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 253 | |
| 254 | Notification n = new Notification.Builder(getContext(), "a") |
| 255 | .setGroup("a") |
| 256 | .setGroupSummary(true) |
| 257 | .setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY) |
| 258 | .build(); |
| 259 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 260 | UserHandle.of(0), null, 0); |
| 261 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 262 | |
| 263 | assertTrue(mStatusBar.shouldPeek(entry, sbn)); |
| 264 | } |
| 265 | |
| 266 | @Test |
| 267 | public void testShouldPeek_suppressedGroupSummary() { |
| 268 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 269 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 270 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false); |
| 271 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 272 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 273 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 274 | |
| 275 | Notification n = new Notification.Builder(getContext(), "a") |
| 276 | .setGroup("a") |
| 277 | .setGroupSummary(true) |
| 278 | .setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN) |
| 279 | .build(); |
| 280 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 281 | UserHandle.of(0), null, 0); |
| 282 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 283 | |
| 284 | assertFalse(mStatusBar.shouldPeek(entry, sbn)); |
| 285 | } |
| 286 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 287 | static class TestableStatusBar extends StatusBar { |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 288 | public TestableStatusBar(StatusBarKeyguardViewManager man, |
| 289 | UnlockMethodCache unlock, KeyguardIndicationController key, |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 290 | NotificationStackScrollLayout stack, HeadsUpManager hum, NotificationData nd, |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame^] | 291 | PowerManager pm, SystemServicesProxy ssp, NotificationPanelView panelView) { |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 292 | mStatusBarKeyguardViewManager = man; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 293 | mUnlockMethodCache = unlock; |
| 294 | mKeyguardIndicationController = key; |
| 295 | mStackScroller = stack; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 296 | mHeadsUpManager = hum; |
| 297 | mNotificationData = nd; |
| 298 | mUseHeadsUp = true; |
| 299 | mPowerManager = pm; |
| 300 | mSystemServicesProxy = ssp; |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame^] | 301 | mNotificationPanel = panelView; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | @Override |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 305 | protected H createHandler() { |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 306 | return null; |
| 307 | } |
| 308 | } |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 309 | } |