diff options
| author | 2024-02-27 15:31:10 -0800 | |
|---|---|---|
| committer | 2024-03-04 11:23:35 -0800 | |
| commit | 90f32b6796ed2d3aee0c1cf80dea53f9096f636a (patch) | |
| tree | 570af3d8971c0c365b45cebcbc64be71be18bfef | |
| parent | 6505660c0d13326e6012f864f2d768a5f4c67416 (diff) | |
Invalidate pipeline on state change
When SensitiveNotificationProtectionController state changes, invalidate
notification pipeline. This is done via SensitiveContentCoordinator due
to its usage of that state in onBeforeRenderList
Bug: 327024492
Test: atest SensitiveContentCoordinatorTest
Flag: ACONFIG com.android.server.notification.screenshare_notification_hiding DISABLED
Change-Id: I083f7a1e85849ea9811cd90eada79e5388beaceb
2 files changed, 27 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinator.kt index f03c3139ca8f..e4db4c70985d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinator.kt @@ -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) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt index 457d2f09ed9e..018a571b3d18 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/collection/coordinator/SensitiveContentCoordinatorTest.kt @@ -94,6 +94,26 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() { } @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) val onBeforeRenderListListener = |