Wake word with the screen off: the sheet stays over the lock screen and listens
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
A phone whose screen is off is locked. AssistActivity.take() sent every locked opening through requestDismissKeyguard and finished the activity on onDismissCancelled / onDismissError -- which is Android's answer when nobody unlocks. So the wake word lit the screen, showed the sheet, and closed it. lockedStart() decides now: a way in that means to speak (the wake word, a headset's button) stays and listens; what is heard is held in the state (waiting), shown as the person's own question with "Unlock to send", and Android is asked to unlock at once. Not unlocking leaves the sheet as it is. The question is asked on unlock (the dismiss callback or USER_PRESENT). The other locked openings ask to unlock first, as before. Nothing from the account over the lock screen still holds, and a little more than before: turns that were on the sheet when the phone locked are not drawn while it is locked (onStart reads the keyguard again), and a sheet over the lock screen goes when the screen goes off. The screen is kept on while it listens or works. The session (screen on, locked) listens over the lock screen as well and hands what it heard to the activity. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
19 files changed
+303
-26
No files matched your search
@@ -6,9 +6,12 @@ import eu.llembas.android.api.Step
|
||||
import eu.llembas.android.api.Tail
|
||||
import eu.llembas.android.assist.AssistController
|
||||
import eu.llembas.android.assist.AssistTurn
|
||||
import eu.llembas.android.assist.LockedStart
|
||||
import eu.llembas.android.assist.Opening
|
||||
import eu.llembas.android.assist.Recorder
|
||||
import eu.llembas.android.assist.SheetStop
|
||||
import eu.llembas.android.assist.isStopPhrase
|
||||
import eu.llembas.android.assist.lockedStart
|
||||
import eu.llembas.android.assist.settle
|
||||
import eu.llembas.android.assist.usePhoneRecognizer
|
||||
import eu.llembas.android.auth.Prefs
|
||||
@@ -70,6 +73,25 @@ class AssistTest {
|
||||
assertEquals(null, AssistController.assistantModelFor("quick", null, emptyList()))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun overTheLockScreenAWayInThatMeansToSpeakStaysAndListens() {
|
||||
// The wake word with the screen off: nobody is there to unlock. It listens; sending waits.
|
||||
assertEquals(LockedStart.Listen, lockedStart(locked = true, Opening.Listen, question = false, micAllowed = true))
|
||||
// A question handed over (heard by the assistant's own sheet, or typed there) is held, not dropped.
|
||||
assertEquals(LockedStart.Hold, lockedStart(locked = true, Opening.Sheet, question = true, micAllowed = true))
|
||||
assertEquals(LockedStart.Hold, lockedStart(locked = true, Opening.Listen, question = true, micAllowed = false))
|
||||
// Anything else over the lock screen asks to unlock first, as before: the plain sheet,
|
||||
// the last chat (which is the account's), and the microphone's permission prompt.
|
||||
assertEquals(LockedStart.Unlock, lockedStart(locked = true, Opening.Sheet, question = false, micAllowed = true))
|
||||
assertEquals(LockedStart.Unlock, lockedStart(locked = true, Opening.Continue, question = false, micAllowed = true))
|
||||
assertEquals(LockedStart.Unlock, lockedStart(locked = true, Opening.Listen, question = false, micAllowed = false))
|
||||
// Unlocked, the way in decides alone.
|
||||
for (opening in Opening.entries) {
|
||||
assertEquals(LockedStart.Go, lockedStart(locked = false, opening, question = false, micAllowed = true))
|
||||
assertEquals(LockedStart.Go, lockedStart(locked = false, opening, question = true, micAllowed = false))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aVoiceReadsOnlyTheWords() {
|
||||
val steps = listOf(
|
||||
|
||||
@@ -335,6 +335,13 @@ class ScreenShots {
|
||||
shoot("20-assistant-answered", content = over(Fakes.assistAnswered, false))
|
||||
shoot("21-assistant-writing", content = over(Fakes.assistWriting, false))
|
||||
shoot("22-assistant-locked", content = over(Fakes.assistOpened, true))
|
||||
// Over the lock screen after the wake word: listening, then the question waiting for the
|
||||
// unlock; and a conversation that was up when the phone locked is not shown.
|
||||
shoot("22-assistant-locked-listening", content = over(Fakes.assistListening, true))
|
||||
val waiting = Fakes.assistOpened.copy(waiting = "How far is it to the next town?")
|
||||
shoot("22-assistant-locked-waiting", content = over(waiting, true))
|
||||
shoot("22-assistant-locked-waiting", Phone.Small, fontScale = 1.5f, content = over(waiting, true))
|
||||
shoot("22-assistant-locked-answered", content = over(Fakes.assistAnswered, true))
|
||||
shoot("23-assistant-offline", Phone.Small, content = over(Fakes.assistOffline, false))
|
||||
shoot("24-assistant-conversation", content = over(Fakes.assistConversation, false))
|
||||
shoot("24-assistant-conversation", Phone.Small, fontScale = 1.5f, content = over(Fakes.assistConversation, false))
|
||||
|
||||
Reference in new issue
Block a user