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; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 23 | import static junit.framework.TestCase.fail; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 24 | |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 25 | import static org.mockito.ArgumentMatchers.any; |
| 26 | import static org.mockito.ArgumentMatchers.anyBoolean; |
| 27 | import static org.mockito.ArgumentMatchers.anyInt; |
| 28 | import static org.mockito.ArgumentMatchers.anyString; |
Lucas Dupin | 311eac8 | 2017-12-11 14:40:07 -0800 | [diff] [blame^] | 29 | import static org.mockito.ArgumentMatchers.eq; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 30 | import static org.mockito.Mockito.doAnswer; |
| 31 | import static org.mockito.Mockito.mock; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 32 | import static org.mockito.Mockito.never; |
| 33 | import static org.mockito.Mockito.times; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 34 | import static org.mockito.Mockito.verify; |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 35 | import static org.mockito.Mockito.when; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 36 | |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 37 | import android.app.Notification; |
Charles He | 2eda242 | 2017-09-24 17:55:21 +0100 | [diff] [blame] | 38 | import android.app.StatusBarManager; |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 39 | import android.app.trust.TrustManager; |
| 40 | import android.hardware.fingerprint.FingerprintManager; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 41 | import android.metrics.LogMaker; |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 42 | import android.os.Binder; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 43 | import android.os.Handler; |
| 44 | import android.os.HandlerThread; |
| 45 | import android.os.IPowerManager; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 46 | import android.os.Message; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 47 | import android.os.PowerManager; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 48 | import android.os.RemoteException; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 49 | import android.os.UserHandle; |
| 50 | import android.service.notification.StatusBarNotification; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 51 | import android.support.test.filters.SmallTest; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 52 | import android.support.test.metricshelper.MetricsAsserts; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 53 | import android.testing.AndroidTestingRunner; |
| 54 | import android.testing.TestableLooper; |
| 55 | import android.testing.TestableLooper.MessageHandler; |
| 56 | import android.testing.TestableLooper.RunWithLooper; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 57 | import android.util.DisplayMetrics; |
Eliot Courtney | 0932228 | 2017-11-09 15:31:19 +0900 | [diff] [blame] | 58 | import android.util.SparseArray; |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 59 | import android.view.ViewGroup.LayoutParams; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 60 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 61 | import com.android.internal.logging.MetricsLogger; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 62 | import com.android.internal.logging.nano.MetricsProto.MetricsEvent; |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 63 | import com.android.internal.logging.testing.FakeMetricsLogger; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 64 | import com.android.internal.statusbar.IStatusBarService; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 65 | import com.android.keyguard.KeyguardHostView.OnDismissAction; |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 66 | import com.android.systemui.R; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 67 | import com.android.systemui.SysuiTestCase; |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 68 | import com.android.systemui.assist.AssistManager; |
Adrian Roos | 6d5ebb7 | 2017-08-03 15:10:22 +0200 | [diff] [blame] | 69 | import com.android.systemui.keyguard.WakefulnessLifecycle; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 70 | import com.android.systemui.recents.misc.SystemServicesProxy; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 71 | import com.android.systemui.statusbar.ActivatableNotificationView; |
Jason Monk | 5ecf80c | 2017-07-06 15:28:17 -0400 | [diff] [blame] | 72 | import com.android.systemui.statusbar.CommandQueue; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 73 | import com.android.systemui.statusbar.KeyguardIndicationController; |
| 74 | import com.android.systemui.statusbar.NotificationData; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 75 | import com.android.systemui.statusbar.NotificationData.Entry; |
Eliot Courtney | 0932228 | 2017-11-09 15:31:19 +0900 | [diff] [blame] | 76 | import com.android.systemui.statusbar.NotificationLockscreenUserManager; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 77 | import com.android.systemui.statusbar.StatusBarState; |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 78 | import com.android.systemui.statusbar.policy.DeviceProvisionedController; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 79 | import com.android.systemui.statusbar.policy.HeadsUpManager; |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 80 | import com.android.systemui.statusbar.policy.KeyguardMonitor; |
| 81 | import com.android.systemui.statusbar.policy.KeyguardMonitorImpl; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 82 | import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 83 | |
| 84 | import org.junit.Before; |
| 85 | import org.junit.Test; |
| 86 | import org.junit.runner.RunWith; |
| 87 | |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 88 | import java.io.ByteArrayOutputStream; |
| 89 | import java.io.PrintWriter; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 90 | import java.util.ArrayList; |
| 91 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 92 | @SmallTest |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 93 | @RunWith(AndroidTestingRunner.class) |
| 94 | @RunWithLooper |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 95 | public class StatusBarTest extends SysuiTestCase { |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 96 | |
| 97 | StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 98 | UnlockMethodCache mUnlockMethodCache; |
| 99 | KeyguardIndicationController mKeyguardIndicationController; |
| 100 | NotificationStackScrollLayout mStackScroller; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 101 | TestableStatusBar mStatusBar; |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 102 | FakeMetricsLogger mMetricsLogger; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 103 | HeadsUpManager mHeadsUpManager; |
| 104 | NotificationData mNotificationData; |
| 105 | PowerManager mPowerManager; |
| 106 | SystemServicesProxy mSystemServicesProxy; |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame] | 107 | NotificationPanelView mNotificationPanelView; |
Lucas Dupin | c2e7546 | 2017-12-06 13:59:25 -0800 | [diff] [blame] | 108 | ScrimController mScrimController; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 109 | IStatusBarService mBarService; |
| 110 | ArrayList<Entry> mNotificationList; |
Lucas Dupin | 311eac8 | 2017-12-11 14:40:07 -0800 | [diff] [blame^] | 111 | FingerprintUnlockController mFingerprintUnlockController; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 112 | private DisplayMetrics mDisplayMetrics = new DisplayMetrics(); |
| 113 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 114 | @Before |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 115 | public void setup() throws Exception { |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 116 | mContext.setTheme(R.style.Theme_SystemUI_Light); |
| 117 | mDependency.injectMockDependency(AssistManager.class); |
| 118 | mDependency.injectMockDependency(DeviceProvisionedController.class); |
| 119 | mDependency.injectTestDependency(KeyguardMonitor.class, mock(KeyguardMonitorImpl.class)); |
| 120 | CommandQueue commandQueue = mock(CommandQueue.class); |
| 121 | when(commandQueue.asBinder()).thenReturn(new Binder()); |
| 122 | mContext.putComponent(CommandQueue.class, commandQueue); |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 123 | mContext.addMockSystemService(TrustManager.class, mock(TrustManager.class)); |
| 124 | mContext.addMockSystemService(FingerprintManager.class, mock(FingerprintManager.class)); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 125 | mStatusBarKeyguardViewManager = mock(StatusBarKeyguardViewManager.class); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 126 | mUnlockMethodCache = mock(UnlockMethodCache.class); |
| 127 | mKeyguardIndicationController = mock(KeyguardIndicationController.class); |
| 128 | mStackScroller = mock(NotificationStackScrollLayout.class); |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 129 | when(mStackScroller.generateLayoutParams(any())).thenReturn(new LayoutParams(0, 0)); |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 130 | mMetricsLogger = new FakeMetricsLogger(); |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 131 | mHeadsUpManager = mock(HeadsUpManager.class); |
| 132 | mNotificationData = mock(NotificationData.class); |
| 133 | mSystemServicesProxy = mock(SystemServicesProxy.class); |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame] | 134 | mNotificationPanelView = mock(NotificationPanelView.class); |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 135 | when(mNotificationPanelView.getLayoutParams()).thenReturn(new LayoutParams(0, 0)); |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 136 | mNotificationList = mock(ArrayList.class); |
Lucas Dupin | c2e7546 | 2017-12-06 13:59:25 -0800 | [diff] [blame] | 137 | mScrimController = mock(ScrimController.class); |
Lucas Dupin | 311eac8 | 2017-12-11 14:40:07 -0800 | [diff] [blame^] | 138 | mFingerprintUnlockController = mock(FingerprintUnlockController.class); |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 139 | IPowerManager powerManagerService = mock(IPowerManager.class); |
| 140 | HandlerThread handlerThread = new HandlerThread("TestThread"); |
| 141 | handlerThread.start(); |
| 142 | mPowerManager = new PowerManager(mContext, powerManagerService, |
| 143 | new Handler(handlerThread.getLooper())); |
| 144 | when(powerManagerService.isInteractive()).thenReturn(true); |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 145 | mBarService = mock(IStatusBarService.class); |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 146 | |
Jason Monk | 8c09ac7 | 2017-03-16 11:53:40 -0400 | [diff] [blame] | 147 | mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 148 | mStatusBar = new TestableStatusBar(mStatusBarKeyguardViewManager, mUnlockMethodCache, |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 149 | mKeyguardIndicationController, mStackScroller, mHeadsUpManager, |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 150 | mNotificationData, mPowerManager, mSystemServicesProxy, mNotificationPanelView, |
Lucas Dupin | 311eac8 | 2017-12-11 14:40:07 -0800 | [diff] [blame^] | 151 | mBarService, mScrimController, mFingerprintUnlockController); |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 152 | mStatusBar.mContext = mContext; |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 153 | mStatusBar.mComponents = mContext.getComponents(); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 154 | doAnswer(invocation -> { |
| 155 | OnDismissAction onDismissAction = (OnDismissAction) invocation.getArguments()[0]; |
| 156 | onDismissAction.onDismiss(); |
| 157 | return null; |
| 158 | }).when(mStatusBarKeyguardViewManager).dismissWithAction(any(), any(), anyBoolean()); |
| 159 | |
| 160 | doAnswer(invocation -> { |
| 161 | Runnable runnable = (Runnable) invocation.getArguments()[0]; |
| 162 | runnable.run(); |
| 163 | return null; |
| 164 | }).when(mStatusBarKeyguardViewManager).addAfterKeyguardGoneRunnable(any()); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 165 | |
| 166 | when(mStackScroller.getActivatedChild()).thenReturn(null); |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 167 | TestableLooper.get(this).setMessageHandler(new MessageHandler() { |
| 168 | @Override |
| 169 | public boolean onMessageHandled(Message m) { |
| 170 | if (m.getCallback() == mStatusBar.mVisibilityReporter) { |
| 171 | return false; |
| 172 | } |
| 173 | return true; |
| 174 | } |
| 175 | }); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 176 | } |
| 177 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 178 | @Test |
Jason Monk | 5ecf80c | 2017-07-06 15:28:17 -0400 | [diff] [blame] | 179 | public void testSetBouncerShowing_noCrash() { |
| 180 | mStatusBar.mCommandQueue = mock(CommandQueue.class); |
| 181 | mStatusBar.setBouncerShowing(true); |
| 182 | } |
| 183 | |
| 184 | @Test |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 185 | public void executeRunnableDismissingKeyguard_nullRunnable_showingAndOccluded() { |
| 186 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 187 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(true); |
| 188 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 189 | mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 190 | } |
| 191 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 192 | @Test |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 193 | public void executeRunnableDismissingKeyguard_nullRunnable_showing() { |
| 194 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 195 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 196 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 197 | mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 198 | } |
| 199 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 200 | @Test |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 201 | public void executeRunnableDismissingKeyguard_nullRunnable_notShowing() { |
| 202 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); |
| 203 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 204 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 205 | mStatusBar.executeRunnableDismissingKeyguard(null, null, false, false, false); |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 206 | } |
| 207 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 208 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 209 | public void lockscreenStateMetrics_notShowing() { |
| 210 | // uninteresting state, except that fingerprint must be non-zero |
| 211 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 212 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 213 | // interesting state |
| 214 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); |
| 215 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 216 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(false); |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 217 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 218 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 219 | MetricsAsserts.assertHasLog("missing hidden insecure lockscreen log", |
| 220 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 221 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 222 | .setType(MetricsEvent.TYPE_CLOSE) |
| 223 | .setSubtype(0)); |
| 224 | } |
| 225 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 226 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 227 | public void lockscreenStateMetrics_notShowing_secure() { |
| 228 | // uninteresting state, except that fingerprint must be non-zero |
| 229 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 230 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 231 | // interesting state |
| 232 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); |
| 233 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 234 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(true); |
| 235 | |
| 236 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 237 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 238 | MetricsAsserts.assertHasLog("missing hidden secure lockscreen log", |
| 239 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 240 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 241 | .setType(MetricsEvent.TYPE_CLOSE) |
| 242 | .setSubtype(1)); |
| 243 | } |
| 244 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 245 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 246 | public void lockscreenStateMetrics_isShowing() { |
| 247 | // uninteresting state, except that fingerprint must be non-zero |
| 248 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 249 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 250 | // interesting state |
| 251 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 252 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 253 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(false); |
| 254 | |
| 255 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 256 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 257 | MetricsAsserts.assertHasLog("missing insecure lockscreen showing", |
| 258 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 259 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 260 | .setType(MetricsEvent.TYPE_OPEN) |
| 261 | .setSubtype(0)); |
| 262 | } |
| 263 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 264 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 265 | public void lockscreenStateMetrics_isShowing_secure() { |
| 266 | // uninteresting state, except that fingerprint must be non-zero |
| 267 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 268 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 269 | // interesting state |
| 270 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 271 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); |
| 272 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(true); |
| 273 | |
| 274 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 275 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 276 | MetricsAsserts.assertHasLog("missing secure lockscreen showing log", |
| 277 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 278 | new LogMaker(MetricsEvent.LOCKSCREEN) |
| 279 | .setType(MetricsEvent.TYPE_OPEN) |
| 280 | .setSubtype(1)); |
| 281 | } |
| 282 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 283 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 284 | public void lockscreenStateMetrics_isShowingBouncer() { |
| 285 | // uninteresting state, except that fingerprint must be non-zero |
| 286 | when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); |
| 287 | when(mUnlockMethodCache.canSkipBouncer()).thenReturn(true); |
| 288 | // interesting state |
| 289 | when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); |
| 290 | when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); |
| 291 | when(mUnlockMethodCache.isMethodSecure()).thenReturn(true); |
| 292 | |
| 293 | mStatusBar.onKeyguardViewManagerStatesUpdated(); |
| 294 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 295 | MetricsAsserts.assertHasLog("missing bouncer log", |
| 296 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 297 | new LogMaker(MetricsEvent.BOUNCER) |
| 298 | .setType(MetricsEvent.TYPE_OPEN) |
| 299 | .setSubtype(1)); |
| 300 | } |
| 301 | |
Adrian Roos | 02de498 | 2017-02-11 09:35:54 +0100 | [diff] [blame] | 302 | @Test |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 303 | public void onActivatedMetrics() { |
| 304 | ActivatableNotificationView view = mock(ActivatableNotificationView.class); |
| 305 | mStatusBar.onActivated(view); |
| 306 | |
Chris Wren | ef31990 | 2017-03-07 17:58:31 -0500 | [diff] [blame] | 307 | MetricsAsserts.assertHasLog("missing lockscreen note tap log", |
| 308 | mMetricsLogger.getLogs(), |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 309 | new LogMaker(MetricsEvent.ACTION_LS_NOTE) |
| 310 | .setType(MetricsEvent.TYPE_ACTION)); |
| 311 | } |
| 312 | |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 313 | @Test |
| 314 | public void testShouldPeek_nonSuppressedGroupSummary() { |
| 315 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 316 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 317 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false); |
| 318 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 319 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 320 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 321 | |
| 322 | Notification n = new Notification.Builder(getContext(), "a") |
| 323 | .setGroup("a") |
| 324 | .setGroupSummary(true) |
| 325 | .setGroupAlertBehavior(Notification.GROUP_ALERT_SUMMARY) |
| 326 | .build(); |
| 327 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 328 | UserHandle.of(0), null, 0); |
| 329 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 330 | |
| 331 | assertTrue(mStatusBar.shouldPeek(entry, sbn)); |
| 332 | } |
| 333 | |
| 334 | @Test |
| 335 | public void testShouldPeek_suppressedGroupSummary() { |
| 336 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 337 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 338 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false); |
| 339 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 340 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 341 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 342 | |
| 343 | Notification n = new Notification.Builder(getContext(), "a") |
| 344 | .setGroup("a") |
| 345 | .setGroupSummary(true) |
| 346 | .setGroupAlertBehavior(Notification.GROUP_ALERT_CHILDREN) |
| 347 | .build(); |
| 348 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 349 | UserHandle.of(0), null, 0); |
| 350 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 351 | |
| 352 | assertFalse(mStatusBar.shouldPeek(entry, sbn)); |
| 353 | } |
| 354 | |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 355 | @Test |
Beverly | 38159ce | 2017-07-13 16:39:24 -0400 | [diff] [blame] | 356 | public void testShouldPeek_suppressedScreenOn_dozing() { |
| 357 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 358 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 359 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 360 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 361 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 362 | |
| 363 | mStatusBar.mDozing = true; |
| 364 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(true); |
| 365 | when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(false); |
| 366 | |
| 367 | Notification n = new Notification.Builder(getContext(), "a").build(); |
| 368 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 369 | UserHandle.of(0), null, 0); |
| 370 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 371 | |
| 372 | assertTrue(mStatusBar.shouldPeek(entry, sbn)); |
| 373 | } |
| 374 | |
| 375 | @Test |
| 376 | public void testShouldPeek_suppressedScreenOn_noDoze() { |
| 377 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 378 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 379 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 380 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 381 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 382 | |
| 383 | mStatusBar.mDozing = false; |
| 384 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(true); |
| 385 | when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(false); |
| 386 | |
| 387 | Notification n = new Notification.Builder(getContext(), "a").build(); |
| 388 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 389 | UserHandle.of(0), null, 0); |
| 390 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 391 | assertFalse(mStatusBar.shouldPeek(entry, sbn)); |
| 392 | } |
| 393 | @Test |
| 394 | public void testShouldPeek_suppressedScreenOff_dozing() { |
| 395 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 396 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 397 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 398 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 399 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 400 | |
| 401 | mStatusBar.mDozing = true; |
| 402 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false); |
| 403 | when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(true); |
| 404 | |
| 405 | Notification n = new Notification.Builder(getContext(), "a").build(); |
| 406 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 407 | UserHandle.of(0), null, 0); |
| 408 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 409 | assertFalse(mStatusBar.shouldPeek(entry, sbn)); |
| 410 | } |
| 411 | |
| 412 | @Test |
| 413 | public void testShouldPeek_suppressedScreenOff_noDoze() { |
| 414 | when(mPowerManager.isScreenOn()).thenReturn(true); |
| 415 | when(mHeadsUpManager.isSnoozed(anyString())).thenReturn(false); |
| 416 | when(mNotificationData.shouldFilterOut(any())).thenReturn(false); |
| 417 | when(mSystemServicesProxy.isDreaming()).thenReturn(false); |
| 418 | when(mNotificationData.getImportance(any())).thenReturn(IMPORTANCE_HIGH); |
| 419 | |
| 420 | mStatusBar.mDozing = false; |
| 421 | when(mNotificationData.shouldSuppressScreenOn(any())).thenReturn(false); |
| 422 | when(mNotificationData.shouldSuppressScreenOff(any())).thenReturn(true); |
| 423 | |
| 424 | Notification n = new Notification.Builder(getContext(), "a").build(); |
| 425 | StatusBarNotification sbn = new StatusBarNotification("a", "a", 0, "a", 0, 0, n, |
| 426 | UserHandle.of(0), null, 0); |
| 427 | NotificationData.Entry entry = new NotificationData.Entry(sbn); |
| 428 | assertTrue(mStatusBar.shouldPeek(entry, sbn)); |
| 429 | } |
| 430 | |
| 431 | |
| 432 | @Test |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 433 | public void testLogHidden() { |
| 434 | try { |
| 435 | mStatusBar.handleVisibleToUserChanged(false); |
Selim Cinek | 1a891a9 | 2017-12-04 17:41:27 +0100 | [diff] [blame] | 436 | waitForUiOffloadThread(); |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 437 | verify(mBarService, times(1)).onPanelHidden(); |
| 438 | verify(mBarService, never()).onPanelRevealed(anyBoolean(), anyInt()); |
| 439 | } catch (RemoteException e) { |
| 440 | fail(); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | @Test |
| 445 | public void testPanelOpenForPeek() { |
| 446 | when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(true); |
| 447 | when(mNotificationData.getActiveNotifications()).thenReturn(mNotificationList); |
| 448 | when(mNotificationList.size()).thenReturn(5); |
| 449 | when(mNotificationPanelView.isFullyCollapsed()).thenReturn(true); |
| 450 | mStatusBar.setBarStateForTest(StatusBarState.SHADE); |
| 451 | |
| 452 | try { |
| 453 | mStatusBar.handleVisibleToUserChanged(true); |
Selim Cinek | 1a891a9 | 2017-12-04 17:41:27 +0100 | [diff] [blame] | 454 | waitForUiOffloadThread(); |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 455 | verify(mBarService, never()).onPanelHidden(); |
| 456 | verify(mBarService, times(1)).onPanelRevealed(false, 1); |
| 457 | } catch (RemoteException e) { |
| 458 | fail(); |
| 459 | } |
| 460 | TestableLooper.get(this).processAllMessages(); |
| 461 | } |
| 462 | |
| 463 | @Test |
| 464 | public void testPanelOpenAndClear() { |
| 465 | when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false); |
| 466 | when(mNotificationData.getActiveNotifications()).thenReturn(mNotificationList); |
| 467 | when(mNotificationList.size()).thenReturn(5); |
| 468 | when(mNotificationPanelView.isFullyCollapsed()).thenReturn(false); |
| 469 | mStatusBar.setBarStateForTest(StatusBarState.SHADE); |
| 470 | |
| 471 | try { |
| 472 | mStatusBar.handleVisibleToUserChanged(true); |
Selim Cinek | 1a891a9 | 2017-12-04 17:41:27 +0100 | [diff] [blame] | 473 | waitForUiOffloadThread(); |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 474 | verify(mBarService, never()).onPanelHidden(); |
| 475 | verify(mBarService, times(1)).onPanelRevealed(true, 5); |
| 476 | } catch (RemoteException e) { |
| 477 | fail(); |
| 478 | } |
| 479 | TestableLooper.get(this).processAllMessages(); |
| 480 | } |
| 481 | |
| 482 | @Test |
| 483 | public void testPanelOpenAndNoClear() { |
| 484 | when(mHeadsUpManager.hasPinnedHeadsUp()).thenReturn(false); |
| 485 | when(mNotificationData.getActiveNotifications()).thenReturn(mNotificationList); |
| 486 | when(mNotificationList.size()).thenReturn(5); |
| 487 | when(mNotificationPanelView.isFullyCollapsed()).thenReturn(false); |
| 488 | mStatusBar.setBarStateForTest(StatusBarState.KEYGUARD); |
| 489 | |
| 490 | try { |
| 491 | mStatusBar.handleVisibleToUserChanged(true); |
Selim Cinek | 1a891a9 | 2017-12-04 17:41:27 +0100 | [diff] [blame] | 492 | waitForUiOffloadThread(); |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 493 | verify(mBarService, never()).onPanelHidden(); |
| 494 | verify(mBarService, times(1)).onPanelRevealed(false, 5); |
| 495 | } catch (RemoteException e) { |
| 496 | fail(); |
| 497 | } |
| 498 | TestableLooper.get(this).processAllMessages(); |
| 499 | } |
| 500 | |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 501 | @Test |
Charles He | 2eda242 | 2017-09-24 17:55:21 +0100 | [diff] [blame] | 502 | public void testDisableExpandStatusBar() { |
| 503 | mStatusBar.setBarStateForTest(StatusBarState.SHADE); |
| 504 | mStatusBar.setUserSetupForTest(true); |
| 505 | when(mStatusBar.isDeviceProvisioned()).thenReturn(true); |
| 506 | |
| 507 | mStatusBar.disable(StatusBarManager.DISABLE_NONE, |
| 508 | StatusBarManager.DISABLE2_NOTIFICATION_SHADE, false); |
| 509 | verify(mNotificationPanelView).setQsExpansionEnabled(false); |
| 510 | mStatusBar.animateExpandNotificationsPanel(); |
| 511 | verify(mNotificationPanelView, never()).expand(anyBoolean()); |
| 512 | mStatusBar.animateExpandSettingsPanel(null); |
| 513 | verify(mNotificationPanelView, never()).expand(anyBoolean()); |
| 514 | |
| 515 | mStatusBar.disable(StatusBarManager.DISABLE_NONE, StatusBarManager.DISABLE2_NONE, false); |
| 516 | verify(mNotificationPanelView).setQsExpansionEnabled(true); |
| 517 | mStatusBar.animateExpandNotificationsPanel(); |
| 518 | verify(mNotificationPanelView).expand(anyBoolean()); |
| 519 | mStatusBar.animateExpandSettingsPanel(null); |
| 520 | verify(mNotificationPanelView).expand(anyBoolean()); |
| 521 | } |
| 522 | |
| 523 | @Test |
Jason Monk | 5130537 | 2017-06-22 11:41:08 -0400 | [diff] [blame] | 524 | public void testDump_DoesNotCrash() { |
| 525 | mStatusBar.dump(null, new PrintWriter(new ByteArrayOutputStream()), null); |
| 526 | } |
| 527 | |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 528 | @Test |
| 529 | @RunWithLooper(setAsMainLooper = true) |
| 530 | public void testUpdateKeyguardState_DoesNotCrash() { |
| 531 | mStatusBar.mStatusBarWindow = mock(StatusBarWindowView.class); |
| 532 | mStatusBar.mState = StatusBarState.KEYGUARD; |
| 533 | mStatusBar.mDozeScrimController = mock(DozeScrimController.class); |
| 534 | mStatusBar.mNotificationIconAreaController = mock(NotificationIconAreaController.class); |
Eliot Courtney | 0932228 | 2017-11-09 15:31:19 +0900 | [diff] [blame] | 535 | mStatusBar.mLockscreenUserManager = mock(NotificationLockscreenUserManager.class); |
| 536 | when(mStatusBar.mLockscreenUserManager.getCurrentProfiles()).thenReturn( |
| 537 | new SparseArray<>()); |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 538 | mStatusBar.updateKeyguardState(false, false); |
| 539 | } |
| 540 | |
Lucas Dupin | c2e7546 | 2017-12-06 13:59:25 -0800 | [diff] [blame] | 541 | @Test |
| 542 | public void testFingerprintNotification_UpdatesScrims() { |
| 543 | mStatusBar.mStatusBarWindowManager = mock(StatusBarWindowManager.class); |
Lucas Dupin | c2e7546 | 2017-12-06 13:59:25 -0800 | [diff] [blame] | 544 | mStatusBar.mDozeScrimController = mock(DozeScrimController.class); |
| 545 | mStatusBar.notifyFpAuthModeChanged(); |
| 546 | verify(mScrimController).transitionTo(any(), any()); |
| 547 | } |
| 548 | |
Lucas Dupin | 311eac8 | 2017-12-11 14:40:07 -0800 | [diff] [blame^] | 549 | @Test |
| 550 | public void testFingerprintUnlock_UpdatesScrims() { |
| 551 | // Simulate unlocking from AoD with fingerprint. |
| 552 | when(mFingerprintUnlockController.getMode()) |
| 553 | .thenReturn(FingerprintUnlockController.MODE_WAKE_AND_UNLOCK); |
| 554 | mStatusBar.updateScrimController(); |
| 555 | verify(mScrimController).transitionTo(eq(ScrimState.UNLOCKED), any()); |
| 556 | } |
| 557 | |
Jason Monk | 2a6ea9c | 2017-01-26 11:14:51 -0500 | [diff] [blame] | 558 | static class TestableStatusBar extends StatusBar { |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 559 | public TestableStatusBar(StatusBarKeyguardViewManager man, |
| 560 | UnlockMethodCache unlock, KeyguardIndicationController key, |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 561 | NotificationStackScrollLayout stack, HeadsUpManager hum, NotificationData nd, |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 562 | PowerManager pm, SystemServicesProxy ssp, NotificationPanelView panelView, |
Lucas Dupin | 311eac8 | 2017-12-11 14:40:07 -0800 | [diff] [blame^] | 563 | IStatusBarService barService, ScrimController scrimController, |
| 564 | FingerprintUnlockController fingerprintUnlockController) { |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 565 | mStatusBarKeyguardViewManager = man; |
Chris Wren | 27a52fa | 2017-02-01 14:21:43 -0500 | [diff] [blame] | 566 | mUnlockMethodCache = unlock; |
| 567 | mKeyguardIndicationController = key; |
| 568 | mStackScroller = stack; |
Julia Reynolds | 3020315 | 2017-05-26 13:36:31 -0400 | [diff] [blame] | 569 | mHeadsUpManager = hum; |
| 570 | mNotificationData = nd; |
| 571 | mUseHeadsUp = true; |
| 572 | mPowerManager = pm; |
| 573 | mSystemServicesProxy = ssp; |
Jorim Jaggi | fd3b1a1 | 2017-06-06 17:04:19 -0700 | [diff] [blame] | 574 | mNotificationPanel = panelView; |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 575 | mBarService = barService; |
Adrian Roos | 6d5ebb7 | 2017-08-03 15:10:22 +0200 | [diff] [blame] | 576 | mWakefulnessLifecycle = createAwakeWakefulnessLifecycle(); |
Lucas Dupin | c2e7546 | 2017-12-06 13:59:25 -0800 | [diff] [blame] | 577 | mScrimController = scrimController; |
Lucas Dupin | 311eac8 | 2017-12-11 14:40:07 -0800 | [diff] [blame^] | 578 | mFingerprintUnlockController = fingerprintUnlockController; |
Adrian Roos | 6d5ebb7 | 2017-08-03 15:10:22 +0200 | [diff] [blame] | 579 | } |
| 580 | |
| 581 | private WakefulnessLifecycle createAwakeWakefulnessLifecycle() { |
| 582 | WakefulnessLifecycle wakefulnessLifecycle = new WakefulnessLifecycle(); |
| 583 | wakefulnessLifecycle.dispatchStartedWakingUp(); |
| 584 | wakefulnessLifecycle.dispatchFinishedWakingUp(); |
| 585 | return wakefulnessLifecycle; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 586 | } |
| 587 | |
Jason Monk | 9c4faa8 | 2017-08-15 09:32:27 -0400 | [diff] [blame] | 588 | @Override |
| 589 | protected void updateTheme() { |
| 590 | // Do nothing for now, until we have more mocking and StatusBar is smaller. |
| 591 | } |
| 592 | |
Chris Wren | 621933f | 2017-06-14 15:59:03 -0400 | [diff] [blame] | 593 | public void setBarStateForTest(int state) { |
| 594 | mState = state; |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 595 | } |
Charles He | 2eda242 | 2017-09-24 17:55:21 +0100 | [diff] [blame] | 596 | |
| 597 | public void setUserSetupForTest(boolean userSetup) { |
| 598 | mUserSetup = userSetup; |
| 599 | } |
Adrian Roos | ef7a402 | 2017-01-19 14:48:35 -0800 | [diff] [blame] | 600 | } |
Eliot Courtney | 0932228 | 2017-11-09 15:31:19 +0900 | [diff] [blame] | 601 | } |