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

Commit 3034ebdc authored by Richard MacGregor's avatar Richard MacGregor Committed by Android (Google) Code Review
Browse files

Merge "Invalidate pipeline on state change" into main

parents fb4332da 90f32b67
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -63,9 +63,16 @@ class SensitiveContentCoordinatorImpl @Inject constructor(
        SensitiveContentCoordinator,
        DynamicPrivacyController.Listener,
        OnBeforeRenderListListener {
    private val onSensitiveStateChanged = Runnable() {
        invalidateList("onSensitiveStateChanged")
    }

    override fun attach(pipeline: NotifPipeline) {
        dynamicPrivacyController.addListener(this)
        if (screenshareNotificationHiding()) {
            sensitiveNotificationProtectionController
                .registerSensitiveStateListener(onSensitiveStateChanged)
        }
        pipeline.addOnBeforeRenderListListener(this)
        pipeline.addPreRenderInvalidator(this)
    }
+20 −0
Original line number Diff line number Diff line
@@ -93,6 +93,26 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        verify(invalidationListener).onPluggableInvalidated(eq(invalidator), any())
    }

    @Test
    @EnableFlags(FLAG_SCREENSHARE_NOTIFICATION_HIDING)
    fun onSensitiveStateChanged_invokeInvalidationListener() {
        coordinator.attach(pipeline)
        val invalidator =
            withArgCaptor<Invalidator> { verify(pipeline).addPreRenderInvalidator(capture()) }
        val onSensitiveStateChangedListener =
            withArgCaptor<Runnable> {
                verify(sensitiveNotificationProtectionController)
                    .registerSensitiveStateListener(capture())
            }

        val invalidationListener = mock<Pluggable.PluggableListener<Invalidator>>()
        invalidator.setInvalidationListener(invalidationListener)

        onSensitiveStateChangedListener.run()

        verify(invalidationListener).onPluggableInvalidated(eq(invalidator), any())
    }

    @Test
    fun onBeforeRenderList_deviceUnlocked_notifDoesNotNeedRedaction() {
        coordinator.attach(pipeline)