Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [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.keyguard; |
| 18 | |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 19 | import static org.mockito.ArgumentMatchers.any; |
| 20 | import static org.mockito.ArgumentMatchers.anyString; |
| 21 | import static org.mockito.ArgumentMatchers.eq; |
Lucas Dupin | 7e171e2 | 2018-12-20 11:29:35 -0800 | [diff] [blame] | 22 | import static org.mockito.Mockito.mock; |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 23 | import static org.mockito.Mockito.never; |
Lucas Dupin | 3d560e4 | 2019-01-07 13:52:44 -0800 | [diff] [blame] | 24 | import static org.mockito.Mockito.reset; |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 25 | import static org.mockito.Mockito.spy; |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 26 | import static org.mockito.Mockito.verify; |
Lucas Dupin | c954824 | 2019-04-11 10:59:13 -0700 | [diff] [blame] | 27 | import static org.mockito.Mockito.when; |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 28 | |
| 29 | import android.app.AlarmManager; |
| 30 | import android.content.ContentResolver; |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 31 | import android.media.MediaMetadata; |
Lucas Dupin | 6b40d5e | 2019-05-15 19:47:11 -0700 | [diff] [blame] | 32 | import android.media.session.PlaybackState; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 33 | import android.net.Uri; |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 34 | import android.provider.Settings; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 35 | import android.testing.AndroidTestingRunner; |
| 36 | import android.testing.TestableLooper; |
| 37 | import android.testing.TestableLooper.RunWithLooper; |
Lucas Dupin | 627ad37 | 2018-11-27 10:28:25 +0100 | [diff] [blame] | 38 | |
| 39 | import androidx.slice.Slice; |
| 40 | import androidx.slice.SliceItem; |
| 41 | import androidx.slice.SliceProvider; |
| 42 | import androidx.slice.SliceSpecs; |
| 43 | import androidx.slice.builders.ListBuilder; |
| 44 | import androidx.slice.core.SliceQuery; |
Brett Chabot | 84151d9 | 2019-02-27 15:37:59 -0800 | [diff] [blame] | 45 | import androidx.test.filters.SmallTest; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 46 | |
Lucas Dupin | 7e171e2 | 2018-12-20 11:29:35 -0800 | [diff] [blame] | 47 | import com.android.keyguard.KeyguardUpdateMonitor; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 48 | import com.android.systemui.SysuiTestCase; |
Beverly | 8fdb533 | 2019-02-04 14:29:49 -0500 | [diff] [blame] | 49 | import com.android.systemui.plugins.statusbar.StatusBarStateController; |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 50 | import com.android.systemui.statusbar.NotificationMediaManager; |
Robert Snoeberger | dc8fee7 | 2019-07-19 16:35:35 -0400 | [diff] [blame] | 51 | import com.android.systemui.statusbar.StatusBarState; |
Selim Cinek | e3c6e46 | 2019-06-24 19:37:06 -0700 | [diff] [blame] | 52 | import com.android.systemui.statusbar.phone.DozeParameters; |
Lucas Dupin | 2d34523 | 2019-06-20 14:07:57 -0700 | [diff] [blame] | 53 | import com.android.systemui.statusbar.phone.KeyguardBypassController; |
Lucas Dupin | 960b7e7f | 2020-01-24 15:47:28 -0800 | [diff] [blame] | 54 | import com.android.systemui.statusbar.policy.NextAlarmController; |
Lucas Dupin | 2d34523 | 2019-06-20 14:07:57 -0700 | [diff] [blame] | 55 | import com.android.systemui.statusbar.policy.ZenModeController; |
| 56 | import com.android.systemui.util.wakelock.SettableWakeLock; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 57 | |
Dave Mankoff | e229469 | 2019-08-14 11:53:13 -0400 | [diff] [blame] | 58 | import org.junit.After; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 59 | import org.junit.Assert; |
| 60 | import org.junit.Before; |
| 61 | import org.junit.Test; |
| 62 | import org.junit.runner.RunWith; |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 63 | import org.mockito.Mock; |
| 64 | import org.mockito.MockitoAnnotations; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 65 | |
Jason Monk | 459fee3 | 2018-01-09 20:37:27 -0500 | [diff] [blame] | 66 | import java.util.Arrays; |
Jeff Gaston | c2100af | 2018-04-04 01:54:52 -0400 | [diff] [blame] | 67 | import java.util.HashSet; |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 68 | import java.util.concurrent.TimeUnit; |
Jason Monk | 459fee3 | 2018-01-09 20:37:27 -0500 | [diff] [blame] | 69 | |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 70 | @SmallTest |
| 71 | @RunWith(AndroidTestingRunner.class) |
Jason Monk | a716bac | 2018-12-05 15:48:21 -0500 | [diff] [blame] | 72 | @RunWithLooper |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 73 | public class KeyguardSliceProviderTest extends SysuiTestCase { |
| 74 | |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 75 | @Mock |
| 76 | private ContentResolver mContentResolver; |
| 77 | @Mock |
| 78 | private AlarmManager mAlarmManager; |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 79 | @Mock |
| 80 | private NotificationMediaManager mNotificationMediaManager; |
Lucas Dupin | 3d560e4 | 2019-01-07 13:52:44 -0800 | [diff] [blame] | 81 | @Mock |
| 82 | private StatusBarStateController mStatusBarStateController; |
Lucas Dupin | 2d34523 | 2019-06-20 14:07:57 -0700 | [diff] [blame] | 83 | @Mock |
| 84 | private KeyguardBypassController mKeyguardBypassController; |
| 85 | @Mock |
| 86 | private ZenModeController mZenModeController; |
| 87 | @Mock |
| 88 | private SettableWakeLock mMediaWakeLock; |
| 89 | @Mock |
Selim Cinek | e3c6e46 | 2019-06-24 19:37:06 -0700 | [diff] [blame] | 90 | private DozeParameters mDozeParameters; |
Lucas Dupin | 960b7e7f | 2020-01-24 15:47:28 -0800 | [diff] [blame] | 91 | @Mock |
| 92 | private NextAlarmController mNextAlarmController; |
Dave Mankoff | e229469 | 2019-08-14 11:53:13 -0400 | [diff] [blame] | 93 | private KeyguardUpdateMonitor mKeyguardUpdateMonitor; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 94 | private TestableKeyguardSliceProvider mProvider; |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 95 | private boolean mIsZenMode; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 96 | |
| 97 | @Before |
| 98 | public void setup() { |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 99 | MockitoAnnotations.initMocks(this); |
Dave Mankoff | e229469 | 2019-08-14 11:53:13 -0400 | [diff] [blame] | 100 | mKeyguardUpdateMonitor = mDependency.injectMockDependency(KeyguardUpdateMonitor.class); |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 101 | mIsZenMode = false; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 102 | mProvider = new TestableKeyguardSliceProvider(); |
Lucas Dupin | 960b7e7f | 2020-01-24 15:47:28 -0800 | [diff] [blame] | 103 | mProvider.setContextAvailableCallback(context -> { }); |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 104 | mProvider.attachInfo(getContext(), null); |
Lucas Dupin | 960b7e7f | 2020-01-24 15:47:28 -0800 | [diff] [blame] | 105 | reset(mContentResolver); |
Jeff Gaston | c2100af | 2018-04-04 01:54:52 -0400 | [diff] [blame] | 106 | SliceProvider.setSpecs(new HashSet<>(Arrays.asList(SliceSpecs.LIST))); |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 107 | } |
| 108 | |
Dave Mankoff | e229469 | 2019-08-14 11:53:13 -0400 | [diff] [blame] | 109 | @After |
| 110 | public void tearDown() { |
| 111 | mProvider.onDestroy(); |
| 112 | } |
| 113 | |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 114 | @Test |
| 115 | public void registersClockUpdate() { |
| 116 | Assert.assertTrue("registerClockUpdate should have been called during initialization.", |
| 117 | mProvider.isRegistered()); |
| 118 | } |
| 119 | |
| 120 | @Test |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 121 | public void returnsValidSlice() { |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 122 | Slice slice = mProvider.onBindSlice(mProvider.getUri()); |
Lucas Dupin | 6bd8601 | 2017-12-05 17:58:57 -0800 | [diff] [blame] | 123 | SliceItem text = SliceQuery.find(slice, android.app.slice.SliceItem.FORMAT_TEXT, |
| 124 | android.app.slice.Slice.HINT_TITLE, |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 125 | null /* nonHints */); |
| 126 | Assert.assertNotNull("Slice must provide a title.", text); |
| 127 | } |
| 128 | |
| 129 | @Test |
Lucas Dupin | 940e490 | 2019-06-03 15:43:20 -0700 | [diff] [blame] | 130 | public void onBindSlice_readsMedia_withoutBypass() { |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 131 | MediaMetadata metadata = mock(MediaMetadata.class); |
Lucas Dupin | c954824 | 2019-04-11 10:59:13 -0700 | [diff] [blame] | 132 | when(metadata.getText(any())).thenReturn("metadata"); |
Lucas Dupin | 3d560e4 | 2019-01-07 13:52:44 -0800 | [diff] [blame] | 133 | mProvider.onDozingChanged(true); |
Lucas Dupin | 6b40d5e | 2019-05-15 19:47:11 -0700 | [diff] [blame] | 134 | mProvider.onMetadataOrStateChanged(metadata, PlaybackState.STATE_PLAYING); |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 135 | mProvider.onBindSlice(mProvider.getUri()); |
| 136 | verify(metadata).getText(eq(MediaMetadata.METADATA_KEY_TITLE)); |
| 137 | verify(metadata).getText(eq(MediaMetadata.METADATA_KEY_ARTIST)); |
| 138 | verify(mNotificationMediaManager).getMediaIcon(); |
| 139 | } |
| 140 | |
| 141 | @Test |
Lucas Dupin | 940e490 | 2019-06-03 15:43:20 -0700 | [diff] [blame] | 142 | public void onBindSlice_readsMedia_withBypass_notDozing() { |
| 143 | MediaMetadata metadata = mock(MediaMetadata.class); |
| 144 | when(metadata.getText(any())).thenReturn("metadata"); |
| 145 | when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); |
Selim Cinek | e3c6e46 | 2019-06-24 19:37:06 -0700 | [diff] [blame] | 146 | when(mDozeParameters.getAlwaysOn()).thenReturn(true); |
Lucas Dupin | 940e490 | 2019-06-03 15:43:20 -0700 | [diff] [blame] | 147 | mProvider.onMetadataOrStateChanged(metadata, PlaybackState.STATE_PLAYING); |
| 148 | mProvider.onBindSlice(mProvider.getUri()); |
| 149 | verify(metadata).getText(eq(MediaMetadata.METADATA_KEY_TITLE)); |
| 150 | verify(metadata).getText(eq(MediaMetadata.METADATA_KEY_ARTIST)); |
| 151 | verify(mNotificationMediaManager).getMediaIcon(); |
| 152 | } |
| 153 | |
| 154 | @Test |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 155 | public void cleansDateFormat() { |
Lucas Dupin | 7e171e2 | 2018-12-20 11:29:35 -0800 | [diff] [blame] | 156 | mProvider.mKeyguardUpdateMonitorCallback.onTimeZoneChanged(null); |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 157 | TestableLooper.get(this).processAllMessages(); |
| 158 | Assert.assertEquals("Date format should have been cleaned.", 1 /* expected */, |
| 159 | mProvider.mCleanDateFormatInvokations); |
| 160 | } |
| 161 | |
| 162 | @Test |
| 163 | public void updatesClock() { |
Lucas Dupin | 7e171e2 | 2018-12-20 11:29:35 -0800 | [diff] [blame] | 164 | mProvider.mKeyguardUpdateMonitorCallback.onTimeChanged(); |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 165 | TestableLooper.get(this).processAllMessages(); |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 166 | verify(mContentResolver).notifyChange(eq(mProvider.getUri()), eq(null)); |
| 167 | } |
| 168 | |
| 169 | @Test |
| 170 | public void schedulesAlarm12hBefore() { |
| 171 | long in16Hours = System.currentTimeMillis() + TimeUnit.HOURS.toHours(16); |
| 172 | AlarmManager.AlarmClockInfo alarmClockInfo = new AlarmManager.AlarmClockInfo(in16Hours, null); |
| 173 | mProvider.onNextAlarmChanged(alarmClockInfo); |
| 174 | |
| 175 | long twelveHours = TimeUnit.HOURS.toMillis(KeyguardSliceProvider.ALARM_VISIBILITY_HOURS); |
| 176 | long triggerAt = in16Hours - twelveHours; |
| 177 | verify(mAlarmManager).setExact(eq(AlarmManager.RTC), eq(triggerAt), anyString(), any(), |
| 178 | any()); |
| 179 | } |
| 180 | |
| 181 | @Test |
| 182 | public void updatingNextAlarmInvalidatesSlice() { |
| 183 | long in16Hours = System.currentTimeMillis() + TimeUnit.HOURS.toHours(8); |
| 184 | AlarmManager.AlarmClockInfo alarmClockInfo = new AlarmManager.AlarmClockInfo(in16Hours, null); |
| 185 | mProvider.onNextAlarmChanged(alarmClockInfo); |
| 186 | |
| 187 | verify(mContentResolver).notifyChange(eq(mProvider.getUri()), eq(null)); |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 188 | } |
| 189 | |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 190 | @Test |
| 191 | public void onZenChanged_updatesSlice() { |
| 192 | mProvider.onZenChanged(Settings.Global.ZEN_MODE_ALARMS); |
| 193 | verify(mContentResolver).notifyChange(eq(mProvider.getUri()), eq(null)); |
| 194 | } |
| 195 | |
| 196 | @Test |
| 197 | public void addZenMode_addedToSlice() { |
Jason Monk | 1045e0b | 2018-08-06 09:42:10 -0400 | [diff] [blame] | 198 | ListBuilder listBuilder = spy(new ListBuilder(getContext(), mProvider.getUri(), |
| 199 | ListBuilder.INFINITY)); |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 200 | mProvider.addZenModeLocked(listBuilder); |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 201 | verify(listBuilder, never()).addRow(any(ListBuilder.RowBuilder.class)); |
| 202 | |
| 203 | mIsZenMode = true; |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 204 | mProvider.addZenModeLocked(listBuilder); |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 205 | verify(listBuilder).addRow(any(ListBuilder.RowBuilder.class)); |
| 206 | } |
| 207 | |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 208 | @Test |
| 209 | public void onMetadataChanged_updatesSlice() { |
Robert Snoeberger | dc8fee7 | 2019-07-19 16:35:35 -0400 | [diff] [blame] | 210 | mProvider.onStateChanged(StatusBarState.KEYGUARD); |
Lucas Dupin | 3d560e4 | 2019-01-07 13:52:44 -0800 | [diff] [blame] | 211 | mProvider.onDozingChanged(true); |
Lucas Dupin | 76527ee | 2019-02-20 10:46:23 -0800 | [diff] [blame] | 212 | reset(mContentResolver); |
Lucas Dupin | 6b40d5e | 2019-05-15 19:47:11 -0700 | [diff] [blame] | 213 | mProvider.onMetadataOrStateChanged(mock(MediaMetadata.class), PlaybackState.STATE_PLAYING); |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 214 | verify(mContentResolver).notifyChange(eq(mProvider.getUri()), eq(null)); |
Lucas Dupin | 3d560e4 | 2019-01-07 13:52:44 -0800 | [diff] [blame] | 215 | |
| 216 | // Hides after waking up |
| 217 | reset(mContentResolver); |
| 218 | mProvider.onDozingChanged(false); |
| 219 | verify(mContentResolver).notifyChange(eq(mProvider.getUri()), eq(null)); |
Lucas Dupin | 3d560e4 | 2019-01-07 13:52:44 -0800 | [diff] [blame] | 220 | } |
| 221 | |
| 222 | @Test |
| 223 | public void onDozingChanged_updatesSliceIfMedia() { |
Robert Snoeberger | dc8fee7 | 2019-07-19 16:35:35 -0400 | [diff] [blame] | 224 | mProvider.onStateChanged(StatusBarState.KEYGUARD); |
Lucas Dupin | 6b40d5e | 2019-05-15 19:47:11 -0700 | [diff] [blame] | 225 | mProvider.onMetadataOrStateChanged(mock(MediaMetadata.class), PlaybackState.STATE_PLAYING); |
Lucas Dupin | 76527ee | 2019-02-20 10:46:23 -0800 | [diff] [blame] | 226 | reset(mContentResolver); |
| 227 | // Show media when dozing |
Lucas Dupin | 3d560e4 | 2019-01-07 13:52:44 -0800 | [diff] [blame] | 228 | mProvider.onDozingChanged(true); |
| 229 | verify(mContentResolver).notifyChange(eq(mProvider.getUri()), eq(null)); |
| 230 | |
| 231 | // Do not notify again if nothing changed |
| 232 | reset(mContentResolver); |
| 233 | mProvider.onDozingChanged(true); |
| 234 | verify(mContentResolver, never()).notifyChange(eq(mProvider.getUri()), eq(null)); |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 235 | } |
| 236 | |
Lucas Dupin | 2d34523 | 2019-06-20 14:07:57 -0700 | [diff] [blame] | 237 | @Test |
| 238 | public void onDestroy_noCrash() { |
| 239 | mProvider.onDestroy(); |
| 240 | } |
| 241 | |
| 242 | @Test |
| 243 | public void onDestroy_unregisterListeners() { |
| 244 | mProvider.registerClockUpdate(); |
| 245 | mProvider.onDestroy(); |
| 246 | verify(mMediaWakeLock).setAcquired(eq(false)); |
| 247 | verify(mAlarmManager).cancel(any(AlarmManager.OnAlarmListener.class)); |
| 248 | verify(mKeyguardUpdateMonitor).removeCallback(any()); |
| 249 | } |
| 250 | |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 251 | private class TestableKeyguardSliceProvider extends KeyguardSliceProvider { |
| 252 | int mCleanDateFormatInvokations; |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 253 | private int mCounter; |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 254 | |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 255 | Uri getUri() { |
| 256 | return mSliceUri; |
| 257 | } |
| 258 | |
| 259 | @Override |
Lucas Dupin | 960b7e7f | 2020-01-24 15:47:28 -0800 | [diff] [blame] | 260 | protected void inject() { |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 261 | mAlarmManager = KeyguardSliceProviderTest.this.mAlarmManager; |
| 262 | mContentResolver = KeyguardSliceProviderTest.this.mContentResolver; |
Lucas Dupin | 2d34523 | 2019-06-20 14:07:57 -0700 | [diff] [blame] | 263 | mZenModeController = KeyguardSliceProviderTest.this.mZenModeController; |
| 264 | mMediaWakeLock = KeyguardSliceProviderTest.this.mMediaWakeLock; |
Lucas Dupin | 960b7e7f | 2020-01-24 15:47:28 -0800 | [diff] [blame] | 265 | mDozeParameters = KeyguardSliceProviderTest.this.mDozeParameters; |
| 266 | mNextAlarmController = KeyguardSliceProviderTest.this.mNextAlarmController; |
| 267 | mStatusBarStateController = KeyguardSliceProviderTest.this.mStatusBarStateController; |
| 268 | mKeyguardBypassController = KeyguardSliceProviderTest.this.mKeyguardBypassController; |
| 269 | mMediaManager = KeyguardSliceProviderTest.this.mNotificationMediaManager; |
Lucas Dupin | 1f7374a | 2018-02-26 18:08:33 -0800 | [diff] [blame] | 270 | } |
| 271 | |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 272 | @Override |
Lucas Dupin | 627ad37 | 2018-11-27 10:28:25 +0100 | [diff] [blame] | 273 | protected boolean isDndOn() { |
Lucas Dupin | 8b77a3b | 2018-05-01 13:23:03 -0700 | [diff] [blame] | 274 | return mIsZenMode; |
| 275 | } |
| 276 | |
| 277 | @Override |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 278 | void cleanDateFormatLocked() { |
| 279 | super.cleanDateFormatLocked(); |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 280 | mCleanDateFormatInvokations++; |
| 281 | } |
| 282 | |
| 283 | @Override |
Lucas Dupin | 6a03a9f | 2018-12-20 17:13:52 -0800 | [diff] [blame] | 284 | protected String getFormattedDateLocked() { |
| 285 | return super.getFormattedDateLocked() + mCounter++; |
| 286 | } |
Lucas Dupin | 957e50c | 2017-10-10 11:23:27 -0700 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | } |