Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +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 |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.android.systemui.statusbar; |
| 18 | |
| 19 | import static junit.framework.Assert.assertNotNull; |
| 20 | import static junit.framework.Assert.assertNull; |
| 21 | import static junit.framework.Assert.assertTrue; |
| 22 | |
| 23 | import static org.junit.Assert.assertEquals; |
| 24 | import static org.mockito.ArgumentMatchers.any; |
| 25 | import static org.mockito.ArgumentMatchers.anyInt; |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 26 | import static org.mockito.ArgumentMatchers.anyString; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 27 | import static org.mockito.ArgumentMatchers.eq; |
| 28 | import static org.mockito.Mockito.doAnswer; |
| 29 | import static org.mockito.Mockito.mock; |
| 30 | import static org.mockito.Mockito.never; |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 31 | import static org.mockito.Mockito.times; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 32 | import static org.mockito.Mockito.verify; |
| 33 | import static org.mockito.Mockito.when; |
| 34 | |
| 35 | import android.app.ActivityManager; |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 36 | import android.app.AppOpsManager; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 37 | import android.app.Notification; |
Dan Sandler | 1d958f8 | 2018-01-09 21:10:26 -0500 | [diff] [blame] | 38 | import android.app.NotificationManager; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 39 | import android.content.Context; |
| 40 | import android.os.Handler; |
| 41 | import android.os.Looper; |
| 42 | import android.os.UserHandle; |
| 43 | import android.service.notification.NotificationListenerService; |
| 44 | import android.service.notification.StatusBarNotification; |
| 45 | import android.support.test.filters.SmallTest; |
| 46 | import android.testing.AndroidTestingRunner; |
| 47 | import android.testing.TestableLooper; |
Julia Reynolds | 9159006 | 2018-04-02 16:24:11 -0400 | [diff] [blame] | 48 | import android.util.ArraySet; |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 49 | import android.widget.FrameLayout; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 50 | |
| 51 | import com.android.internal.logging.MetricsLogger; |
| 52 | import com.android.internal.statusbar.IStatusBarService; |
| 53 | import com.android.systemui.ForegroundServiceController; |
| 54 | import com.android.systemui.R; |
| 55 | import com.android.systemui.SysuiTestCase; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 56 | import com.android.systemui.statusbar.notification.VisualStabilityManager; |
| 57 | import com.android.systemui.statusbar.phone.NotificationGroupManager; |
| 58 | import com.android.systemui.statusbar.policy.DeviceProvisionedController; |
| 59 | import com.android.systemui.statusbar.policy.HeadsUpManager; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 60 | |
Julia Reynolds | 9159006 | 2018-04-02 16:24:11 -0400 | [diff] [blame] | 61 | import junit.framework.Assert; |
| 62 | |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 63 | import org.junit.Before; |
| 64 | import org.junit.Test; |
| 65 | import org.junit.runner.RunWith; |
| 66 | import org.mockito.ArgumentCaptor; |
| 67 | import org.mockito.Mock; |
| 68 | import org.mockito.MockitoAnnotations; |
| 69 | |
| 70 | import java.util.concurrent.CountDownLatch; |
| 71 | import java.util.concurrent.TimeUnit; |
| 72 | |
| 73 | @SmallTest |
| 74 | @RunWith(AndroidTestingRunner.class) |
| 75 | @TestableLooper.RunWithLooper |
| 76 | public class NotificationEntryManagerTest extends SysuiTestCase { |
| 77 | private static final String TEST_PACKAGE_NAME = "test"; |
| 78 | private static final int TEST_UID = 0; |
| 79 | |
| 80 | @Mock private NotificationPresenter mPresenter; |
| 81 | @Mock private ExpandableNotificationRow mRow; |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 82 | @Mock private NotificationListContainer mListContainer; |
| 83 | @Mock private NotificationEntryManager.Callback mCallback; |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 84 | @Mock private HeadsUpManager mHeadsUpManager; |
| 85 | @Mock private NotificationListenerService.RankingMap mRankingMap; |
| 86 | @Mock private RemoteInputController mRemoteInputController; |
| 87 | @Mock private IStatusBarService mBarService; |
| 88 | |
Eliot Courtney | 8f56b0e | 2017-12-14 18:54:28 +0900 | [diff] [blame] | 89 | // Dependency mocks: |
| 90 | @Mock private ForegroundServiceController mForegroundServiceController; |
| 91 | @Mock private NotificationLockscreenUserManager mLockscreenUserManager; |
| 92 | @Mock private NotificationGroupManager mGroupManager; |
| 93 | @Mock private NotificationGutsManager mGutsManager; |
| 94 | @Mock private NotificationRemoteInputManager mRemoteInputManager; |
| 95 | @Mock private NotificationMediaManager mMediaManager; |
| 96 | @Mock private NotificationListener mNotificationListener; |
| 97 | @Mock private DeviceProvisionedController mDeviceProvisionedController; |
| 98 | @Mock private VisualStabilityManager mVisualStabilityManager; |
| 99 | @Mock private MetricsLogger mMetricsLogger; |
| 100 | |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 101 | private NotificationData.Entry mEntry; |
| 102 | private StatusBarNotification mSbn; |
| 103 | private Handler mHandler; |
| 104 | private TestableNotificationEntryManager mEntryManager; |
| 105 | private CountDownLatch mCountDownLatch; |
| 106 | |
| 107 | private class TestableNotificationEntryManager extends NotificationEntryManager { |
| 108 | private final CountDownLatch mCountDownLatch; |
| 109 | |
Eliot Courtney | 6c313d3 | 2017-12-14 19:57:51 +0900 | [diff] [blame] | 110 | public TestableNotificationEntryManager(Context context, IStatusBarService barService) { |
| 111 | super(context); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 112 | mBarService = barService; |
| 113 | mCountDownLatch = new CountDownLatch(1); |
| 114 | mUseHeadsUp = true; |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public void onAsyncInflationFinished(NotificationData.Entry entry) { |
| 119 | super.onAsyncInflationFinished(entry); |
| 120 | |
| 121 | mCountDownLatch.countDown(); |
| 122 | } |
| 123 | |
| 124 | public CountDownLatch getCountDownLatch() { |
| 125 | return mCountDownLatch; |
| 126 | } |
| 127 | } |
| 128 | |
Dan Sandler | 1d958f8 | 2018-01-09 21:10:26 -0500 | [diff] [blame] | 129 | private void setUserSentiment(String key, int sentiment) { |
| 130 | doAnswer(invocationOnMock -> { |
| 131 | NotificationListenerService.Ranking ranking = (NotificationListenerService.Ranking) |
| 132 | invocationOnMock.getArguments()[1]; |
| 133 | ranking.populate( |
| 134 | key, |
| 135 | 0, |
| 136 | false, |
| 137 | 0, |
| 138 | 0, |
| 139 | NotificationManager.IMPORTANCE_DEFAULT, |
| 140 | null, null, |
Beverly | 5a20a5e | 2018-03-06 15:02:44 -0500 | [diff] [blame] | 141 | null, null, null, true, sentiment, false); |
Dan Sandler | 1d958f8 | 2018-01-09 21:10:26 -0500 | [diff] [blame] | 142 | return true; |
| 143 | }).when(mRankingMap).getRanking(eq(key), any(NotificationListenerService.Ranking.class)); |
| 144 | } |
| 145 | |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 146 | @Before |
| 147 | public void setUp() { |
| 148 | MockitoAnnotations.initMocks(this); |
Eliot Courtney | 8f56b0e | 2017-12-14 18:54:28 +0900 | [diff] [blame] | 149 | mDependency.injectTestDependency(ForegroundServiceController.class, |
| 150 | mForegroundServiceController); |
| 151 | mDependency.injectTestDependency(NotificationLockscreenUserManager.class, |
| 152 | mLockscreenUserManager); |
| 153 | mDependency.injectTestDependency(NotificationGroupManager.class, mGroupManager); |
| 154 | mDependency.injectTestDependency(NotificationGutsManager.class, mGutsManager); |
| 155 | mDependency.injectTestDependency(NotificationRemoteInputManager.class, mRemoteInputManager); |
| 156 | mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); |
| 157 | mDependency.injectTestDependency(NotificationListener.class, mNotificationListener); |
| 158 | mDependency.injectTestDependency(DeviceProvisionedController.class, |
| 159 | mDeviceProvisionedController); |
| 160 | mDependency.injectTestDependency(VisualStabilityManager.class, mVisualStabilityManager); |
| 161 | mDependency.injectTestDependency(MetricsLogger.class, mMetricsLogger); |
| 162 | |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 163 | mHandler = new Handler(Looper.getMainLooper()); |
| 164 | mCountDownLatch = new CountDownLatch(1); |
| 165 | |
| 166 | when(mPresenter.getHandler()).thenReturn(mHandler); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 167 | when(mPresenter.getNotificationLockscreenUserManager()).thenReturn(mLockscreenUserManager); |
| 168 | when(mPresenter.getGroupManager()).thenReturn(mGroupManager); |
| 169 | when(mRemoteInputManager.getController()).thenReturn(mRemoteInputController); |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 170 | when(mListContainer.getViewParentForNotification(any())).thenReturn( |
| 171 | new FrameLayout(mContext)); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 172 | |
| 173 | Notification.Builder n = new Notification.Builder(mContext, "") |
| 174 | .setSmallIcon(R.drawable.ic_person) |
| 175 | .setContentTitle("Title") |
| 176 | .setContentText("Text"); |
| 177 | mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, |
| 178 | 0, n.build(), new UserHandle(ActivityManager.getCurrentUser()), null, 0); |
| 179 | mEntry = new NotificationData.Entry(mSbn); |
| 180 | mEntry.expandedIcon = mock(StatusBarIconView.class); |
| 181 | |
Eliot Courtney | 6c313d3 | 2017-12-14 19:57:51 +0900 | [diff] [blame] | 182 | mEntryManager = new TestableNotificationEntryManager(mContext, mBarService); |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 183 | mEntryManager.setUpWithPresenter(mPresenter, mListContainer, mCallback, mHeadsUpManager); |
Dan Sandler | 1d958f8 | 2018-01-09 21:10:26 -0500 | [diff] [blame] | 184 | |
| 185 | setUserSentiment(mEntry.key, NotificationListenerService.Ranking.USER_SENTIMENT_NEUTRAL); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | @Test |
| 189 | public void testAddNotification() throws Exception { |
| 190 | com.android.systemui.util.Assert.isNotMainThread(); |
| 191 | |
| 192 | doAnswer(invocation -> { |
| 193 | mCountDownLatch.countDown(); |
| 194 | return null; |
| 195 | }).when(mCallback).onBindRow(any(), any(), any(), any()); |
| 196 | |
| 197 | // Post on main thread, otherwise we will be stuck waiting here for the inflation finished |
| 198 | // callback forever, since it won't execute until the tests ends. |
| 199 | mHandler.post(() -> { |
| 200 | mEntryManager.addNotification(mSbn, mRankingMap); |
| 201 | }); |
| 202 | assertTrue(mCountDownLatch.await(1, TimeUnit.MINUTES)); |
| 203 | assertTrue(mEntryManager.getCountDownLatch().await(1, TimeUnit.MINUTES)); |
| 204 | waitForIdleSync(mHandler); |
| 205 | |
| 206 | // Check that no inflation error occurred. |
| 207 | verify(mBarService, never()).onNotificationError(any(), any(), anyInt(), anyInt(), anyInt(), |
| 208 | any(), anyInt()); |
| 209 | verify(mForegroundServiceController).addNotification(eq(mSbn), anyInt()); |
| 210 | |
| 211 | // Row inflation: |
| 212 | ArgumentCaptor<NotificationData.Entry> entryCaptor = ArgumentCaptor.forClass( |
| 213 | NotificationData.Entry.class); |
| 214 | verify(mCallback).onBindRow(entryCaptor.capture(), any(), eq(mSbn), any()); |
| 215 | NotificationData.Entry entry = entryCaptor.getValue(); |
| 216 | verify(mRemoteInputManager).bindRow(entry.row); |
| 217 | |
| 218 | // Row content inflation: |
| 219 | verify(mCallback).onNotificationAdded(entry); |
| 220 | verify(mPresenter).updateNotificationViews(); |
| 221 | |
| 222 | assertEquals(mEntryManager.getNotificationData().get(mSbn.getKey()), entry); |
| 223 | assertNotNull(entry.row); |
Dan Sandler | 1d958f8 | 2018-01-09 21:10:26 -0500 | [diff] [blame] | 224 | assertEquals(mEntry.userSentiment, |
| 225 | NotificationListenerService.Ranking.USER_SENTIMENT_NEUTRAL); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | @Test |
| 229 | public void testUpdateNotification() throws Exception { |
| 230 | com.android.systemui.util.Assert.isNotMainThread(); |
| 231 | |
| 232 | mEntryManager.getNotificationData().add(mEntry); |
| 233 | |
Dan Sandler | 1d958f8 | 2018-01-09 21:10:26 -0500 | [diff] [blame] | 234 | setUserSentiment(mEntry.key, NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE); |
| 235 | |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 236 | mHandler.post(() -> { |
| 237 | mEntryManager.updateNotification(mSbn, mRankingMap); |
| 238 | }); |
| 239 | // Wait for content update. |
| 240 | mEntryManager.getCountDownLatch().await(1, TimeUnit.MINUTES); |
| 241 | waitForIdleSync(mHandler); |
| 242 | |
| 243 | verify(mBarService, never()).onNotificationError(any(), any(), anyInt(), anyInt(), anyInt(), |
| 244 | any(), anyInt()); |
| 245 | |
| 246 | verify(mRemoteInputManager).onUpdateNotification(mEntry); |
| 247 | verify(mPresenter).updateNotificationViews(); |
| 248 | verify(mForegroundServiceController).updateNotification(eq(mSbn), anyInt()); |
| 249 | verify(mCallback).onNotificationUpdated(mSbn); |
| 250 | assertNotNull(mEntry.row); |
Dan Sandler | 1d958f8 | 2018-01-09 21:10:26 -0500 | [diff] [blame] | 251 | assertEquals(mEntry.userSentiment, |
| 252 | NotificationListenerService.Ranking.USER_SENTIMENT_NEGATIVE); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | @Test |
| 256 | public void testRemoveNotification() throws Exception { |
| 257 | com.android.systemui.util.Assert.isNotMainThread(); |
| 258 | |
| 259 | mEntry.row = mRow; |
| 260 | mEntryManager.getNotificationData().add(mEntry); |
| 261 | |
| 262 | mHandler.post(() -> { |
| 263 | mEntryManager.removeNotification(mSbn.getKey(), mRankingMap); |
| 264 | }); |
| 265 | waitForIdleSync(mHandler); |
| 266 | |
| 267 | verify(mBarService, never()).onNotificationError(any(), any(), anyInt(), anyInt(), anyInt(), |
| 268 | any(), anyInt()); |
| 269 | |
| 270 | verify(mMediaManager).onNotificationRemoved(mSbn.getKey()); |
| 271 | verify(mRemoteInputManager).onRemoveNotification(mEntry); |
| 272 | verify(mForegroundServiceController).removeNotification(mSbn); |
Eliot Courtney | 2b4c3a0 | 2017-11-27 13:27:46 +0900 | [diff] [blame] | 273 | verify(mListContainer).cleanUpViewState(mRow); |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 274 | verify(mPresenter).updateNotificationViews(); |
| 275 | verify(mCallback).onNotificationRemoved(mSbn.getKey(), mSbn); |
| 276 | verify(mRow).setRemoved(); |
| 277 | |
| 278 | assertNull(mEntryManager.getNotificationData().get(mSbn.getKey())); |
| 279 | } |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 280 | |
| 281 | @Test |
| 282 | public void testUpdateAppOps_foregroundNoti() { |
| 283 | com.android.systemui.util.Assert.isNotMainThread(); |
| 284 | |
| 285 | when(mForegroundServiceController.getStandardLayoutKey(anyInt(), anyString())) |
Julia Reynolds | 9159006 | 2018-04-02 16:24:11 -0400 | [diff] [blame] | 286 | .thenReturn(mEntry.key); |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 287 | mEntry.row = mRow; |
| 288 | mEntryManager.getNotificationData().add(mEntry); |
| 289 | |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 290 | mHandler.post(() -> { |
Julia Reynolds | 9159006 | 2018-04-02 16:24:11 -0400 | [diff] [blame] | 291 | mEntryManager.updateNotificationsForAppOp( |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 292 | AppOpsManager.OP_CAMERA, mEntry.notification.getUid(), |
| 293 | mEntry.notification.getPackageName(), true); |
| 294 | }); |
| 295 | waitForIdleSync(mHandler); |
| 296 | |
| 297 | verify(mPresenter, times(1)).updateNotificationViews(); |
| 298 | assertTrue(mEntryManager.getNotificationData().get(mEntry.key).mActiveAppOps.contains( |
| 299 | AppOpsManager.OP_CAMERA)); |
| 300 | } |
| 301 | |
| 302 | @Test |
| 303 | public void testUpdateAppOps_otherNoti() { |
| 304 | com.android.systemui.util.Assert.isNotMainThread(); |
| 305 | |
| 306 | when(mForegroundServiceController.getStandardLayoutKey(anyInt(), anyString())) |
| 307 | .thenReturn(null); |
| 308 | mHandler.post(() -> { |
Julia Reynolds | 9159006 | 2018-04-02 16:24:11 -0400 | [diff] [blame] | 309 | mEntryManager.updateNotificationsForAppOp(AppOpsManager.OP_CAMERA, 1000, "pkg", true); |
Julia Reynolds | fc64001 | 2018-02-21 12:25:27 -0500 | [diff] [blame] | 310 | }); |
| 311 | waitForIdleSync(mHandler); |
| 312 | |
| 313 | verify(mPresenter, never()).updateNotificationViews(); |
| 314 | } |
Julia Reynolds | 9159006 | 2018-04-02 16:24:11 -0400 | [diff] [blame] | 315 | |
| 316 | @Test |
| 317 | public void testAddNotificationExistingAppOps() { |
| 318 | mEntry.row = mRow; |
| 319 | mEntryManager.getNotificationData().add(mEntry); |
| 320 | ArraySet<Integer> expected = new ArraySet<>(); |
| 321 | expected.add(3); |
| 322 | expected.add(235); |
| 323 | expected.add(1); |
| 324 | |
| 325 | when(mForegroundServiceController.getAppOps(mEntry.notification.getUserId(), |
| 326 | mEntry.notification.getPackageName())).thenReturn(expected); |
| 327 | when(mForegroundServiceController.getStandardLayoutKey( |
| 328 | mEntry.notification.getUserId(), |
| 329 | mEntry.notification.getPackageName())).thenReturn(mEntry.key); |
| 330 | |
| 331 | mEntryManager.tagForeground(mEntry.notification); |
| 332 | |
| 333 | Assert.assertEquals(expected.size(), mEntry.mActiveAppOps.size()); |
| 334 | for (int op : expected) { |
| 335 | assertTrue("Entry missing op " + op, mEntry.mActiveAppOps.contains(op)); |
| 336 | } |
| 337 | } |
| 338 | |
| 339 | @Test |
| 340 | public void testAdd_noExistingAppOps() { |
| 341 | mEntry.row = mRow; |
| 342 | mEntryManager.getNotificationData().add(mEntry); |
| 343 | when(mForegroundServiceController.getStandardLayoutKey( |
| 344 | mEntry.notification.getUserId(), |
| 345 | mEntry.notification.getPackageName())).thenReturn(mEntry.key); |
| 346 | when(mForegroundServiceController.getAppOps(mEntry.notification.getUserId(), |
| 347 | mEntry.notification.getPackageName())).thenReturn(null); |
| 348 | |
| 349 | mEntryManager.tagForeground(mEntry.notification); |
| 350 | Assert.assertEquals(0, mEntry.mActiveAppOps.size()); |
| 351 | } |
| 352 | |
| 353 | @Test |
| 354 | public void testAdd_existingAppOpsNotForegroundNoti() { |
| 355 | mEntry.row = mRow; |
| 356 | mEntryManager.getNotificationData().add(mEntry); |
| 357 | ArraySet<Integer> ops = new ArraySet<>(); |
| 358 | ops.add(3); |
| 359 | ops.add(235); |
| 360 | ops.add(1); |
| 361 | when(mForegroundServiceController.getAppOps(mEntry.notification.getUserId(), |
| 362 | mEntry.notification.getPackageName())).thenReturn(ops); |
| 363 | when(mForegroundServiceController.getStandardLayoutKey( |
| 364 | mEntry.notification.getUserId(), |
| 365 | mEntry.notification.getPackageName())).thenReturn("something else"); |
| 366 | |
| 367 | mEntryManager.tagForeground(mEntry.notification); |
| 368 | Assert.assertEquals(0, mEntry.mActiveAppOps.size()); |
| 369 | } |
Eliot Courtney | a6d8cf2 | 2017-10-20 13:26:58 +0900 | [diff] [blame] | 370 | } |