Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7b0f6788 authored by Richard MacGregor's avatar Richard MacGregor
Browse files

Update/fix SensitiveContentProtectionManager test

- Use real MediaProjectionInfo, not a mock
- Fix failing tests from recent change that does not update wm with
  empty set of packages

Bug: 332782679
Test: atest SensitiveContentProtectionManagerServiceNotificationTest
Flag: N/A - test fix
Change-Id: I3d1ce2c487abece12016ec4ad08e7d0f31e25172
parent 60c608bf
Loading
Loading
Loading
Loading
+69 −57
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
@@ -34,6 +33,7 @@ import static org.mockito.Mockito.when;
import android.content.pm.PackageManagerInternal;
import android.media.projection.MediaProjectionInfo;
import android.media.projection.MediaProjectionManager;
import android.os.Process;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
@@ -79,7 +79,8 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
    private static final String NOTIFICATION_PKG_1 = "com.android.server.notification.one";
    private static final String NOTIFICATION_PKG_2 = "com.android.server.notification.two";

    private static final String EXEMPTED_SCREEN_RECORDER_PACKAGE = "test.screen.recorder.package";
    private static final String SCREEN_RECORDER_PACKAGE = "test.screen.recorder.package";
    private static final String EXEMPTED_SCREEN_RECORDER_PACKAGE = "exempt.screen.recorder.package";

    private static final int NOTIFICATION_UID_1 = 5;
    private static final int NOTIFICATION_UID_2 = 6;
@@ -281,10 +282,18 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
                .getActiveNotifications();
    }

    private MediaProjectionInfo createMediaProjectionInfo() {
        return new MediaProjectionInfo(SCREEN_RECORDER_PACKAGE, Process.myUserHandle(), null);
    }

    private MediaProjectionInfo createExemptMediaProjectionInfo() {
        return new MediaProjectionInfo(
                EXEMPTED_SCREEN_RECORDER_PACKAGE, Process.myUserHandle(), null);
    }

    @Test
    public void mediaProjectionOnStart_verifyExemptedRecorderPackage() {
        MediaProjectionInfo mediaProjectionInfo = mock(MediaProjectionInfo.class);
        when(mediaProjectionInfo.getPackageName()).thenReturn(EXEMPTED_SCREEN_RECORDER_PACKAGE);
        MediaProjectionInfo mediaProjectionInfo = createExemptMediaProjectionInfo();

        mMediaProjectionCallbackCaptor.getValue().onStart(mediaProjectionInfo);

@@ -295,7 +304,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
    public void mediaProjectionOnStart_onProjectionStart_setWmBlockedPackages() {
        ArraySet<PackageInfo> expectedBlockedPackages = setupSensitiveNotification();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(expectedBlockedPackages);
    }
@@ -304,18 +313,18 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
    public void mediaProjectionOnStart_noSensitiveNotifications_noBlockedPackages() {
        setupNoSensitiveNotifications();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
    public void mediaProjectionOnStart_noNotifications_noBlockedPackages() {
        setupNoNotifications();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -323,7 +332,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        ArraySet<PackageInfo> expectedBlockedPackages =
                setupMultipleSensitiveNotificationsFromSamePackageAndUid();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(expectedBlockedPackages);
    }
@@ -333,7 +342,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        ArraySet<PackageInfo> expectedBlockedPackages =
                setupMultipleSensitiveNotificationsFromDifferentPackage();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(expectedBlockedPackages);
    }
@@ -343,7 +352,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        ArraySet<PackageInfo> expectedBlockedPackages =
                setupMultipleSensitiveNotificationsFromDifferentUid();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(expectedBlockedPackages);
    }
@@ -352,7 +361,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
    public void mediaProjectionOnStop_onProjectionEnd_clearWmBlockedPackages() {
        setupSensitiveNotification();

        MediaProjectionInfo mediaProjectionInfo = mock(MediaProjectionInfo.class);
        MediaProjectionInfo mediaProjectionInfo = createMediaProjectionInfo();
        mMediaProjectionCallbackCaptor.getValue().onStart(mediaProjectionInfo);
        Mockito.reset(mWindowManager);

@@ -365,7 +374,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
    public void mediaProjectionOnStart_afterOnStop_onProjectionStart_setWmBlockedPackages() {
        ArraySet<PackageInfo> expectedBlockedPackages = setupSensitiveNotification();

        MediaProjectionInfo mediaProjectionInfo = mock(MediaProjectionInfo.class);
        MediaProjectionInfo mediaProjectionInfo = createMediaProjectionInfo();
        mMediaProjectionCallbackCaptor.getValue().onStart(mediaProjectionInfo);
        mMediaProjectionCallbackCaptor.getValue().onStop(mediaProjectionInfo);
        Mockito.reset(mWindowManager);
@@ -381,9 +390,9 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
                .when(mSensitiveContentProtectionManagerService.mNotificationListener)
                .getActiveNotifications();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -392,9 +401,9 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
                .when(mSensitiveContentProtectionManagerService.mNotificationListener)
                .getCurrentRanking();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -403,9 +412,9 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
                .when(mSensitiveContentProtectionManagerService.mNotificationListener)
                .getCurrentRanking();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -416,9 +425,9 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
                .when(mSensitiveContentProtectionManagerService.mNotificationListener)
                .getCurrentRanking();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -426,7 +435,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        mockDisabledViaDevelopOption();
        setupSensitiveNotification();

        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());

        verifyZeroInteractions(mWindowManager);
    }
