Notification summaries on request: NotificationListenerService, off by default
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
- LembasNotificationListener keeps nothing; NotificationReader.read takes the notifications up now (not ours, not ongoing, not group summaries; newest 40, 600 chars each, 12k in all) and returns nothing while the phone is locked. - The assistant sends them with one question: its "Summarise my notifications" chip, or a question naming them (assist_notifications_phrases, per language). - Settings › Assistant › Notification summaries: the app's switch (off) and, when on, Android's notification-access page with whether it is given; a privacy paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
20 files changed
+399
-4
No files matched your search
@@ -11,6 +11,8 @@ import eu.llembas.android.assist.isStopPhrase
|
||||
import eu.llembas.android.assist.settle
|
||||
import eu.llembas.android.assist.usePhoneRecognizer
|
||||
import eu.llembas.android.auth.Prefs
|
||||
import eu.llembas.android.notify.Notice
|
||||
import eu.llembas.android.notify.NotificationReader
|
||||
import eu.llembas.android.share.shareMessage
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
@@ -108,4 +110,20 @@ class AssistTest {
|
||||
assertFalse(isStopPhrase("", phrases))
|
||||
assertTrue(isStopPhrase("Ďakujem, to je všetko", listOf("ďakujem to je všetko")))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun notificationsGoAsShortBlocksAndOnlyWhenAskedFor() {
|
||||
val now = 10 * 3_600_000L
|
||||
val text = NotificationReader.asText(
|
||||
listOf(
|
||||
Notice("Mail", "Bilbo", "The party is on Thursday.", now - 5 * 60_000),
|
||||
Notice("Weather", "Rain", "", now - 3 * 3_600_000),
|
||||
),
|
||||
now,
|
||||
)
|
||||
assertEquals("[Mail · 5m ago] Bilbo\nThe party is on Thursday.\n\n[Weather · 3h ago] Rain", text)
|
||||
val phrases = listOf("my notifications")
|
||||
assertTrue(NotificationReader.asksAbout("Anything urgent in My Notifications?", phrases))
|
||||
assertFalse(NotificationReader.asksAbout("How do notifications work on Android?", phrases))
|
||||
}
|
||||
}
|
||||
@@ -357,7 +357,7 @@ object Fakes {
|
||||
val settings = SettingsState(
|
||||
instances = listOf(home, work),
|
||||
active = home,
|
||||
prefs = Prefs(theme = "", assistantTemporary = true, accountLanguage = "en"),
|
||||
prefs = Prefs(theme = "", assistantTemporary = true, accountLanguage = "en", notificationSummaries = true),
|
||||
hasDistributor = true,
|
||||
version = "1.0.0-beta.3",
|
||||
selfUpdate = true,
|
||||
@@ -384,7 +384,7 @@ object Fakes {
|
||||
)
|
||||
|
||||
/** Opened from the tile, nothing asked yet: the last chat, the help, the microphone. */
|
||||
val assistOpened = assistBase.copy(last = LastAssist("c1", "Packing for the road", 0), screenText = true, includeScreen = true)
|
||||
val assistOpened = assistBase.copy(last = LastAssist("c1", "Packing for the road", 0), screenText = true, includeScreen = true, canReadNotifications = true)
|
||||
|
||||
/** A spoken question answered, the answer read aloud. */
|
||||
val assistAnswered = assistBase.copy(
|
||||
|
||||
Reference in new issue
Block a user