Keep listener active for direct alert control

This commit is contained in:
ajp_anton
2026-08-18 16:35:31 +00:00
parent 4e0c5d5298
commit 4a7981669b
@@ -47,4 +47,24 @@ class AlertListenerPolicyDeviceTest {
context.packageManager.getComponentEnabledSetting(component),
)
}
@Test
fun directAlertControlKeepsListenerEnabledWithoutRules() {
LoggingType.entries.forEach { LoggingRuleStore(context).save(it, LoggingRule(enabled = false)) }
AlertConfigurationStore(context).save(
AlertConfiguration(appSettings = listOf(AlertAppSettings("example.app", directAlertControl = true))),
)
assertEquals(
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
context.packageManager.getComponentEnabledSetting(component),
)
AlertConfigurationStore(context).save(AlertConfiguration())
assertEquals(
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
context.packageManager.getComponentEnabledSetting(component),
)
}
}