Wake word, from the review: a heard word always shows, holds end, stop and retry
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
1. Heard, but not the assistant and not on screen: Android blocks the activity start silently and runCatching called it a success, so nothing opened and nothing was posted. The opening is decided from what Android allows (wakeOpening: session, activity while an activity of the app is started, else a notification); "Heard you. Tap to ask." goes on a channel of its own (high importance, fixed words, times out after a minute) and the sheet cancels it. Settings says that only the digital assistant app opens by voice over other apps, with a row to that system setting. 2. The hold after the word is apart from the sheets' count and ends on a process scope in a finally; a starting service clears it. 3. A tap on the state in Settings retries now (WakeStatus.retryNow -> WakeListener.retryNow) and restarts the back-off; thirty seconds of samples taken in also resets the count of failures. 4. State writes carry the instance's token (WakeStatus.begin): an older instance's last "off" no longer overwrites a newer one. Engine.create is synchronized and writes the keywords to a file of its own. 5. numTrailingBlanks = 1 means more than one blank frame after the phrase (about 80 ms): the comment is corrected, and Settings and the test row say to pause after the phrase. 6. Stop no longer calls stopService or stopSelf() under a possible pending foreground start: the setting goes off and the loop ends the service with stopSelf(lastStartId); a start that arrives after the loop ended begins it again. 7. The "tap to listen again" notification is cancelled when the service starts. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
24 files changed
+615
-104
No files matched your search
@@ -20,6 +20,16 @@ is in alpha and releases come off `main`.
|
||||
uncompressed as well.
|
||||
- **The wake word's notification told the default phrase, not yours**, each time the app was
|
||||
opened. It is now written from one place, from what the wake word is really doing.
|
||||
- **Hearing the word when LLeMbas is not the phone's assistant and not on screen did nothing at
|
||||
all**: Android blocks an activity started from the background without saying so, and the app
|
||||
took the silence for success. It now posts *Heard you. Tap to ask.* on a channel of its own that
|
||||
comes up over what is on screen, and Settings › Wake word says plainly that only the phone's
|
||||
digital assistant app can open by voice over other apps, with a row that opens that setting.
|
||||
- The wake word could stay "paused while the assistant is open" for good if its service ended in
|
||||
the three seconds after the word. The hold now ends by itself, whatever happens to the service.
|
||||
- Turning the wake word off and on again quickly could leave "not listening" showing over a wake
|
||||
word that listened, or close the app (the service was stopped under a start still on its way).
|
||||
Stop is now the setting going off, and the service ends itself.
|
||||
- A change of phrase could release the engine while the old listening loop was still using it.
|
||||
The old loop is now stopped and waited for first.
|
||||
- A microphone that failed to start, or stopped giving sound, was not noticed (and one kind of
|
||||
@@ -76,6 +86,10 @@ is in alpha and releases come off `main`.
|
||||
switched off), or not working and why (its model could not be unpacked, the engine did not
|
||||
start, the microphone did not start) -- with the technical reason under it in Settings. A
|
||||
failure is tried again by itself, after 2 s, 5 s, 15 s, a minute, then every five minutes.
|
||||
- A tap on a failure in Settings tries again at once; trouble after half a minute of listening
|
||||
well starts the waits over instead of counting on from old failures. Say the phrase and then
|
||||
leave a short pause: the engine takes it as heard once something else follows (Settings and the
|
||||
test row say so).
|
||||
- A microphone permission given or taken in the system's settings is noticed when the app comes
|
||||
back to the screen.
|
||||
|
||||
|
||||
@@ -27,7 +27,12 @@ object WakeEngine {
|
||||
/**
|
||||
* The engine for [keywords] (the keywords file's text). Throws a [WakeError] that says which
|
||||
* half failed -- the model's files or the engine -- and never returns nothing.
|
||||
*
|
||||
* One at a time: two service instances may overlap for a moment (the wake word turned off and
|
||||
* on again), and the unpacking and the keywords file are shared. The keywords go into a file
|
||||
* of this call's own, which the engine reads as it is made and which is gone afterwards.
|
||||
*/
|
||||
@Synchronized
|
||||
fun create(context: Context, keywords: String): WakeDetector {
|
||||
val dir = File(context.noBackupFilesDir, "wakeword")
|
||||
try {
|
||||
@@ -36,8 +41,11 @@ object WakeEngine {
|
||||
throw WakeError(WakeFailure.Model, e)
|
||||
}
|
||||
checkKeywords(keywords, File(dir, "tokens.txt").readText())
|
||||
var file: File? = null
|
||||
try {
|
||||
val file = File(dir, "keywords.txt").apply { writeText(keywords) }
|
||||
val written = File.createTempFile("keywords", ".txt", dir)
|
||||
file = written
|
||||
written.writeText(keywords)
|
||||
val config = KeywordSpotterConfig(
|
||||
featConfig = FeatureConfig(sampleRate = RATE, featureDim = 80),
|
||||
modelConfig = OnlineModelConfig(
|
||||
@@ -50,15 +58,19 @@ object WakeEngine {
|
||||
modelType = "zipformer2",
|
||||
numThreads = 1,
|
||||
),
|
||||
keywordsFile = file.path,
|
||||
// The word counts once one frame of something else follows it (the engine's own
|
||||
// default; the Kotlin wrapper's is two), so a question may follow straight on.
|
||||
keywordsFile = written.path,
|
||||
// The engine's own default (the Kotlin wrapper's is 2). The phrase counts once
|
||||
// MORE than this many blank frames follow it -- two frames, about 80 ms of
|
||||
// anything that is not the phrase going on. So: say it, then a short pause; a
|
||||
// question run straight into the name can be missed.
|
||||
numTrailingBlanks = 1,
|
||||
)
|
||||
return SherpaDetector(KeywordSpotter(null, config))
|
||||
} catch (e: Throwable) {
|
||||
// UnsatisfiedLinkError included: a phone whose processor the library was not built for.
|
||||
throw WakeError(WakeFailure.Engine, e)
|
||||
} finally {
|
||||
file?.delete()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package eu.llembas.android
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Application
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.os.Bundle
|
||||
import eu.llembas.android.auth.InstanceStore
|
||||
import eu.llembas.android.wake.AppVisibility
|
||||
|
||||
/** The process: one store of instances, and the notification channels, made once. */
|
||||
class LembasApp : Application() {
|
||||
@@ -13,6 +16,25 @@ class LembasApp : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
instances = InstanceStore(this)
|
||||
// Whether the app is on screen: the wake word may open the assistant's sheet as an
|
||||
// activity only then (Android blocks one started from the background, silently).
|
||||
registerActivityLifecycleCallbacks(
|
||||
object : ActivityLifecycleCallbacks {
|
||||
override fun onActivityStarted(activity: Activity) = AppVisibility.activityStarted()
|
||||
|
||||
override fun onActivityStopped(activity: Activity) = AppVisibility.activityStopped()
|
||||
|
||||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) = Unit
|
||||
|
||||
override fun onActivityResumed(activity: Activity) = Unit
|
||||
|
||||
override fun onActivityPaused(activity: Activity) = Unit
|
||||
|
||||
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) = Unit
|
||||
|
||||
override fun onActivityDestroyed(activity: Activity) = Unit
|
||||
},
|
||||
)
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
manager.createNotificationChannels(
|
||||
listOf(
|
||||
|
||||
@@ -2,6 +2,7 @@ package eu.llembas.android.assist
|
||||
|
||||
import android.Manifest
|
||||
import android.app.KeyguardManager
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
@@ -18,6 +19,7 @@ import eu.llembas.android.auth.Prefs
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.theme.LembasTheme
|
||||
import eu.llembas.android.wake.AssistPresence
|
||||
import eu.llembas.android.wake.WakeWordService
|
||||
|
||||
/** What a way into the sheet asks for. */
|
||||
enum class Opening {
|
||||
@@ -74,6 +76,8 @@ class AssistActivity : ComponentActivity() {
|
||||
keyguard = getSystemService(KeyguardManager::class.java)
|
||||
locked.value = keyguard.isKeyguardLocked
|
||||
AssistPresence.shown()
|
||||
// The sheet is up: "Heard you. Tap to ask." has been answered, however it was opened.
|
||||
getSystemService(NotificationManager::class.java).cancel(WakeWordService.HEARD_ID)
|
||||
take(intent)
|
||||
setContent {
|
||||
val prefs by lembas.instances.prefs.collectAsState(initial = Prefs())
|
||||
|
||||
@@ -4,6 +4,7 @@ package eu.llembas.android.ui.settings
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.app.role.RoleManager
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.SystemClock
|
||||
@@ -138,6 +139,7 @@ interface SettingsActions {
|
||||
fun wakePhrase(id: String) {}
|
||||
fun wakeSensitivity(id: String) {}
|
||||
fun wakeTest() {}
|
||||
fun wakeRetry() {}
|
||||
fun wakeScreenOnly(on: Boolean) {}
|
||||
fun batterySettings() {}
|
||||
fun notificationSummaries(on: Boolean) {}
|
||||
@@ -177,6 +179,8 @@ data class SettingsState(
|
||||
val wakeState: WakeState = WakeState.Off,
|
||||
/** "Test the wake word": whether its ten seconds are running, and how often the phrase landed. */
|
||||
val wakeTest: WakeTestShown = WakeTestShown(),
|
||||
/** Whether LLeMbas is the phone's digital assistant app: only then can the wake word open it over other apps. */
|
||||
val isAssistant: Boolean = true,
|
||||
/** Whether Android's notification access is given to LLeMbas. */
|
||||
val notificationAccess: Boolean = false,
|
||||
/** Whether this build can read notifications at all (only the `notifications` build declares the listener). */
|
||||
@@ -290,7 +294,7 @@ fun SettingsScreen(onBack: () -> Unit, onAddInstance: () -> Unit) {
|
||||
|
||||
else -> scope.launch {
|
||||
store.savePrefs { it.copy(wakeWord = false) }
|
||||
WakeWordService.stop(context)
|
||||
WakeWordService.stop()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,6 +307,13 @@ fun SettingsScreen(onBack: () -> Unit, onAddInstance: () -> Unit) {
|
||||
scope.launch { store.savePrefs { it.copy(wakeSensitivity = id) } }
|
||||
}
|
||||
|
||||
// A tap on the wake word's state: start it if the phone stopped it (asking for the
|
||||
// microphone where that is missing), and if it is waiting to try again, try now.
|
||||
override fun wakeRetry() {
|
||||
WakeStatus.retryNow()
|
||||
wakeWord(true)
|
||||
}
|
||||
|
||||
override fun wakeTest() {
|
||||
tested = true
|
||||
WakeStatus.startTrial(SystemClock.elapsedRealtime())
|
||||
@@ -391,6 +402,8 @@ fun SettingsScreen(onBack: () -> Unit, onAddInstance: () -> Unit) {
|
||||
phoneRecognizer = remember { PhoneRecognizer.available(context) },
|
||||
wakeAvailable = WakeEngine.AVAILABLE,
|
||||
wakeState = wakeState,
|
||||
// Read again each time Settings is composed: the person comes back from the system's page.
|
||||
isAssistant = context.getSystemService(RoleManager::class.java)?.isRoleHeld(RoleManager.ROLE_ASSISTANT) ?: false,
|
||||
wakeTest = WakeTestShown(running = clock < trial.until, done = tested && clock >= trial.until, heard = if (tested) trial.heard else 0),
|
||||
// Read again each time Settings is composed: the person comes back from the system's page.
|
||||
notificationAccess = NotificationAccess.granted(context),
|
||||
@@ -709,8 +722,18 @@ internal fun WakeWordGroup(state: SettingsState, actions: SettingsActions, onCho
|
||||
else -> null
|
||||
},
|
||||
tint = if (trouble) palette.warning else null,
|
||||
onClick = { actions.wakeWord(true) },
|
||||
onClick = actions::wakeRetry,
|
||||
)
|
||||
if (!state.isAssistant) {
|
||||
// Said plainly: Android lets only the phone's assistant open over other apps.
|
||||
Rule()
|
||||
SettingRow(
|
||||
Icons.Filled.Assistant,
|
||||
stringResource(R.string.wake_not_assistant),
|
||||
subtitle = stringResource(R.string.wake_not_assistant_line),
|
||||
onClick = actions::assistantSettings,
|
||||
)
|
||||
}
|
||||
}
|
||||
if (state.wakeAvailable) {
|
||||
val phrase = WakePhrases.byId(state.prefs.wakePhrase)
|
||||
|
||||
@@ -2,14 +2,21 @@ package eu.llembas.android.wake
|
||||
|
||||
import android.content.Context
|
||||
import eu.llembas.android.R
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
/** One word of a wake phrase: its [id], how it is written for the person, and its spelling in the model's [pieces]. */
|
||||
data class WakeWord(val id: String, val words: String, val pieces: String)
|
||||
@@ -88,14 +95,91 @@ interface WakeMicrophone {
|
||||
* Whether the assistant's sheet is up -- the wake-word service lets go of the microphone while
|
||||
* it is, and takes it back once the sheet is gone. Counted, since the session and the activity
|
||||
* can overlap for a moment when one hands over to the other.
|
||||
*
|
||||
* The wake word's own hold is apart from the count: when the word is heard the microphone is
|
||||
* the sheet's for a few seconds ([holdFor]), whether or not a sheet then says it is up. It ends
|
||||
* by itself on a scope that outlives the service, so a service that is destroyed in those
|
||||
* seconds cannot leave the wake word "paused while the assistant is open" for good.
|
||||
*/
|
||||
object AssistPresence {
|
||||
private val sheets = MutableStateFlow(0)
|
||||
private val held = MutableStateFlow(0L)
|
||||
private val holds = AtomicLong(0)
|
||||
private val _open = MutableStateFlow(0)
|
||||
val open: StateFlow<Int> = _open.asStateFlow()
|
||||
|
||||
fun shown() = _open.update { it + 1 }
|
||||
private val process = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||
|
||||
fun hidden() = _open.update { (it - 1).coerceAtLeast(0) }
|
||||
private fun count() {
|
||||
_open.value = sheets.value + if (held.value != 0L) 1 else 0
|
||||
}
|
||||
|
||||
fun shown() {
|
||||
sheets.update { it + 1 }
|
||||
count()
|
||||
}
|
||||
|
||||
fun hidden() {
|
||||
sheets.update { (it - 1).coerceAtLeast(0) }
|
||||
count()
|
||||
}
|
||||
|
||||
/** The word was heard: the microphone is the sheet's for [millis], then the hold lets go by itself. */
|
||||
fun holdFor(millis: Long, scope: CoroutineScope = process) {
|
||||
// Each hold has a number of its own, never used twice, so an old one cannot end a newer one.
|
||||
val mine = holds.incrementAndGet()
|
||||
held.value = mine
|
||||
count()
|
||||
scope.launch {
|
||||
try {
|
||||
delay(millis)
|
||||
} finally {
|
||||
// Only the newest hold lets go; an older one that ends later changes nothing.
|
||||
if (held.compareAndSet(mine, 0L)) count()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** No hold is left standing: the wake-word service starts from what the sheets say alone. */
|
||||
fun release() {
|
||||
held.value = 0L
|
||||
count()
|
||||
}
|
||||
}
|
||||
|
||||
/** How the assistant is opened when the word was heard, from what Android will allow. */
|
||||
enum class WakeOpening {
|
||||
/** LLeMbas is the phone's assistant: its voice-interaction service shows the sheet, from anywhere. */
|
||||
Session,
|
||||
|
||||
/** The app is on screen: the sheet's activity may start. */
|
||||
Activity,
|
||||
|
||||
/**
|
||||
* Neither: Android blocks an activity started from the background, and says nothing when it
|
||||
* does -- so it is not relied on, and a notification to tap is posted.
|
||||
*/
|
||||
Notification,
|
||||
}
|
||||
|
||||
fun wakeOpening(isAssistant: Boolean, appVisible: Boolean): WakeOpening = when {
|
||||
isAssistant -> WakeOpening.Session
|
||||
appVisible -> WakeOpening.Activity
|
||||
else -> WakeOpening.Notification
|
||||
}
|
||||
|
||||
/** Whether the app has an activity on screen: counted from every activity's start and stop (LembasApp). */
|
||||
object AppVisibility {
|
||||
private val started = AtomicInteger(0)
|
||||
val visible: Boolean get() = started.get() > 0
|
||||
|
||||
fun activityStarted() {
|
||||
started.incrementAndGet()
|
||||
}
|
||||
|
||||
fun activityStopped() {
|
||||
started.updateAndGet { (it - 1).coerceAtLeast(0) }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,7 +244,13 @@ sealed interface WakeState {
|
||||
*/
|
||||
data class WakeTrial(val until: Long = 0, val heard: Int = 0)
|
||||
|
||||
/** The wake word's state for the whole process: written by the service, read by everything else. */
|
||||
/**
|
||||
* The wake word's state for the whole process: written by the service, read by everything else.
|
||||
*
|
||||
* A service instance writes with the token [begin] gave it, and only the newest token's writes
|
||||
* count: an old instance on its way out (its loop ending after Settings turned the wake word off
|
||||
* and on again) cannot write its "off" over the new one's state.
|
||||
*/
|
||||
object WakeStatus {
|
||||
private val _state = MutableStateFlow<WakeState>(WakeState.Off)
|
||||
val state: StateFlow<WakeState> = _state.asStateFlow()
|
||||
@@ -168,10 +258,31 @@ object WakeStatus {
|
||||
private val _trial = MutableStateFlow(WakeTrial())
|
||||
val trial: StateFlow<WakeTrial> = _trial.asStateFlow()
|
||||
|
||||
fun set(now: WakeState) {
|
||||
_state.value = now
|
||||
private val _retries = MutableStateFlow(0)
|
||||
|
||||
/** Counts up each time somebody asks for a retry now ([retryNow]). */
|
||||
val retries: StateFlow<Int> = _retries.asStateFlow()
|
||||
|
||||
private val generation = AtomicInteger(0)
|
||||
|
||||
/** A new writer takes over: its token, which makes every older one's writes count for nothing. */
|
||||
fun begin(): Int = generation.incrementAndGet()
|
||||
|
||||
/** [now], if [token] is still the newest writer's. */
|
||||
fun set(token: Int, now: WakeState) {
|
||||
synchronized(generation) {
|
||||
if (token == generation.get()) _state.value = now
|
||||
}
|
||||
}
|
||||
|
||||
/** [now], said by the app itself, outside any service instance: not started and why, turned off. */
|
||||
fun set(now: WakeState) {
|
||||
synchronized(generation) { _state.value = now }
|
||||
}
|
||||
|
||||
/** Try again now, instead of when the back-off says: the person tapped the failure. */
|
||||
fun retryNow() = _retries.update { it + 1 }
|
||||
|
||||
/** Start a test at [now]: the next [TRIAL_MS] of heard phrases are counted, not acted on. */
|
||||
fun startTrial(now: Long) {
|
||||
_trial.value = WakeTrial(until = now + TRIAL_MS)
|
||||
@@ -190,6 +301,13 @@ object WakeStatus {
|
||||
const val TRIAL_MS = 10_000L
|
||||
}
|
||||
|
||||
/**
|
||||
* What the service's notification says the moment Android starts it (again): what is true --
|
||||
* [current], while its loop is [running]; "starting" for a service that has only just begun.
|
||||
* Never a phrase by default.
|
||||
*/
|
||||
fun wakeStateAtStart(running: Boolean, current: WakeState): WakeState = if (running && current != WakeState.Off) current else WakeState.Starting
|
||||
|
||||
/**
|
||||
* [state] in plain words: the notification's title and Settings' line. A failure names what
|
||||
* failed and that it is tried again; it never claims to listen while it does not.
|
||||
|
||||
@@ -10,9 +10,13 @@ import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.ensureActive
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.update
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
|
||||
/** What the service wants right now: this phrase, spelled for the engine as [keywords], unless [pause]d. */
|
||||
data class WakePlan(val phrase: WakePhrase, val keywords: String, val pause: WakePause)
|
||||
@@ -67,11 +71,20 @@ class WakeListener(
|
||||
detectorFor = null
|
||||
}
|
||||
|
||||
private val nudges = MutableStateFlow(0)
|
||||
|
||||
/** How many samples the last stretch of listening heard before it ended. */
|
||||
@Volatile private var listened = 0L
|
||||
|
||||
/** Try again now rather than when the back-off says: somebody asked. The count of failures starts over. */
|
||||
fun retryNow() = nudges.update { it + 1 }
|
||||
|
||||
/** Listen for [plan]'s phrase until cancelled: after the word, again; after a failure, again later. */
|
||||
private suspend fun hear(plan: WakePlan) {
|
||||
var failures = 0
|
||||
while (true) {
|
||||
try {
|
||||
listened = 0
|
||||
listen(plan)
|
||||
failures = 0
|
||||
heard(plan.phrase)
|
||||
@@ -84,7 +97,11 @@ class WakeListener(
|
||||
say(WakeState.Failed(e.why, e.detail))
|
||||
// A build without an engine does not grow one: nothing to try again.
|
||||
if (e.why == WakeFailure.NoEngine) return
|
||||
delay(backoff(failures++))
|
||||
// It had been listening well for a while: this is a new trouble, not the old one again.
|
||||
if (listened >= STEADY_SAMPLES) failures = 0
|
||||
val seen = nudges.value
|
||||
val asked = withTimeoutOrNull(backoff(failures++)) { nudges.first { it != seen } } != null
|
||||
if (asked) failures = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -114,6 +131,7 @@ class WakeListener(
|
||||
continue
|
||||
}
|
||||
empty = 0
|
||||
listened += read
|
||||
val samples = FloatArray(read)
|
||||
var sound = false
|
||||
for (i in 0 until read) {
|
||||
@@ -177,5 +195,8 @@ class WakeListener(
|
||||
private const val EMPTY_READS = 50
|
||||
private const val SILENT_SAMPLES = RATE * 5
|
||||
private const val HEARD_REST_MS = 1_500L
|
||||
|
||||
/** Half a minute of sound taken in: the microphone and the engine work. */
|
||||
private const val STEADY_SAMPLES = RATE * 30L
|
||||
}
|
||||
}
|
||||
@@ -31,9 +31,9 @@ import eu.llembas.android.lembas
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.drop
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.takeWhile
|
||||
@@ -58,6 +58,13 @@ class WakeWordService : LifecycleService() {
|
||||
private val batterySaver = MutableStateFlow(false)
|
||||
private val mayRecord = MutableStateFlow(true)
|
||||
private var following: Job? = null
|
||||
private var watching: Job? = null
|
||||
|
||||
/** This instance's right to write the state (WakeStatus.begin). */
|
||||
private var token = 0
|
||||
|
||||
/** The newest start Android has delivered: what the service stops itself by, so a start still on its way is not stopped. */
|
||||
private var lastStart = 0
|
||||
|
||||
/** Set when the service could not even start: the state then says why, and is not wiped on the way out. */
|
||||
private var keepState = false
|
||||
@@ -97,17 +104,23 @@ class WakeWordService : LifecycleService() {
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
super.onStartCommand(intent, flags, startId)
|
||||
if (intent?.action == ACTION_STOP) {
|
||||
// Stop is the setting going off; the loop sees it and ends the service on the path
|
||||
// that has shown its notification first (follow). The service is stopped from here
|
||||
// only when nothing is running in it, and only if no newer start is on its way
|
||||
// (stopSelf(startId)): stopping under a pending foreground start closes the app.
|
||||
lifecycleScope.launch {
|
||||
lembas.instances.savePrefs { it.copy(wakeWord = false) }
|
||||
stopSelf()
|
||||
if (following?.isActive != true) stopSelf(startId)
|
||||
}
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
lastStart = startId
|
||||
mayRecord.value = micAllowed(this)
|
||||
val running = following?.isActive == true
|
||||
// The notification first: Android stops a foreground service that is slow to show one.
|
||||
// It says what is true now -- "starting" for a service that just began, and on every
|
||||
// later start (the app opens) whatever the state already is; never a phrase by default.
|
||||
val now = WakeStatus.state.value.takeUnless { following == null || it == WakeState.Off } ?: WakeState.Starting
|
||||
val now = wakeStateAtStart(running, WakeStatus.state.value)
|
||||
try {
|
||||
ServiceCompat.startForeground(this, NOTIFICATION_ID, wakeNotification(this, now), ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE)
|
||||
} catch (e: Exception) {
|
||||
@@ -124,23 +137,45 @@ class WakeWordService : LifecycleService() {
|
||||
stopSelf()
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
if (following == null) {
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
// It is listening again: "tap to listen again" (after a restart) has nothing left to say.
|
||||
manager.cancel(WakeBootReceiver.RESUME_ID)
|
||||
if (!running) {
|
||||
keepState = false
|
||||
WakeStatus.set(now)
|
||||
// This instance writes the state from here; an older one's last words count for nothing.
|
||||
token = WakeStatus.begin()
|
||||
// And it starts from what the sheets say: no hold of an earlier instance is left standing.
|
||||
AssistPresence.release()
|
||||
WakeStatus.set(token, now)
|
||||
following = lifecycleScope.launch { follow() }
|
||||
}
|
||||
if (watching == null) {
|
||||
// The one place the notification is written: from the state, whenever it changes.
|
||||
val manager = getSystemService(NotificationManager::class.java)
|
||||
lifecycleScope.launch {
|
||||
watching = lifecycleScope.launch {
|
||||
WakeStatus.state.collect { state ->
|
||||
if (state != WakeState.Off) manager.notify(NOTIFICATION_ID, wakeNotification(this@WakeWordService, state))
|
||||
}
|
||||
}
|
||||
// A tap on the failure in Settings: try now, not when the back-off says.
|
||||
lifecycleScope.launch { WakeStatus.retries.drop(1).collect { listener.retryNow() } }
|
||||
}
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
private val listener by lazy {
|
||||
WakeListener(
|
||||
say = { WakeStatus.set(token, it) },
|
||||
engine = { keywords -> WakeEngine.create(this, keywords) },
|
||||
microphone = { PhoneMicrophone() },
|
||||
// A test in Settings takes the word; otherwise the assistant opens.
|
||||
heard = { if (!WakeStatus.heardInTrial(SystemClock.elapsedRealtime())) wake() },
|
||||
log = { message, cause -> Log.w(TAG, message, cause) },
|
||||
)
|
||||
}
|
||||
|
||||
/** Listen, or pause, as the phone and Settings change; stop when Settings turns it off. */
|
||||
private suspend fun follow() {
|
||||
val mine = token
|
||||
val plans = combine(lembas.instances.prefs, screenOn, batterySaver, AssistPresence.open, mayRecord) { prefs, on, saver, open, mic ->
|
||||
if (!prefs.wakeWord) {
|
||||
null
|
||||
@@ -149,50 +184,36 @@ class WakeWordService : LifecycleService() {
|
||||
WakePlan(phrase, wakeKeywords(phrase, WakeSensitivity.byId(prefs.wakeSensitivity)), wakePause(on, prefs.wakeScreenOnly, saver, open > 0, mic))
|
||||
}
|
||||
}
|
||||
val listener = WakeListener(
|
||||
say = WakeStatus::set,
|
||||
engine = { keywords -> WakeEngine.create(this, keywords) },
|
||||
microphone = { PhoneMicrophone() },
|
||||
// A test in Settings takes the word; otherwise the assistant opens.
|
||||
heard = { if (!WakeStatus.heardInTrial(SystemClock.elapsedRealtime())) wake() },
|
||||
log = { message, cause -> Log.w(TAG, message, cause) },
|
||||
)
|
||||
try {
|
||||
listener.follow(plans.takeWhile { it != null }.filterNotNull())
|
||||
} finally {
|
||||
// After the loop has ended, so nothing it said on its way out is left standing.
|
||||
if (!keepState) WakeStatus.set(WakeState.Off)
|
||||
// After the loop has ended, so nothing it said on its way out is left standing --
|
||||
// and only if no newer writer has taken over meanwhile.
|
||||
if (!keepState) WakeStatus.set(mine, WakeState.Off)
|
||||
}
|
||||
stopSelf()
|
||||
// Not if a newer start is already on its way: that one finds the loop ended and begins it again.
|
||||
stopSelf(lastStart)
|
||||
}
|
||||
|
||||
/**
|
||||
* The word was heard: the assistant opens listening. Through the voice-interaction service
|
||||
* when LLeMbas is the phone's assistant (Android lets it open the sheet from the background),
|
||||
* else as an activity; and if Android refuses that too, a notification to tap.
|
||||
* when LLeMbas is the phone's assistant (Android lets it open the sheet from the background);
|
||||
* as an activity while the app is on screen; and otherwise with a notification to tap,
|
||||
* because Android blocks an activity started from the background and says nothing when it
|
||||
* does ([wakeOpening]). The activity is still tried then -- where a phone allows it, it
|
||||
* opens and takes the notification away.
|
||||
*/
|
||||
private fun wake() {
|
||||
AssistPresence.shown() // the microphone is the sheet's from here, until it says it is gone
|
||||
val shownBySystem = LembasAssistService.current?.let { service ->
|
||||
runCatching { service.showSession(Bundle().apply { putBoolean(AssistActivity.EXTRA_LISTEN, true) }, 0) }.isSuccess
|
||||
} ?: false
|
||||
val opened = shownBySystem || runCatching { startActivity(AssistActivity.listening(this).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) }.isSuccess
|
||||
if (!opened) {
|
||||
getSystemService(NotificationManager::class.java).notify(
|
||||
HEARD_ID,
|
||||
NotificationCompat.Builder(this, CHANNEL)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentTitle(getString(R.string.wake_heard))
|
||||
.setContentIntent(PendingIntent.getActivity(this, 1, AssistActivity.listening(this), PendingIntent.FLAG_IMMUTABLE))
|
||||
.setAutoCancel(true)
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.build(),
|
||||
)
|
||||
}
|
||||
// Released by the sheet as it shows and hides; if nothing opened, at once.
|
||||
lifecycleScope.launch {
|
||||
delay(SHEET_GRACE_MS)
|
||||
AssistPresence.hidden()
|
||||
// The microphone is the sheet's from here: for a moment by this hold, then for as long as a sheet says it is up.
|
||||
AssistPresence.holdFor(SHEET_GRACE_MS)
|
||||
val session = LembasAssistService.current
|
||||
val shownBySystem = session != null &&
|
||||
runCatching { session.showSession(Bundle().apply { putBoolean(AssistActivity.EXTRA_LISTEN, true) }, 0) }.isSuccess
|
||||
val opening = wakeOpening(shownBySystem, AppVisibility.visible)
|
||||
if (opening == WakeOpening.Session) return
|
||||
val started = runCatching { startActivity(AssistActivity.listening(this).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)) }.isSuccess
|
||||
if (opening == WakeOpening.Notification || !started) {
|
||||
getSystemService(NotificationManager::class.java).notify(HEARD_ID, wakeHeardNotification(this))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,14 +223,15 @@ class WakeWordService : LifecycleService() {
|
||||
runCatching { unregisterReceiver(receiver) }
|
||||
// The scope ends with the service: the listener's loop is joined and its engine released
|
||||
// on the way out (WakeListener.follow), not here under a loop that may still run.
|
||||
if (!keepState) WakeStatus.set(WakeState.Off)
|
||||
if (!keepState) WakeStatus.set(token, WakeState.Off)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val CHANNEL = "wake_word"
|
||||
const val CHANNEL_HEARD = "wake_heard"
|
||||
private const val NOTIFICATION_ID = 7001
|
||||
private const val HEARD_ID = 7002
|
||||
const val HEARD_ID = 7002
|
||||
private const val SHEET_GRACE_MS = 3_000L
|
||||
private const val TAG = "LLeMbasWake"
|
||||
const val ACTION_STOP = "eu.llembas.android.action.WAKE_STOP"
|
||||
@@ -230,21 +252,51 @@ class WakeWordService : LifecycleService() {
|
||||
}
|
||||
}
|
||||
|
||||
fun stop(context: Context) {
|
||||
context.stopService(Intent(context, WakeWordService::class.java))
|
||||
/**
|
||||
* The wake word was turned off. The service is not stopped from outside: it ends itself
|
||||
* when it sees the setting, after it has shown its notification -- stopping it under a
|
||||
* foreground start that is still on its way closes the app. The state is "off" at once.
|
||||
*/
|
||||
fun stop() {
|
||||
WakeStatus.set(WakeState.Off)
|
||||
}
|
||||
|
||||
fun micAllowed(context: Context) = ContextCompat.checkSelfPermission(context, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED
|
||||
|
||||
fun channel(context: Context) {
|
||||
context.getSystemService(NotificationManager::class.java).createNotificationChannel(
|
||||
NotificationChannel(CHANNEL, context.getString(R.string.channel_wake), NotificationManager.IMPORTANCE_LOW),
|
||||
context.getSystemService(NotificationManager::class.java).createNotificationChannels(
|
||||
listOf(
|
||||
NotificationChannel(CHANNEL, context.getString(R.string.channel_wake), NotificationManager.IMPORTANCE_LOW),
|
||||
// "Heard you. Tap to ask.": it must come up over what is on screen, or the word was for nothing.
|
||||
NotificationChannel(CHANNEL_HEARD, context.getString(R.string.channel_wake_heard), NotificationManager.IMPORTANCE_HIGH),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* "Heard you. Tap to ask.": what the wake word posts when it cannot open the assistant itself.
|
||||
* A fixed sentence, nothing from the account; the tap opens the assistant listening.
|
||||
*/
|
||||
fun wakeHeardNotification(context: Context): Notification {
|
||||
val ask = PendingIntent.getActivity(context, 1, AssistActivity.listening(context), PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
return NotificationCompat.Builder(context, WakeWordService.CHANNEL_HEARD)
|
||||
.setSmallIcon(R.drawable.ic_notification)
|
||||
.setContentTitle(context.getString(R.string.wake_heard))
|
||||
.setContentText(context.getString(R.string.wake_heard_line))
|
||||
.setContentIntent(ask)
|
||||
.setAutoCancel(true)
|
||||
.setCategory(NotificationCompat.CATEGORY_RECOMMENDATION)
|
||||
.setPriority(NotificationCompat.PRIORITY_HIGH)
|
||||
.setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
|
||||
.setTimeoutAfter(HEARD_TIMEOUT_MS)
|
||||
.build()
|
||||
}
|
||||
|
||||
/** A minute: a "tap to ask" nobody tapped is no longer an answer to anything. */
|
||||
private const val HEARD_TIMEOUT_MS = 60_000L
|
||||
|
||||
/**
|
||||
* The persistent notification, from [state] alone: what the wake word is doing in plain words
|
||||
* (the phrase it listens for, why it is paused, what failed). Nothing from the account.
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Naslouchat budicímu slovu</string>
|
||||
<string name="wake_word_line">Ve výchozím stavu vypnuto. Řekněte frázi a asistent se otevře a poslouchá, nad jakoukoli aplikací na obrazovce.</string>
|
||||
<string name="wake_word_unavailable">V tomto sestavení není. Sestavení pro F-Droid nemá modul pro budicí slovo, protože F-Droid sestavuje každou knihovnu ze zdrojů; sestavení z llembas.eu ho má.</string>
|
||||
<string name="wake_phrase_line">Tohle říkáte. Anglicky, ať je aplikace v jakémkoli jazyce: modul zná jen anglickou řeč.</string>
|
||||
<string name="wake_phrase_line">Tohle říkáte, potom krátká pauza: platí, až když zmlknete. Anglicky, ať je aplikace v jakémkoli jazyce: modul zná jen anglickou řeč.</string>
|
||||
<string name="wake_greeting">Oslovení</string>
|
||||
<string name="wake_name">Jméno</string>
|
||||
<string name="wake_name_google_line">Ozve se i telefon nebo reproduktor Google poblíž.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">Slyší vás nejsnáze, i z větší dálky. Omylem se spustí častěji.</string>
|
||||
<string name="wake_test">Vyzkoušet budicí slovo</string>
|
||||
<string name="wake_test_line">Deset sekund ukazuje, zda je vaši frázi slyšet, bez otevření asistenta.</string>
|
||||
<string name="wake_test_say">Teď řekněte „%1$s“…</string>
|
||||
<string name="wake_test_say">Teď řekněte „%1$s“ a udělejte pauzu…</string>
|
||||
<string name="wake_test_heard">Slyšel jsem ji</string>
|
||||
<string name="wake_test_missed">Za deset sekund jsem ji neslyšel. Zkuste to blíž k telefonu, ve chvíli většího ticha nebo s vyšší citlivostí.</string>
|
||||
<string name="wake_test_off">Nejdřív zapněte budicí slovo.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Budicí slovo pozastaveno: LLeMbas nemá povolený mikrofon</string>
|
||||
<string name="wake_stop">Přestat naslouchat</string>
|
||||
<string name="wake_heard">Slyšel jsem vás. Klepněte a ptejte se.</string>
|
||||
<string name="channel_wake_heard">Budicí slovo zaznělo</string>
|
||||
<string name="wake_heard_line">LLeMbas se umí sám otevřít nad jinými aplikacemi jen jako aplikace digitálního asistenta v telefonu.</string>
|
||||
<string name="wake_not_assistant">LLeMbas není aplikací digitálního asistenta</string>
|
||||
<string name="wake_not_assistant_line">Budicí slovo proto nemůže otevřít asistenta nad jinými aplikacemi: dostanete oznámení, na které klepnete. Chcete-li otevírat hlasem kdekoli, klepněte sem a vyberte LLeMbas jako aplikaci digitálního asistenta.</string>
|
||||
<string name="wake_resume">Znovu naslouchat budicímu slovu</string>
|
||||
<string name="wake_resume_line">Telefon se restartoval. Klepnutím znovu spustíte naslouchání.</string>
|
||||
<string name="assist_notifications">Shrnout má oznámení</string>
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Auf ein Aktivierungswort hören</string>
|
||||
<string name="wake_word_line">Standardmäßig aus. Sag den Satz, und der Assistent öffnet sich zuhörend über der App auf dem Bildschirm.</string>
|
||||
<string name="wake_word_unavailable">Nicht in diesem Build. Der F-Droid-Build hat keine Aktivierungswort-Engine, weil F-Droid jede Bibliothek aus dem Quellcode baut; der Build von llembas.eu hat eine.</string>
|
||||
<string name="wake_phrase_line">Das sagst du. Auf Englisch, egal in welcher Sprache die App ist: Die Engine kennt nur englische Sprache.</string>
|
||||
<string name="wake_phrase_line">Das sagst du, dann eine kurze Pause: Es zählt, sobald du aufhörst. Auf Englisch, egal in welcher Sprache die App ist: Die Engine kennt nur englische Sprache.</string>
|
||||
<string name="wake_greeting">Anrede</string>
|
||||
<string name="wake_name">Name</string>
|
||||
<string name="wake_name_google_line">Ein Google-Telefon oder -Lautsprecher in der Nähe antwortet ebenfalls.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">Hört dich am leichtesten, auch aus größerer Entfernung. Startet öfter versehentlich.</string>
|
||||
<string name="wake_test">Aktivierungswort testen</string>
|
||||
<string name="wake_test_line">Zeigt zehn Sekunden lang, ob dein Satz gehört wird, ohne den Assistenten zu öffnen.</string>
|
||||
<string name="wake_test_say">Sag jetzt „%1$s“…</string>
|
||||
<string name="wake_test_say">Sag jetzt „%1$s“, dann eine Pause…</string>
|
||||
<string name="wake_test_heard">Gehört</string>
|
||||
<string name="wake_test_missed">In zehn Sekunden nicht gehört. Versuch es näher am Telefon, in einem ruhigeren Moment oder mit höherer Empfindlichkeit.</string>
|
||||
<string name="wake_test_off">Schalte zuerst das Aktivierungswort ein.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Aktivierungswort pausiert: LLeMbas darf das Mikrofon nicht verwenden</string>
|
||||
<string name="wake_stop">Nicht mehr zuhören</string>
|
||||
<string name="wake_heard">Gehört. Tippe, um zu fragen.</string>
|
||||
<string name="channel_wake_heard">Aktivierungswort gehört</string>
|
||||
<string name="wake_heard_line">LLeMbas kann sich nur als App für den digitalen Assistenten des Telefons selbst über anderen Apps öffnen.</string>
|
||||
<string name="wake_not_assistant">LLeMbas ist nicht die App für den digitalen Assistenten</string>
|
||||
<string name="wake_not_assistant_line">Deshalb kann das Aktivierungswort den Assistenten nicht über anderen Apps öffnen: Du bekommst eine Benachrichtigung zum Antippen. Um überall per Stimme zu öffnen, tippe hier und wähle LLeMbas als App für den digitalen Assistenten.</string>
|
||||
<string name="wake_resume">Wieder auf das Aktivierungswort hören</string>
|
||||
<string name="wake_resume_line">Das Telefon wurde neu gestartet. Tippe, um wieder zuzuhören.</string>
|
||||
<string name="assist_notifications">Meine Benachrichtigungen zusammenfassen</string>
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Escuchar una palabra de activación</string>
|
||||
<string name="wake_word_line">Desactivado por defecto. Di la frase y el asistente se abre escuchando, sobre la app que esté en pantalla.</string>
|
||||
<string name="wake_word_unavailable">No en esta versión. La versión de F-Droid no tiene motor de palabra de activación, porque F-Droid compila cada biblioteca desde el código fuente; la de llembas.eu sí lo tiene.</string>
|
||||
<string name="wake_phrase_line">Lo que dices. En inglés, sea cual sea el idioma de la app: el motor solo conoce el habla inglesa.</string>
|
||||
<string name="wake_phrase_line">Lo que dices, y después una pausa breve: cuenta cuando te callas. En inglés, sea cual sea el idioma de la app: el motor solo conoce el habla inglesa.</string>
|
||||
<string name="wake_greeting">Saludo</string>
|
||||
<string name="wake_name">Nombre</string>
|
||||
<string name="wake_name_google_line">Un teléfono o altavoz de Google cercano también responderá.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">Te oye con más facilidad, también desde más lejos. Se activa por error más a menudo.</string>
|
||||
<string name="wake_test">Probar la palabra de activación</string>
|
||||
<string name="wake_test_line">Durante diez segundos muestra si se oye tu frase, sin abrir el asistente.</string>
|
||||
<string name="wake_test_say">Di «%1$s» ahora…</string>
|
||||
<string name="wake_test_say">Di «%1$s» ahora y haz una pausa…</string>
|
||||
<string name="wake_test_heard">Oída</string>
|
||||
<string name="wake_test_missed">No se ha oído en diez segundos. Prueba más cerca del teléfono, en un momento más tranquilo o con más sensibilidad.</string>
|
||||
<string name="wake_test_off">Activa primero la palabra de activación.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Palabra de activación en pausa: LLeMbas no tiene permiso para usar el micrófono</string>
|
||||
<string name="wake_stop">Dejar de escuchar</string>
|
||||
<string name="wake_heard">Te he oído. Toca para preguntar.</string>
|
||||
<string name="channel_wake_heard">Palabra de activación oída</string>
|
||||
<string name="wake_heard_line">LLeMbas solo puede abrirse por sí mismo sobre otras apps si es la app de asistente digital del teléfono.</string>
|
||||
<string name="wake_not_assistant">LLeMbas no es la app de asistente digital</string>
|
||||
<string name="wake_not_assistant_line">Por eso la palabra de activación no puede abrir el asistente sobre otras apps: recibes una notificación que tocar. Para abrir con la voz en cualquier parte, toca aquí y elige LLeMbas como app de asistente digital.</string>
|
||||
<string name="wake_resume">Volver a escuchar la palabra de activación</string>
|
||||
<string name="wake_resume_line">El teléfono se reinició. Toca para volver a escuchar.</string>
|
||||
<string name="assist_notifications">Resumir mis notificaciones</string>
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Écouter un mot d’activation</string>
|
||||
<string name="wake_word_line">Désactivé par défaut. Dites la phrase et l’assistant s’ouvre en écoute, par-dessus l’app à l’écran.</string>
|
||||
<string name="wake_word_unavailable">Pas dans cette version. La version F-Droid n’a pas de moteur de mot d’activation, car F-Droid compile chaque bibliothèque depuis les sources ; celle de llembas.eu en a un.</string>
|
||||
<string name="wake_phrase_line">Ce que vous dites. En anglais, quelle que soit la langue de l’app : le moteur ne connaît que la parole anglaise.</string>
|
||||
<string name="wake_phrase_line">Ce que vous dites, puis une courte pause : cela compte dès que vous vous taisez. En anglais, quelle que soit la langue de l’app : le moteur ne connaît que la parole anglaise.</string>
|
||||
<string name="wake_greeting">Salutation</string>
|
||||
<string name="wake_name">Nom</string>
|
||||
<string name="wake_name_google_line">Un téléphone ou une enceinte Google à proximité répondra aussi.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">Vous entend le plus facilement, même de plus loin. Se déclenche plus souvent par erreur.</string>
|
||||
<string name="wake_test">Tester le mot d’activation</string>
|
||||
<string name="wake_test_line">Pendant dix secondes, indique si votre phrase est entendue, sans ouvrir l’assistant.</string>
|
||||
<string name="wake_test_say">Dites « %1$s » maintenant…</string>
|
||||
<string name="wake_test_say">Dites « %1$s » maintenant, puis faites une pause…</string>
|
||||
<string name="wake_test_heard">Entendu</string>
|
||||
<string name="wake_test_missed">Pas entendu en dix secondes. Essayez plus près du téléphone, dans un moment plus calme ou avec une sensibilité plus élevée.</string>
|
||||
<string name="wake_test_off">Activez d’abord le mot d’activation.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Mot d’activation en pause : LLeMbas n’est pas autorisé à utiliser le micro</string>
|
||||
<string name="wake_stop">Arrêter l’écoute</string>
|
||||
<string name="wake_heard">Entendu. Touchez pour demander.</string>
|
||||
<string name="channel_wake_heard">Mot d’activation entendu</string>
|
||||
<string name="wake_heard_line">LLeMbas ne peut s’ouvrir de lui-même par-dessus d’autres apps que s’il est l’assistant numérique du téléphone.</string>
|
||||
<string name="wake_not_assistant">LLeMbas n’est pas l’application d’assistant numérique</string>
|
||||
<string name="wake_not_assistant_line">Le mot d’activation ne peut donc pas ouvrir l’assistant par-dessus d’autres apps : vous recevez une notification à toucher. Pour ouvrir à la voix partout, touchez ici et choisissez LLeMbas comme application d’assistant numérique.</string>
|
||||
<string name="wake_resume">Écouter à nouveau le mot d’activation</string>
|
||||
<string name="wake_resume_line">Le téléphone a redémarré. Touchez pour reprendre l’écoute.</string>
|
||||
<string name="assist_notifications">Résumer mes notifications</string>
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Ébresztőszó figyelése</string>
|
||||
<string name="wake_word_line">Alapból ki van kapcsolva. Mondd ki a kifejezést, és az asszisztens figyelve megnyílik a képernyőn lévő alkalmazás fölött.</string>
|
||||
<string name="wake_word_unavailable">Ebben a változatban nincs. Az F-Droid-változatban nincs ébresztőszó-motor, mert az F-Droid minden könyvtárat forrásból fordít; a llembas.eu-s változatban van.</string>
|
||||
<string name="wake_phrase_line">Ezt mondod. Angolul, bármilyen nyelvű is az alkalmazás: a motor csak az angol beszédet ismeri.</string>
|
||||
<string name="wake_phrase_line">Ezt mondod, utána rövid szünet: akkor számít, amikor elhallgatsz. Angolul, bármilyen nyelvű is az alkalmazás: a motor csak az angol beszédet ismeri.</string>
|
||||
<string name="wake_greeting">Megszólítás</string>
|
||||
<string name="wake_name">Név</string>
|
||||
<string name="wake_name_google_line">A közelben lévő Google-telefon vagy -hangszóró is válaszolni fog.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">A legkönnyebben hall meg, távolabbról is. Gyakrabban indul el tévedésből.</string>
|
||||
<string name="wake_test">Ébresztőszó kipróbálása</string>
|
||||
<string name="wake_test_line">Tíz másodpercig mutatja, hogy hallja-e a kifejezésedet, az asszisztens megnyitása nélkül.</string>
|
||||
<string name="wake_test_say">Most mondd: „%1$s”…</string>
|
||||
<string name="wake_test_say">Most mondd: „%1$s”, aztán tarts szünetet…</string>
|
||||
<string name="wake_test_heard">Hallottam</string>
|
||||
<string name="wake_test_missed">Tíz másodperc alatt nem hallottam. Próbáld közelebb a telefonhoz, csendesebb pillanatban vagy nagyobb érzékenységgel.</string>
|
||||
<string name="wake_test_off">Előbb kapcsold be az ébresztőszót.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Ébresztőszó szünetel: a LLeMbas nem használhatja a mikrofont</string>
|
||||
<string name="wake_stop">Figyelés leállítása</string>
|
||||
<string name="wake_heard">Hallottalak. Koppints a kérdezéshez.</string>
|
||||
<string name="channel_wake_heard">Ébresztőszó elhangzott</string>
|
||||
<string name="wake_heard_line">A LLeMbas csak a telefon digitális asszisztens alkalmazásaként tud magától megnyílni más alkalmazások fölött.</string>
|
||||
<string name="wake_not_assistant">A LLeMbas nem a digitális asszisztens alkalmazás</string>
|
||||
<string name="wake_not_assistant_line">Ezért az ébresztőszó nem tudja megnyitni az asszisztenst más alkalmazások fölött: értesítést kapsz, amelyre koppinthatsz. Ha bárhol hanggal szeretnéd megnyitni, koppints ide, és válaszd a LLeMbast digitális asszisztens alkalmazásnak.</string>
|
||||
<string name="wake_resume">Ébresztőszó figyelése újra</string>
|
||||
<string name="wake_resume_line">A telefon újraindult. Koppints a figyelés folytatásához.</string>
|
||||
<string name="assist_notifications">Értesítéseim összefoglalása</string>
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Ascolta una parola di attivazione</string>
|
||||
<string name="wake_word_line">Disattivata per impostazione predefinita. Di’ la frase e l’assistente si apre in ascolto, sopra l’app sullo schermo.</string>
|
||||
<string name="wake_word_unavailable">Non in questa build. La build F-Droid non ha un motore per la parola di attivazione, perché F-Droid compila ogni libreria dal sorgente; la build di llembas.eu ce l’ha.</string>
|
||||
<string name="wake_phrase_line">Quello che dici. In inglese, qualunque sia la lingua dell’app: il motore conosce solo il parlato inglese.</string>
|
||||
<string name="wake_phrase_line">Quello che dici, poi una breve pausa: conta quando smetti di parlare. In inglese, qualunque sia la lingua dell’app: il motore conosce solo il parlato inglese.</string>
|
||||
<string name="wake_greeting">Saluto</string>
|
||||
<string name="wake_name">Nome</string>
|
||||
<string name="wake_name_google_line">Risponderà anche un telefono o un altoparlante Google nelle vicinanze.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">Ti sente più facilmente, anche da più lontano. Si attiva per errore più spesso.</string>
|
||||
<string name="wake_test">Prova la parola di attivazione</string>
|
||||
<string name="wake_test_line">Per dieci secondi mostra se la tua frase viene sentita, senza aprire l’assistente.</string>
|
||||
<string name="wake_test_say">Di’ «%1$s» adesso…</string>
|
||||
<string name="wake_test_say">Di’ «%1$s» adesso, poi fai una pausa…</string>
|
||||
<string name="wake_test_heard">Sentita</string>
|
||||
<string name="wake_test_missed">Non sentita in dieci secondi. Prova più vicino al telefono, in un momento più silenzioso o con una sensibilità più alta.</string>
|
||||
<string name="wake_test_off">Attiva prima la parola di attivazione.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Parola di attivazione in pausa: LLeMbas non ha il permesso di usare il microfono</string>
|
||||
<string name="wake_stop">Smetti di ascoltare</string>
|
||||
<string name="wake_heard">Ti ho sentito. Tocca per chiedere.</string>
|
||||
<string name="channel_wake_heard">Parola di attivazione sentita</string>
|
||||
<string name="wake_heard_line">LLeMbas può aprirsi da solo sopra le altre app soltanto come app di assistente digitale del telefono.</string>
|
||||
<string name="wake_not_assistant">LLeMbas non è l’app di assistente digitale</string>
|
||||
<string name="wake_not_assistant_line">Per questo la parola di attivazione non può aprire l’assistente sopra le altre app: ricevi una notifica da toccare. Per aprire con la voce ovunque, tocca qui e scegli LLeMbas come app di assistente digitale.</string>
|
||||
<string name="wake_resume">Ascolta di nuovo la parola di attivazione</string>
|
||||
<string name="wake_resume_line">Il telefono si è riavviato. Tocca per ricominciare ad ascoltare.</string>
|
||||
<string name="assist_notifications">Riassumi le mie notifiche</string>
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Nasłuchuj słowa aktywującego</string>
|
||||
<string name="wake_word_line">Domyślnie wyłączone. Powiedz frazę, a asystent otworzy się i zacznie słuchać, nad aplikacją na ekranie.</string>
|
||||
<string name="wake_word_unavailable">Nie w tej wersji. Wersja z F-Droid nie ma silnika słowa aktywującego, bo F-Droid buduje każdą bibliotekę ze źródeł; wersja z llembas.eu go ma.</string>
|
||||
<string name="wake_phrase_line">To, co mówisz. Po angielsku, niezależnie od języka aplikacji: silnik zna tylko mowę angielską.</string>
|
||||
<string name="wake_phrase_line">To, co mówisz, a potem krótka pauza: liczy się, gdy zamilkniesz. Po angielsku, niezależnie od języka aplikacji: silnik zna tylko mowę angielską.</string>
|
||||
<string name="wake_greeting">Powitanie</string>
|
||||
<string name="wake_name">Imię</string>
|
||||
<string name="wake_name_google_line">Odpowie też telefon lub głośnik Google w pobliżu.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">Słyszy Cię najłatwiej, także z większej odległości. Częściej uruchamia się przez pomyłkę.</string>
|
||||
<string name="wake_test">Wypróbuj słowo aktywujące</string>
|
||||
<string name="wake_test_line">Przez dziesięć sekund pokazuje, czy Twoja fraza jest słyszana, bez otwierania asystenta.</string>
|
||||
<string name="wake_test_say">Powiedz teraz „%1$s”…</string>
|
||||
<string name="wake_test_say">Powiedz teraz „%1$s” i zrób pauzę…</string>
|
||||
<string name="wake_test_heard">Usłyszano</string>
|
||||
<string name="wake_test_missed">Nie usłyszano w ciągu dziesięciu sekund. Spróbuj bliżej telefonu, w cichszej chwili albo z wyższą czułością.</string>
|
||||
<string name="wake_test_off">Najpierw włącz słowo aktywujące.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Słowo aktywujące wstrzymane: LLeMbas nie ma zgody na używanie mikrofonu</string>
|
||||
<string name="wake_stop">Przestań słuchać</string>
|
||||
<string name="wake_heard">Słyszę. Dotknij, aby zapytać.</string>
|
||||
<string name="channel_wake_heard">Usłyszano słowo aktywujące</string>
|
||||
<string name="wake_heard_line">LLeMbas może sam otworzyć się nad innymi aplikacjami tylko jako aplikacja asystenta cyfrowego telefonu.</string>
|
||||
<string name="wake_not_assistant">LLeMbas nie jest aplikacją asystenta cyfrowego</string>
|
||||
<string name="wake_not_assistant_line">Dlatego słowo aktywujące nie może otworzyć asystenta nad innymi aplikacjami: dostajesz powiadomienie do dotknięcia. Aby otwierać głosem wszędzie, dotknij tutaj i wybierz LLeMbas jako aplikację asystenta cyfrowego.</string>
|
||||
<string name="wake_resume">Znów nasłuchuj słowa aktywującego</string>
|
||||
<string name="wake_resume_line">Telefon uruchomił się ponownie. Dotknij, aby znów słuchać.</string>
|
||||
<string name="assist_notifications">Podsumuj moje powiadomienia</string>
|
||||
|
||||
@@ -404,7 +404,7 @@
|
||||
<string name="wake_word_listen">Počúvať budiace slovo</string>
|
||||
<string name="wake_word_line">Predvolene vypnuté. Povedzte frázu a asistent sa otvorí a počúva, nad akoukoľvek aplikáciou na obrazovke.</string>
|
||||
<string name="wake_word_unavailable">V tomto zostavení nie je. Zostavenie pre F-Droid nemá modul pre budiace slovo, pretože F-Droid zostavuje každú knižnicu zo zdrojov; zostavenie z llembas.eu ho má.</string>
|
||||
<string name="wake_phrase_line">Toto hovoríte. Po anglicky, nech je aplikácia v akomkoľvek jazyku: modul pozná len anglickú reč.</string>
|
||||
<string name="wake_phrase_line">Toto hovoríte, potom krátka pauza: platí, až keď zmĺknete. Po anglicky, nech je aplikácia v akomkoľvek jazyku: modul pozná len anglickú reč.</string>
|
||||
<string name="wake_greeting">Oslovenie</string>
|
||||
<string name="wake_name">Meno</string>
|
||||
<string name="wake_name_google_line">Ozve sa aj telefón alebo reproduktor Google nablízku.</string>
|
||||
@@ -417,7 +417,7 @@
|
||||
<string name="wake_sensitivity_high_line">Počuje vás najľahšie, aj z väčšej diaľky. Omylom sa spustí častejšie.</string>
|
||||
<string name="wake_test">Vyskúšať budiace slovo</string>
|
||||
<string name="wake_test_line">Desať sekúnd ukazuje, či vašu frázu počuť, bez otvorenia asistenta.</string>
|
||||
<string name="wake_test_say">Teraz povedzte „%1$s“…</string>
|
||||
<string name="wake_test_say">Teraz povedzte „%1$s“ a urobte pauzu…</string>
|
||||
<string name="wake_test_heard">Počul som ju</string>
|
||||
<string name="wake_test_missed">Za desať sekúnd som ju nepočul. Skúste to bližšie k telefónu, v tichšej chvíli alebo s vyššou citlivosťou.</string>
|
||||
<string name="wake_test_off">Najprv zapnite budiace slovo.</string>
|
||||
@@ -444,6 +444,10 @@
|
||||
<string name="wake_paused_microphone">Budiace slovo pozastavené: LLeMbas nemá povolený mikrofón</string>
|
||||
<string name="wake_stop">Prestať počúvať</string>
|
||||
<string name="wake_heard">Počul som vás. Ťuknite a pýtajte sa.</string>
|
||||
<string name="channel_wake_heard">Budiace slovo zaznelo</string>
|
||||
<string name="wake_heard_line">LLeMbas sa dokáže sám otvoriť nad inými aplikáciami len ako aplikácia digitálneho asistenta v telefóne.</string>
|
||||
<string name="wake_not_assistant">LLeMbas nie je aplikáciou digitálneho asistenta</string>
|
||||
<string name="wake_not_assistant_line">Budiace slovo preto nemôže otvoriť asistenta nad inými aplikáciami: dostanete oznámenie, na ktoré ťuknete. Ak chcete otvárať hlasom kdekoľvek, ťuknite sem a vyberte LLeMbas ako aplikáciu digitálneho asistenta.</string>
|
||||
<string name="wake_resume">Znova počúvať budiace slovo</string>
|
||||
<string name="wake_resume_line">Telefón sa reštartoval. Ťuknutím znova spustíte počúvanie.</string>
|
||||
<string name="assist_notifications">Zhrnúť moje oznámenia</string>
|
||||
|
||||
@@ -406,7 +406,7 @@
|
||||
<string name="wake_word_listen">Listen for a wake word</string>
|
||||
<string name="wake_word_line">Off by default. Say the phrase and the assistant opens, listening, over whatever app is on screen.</string>
|
||||
<string name="wake_word_unavailable">Not in this build. The F-Droid build has no wake-word engine, because F-Droid builds every library from source; the build from llembas.eu has one.</string>
|
||||
<string name="wake_phrase_line">What you say. In English, whatever language the app is in: the engine only knows English speech.</string>
|
||||
<string name="wake_phrase_line">What you say, then a short pause: it counts once you stop. In English, whatever language the app is in: the engine only knows English speech.</string>
|
||||
<string name="wake_greeting">Greeting</string>
|
||||
<string name="wake_name">Name</string>
|
||||
<string name="wake_name_google_line">A Google phone or speaker nearby will answer too.</string>
|
||||
@@ -419,7 +419,7 @@
|
||||
<string name="wake_sensitivity_high_line">Hears you most easily, also from further away. Starts by mistake more often.</string>
|
||||
<string name="wake_test">Test the wake word</string>
|
||||
<string name="wake_test_line">For ten seconds, shows whether your phrase is heard, without opening the assistant.</string>
|
||||
<string name="wake_test_say">Say “%1$s” now…</string>
|
||||
<string name="wake_test_say">Say “%1$s” now, then pause…</string>
|
||||
<string name="wake_test_heard">Heard it</string>
|
||||
<string name="wake_test_missed">Not heard in ten seconds. Try closer to the phone, in a quieter moment, or a higher sensitivity.</string>
|
||||
<string name="wake_test_off">Turn the wake word on first.</string>
|
||||
@@ -446,6 +446,10 @@
|
||||
<string name="wake_paused_microphone">Wake word paused: LLeMbas is not allowed to use the microphone</string>
|
||||
<string name="wake_stop">Stop listening</string>
|
||||
<string name="wake_heard">Heard you. Tap to ask.</string>
|
||||
<string name="channel_wake_heard">Wake word heard</string>
|
||||
<string name="wake_heard_line">LLeMbas can open by itself over other apps only as the phone\'s digital assistant app.</string>
|
||||
<string name="wake_not_assistant">LLeMbas is not the digital assistant app</string>
|
||||
<string name="wake_not_assistant_line">So the wake word cannot open the assistant over other apps: you get a notification to tap. To open by voice anywhere, tap here and choose LLeMbas as the digital assistant app.</string>
|
||||
<string name="wake_resume">Listen for the wake word again</string>
|
||||
<string name="wake_resume_line">The phone restarted. Tap to start listening again.</string>
|
||||
<string name="assist_notifications">Summarise my notifications</string>
|
||||
|
||||
@@ -140,6 +140,44 @@ class WakeListenerTest {
|
||||
job.cancelAndJoin()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aTapTriesAgainNowAndStartsTheWaitsOver() = runTest {
|
||||
var opens = 0
|
||||
val listener = listener(engine = { Detector() }, microphone = {
|
||||
opens++
|
||||
throw IllegalStateException("recording did not start")
|
||||
})
|
||||
val job = launch { listener.follow(MutableStateFlow(plan)) }
|
||||
advanceTimeBy(2_001 + 5_001) // two waits gone by: the third would be fifteen seconds
|
||||
assertEquals(3, opens)
|
||||
listener.retryNow()
|
||||
runCurrent()
|
||||
assertEquals(4, opens)
|
||||
// And the count of failures starts over: two seconds again, not a minute.
|
||||
advanceTimeBy(2_001)
|
||||
assertEquals(5, opens)
|
||||
job.cancelAndJoin()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun troubleAfterListeningWellIsNewTroubleNotTheOldOneAgain() = runTest {
|
||||
var opens = 0
|
||||
// Each microphone works for forty seconds (a tenth of a second a chunk), then stops.
|
||||
val listener = listener(engine = { Detector() }, microphone = {
|
||||
opens++
|
||||
Mic(script = List(400) { true }, after = -3)
|
||||
})
|
||||
val job = launch { listener.follow(MutableStateFlow(plan)) }
|
||||
runCurrent()
|
||||
assertEquals(1, opens)
|
||||
// Every wait is the first, two seconds, however many times it has happened.
|
||||
repeat(4) {
|
||||
advanceTimeBy(2_001)
|
||||
assertEquals(it + 2, opens)
|
||||
}
|
||||
job.cancelAndJoin()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aMicrophoneThatStopsIsAFailureAndIsClosed() = runTest {
|
||||
val mic = Mic(script = listOf(true, true), after = -3)
|
||||
|
||||
@@ -2,13 +2,17 @@ package eu.llembas.android
|
||||
|
||||
import android.app.Application
|
||||
import android.app.Notification
|
||||
import android.app.NotificationManager
|
||||
import eu.llembas.android.wake.WakeFailure
|
||||
import eu.llembas.android.wake.WakePause
|
||||
import eu.llembas.android.wake.WakeState
|
||||
import eu.llembas.android.wake.WakeWordService
|
||||
import eu.llembas.android.wake.wakeHeardNotification
|
||||
import eu.llembas.android.wake.wakeNotification
|
||||
import eu.llembas.android.wake.wakeTitle
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
@@ -75,4 +79,20 @@ class WakeNotificationTest {
|
||||
assertEquals(Notification.FLAG_ONGOING_EVENT, notification.flags and Notification.FLAG_ONGOING_EVENT)
|
||||
assertEquals(1, notification.actions.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun heardButUnableToOpenIsANotificationThatComesUp() {
|
||||
val heard = wakeHeardNotification(app)
|
||||
assertEquals("Heard you. Tap to ask.", heard.extras.getCharSequence(Notification.EXTRA_TITLE).toString())
|
||||
// Its own channel, which may come up over what is on screen; the listening one is quiet.
|
||||
assertEquals(WakeWordService.CHANNEL_HEARD, heard.channelId)
|
||||
WakeWordService.channel(app)
|
||||
val manager = app.getSystemService(NotificationManager::class.java)
|
||||
assertEquals(NotificationManager.IMPORTANCE_HIGH, manager.getNotificationChannel(WakeWordService.CHANNEL_HEARD).importance)
|
||||
assertEquals(NotificationManager.IMPORTANCE_LOW, manager.getNotificationChannel(WakeWordService.CHANNEL).importance)
|
||||
// Fixed words, nothing from the account: it may show on the lock screen. The tap asks.
|
||||
assertEquals(Notification.VISIBILITY_PUBLIC, heard.visibility)
|
||||
assertEquals(Notification.FLAG_AUTO_CANCEL, heard.flags and Notification.FLAG_AUTO_CANCEL)
|
||||
assertNotNull(heard.contentIntent)
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,10 @@ package eu.llembas.android
|
||||
import android.Manifest
|
||||
import android.app.Application
|
||||
import android.app.Notification
|
||||
import android.app.NotificationManager
|
||||
import androidx.core.app.NotificationCompat
|
||||
import eu.llembas.android.wake.AssistPresence
|
||||
import eu.llembas.android.wake.WakeBootReceiver
|
||||
import eu.llembas.android.wake.WakePause
|
||||
import eu.llembas.android.wake.WakeState
|
||||
import eu.llembas.android.wake.WakeStatus
|
||||
@@ -40,17 +44,38 @@ class WakeServiceTest {
|
||||
// The first start: nothing is known yet, so it says it is starting -- no phrase.
|
||||
service.startCommand(0, 1)
|
||||
assertEquals("Starting the wake word…", title(shadowOf(service.get()).lastForegroundNotification))
|
||||
// The app is opened again while it listens for the chosen phrase: the start says the same.
|
||||
WakeStatus.set(WakeState.Listening("OK Google"))
|
||||
service.startCommand(0, 2)
|
||||
assertEquals("Listening for “OK Google”", title(shadowOf(service.get()).lastForegroundNotification))
|
||||
// And while it is paused, a start does not turn the notification into "listening".
|
||||
WakeStatus.set(WakeState.Paused(WakePause.BatterySaver))
|
||||
service.startCommand(0, 3)
|
||||
assertEquals("Wake word paused: battery saver is on", title(shadowOf(service.get()).lastForegroundNotification))
|
||||
service.destroy()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aStartClearsWhatAnEarlierInstanceLeftBehind() {
|
||||
shadowOf(app).grantPermissions(Manifest.permission.RECORD_AUDIO)
|
||||
val manager = app.getSystemService(NotificationManager::class.java)
|
||||
WakeWordService.channel(app)
|
||||
// "Tap to listen again" from a restart, and a hold of the microphone nobody ended.
|
||||
manager.notify(WakeBootReceiver.RESUME_ID, NotificationCompat.Builder(app, WakeWordService.CHANNEL).setSmallIcon(R.drawable.ic_notification).build())
|
||||
AssistPresence.release()
|
||||
val before = AssistPresence.open.value
|
||||
AssistPresence.holdFor(600_000)
|
||||
assertEquals(before + 1, AssistPresence.open.value)
|
||||
val service = Robolectric.buildService(WakeWordService::class.java).create()
|
||||
service.startCommand(0, 1)
|
||||
assertNull(shadowOf(manager).getNotification(WakeBootReceiver.RESUME_ID))
|
||||
assertEquals(before, AssistPresence.open.value)
|
||||
service.destroy()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun stopIsTheSettingGoingOffNotTheServiceStoppedUnderAStart() {
|
||||
shadowOf(app).grantPermissions(Manifest.permission.RECORD_AUDIO)
|
||||
WakeStatus.set(WakeState.Listening("Hey Assistant"))
|
||||
while (shadowOf(app).nextStoppedService != null) Unit
|
||||
WakeWordService.stop()
|
||||
// Nobody calls stopService: the service ends itself once it has shown its notification.
|
||||
assertNull(shadowOf(app).nextStoppedService)
|
||||
assertEquals(WakeState.Off, WakeStatus.state.value)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun withoutTheMicrophonePermissionItIsNotStartedAndSaysWhy() {
|
||||
shadowOf(app).denyPermissions(Manifest.permission.RECORD_AUDIO)
|
||||
|
||||
@@ -2,18 +2,31 @@ package eu.llembas.android
|
||||
|
||||
import eu.llembas.android.api.LembasJson
|
||||
import eu.llembas.android.auth.Prefs
|
||||
import eu.llembas.android.wake.AppVisibility
|
||||
import eu.llembas.android.wake.AssistPresence
|
||||
import eu.llembas.android.wake.WakeError
|
||||
import eu.llembas.android.wake.WakeFailure
|
||||
import eu.llembas.android.wake.WakeOpening
|
||||
import eu.llembas.android.wake.WakePause
|
||||
import eu.llembas.android.wake.WakePhrases
|
||||
import eu.llembas.android.wake.WakeSensitivity
|
||||
import eu.llembas.android.wake.WakeState
|
||||
import eu.llembas.android.wake.WakeStatus
|
||||
import eu.llembas.android.wake.WakeWords
|
||||
import eu.llembas.android.wake.checkKeywords
|
||||
import eu.llembas.android.wake.unpackWakeModel
|
||||
import eu.llembas.android.wake.wakeBackoff
|
||||
import eu.llembas.android.wake.wakeKeywords
|
||||
import eu.llembas.android.wake.wakeOpening
|
||||
import eu.llembas.android.wake.wakePause
|
||||
import eu.llembas.android.wake.wakeStateAtStart
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.cancel
|
||||
import kotlinx.coroutines.test.advanceTimeBy
|
||||
import kotlinx.coroutines.test.runCurrent
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertThrows
|
||||
@@ -26,6 +39,7 @@ import java.io.FileNotFoundException
|
||||
import java.io.InputStream
|
||||
import java.util.Locale
|
||||
|
||||
@OptIn(ExperimentalCoroutinesApi::class)
|
||||
class WakeTest {
|
||||
@get:Rule
|
||||
val folder = TemporaryFolder()
|
||||
@@ -144,6 +158,82 @@ class WakeTest {
|
||||
assertEquals(0, WakeStatus.trial.value.heard)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theAssistantIsOpenedOnlyTheWayAndroidAllows() {
|
||||
// The phone's assistant: its own service shows the sheet, on screen or not.
|
||||
assertEquals(WakeOpening.Session, wakeOpening(isAssistant = true, appVisible = false))
|
||||
assertEquals(WakeOpening.Session, wakeOpening(isAssistant = true, appVisible = true))
|
||||
// Not the assistant, but on screen: the sheet's activity may start.
|
||||
assertEquals(WakeOpening.Activity, wakeOpening(isAssistant = false, appVisible = true))
|
||||
// Neither: an activity start is blocked without a word, so the notification is what is relied on.
|
||||
assertEquals(WakeOpening.Notification, wakeOpening(isAssistant = false, appVisible = false))
|
||||
repeat(3) { AppVisibility.activityStopped() }
|
||||
assertFalse(AppVisibility.visible)
|
||||
AppVisibility.activityStarted()
|
||||
AppVisibility.activityStarted()
|
||||
AppVisibility.activityStopped()
|
||||
assertTrue(AppVisibility.visible)
|
||||
AppVisibility.activityStopped()
|
||||
assertFalse(AppVisibility.visible)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theHoldAfterTheWordEndsEvenIfWhoeverStartedItIsGone() = runTest {
|
||||
AssistPresence.release()
|
||||
val before = AssistPresence.open.value
|
||||
// The service that heard the word is destroyed before its three seconds are up.
|
||||
val service = CoroutineScope(coroutineContext + Job())
|
||||
AssistPresence.holdFor(3_000, service)
|
||||
assertEquals(before + 1, AssistPresence.open.value)
|
||||
runCurrent()
|
||||
service.cancel()
|
||||
runCurrent()
|
||||
assertEquals(before, AssistPresence.open.value)
|
||||
// Left to itself it ends after its time; a second word meanwhile holds on from then.
|
||||
AssistPresence.holdFor(3_000, this)
|
||||
advanceTimeBy(2_000)
|
||||
AssistPresence.holdFor(3_000, this)
|
||||
advanceTimeBy(2_000)
|
||||
assertEquals(before + 1, AssistPresence.open.value)
|
||||
advanceTimeBy(1_001)
|
||||
assertEquals(before, AssistPresence.open.value)
|
||||
// A sheet that is up is counted apart, and a starting service clears only the hold.
|
||||
AssistPresence.shown()
|
||||
AssistPresence.holdFor(60_000, this)
|
||||
AssistPresence.release()
|
||||
assertEquals(before + 1, AssistPresence.open.value)
|
||||
AssistPresence.hidden()
|
||||
assertEquals(before, AssistPresence.open.value)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aStartSaysWhatIsTrueAndNeverAPhraseByDefault() {
|
||||
// A service that has only just begun knows no phrase.
|
||||
assertEquals(WakeState.Starting, wakeStateAtStart(running = false, current = WakeState.Off))
|
||||
// Whatever an earlier instance left behind is not this one's to repeat.
|
||||
assertEquals(WakeState.Starting, wakeStateAtStart(running = false, current = WakeState.Listening("Hey Assistant")))
|
||||
// The app is opened again while it runs: the start says the same as before.
|
||||
val listening = WakeState.Listening("OK Google")
|
||||
assertEquals(listening, wakeStateAtStart(running = true, current = listening))
|
||||
val paused = WakeState.Paused(WakePause.BatterySaver)
|
||||
assertEquals(paused, wakeStateAtStart(running = true, current = paused))
|
||||
assertEquals(WakeState.Starting, wakeStateAtStart(running = true, current = WakeState.Off))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onlyTheNewestServiceWritesTheState() {
|
||||
val old = WakeStatus.begin()
|
||||
WakeStatus.set(old, WakeState.Listening("Hey Assistant"))
|
||||
assertEquals(WakeState.Listening("Hey Assistant"), WakeStatus.state.value)
|
||||
// Turned off and on again: a new instance takes over while the old one is still ending.
|
||||
val new = WakeStatus.begin()
|
||||
WakeStatus.set(new, WakeState.Starting)
|
||||
WakeStatus.set(old, WakeState.Off)
|
||||
assertEquals(WakeState.Starting, WakeStatus.state.value)
|
||||
WakeStatus.set(new, WakeState.Off)
|
||||
assertEquals(WakeState.Off, WakeStatus.state.value)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun retriesBackOff() {
|
||||
assertEquals(listOf(2_000L, 5_000L, 15_000L, 60_000L, 300_000L, 300_000L), (0..5).map(::wakeBackoff))
|
||||
|
||||
@@ -379,7 +379,7 @@ object Fakes {
|
||||
)
|
||||
|
||||
/** A standard build: the test heard the phrase twice, and notification summaries are in the other build. */
|
||||
val settingsWakeTested = settings.copy(wakeTest = WakeTestShown(running = true, heard = 2), notificationsBuild = false)
|
||||
val settingsWakeTested = settings.copy(wakeTest = WakeTestShown(running = true, heard = 2), notificationsBuild = false, isAssistant = false)
|
||||
|
||||
// The assistant's sheet, as it opens and as it answers.
|
||||
private val assistBase = AssistUiState(
|
||||
|
||||
+6
-2
@@ -431,7 +431,7 @@ STRINGS: dict[str, str] = {
|
||||
"wake_word_listen": "Listen for a wake word",
|
||||
"wake_word_line": "Off by default. Say the phrase and the assistant opens, listening, over whatever app is on screen.",
|
||||
"wake_word_unavailable": "Not in this build. The F-Droid build has no wake-word engine, because F-Droid builds every library from source; the build from llembas.eu has one.",
|
||||
"wake_phrase_line": "What you say. In English, whatever language the app is in: the engine only knows English speech.",
|
||||
"wake_phrase_line": "What you say, then a short pause: it counts once you stop. In English, whatever language the app is in: the engine only knows English speech.",
|
||||
"wake_greeting": "Greeting",
|
||||
"wake_name": "Name",
|
||||
"wake_name_google_line": "A Google phone or speaker nearby will answer too.",
|
||||
@@ -444,7 +444,7 @@ STRINGS: dict[str, str] = {
|
||||
"wake_sensitivity_high_line": "Hears you most easily, also from further away. Starts by mistake more often.",
|
||||
"wake_test": "Test the wake word",
|
||||
"wake_test_line": "For ten seconds, shows whether your phrase is heard, without opening the assistant.",
|
||||
"wake_test_say": "Say “%1$s” now…",
|
||||
"wake_test_say": "Say “%1$s” now, then pause…",
|
||||
"wake_test_heard": "Heard it",
|
||||
"wake_test_missed": "Not heard in ten seconds. Try closer to the phone, in a quieter moment, or a higher sensitivity.",
|
||||
"wake_test_off": "Turn the wake word on first.",
|
||||
@@ -471,6 +471,10 @@ STRINGS: dict[str, str] = {
|
||||
"wake_paused_microphone": "Wake word paused: LLeMbas is not allowed to use the microphone",
|
||||
"wake_stop": "Stop listening",
|
||||
"wake_heard": "Heard you. Tap to ask.",
|
||||
"channel_wake_heard": "Wake word heard",
|
||||
"wake_heard_line": "LLeMbas can open by itself over other apps only as the phone's digital assistant app.",
|
||||
"wake_not_assistant": "LLeMbas is not the digital assistant app",
|
||||
"wake_not_assistant_line": "So the wake word cannot open the assistant over other apps: you get a notification to tap. To open by voice anywhere, tap here and choose LLeMbas as the digital assistant app.",
|
||||
"wake_resume": "Listen for the wake word again",
|
||||
"wake_resume_line": "The phone restarted. Tap to start listening again.",
|
||||
"assist_notifications": "Summarise my notifications",
|
||||
|
||||
+48
-16
@@ -94,6 +94,7 @@
|
||||
"channel_scheduled_failures": "Selhání naplánovaných úloh",
|
||||
"channel_updates": "Aktualizace aplikace",
|
||||
"channel_wake": "Budicí slovo",
|
||||
"channel_wake_heard": "Budicí slovo zaznělo",
|
||||
"chats_agents": "Chaty s agentem",
|
||||
"chats_earlier": "Dříve",
|
||||
"chats_found_in_messages": "Ve zprávách",
|
||||
@@ -282,9 +283,12 @@
|
||||
"wake_failed_no_engine": "Budicí slovo nefunguje: toto sestavení nemá modul",
|
||||
"wake_greeting": "Oslovení",
|
||||
"wake_heard": "Slyšel jsem vás. Klepněte a ptejte se.",
|
||||
"wake_heard_line": "LLeMbas se umí sám otevřít nad jinými aplikacemi jen jako aplikace digitálního asistenta v telefonu.",
|
||||
"wake_listening_for": "Naslouchám frázi „%1$s“",
|
||||
"wake_name": "Jméno",
|
||||
"wake_name_google_line": "Ozve se i telefon nebo reproduktor Google poblíž.",
|
||||
"wake_not_assistant": "LLeMbas není aplikací digitálního asistenta",
|
||||
"wake_not_assistant_line": "Budicí slovo proto nemůže otevřít asistenta nad jinými aplikacemi: dostanete oznámení, na které klepnete. Chcete-li otevírat hlasem kdekoli, klepněte sem a vyberte LLeMbas jako aplikaci digitálního asistenta.",
|
||||
"wake_notification_line": "Dokud ji neřeknete, nic neopustí telefon.",
|
||||
"wake_off": "Budicí slovo neposlouchá",
|
||||
"wake_paused_assistant": "Budicí slovo je pozastaveno, dokud je asistent otevřený",
|
||||
@@ -292,7 +296,7 @@
|
||||
"wake_paused_microphone": "Budicí slovo pozastaveno: LLeMbas nemá povolený mikrofon",
|
||||
"wake_paused_screen": "Budicí slovo pozastaveno: obrazovka je zhasnutá",
|
||||
"wake_paused_silent": "Budicí slovo nic neslyší: mikrofon používá jiná aplikace, nebo je v telefonu vypnutý",
|
||||
"wake_phrase_line": "Tohle říkáte. Anglicky, ať je aplikace v jakémkoli jazyce: modul zná jen anglickou řeč.",
|
||||
"wake_phrase_line": "Tohle říkáte, potom krátká pauza: platí, až když zmlknete. Anglicky, ať je aplikace v jakémkoli jazyce: modul zná jen anglickou řeč.",
|
||||
"wake_resume": "Znovu naslouchat budicímu slovu",
|
||||
"wake_resume_line": "Telefon se restartoval. Klepnutím znovu spustíte naslouchání.",
|
||||
"wake_screen_only": "Jen při zapnuté obrazovce",
|
||||
@@ -312,7 +316,7 @@
|
||||
"wake_test_line": "Deset sekund ukazuje, zda je vaši frázi slyšet, bez otevření asistenta.",
|
||||
"wake_test_missed": "Za deset sekund jsem ji neslyšel. Zkuste to blíž k telefonu, ve chvíli většího ticha nebo s vyšší citlivostí.",
|
||||
"wake_test_off": "Nejdřív zapněte budicí slovo.",
|
||||
"wake_test_say": "Teď řekněte „%1$s“…",
|
||||
"wake_test_say": "Teď řekněte „%1$s“ a udělejte pauzu…",
|
||||
"wake_word": "Budicí slovo",
|
||||
"wake_word_cost": "Stojí to baterii: mikrofon zůstává zapnutý a procesor telefonu kontroluje každý okamžik zvuku, bez úsporného čipu, který používá vestavěný asistent. Pozastaví se v úsporném režimu, když je asistent otevřený, a pokud to nezměníte, i při zhasnuté obrazovce. Po restartu ho znovu spustíte klepnutím na oznámení.",
|
||||
"wake_word_line": "Ve výchozím stavu vypnuto. Řekněte frázi a asistent se otevře a poslouchá, nad jakoukoli aplikací na obrazovce.",
|
||||
@@ -418,6 +422,7 @@
|
||||
"channel_scheduled_failures": "Geplante Fehler",
|
||||
"channel_updates": "App-Updates",
|
||||
"channel_wake": "Aktivierungswort",
|
||||
"channel_wake_heard": "Aktivierungswort gehört",
|
||||
"chats_agents": "Agenten-Chats",
|
||||
"chats_earlier": "Früher",
|
||||
"chats_found_in_messages": "In den Nachrichten",
|
||||
@@ -607,9 +612,12 @@
|
||||
"wake_failed_no_engine": "Aktivierungswort funktioniert nicht: Dieser Build hat keine Engine",
|
||||
"wake_greeting": "Anrede",
|
||||
"wake_heard": "Gehört. Tippe, um zu fragen.",
|
||||
"wake_heard_line": "LLeMbas kann sich nur als App für den digitalen Assistenten des Telefons selbst über anderen Apps öffnen.",
|
||||
"wake_listening_for": "Hört auf „%1$s“",
|
||||
"wake_name": "Name",
|
||||
"wake_name_google_line": "Ein Google-Telefon oder -Lautsprecher in der Nähe antwortet ebenfalls.",
|
||||
"wake_not_assistant": "LLeMbas ist nicht die App für den digitalen Assistenten",
|
||||
"wake_not_assistant_line": "Deshalb kann das Aktivierungswort den Assistenten nicht über anderen Apps öffnen: Du bekommst eine Benachrichtigung zum Antippen. Um überall per Stimme zu öffnen, tippe hier und wähle LLeMbas als App für den digitalen Assistenten.",
|
||||
"wake_notification_line": "Bis du es sagst, verlässt nichts das Telefon.",
|
||||
"wake_off": "Das Aktivierungswort hört nicht zu",
|
||||
"wake_paused_assistant": "Aktivierungswort pausiert, solange der Assistent offen ist",
|
||||
@@ -617,7 +625,7 @@
|
||||
"wake_paused_microphone": "Aktivierungswort pausiert: LLeMbas darf das Mikrofon nicht verwenden",
|
||||
"wake_paused_screen": "Aktivierungswort pausiert: Bildschirm aus",
|
||||
"wake_paused_silent": "Aktivierungswort hört nichts: Eine andere App hat das Mikrofon, oder das Mikrofon des Telefons ist ausgeschaltet",
|
||||
"wake_phrase_line": "Das sagst du. Auf Englisch, egal in welcher Sprache die App ist: Die Engine kennt nur englische Sprache.",
|
||||
"wake_phrase_line": "Das sagst du, dann eine kurze Pause: Es zählt, sobald du aufhörst. Auf Englisch, egal in welcher Sprache die App ist: Die Engine kennt nur englische Sprache.",
|
||||
"wake_resume": "Wieder auf das Aktivierungswort hören",
|
||||
"wake_resume_line": "Das Telefon wurde neu gestartet. Tippe, um wieder zuzuhören.",
|
||||
"wake_screen_only": "Nur bei eingeschaltetem Bildschirm",
|
||||
@@ -637,7 +645,7 @@
|
||||
"wake_test_line": "Zeigt zehn Sekunden lang, ob dein Satz gehört wird, ohne den Assistenten zu öffnen.",
|
||||
"wake_test_missed": "In zehn Sekunden nicht gehört. Versuch es näher am Telefon, in einem ruhigeren Moment oder mit höherer Empfindlichkeit.",
|
||||
"wake_test_off": "Schalte zuerst das Aktivierungswort ein.",
|
||||
"wake_test_say": "Sag jetzt „%1$s“…",
|
||||
"wake_test_say": "Sag jetzt „%1$s“, dann eine Pause…",
|
||||
"wake_word": "Aktivierungswort",
|
||||
"wake_word_cost": "Es kostet Akku: Das Mikrofon bleibt an, und der Prozessor des Telefons prüft jeden Moment Ton, ohne den Stromspar-Chip, den der eingebaute Assistent nutzt. Es pausiert im Energiesparmodus, während der Assistent offen ist und, wenn du es nicht änderst, bei ausgeschaltetem Bildschirm. Nach einem Neustart tippe auf seine Benachrichtigung, um es wieder zu starten.",
|
||||
"wake_word_line": "Standardmäßig aus. Sag den Satz, und der Assistent öffnet sich zuhörend über der App auf dem Bildschirm.",
|
||||
@@ -743,6 +751,7 @@
|
||||
"channel_scheduled_failures": "Fallos programados",
|
||||
"channel_updates": "Actualizaciones de la aplicación",
|
||||
"channel_wake": "Palabra de activación",
|
||||
"channel_wake_heard": "Palabra de activación oída",
|
||||
"chats_agents": "Chats de agente",
|
||||
"chats_earlier": "Antes",
|
||||
"chats_found_in_messages": "En los mensajes",
|
||||
@@ -931,9 +940,12 @@
|
||||
"wake_failed_no_engine": "La palabra de activación no funciona: esta versión no tiene motor",
|
||||
"wake_greeting": "Saludo",
|
||||
"wake_heard": "Te he oído. Toca para preguntar.",
|
||||
"wake_heard_line": "LLeMbas solo puede abrirse por sí mismo sobre otras apps si es la app de asistente digital del teléfono.",
|
||||
"wake_listening_for": "Escuchando «%1$s»",
|
||||
"wake_name": "Nombre",
|
||||
"wake_name_google_line": "Un teléfono o altavoz de Google cercano también responderá.",
|
||||
"wake_not_assistant": "LLeMbas no es la app de asistente digital",
|
||||
"wake_not_assistant_line": "Por eso la palabra de activación no puede abrir el asistente sobre otras apps: recibes una notificación que tocar. Para abrir con la voz en cualquier parte, toca aquí y elige LLeMbas como app de asistente digital.",
|
||||
"wake_notification_line": "Nada sale del teléfono hasta que lo digas.",
|
||||
"wake_off": "La palabra de activación no está escuchando",
|
||||
"wake_paused_assistant": "Palabra de activación en pausa mientras el asistente está abierto",
|
||||
@@ -941,7 +953,7 @@
|
||||
"wake_paused_microphone": "Palabra de activación en pausa: LLeMbas no tiene permiso para usar el micrófono",
|
||||
"wake_paused_screen": "Palabra de activación en pausa: la pantalla está apagada",
|
||||
"wake_paused_silent": "La palabra de activación no oye nada: otra app tiene el micrófono, o el micrófono del teléfono está apagado",
|
||||
"wake_phrase_line": "Lo que dices. En inglés, sea cual sea el idioma de la app: el motor solo conoce el habla inglesa.",
|
||||
"wake_phrase_line": "Lo que dices, y después una pausa breve: cuenta cuando te callas. En inglés, sea cual sea el idioma de la app: el motor solo conoce el habla inglesa.",
|
||||
"wake_resume": "Volver a escuchar la palabra de activación",
|
||||
"wake_resume_line": "El teléfono se reinició. Toca para volver a escuchar.",
|
||||
"wake_screen_only": "Solo con la pantalla encendida",
|
||||
@@ -961,7 +973,7 @@
|
||||
"wake_test_line": "Durante diez segundos muestra si se oye tu frase, sin abrir el asistente.",
|
||||
"wake_test_missed": "No se ha oído en diez segundos. Prueba más cerca del teléfono, en un momento más tranquilo o con más sensibilidad.",
|
||||
"wake_test_off": "Activa primero la palabra de activación.",
|
||||
"wake_test_say": "Di «%1$s» ahora…",
|
||||
"wake_test_say": "Di «%1$s» ahora y haz una pausa…",
|
||||
"wake_word": "Palabra de activación",
|
||||
"wake_word_cost": "Gasta batería: el micrófono sigue encendido y el procesador del teléfono revisa cada instante de sonido, sin el chip de bajo consumo que usa el asistente integrado. Se pausa en ahorro de batería, mientras el asistente está abierto y, salvo que lo cambies, con la pantalla apagada. Tras reiniciar, toca su notificación para volver a iniciarlo.",
|
||||
"wake_word_line": "Desactivado por defecto. Di la frase y el asistente se abre escuchando, sobre la app que esté en pantalla.",
|
||||
@@ -1067,6 +1079,7 @@
|
||||
"channel_scheduled_failures": "Échecs planifiés",
|
||||
"channel_updates": "Mises à jour de l’application",
|
||||
"channel_wake": "Mot d’activation",
|
||||
"channel_wake_heard": "Mot d’activation entendu",
|
||||
"chats_agents": "Discussions d’agent",
|
||||
"chats_earlier": "Plus tôt",
|
||||
"chats_found_in_messages": "Dans les messages",
|
||||
@@ -1256,9 +1269,12 @@
|
||||
"wake_failed_no_engine": "Le mot d’activation ne fonctionne pas : cette version n’a pas de moteur",
|
||||
"wake_greeting": "Salutation",
|
||||
"wake_heard": "Entendu. Touchez pour demander.",
|
||||
"wake_heard_line": "LLeMbas ne peut s’ouvrir de lui-même par-dessus d’autres apps que s’il est l’assistant numérique du téléphone.",
|
||||
"wake_listening_for": "À l’écoute de « %1$s »",
|
||||
"wake_name": "Nom",
|
||||
"wake_name_google_line": "Un téléphone ou une enceinte Google à proximité répondra aussi.",
|
||||
"wake_not_assistant": "LLeMbas n’est pas l’application d’assistant numérique",
|
||||
"wake_not_assistant_line": "Le mot d’activation ne peut donc pas ouvrir l’assistant par-dessus d’autres apps : vous recevez une notification à toucher. Pour ouvrir à la voix partout, touchez ici et choisissez LLeMbas comme application d’assistant numérique.",
|
||||
"wake_notification_line": "Rien ne quitte le téléphone avant que vous le disiez.",
|
||||
"wake_off": "Le mot d’activation n’écoute pas",
|
||||
"wake_paused_assistant": "Mot d’activation en pause pendant que l’assistant est ouvert",
|
||||
@@ -1266,7 +1282,7 @@
|
||||
"wake_paused_microphone": "Mot d’activation en pause : LLeMbas n’est pas autorisé à utiliser le micro",
|
||||
"wake_paused_screen": "Mot d’activation en pause : écran éteint",
|
||||
"wake_paused_silent": "Le mot d’activation n’entend rien : une autre app utilise le micro, ou le micro du téléphone est coupé",
|
||||
"wake_phrase_line": "Ce que vous dites. En anglais, quelle que soit la langue de l’app : le moteur ne connaît que la parole anglaise.",
|
||||
"wake_phrase_line": "Ce que vous dites, puis une courte pause : cela compte dès que vous vous taisez. En anglais, quelle que soit la langue de l’app : le moteur ne connaît que la parole anglaise.",
|
||||
"wake_resume": "Écouter à nouveau le mot d’activation",
|
||||
"wake_resume_line": "Le téléphone a redémarré. Touchez pour reprendre l’écoute.",
|
||||
"wake_screen_only": "Seulement écran allumé",
|
||||
@@ -1286,7 +1302,7 @@
|
||||
"wake_test_line": "Pendant dix secondes, indique si votre phrase est entendue, sans ouvrir l’assistant.",
|
||||
"wake_test_missed": "Pas entendu en dix secondes. Essayez plus près du téléphone, dans un moment plus calme ou avec une sensibilité plus élevée.",
|
||||
"wake_test_off": "Activez d’abord le mot d’activation.",
|
||||
"wake_test_say": "Dites « %1$s » maintenant…",
|
||||
"wake_test_say": "Dites « %1$s » maintenant, puis faites une pause…",
|
||||
"wake_word": "Mot d’activation",
|
||||
"wake_word_cost": "Cela consomme de la batterie : le micro reste allumé et le processeur du téléphone examine chaque instant de son, sans la puce basse consommation de l’assistant intégré. Il se met en pause en économie de batterie, quand l’assistant est ouvert et, sauf si vous le changez, écran éteint. Après un redémarrage, touchez sa notification pour le relancer.",
|
||||
"wake_word_line": "Désactivé par défaut. Dites la phrase et l’assistant s’ouvre en écoute, par-dessus l’app à l’écran.",
|
||||
@@ -1392,6 +1408,7 @@
|
||||
"channel_scheduled_failures": "Ütemezett hibák",
|
||||
"channel_updates": "Alkalmazásfrissítések",
|
||||
"channel_wake": "Ébresztőszó",
|
||||
"channel_wake_heard": "Ébresztőszó elhangzott",
|
||||
"chats_agents": "Ügynök-csevegések",
|
||||
"chats_earlier": "Korábban",
|
||||
"chats_found_in_messages": "Az üzenetekben",
|
||||
@@ -1581,9 +1598,12 @@
|
||||
"wake_failed_no_engine": "Az ébresztőszó nem működik: ebben a változatban nincs motor",
|
||||
"wake_greeting": "Megszólítás",
|
||||
"wake_heard": "Hallottalak. Koppints a kérdezéshez.",
|
||||
"wake_heard_line": "A LLeMbas csak a telefon digitális asszisztens alkalmazásaként tud magától megnyílni más alkalmazások fölött.",
|
||||
"wake_listening_for": "Figyeli: „%1$s”",
|
||||
"wake_name": "Név",
|
||||
"wake_name_google_line": "A közelben lévő Google-telefon vagy -hangszóró is válaszolni fog.",
|
||||
"wake_not_assistant": "A LLeMbas nem a digitális asszisztens alkalmazás",
|
||||
"wake_not_assistant_line": "Ezért az ébresztőszó nem tudja megnyitni az asszisztenst más alkalmazások fölött: értesítést kapsz, amelyre koppinthatsz. Ha bárhol hanggal szeretnéd megnyitni, koppints ide, és válaszd a LLeMbast digitális asszisztens alkalmazásnak.",
|
||||
"wake_notification_line": "Amíg ki nem mondod, semmi nem hagyja el a telefont.",
|
||||
"wake_off": "Az ébresztőszó nem figyel",
|
||||
"wake_paused_assistant": "Az ébresztőszó szünetel, amíg az asszisztens nyitva van",
|
||||
@@ -1591,7 +1611,7 @@
|
||||
"wake_paused_microphone": "Ébresztőszó szünetel: a LLeMbas nem használhatja a mikrofont",
|
||||
"wake_paused_screen": "Ébresztőszó szünetel: a képernyő ki van kapcsolva",
|
||||
"wake_paused_silent": "Az ébresztőszó semmit nem hall: másik alkalmazás használja a mikrofont, vagy a telefon mikrofonja ki van kapcsolva",
|
||||
"wake_phrase_line": "Ezt mondod. Angolul, bármilyen nyelvű is az alkalmazás: a motor csak az angol beszédet ismeri.",
|
||||
"wake_phrase_line": "Ezt mondod, utána rövid szünet: akkor számít, amikor elhallgatsz. Angolul, bármilyen nyelvű is az alkalmazás: a motor csak az angol beszédet ismeri.",
|
||||
"wake_resume": "Ébresztőszó figyelése újra",
|
||||
"wake_resume_line": "A telefon újraindult. Koppints a figyelés folytatásához.",
|
||||
"wake_screen_only": "Csak bekapcsolt képernyőnél",
|
||||
@@ -1611,7 +1631,7 @@
|
||||
"wake_test_line": "Tíz másodpercig mutatja, hogy hallja-e a kifejezésedet, az asszisztens megnyitása nélkül.",
|
||||
"wake_test_missed": "Tíz másodperc alatt nem hallottam. Próbáld közelebb a telefonhoz, csendesebb pillanatban vagy nagyobb érzékenységgel.",
|
||||
"wake_test_off": "Előbb kapcsold be az ébresztőszót.",
|
||||
"wake_test_say": "Most mondd: „%1$s”…",
|
||||
"wake_test_say": "Most mondd: „%1$s”, aztán tarts szünetet…",
|
||||
"wake_word": "Ébresztőszó",
|
||||
"wake_word_cost": "Akkumulátorba kerül: a mikrofon bekapcsolva marad, és a telefon processzora minden hangpillanatot ellenőriz, a beépített asszisztens energiatakarékos chipje nélkül. Energiatakarékos módban, nyitott asszisztensnél és — ha nem változtatod meg — kikapcsolt képernyőnél szünetel. Újraindítás után koppints az értesítésére az újraindításhoz.",
|
||||
"wake_word_line": "Alapból ki van kapcsolva. Mondd ki a kifejezést, és az asszisztens figyelve megnyílik a képernyőn lévő alkalmazás fölött.",
|
||||
@@ -1717,6 +1737,7 @@
|
||||
"channel_scheduled_failures": "Errori pianificati",
|
||||
"channel_updates": "Aggiornamenti dell’app",
|
||||
"channel_wake": "Parola di attivazione",
|
||||
"channel_wake_heard": "Parola di attivazione sentita",
|
||||
"chats_agents": "Chat con agente",
|
||||
"chats_earlier": "Prima",
|
||||
"chats_found_in_messages": "Nei messaggi",
|
||||
@@ -1905,9 +1926,12 @@
|
||||
"wake_failed_no_engine": "La parola di attivazione non funziona: questa build non ha un motore",
|
||||
"wake_greeting": "Saluto",
|
||||
"wake_heard": "Ti ho sentito. Tocca per chiedere.",
|
||||
"wake_heard_line": "LLeMbas può aprirsi da solo sopra le altre app soltanto come app di assistente digitale del telefono.",
|
||||
"wake_listening_for": "In ascolto di «%1$s»",
|
||||
"wake_name": "Nome",
|
||||
"wake_name_google_line": "Risponderà anche un telefono o un altoparlante Google nelle vicinanze.",
|
||||
"wake_not_assistant": "LLeMbas non è l’app di assistente digitale",
|
||||
"wake_not_assistant_line": "Per questo la parola di attivazione non può aprire l’assistente sopra le altre app: ricevi una notifica da toccare. Per aprire con la voce ovunque, tocca qui e scegli LLeMbas come app di assistente digitale.",
|
||||
"wake_notification_line": "Niente lascia il telefono finché non lo dici.",
|
||||
"wake_off": "La parola di attivazione non è in ascolto",
|
||||
"wake_paused_assistant": "Parola di attivazione in pausa mentre l’assistente è aperto",
|
||||
@@ -1915,7 +1939,7 @@
|
||||
"wake_paused_microphone": "Parola di attivazione in pausa: LLeMbas non ha il permesso di usare il microfono",
|
||||
"wake_paused_screen": "Parola di attivazione in pausa: schermo spento",
|
||||
"wake_paused_silent": "La parola di attivazione non sente nulla: un’altra app sta usando il microfono, o il microfono del telefono è disattivato",
|
||||
"wake_phrase_line": "Quello che dici. In inglese, qualunque sia la lingua dell’app: il motore conosce solo il parlato inglese.",
|
||||
"wake_phrase_line": "Quello che dici, poi una breve pausa: conta quando smetti di parlare. In inglese, qualunque sia la lingua dell’app: il motore conosce solo il parlato inglese.",
|
||||
"wake_resume": "Ascolta di nuovo la parola di attivazione",
|
||||
"wake_resume_line": "Il telefono si è riavviato. Tocca per ricominciare ad ascoltare.",
|
||||
"wake_screen_only": "Solo a schermo acceso",
|
||||
@@ -1935,7 +1959,7 @@
|
||||
"wake_test_line": "Per dieci secondi mostra se la tua frase viene sentita, senza aprire l’assistente.",
|
||||
"wake_test_missed": "Non sentita in dieci secondi. Prova più vicino al telefono, in un momento più silenzioso o con una sensibilità più alta.",
|
||||
"wake_test_off": "Attiva prima la parola di attivazione.",
|
||||
"wake_test_say": "Di’ «%1$s» adesso…",
|
||||
"wake_test_say": "Di’ «%1$s» adesso, poi fai una pausa…",
|
||||
"wake_word": "Parola di attivazione",
|
||||
"wake_word_cost": "Consuma batteria: il microfono resta acceso e il processore del telefono esamina ogni istante di suono, senza il chip a basso consumo usato dall’assistente integrato. Si mette in pausa con il risparmio energetico, mentre l’assistente è aperto e, se non lo cambi, a schermo spento. Dopo un riavvio, tocca la sua notifica per riavviarlo.",
|
||||
"wake_word_line": "Disattivata per impostazione predefinita. Di’ la frase e l’assistente si apre in ascolto, sopra l’app sullo schermo.",
|
||||
@@ -2041,6 +2065,7 @@
|
||||
"channel_scheduled_failures": "Błędy zaplanowanych zadań",
|
||||
"channel_updates": "Aktualizacje aplikacji",
|
||||
"channel_wake": "Słowo aktywujące",
|
||||
"channel_wake_heard": "Usłyszano słowo aktywujące",
|
||||
"chats_agents": "Czaty z agentem",
|
||||
"chats_earlier": "Wcześniej",
|
||||
"chats_found_in_messages": "W wiadomościach",
|
||||
@@ -2229,9 +2254,12 @@
|
||||
"wake_failed_no_engine": "Słowo aktywujące nie działa: ta wersja nie ma silnika",
|
||||
"wake_greeting": "Powitanie",
|
||||
"wake_heard": "Słyszę. Dotknij, aby zapytać.",
|
||||
"wake_heard_line": "LLeMbas może sam otworzyć się nad innymi aplikacjami tylko jako aplikacja asystenta cyfrowego telefonu.",
|
||||
"wake_listening_for": "Nasłuchuje „%1$s”",
|
||||
"wake_name": "Imię",
|
||||
"wake_name_google_line": "Odpowie też telefon lub głośnik Google w pobliżu.",
|
||||
"wake_not_assistant": "LLeMbas nie jest aplikacją asystenta cyfrowego",
|
||||
"wake_not_assistant_line": "Dlatego słowo aktywujące nie może otworzyć asystenta nad innymi aplikacjami: dostajesz powiadomienie do dotknięcia. Aby otwierać głosem wszędzie, dotknij tutaj i wybierz LLeMbas jako aplikację asystenta cyfrowego.",
|
||||
"wake_notification_line": "Nic nie opuszcza telefonu, dopóki tego nie powiesz.",
|
||||
"wake_off": "Słowo aktywujące nie nasłuchuje",
|
||||
"wake_paused_assistant": "Słowo aktywujące wstrzymane, gdy asystent jest otwarty",
|
||||
@@ -2239,7 +2267,7 @@
|
||||
"wake_paused_microphone": "Słowo aktywujące wstrzymane: LLeMbas nie ma zgody na używanie mikrofonu",
|
||||
"wake_paused_screen": "Słowo aktywujące wstrzymane: ekran jest wyłączony",
|
||||
"wake_paused_silent": "Słowo aktywujące nic nie słyszy: inna aplikacja używa mikrofonu albo mikrofon telefonu jest wyłączony",
|
||||
"wake_phrase_line": "To, co mówisz. Po angielsku, niezależnie od języka aplikacji: silnik zna tylko mowę angielską.",
|
||||
"wake_phrase_line": "To, co mówisz, a potem krótka pauza: liczy się, gdy zamilkniesz. Po angielsku, niezależnie od języka aplikacji: silnik zna tylko mowę angielską.",
|
||||
"wake_resume": "Znów nasłuchuj słowa aktywującego",
|
||||
"wake_resume_line": "Telefon uruchomił się ponownie. Dotknij, aby znów słuchać.",
|
||||
"wake_screen_only": "Tylko przy włączonym ekranie",
|
||||
@@ -2259,7 +2287,7 @@
|
||||
"wake_test_line": "Przez dziesięć sekund pokazuje, czy Twoja fraza jest słyszana, bez otwierania asystenta.",
|
||||
"wake_test_missed": "Nie usłyszano w ciągu dziesięciu sekund. Spróbuj bliżej telefonu, w cichszej chwili albo z wyższą czułością.",
|
||||
"wake_test_off": "Najpierw włącz słowo aktywujące.",
|
||||
"wake_test_say": "Powiedz teraz „%1$s”…",
|
||||
"wake_test_say": "Powiedz teraz „%1$s” i zrób pauzę…",
|
||||
"wake_word": "Słowo aktywujące",
|
||||
"wake_word_cost": "Zużywa baterię: mikrofon pozostaje włączony, a procesor telefonu sprawdza każdą chwilę dźwięku, bez energooszczędnego układu, którego używa wbudowany asystent. Wstrzymuje się w trybie oszczędzania baterii, gdy asystent jest otwarty, i — jeśli tego nie zmienisz — przy wyłączonym ekranie. Po ponownym uruchomieniu dotknij jego powiadomienia, by znów zaczął.",
|
||||
"wake_word_line": "Domyślnie wyłączone. Powiedz frazę, a asystent otworzy się i zacznie słuchać, nad aplikacją na ekranie.",
|
||||
@@ -2365,6 +2393,7 @@
|
||||
"channel_scheduled_failures": "Zlyhania naplánovaných úloh",
|
||||
"channel_updates": "Aktualizácie aplikácie",
|
||||
"channel_wake": "Budiace slovo",
|
||||
"channel_wake_heard": "Budiace slovo zaznelo",
|
||||
"chats_agents": "Čety s agentom",
|
||||
"chats_earlier": "Skôr",
|
||||
"chats_found_in_messages": "V správach",
|
||||
@@ -2553,9 +2582,12 @@
|
||||
"wake_failed_no_engine": "Budiace slovo nefunguje: toto zostavenie nemá modul",
|
||||
"wake_greeting": "Oslovenie",
|
||||
"wake_heard": "Počul som vás. Ťuknite a pýtajte sa.",
|
||||
"wake_heard_line": "LLeMbas sa dokáže sám otvoriť nad inými aplikáciami len ako aplikácia digitálneho asistenta v telefóne.",
|
||||
"wake_listening_for": "Počúvam frázu „%1$s“",
|
||||
"wake_name": "Meno",
|
||||
"wake_name_google_line": "Ozve sa aj telefón alebo reproduktor Google nablízku.",
|
||||
"wake_not_assistant": "LLeMbas nie je aplikáciou digitálneho asistenta",
|
||||
"wake_not_assistant_line": "Budiace slovo preto nemôže otvoriť asistenta nad inými aplikáciami: dostanete oznámenie, na ktoré ťuknete. Ak chcete otvárať hlasom kdekoľvek, ťuknite sem a vyberte LLeMbas ako aplikáciu digitálneho asistenta.",
|
||||
"wake_notification_line": "Kým ju nepoviete, nič neopustí telefón.",
|
||||
"wake_off": "Budiace slovo nepočúva",
|
||||
"wake_paused_assistant": "Budiace slovo je pozastavené, kým je asistent otvorený",
|
||||
@@ -2563,7 +2595,7 @@
|
||||
"wake_paused_microphone": "Budiace slovo pozastavené: LLeMbas nemá povolený mikrofón",
|
||||
"wake_paused_screen": "Budiace slovo pozastavené: obrazovka je zhasnutá",
|
||||
"wake_paused_silent": "Budiace slovo nič nepočuje: mikrofón používa iná aplikácia alebo je v telefóne vypnutý",
|
||||
"wake_phrase_line": "Toto hovoríte. Po anglicky, nech je aplikácia v akomkoľvek jazyku: modul pozná len anglickú reč.",
|
||||
"wake_phrase_line": "Toto hovoríte, potom krátka pauza: platí, až keď zmĺknete. Po anglicky, nech je aplikácia v akomkoľvek jazyku: modul pozná len anglickú reč.",
|
||||
"wake_resume": "Znova počúvať budiace slovo",
|
||||
"wake_resume_line": "Telefón sa reštartoval. Ťuknutím znova spustíte počúvanie.",
|
||||
"wake_screen_only": "Len pri zapnutej obrazovke",
|
||||
@@ -2583,7 +2615,7 @@
|
||||
"wake_test_line": "Desať sekúnd ukazuje, či vašu frázu počuť, bez otvorenia asistenta.",
|
||||
"wake_test_missed": "Za desať sekúnd som ju nepočul. Skúste to bližšie k telefónu, v tichšej chvíli alebo s vyššou citlivosťou.",
|
||||
"wake_test_off": "Najprv zapnite budiace slovo.",
|
||||
"wake_test_say": "Teraz povedzte „%1$s“…",
|
||||
"wake_test_say": "Teraz povedzte „%1$s“ a urobte pauzu…",
|
||||
"wake_word": "Budiace slovo",
|
||||
"wake_word_cost": "Stojí to batériu: mikrofón zostáva zapnutý a procesor telefónu kontroluje každý okamih zvuku, bez úsporného čipu, ktorý používa vstavaný asistent. Pozastaví sa v úspornom režime, keď je asistent otvorený, a ak to nezmeníte, aj pri zhasnutej obrazovke. Po reštarte ho znova spustíte ťuknutím na oznámenie.",
|
||||
"wake_word_line": "Predvolene vypnuté. Povedzte frázu a asistent sa otvorí a počúva, nad akoukoľvek aplikáciou na obrazovke.",
|
||||
|
||||
Reference in new issue
Block a user