@@ -447,8 +456,9 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStop(mock(MediaProjectionInfo.class));
        MediaProjectionInfo mediaProjectionInfo = createMediaProjectionInfo();
        mMediaProjectionCallbackCaptor.getValue().onStart(mediaProjectionInfo);
        mMediaProjectionCallbackCaptor.getValue().onStop(mediaProjectionInfo);
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener.onListenerConnected();
@@ -461,7 +471,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        ArraySet<PackageInfo> expectedBlockedPackages = setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener.onListenerConnected();
@@ -472,23 +482,23 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
    @Test
    public void nlsOnListenerConnected_noSensitiveNotifications_noBlockedPackages() {
        setupNoSensitiveNotifications();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener.onListenerConnected();

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
    public void nlsOnListenerConnected_noNotifications_noBlockedPackages() {
        setupNoNotifications();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener.onListenerConnected();

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -496,7 +506,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);
        doReturn(null)
                .when(mSensitiveContentProtectionManagerService.mNotificationListener)
@@ -504,7 +514,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {

        mSensitiveContentProtectionManagerService.mNotificationListener.onListenerConnected();

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -512,7 +522,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);
        when(mRankingMap.getRawRankingObject(eq(NOTIFICATION_KEY_1))).thenReturn(null);
        doReturn(mRankingMap)
@@ -521,7 +531,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {

        mSensitiveContentProtectionManagerService.mNotificationListener.onListenerConnected();

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -530,7 +540,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        mSensitiveContentProtectionManagerService.mNotificationListener.onListenerConnected();

        verifyZeroInteractions(mWindowManager);
@@ -553,8 +563,9 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStop(mock(MediaProjectionInfo.class));
        MediaProjectionInfo mediaProjectionInfo = createMediaProjectionInfo();
        mMediaProjectionCallbackCaptor.getValue().onStart(mediaProjectionInfo);
        mMediaProjectionCallbackCaptor.getValue().onStop(mediaProjectionInfo);
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
@@ -568,7 +579,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        ArraySet<PackageInfo> expectedBlockedPackages = setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
@@ -580,25 +591,25 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
    @Test
    public void nlsOnNotificationRankingUpdate_noSensitiveNotifications_noBlockedPackages() {
        setupNoSensitiveNotifications();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
                .onNotificationRankingUpdate(mRankingMap);

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
    public void nlsOnNotificationRankingUpdate_noNotifications_noBlockedPackages() {
        setupNoNotifications();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
                .onNotificationRankingUpdate(mRankingMap);

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -606,13 +617,13 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
                .onNotificationRankingUpdate(null);

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -620,7 +631,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);
        when(mRankingMap.getRawRankingObject(eq(NOTIFICATION_KEY_1))).thenReturn(null);
        doReturn(mRankingMap)
@@ -630,7 +641,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        mSensitiveContentProtectionManagerService.mNotificationListener
                .onNotificationRankingUpdate(mRankingMap);

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -638,7 +649,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        doThrow(SecurityException.class)
@@ -648,7 +659,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        mSensitiveContentProtectionManagerService.mNotificationListener
                .onNotificationRankingUpdate(mRankingMap);

        verify(mWindowManager).addBlockScreenCaptureForApps(EMPTY_SET);
        verifyZeroInteractions(mWindowManager);
    }

    @Test
@@ -657,7 +668,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        mSensitiveContentProtectionManagerService.mNotificationListener
                .onNotificationRankingUpdate(mRankingMap);

@@ -681,8 +692,9 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStop(mock(MediaProjectionInfo.class));
        MediaProjectionInfo mediaProjectionInfo = createMediaProjectionInfo();
        mMediaProjectionCallbackCaptor.getValue().onStart(mediaProjectionInfo);
        mMediaProjectionCallbackCaptor.getValue().onStop(mediaProjectionInfo);
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
@@ -696,7 +708,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
@@ -712,7 +724,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
@@ -726,7 +738,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
@@ -740,7 +752,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);

        mSensitiveContentProtectionManagerService.mNotificationListener
@@ -754,7 +766,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        Mockito.reset(mWindowManager);
        when(mRankingMap.getRawRankingObject(eq(NOTIFICATION_KEY_1))).thenReturn(null);

@@ -770,7 +782,7 @@ public class SensitiveContentProtectionManagerServiceNotificationTest {
        // Sets up mNotification1 & mRankingMap to be a sensitive notification, and mNotification2
        // as non-sensitive
        setupSensitiveNotification();
        mMediaProjectionCallbackCaptor.getValue().onStart(mock(MediaProjectionInfo.class));
        mMediaProjectionCallbackCaptor.getValue().onStart(createMediaProjectionInfo());
        mSensitiveContentProtectionManagerService.mNotificationListener
                .onNotificationPosted(mNotification1, mRankingMap);