Wake word: the wake runs outside the loop it pauses; what Android says is recorded
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
Review W1 (must): wake() was a suspend function run inside the hearing job, and its own first step -- holding the microphone for the sheet -- paused the listener, which cancelled that job: no wait for the sheet, no fallback, and no "Last wake" record for a real wake. - WakeListener hands `heard` to the scope beside the listening, so a pause never cancels the answer (test: a suspending heard that pauses the plan). The service runs the wake on the app's own scope, one at a time, holds the microphone for the whole attempt, and writes the record NonCancellable. - WakeOpener holds the order of what is tried, apart from Android, with tests: wait up to 1 s for the connection when Android says the service is active; "opened" only once a sheet says it is up; a session that was not refused gets a second wait before anything else is shown (W3: never two sheets -- and the session closes a sheet the wake word opened in its place); the activity counts only where Android will start it. - The record gains isActiveService, FEATURE_VOICE_RECOGNIZERS, screen, keyguard, app visible, ms until the sheet, the service's onCreate and onDestroy times, onPrepareToShowSession / onShowSessionFailed (API 34+), and whether the connection was waited for. Settings says when the role is held but Android does not use LLeMbas as its voice assistant. - AssistLink.shutdown is guarded by instance. W2: a session counts as up once per show; the activity from onStart to onStop. W4: the activity says it is up from onStart and onNewIntent, and turns the screen on there too. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
22 files changed
+740
-97
No files matched your search
@@ -22,6 +22,7 @@ import eu.llembas.android.ui.theme.LembasTheme
|
||||
import eu.llembas.android.wake.AssistLink
|
||||
import eu.llembas.android.wake.AssistPresence
|
||||
import eu.llembas.android.wake.WakeWordService
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
/** What a way into the sheet asks for. */
|
||||
enum class Opening {
|
||||
@@ -61,6 +62,8 @@ enum class Opening {
|
||||
class AssistActivity : ComponentActivity() {
|
||||
private lateinit var controller: AssistController
|
||||
private lateinit var keyguard: KeyguardManager
|
||||
private var started = false
|
||||
private var byWake = false
|
||||
|
||||
/** Whether the phone is locked: the sheet shows nothing from the account until it is not. */
|
||||
private val locked = mutableStateOf(false)
|
||||
@@ -79,11 +82,7 @@ class AssistActivity : ComponentActivity() {
|
||||
locked.value = keyguard.isKeyguardLocked
|
||||
// Opened by the wake word: the screen comes on with it (a spoken phrase is not a touch,
|
||||
// so nothing else has woken the phone).
|
||||
if (intent?.getBooleanExtra(EXTRA_WAKE, false) == true) setTurnScreenOn(true)
|
||||
AssistPresence.shown()
|
||||
AssistLink.sheetShown(SystemClock.elapsedRealtime())
|
||||
// The sheet is up: "Heard you. Tap to ask." has been answered, however it was opened.
|
||||
getSystemService(NotificationManager::class.java).cancel(WakeWordService.HEARD_ID)
|
||||
woken(intent)
|
||||
take(intent)
|
||||
setContent {
|
||||
val prefs by lembas.instances.prefs.collectAsState(initial = Prefs())
|
||||
@@ -113,13 +112,48 @@ class AssistActivity : ComponentActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Opened again while it is up -- the headset's button pressed twice, the tile again. */
|
||||
/** Opened again while it is up -- the headset's button pressed twice, the tile again, the wake word. */
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
setIntent(intent)
|
||||
woken(intent)
|
||||
// The same sheet answers again: it is up, and whoever asked for it is told so.
|
||||
if (started) AssistLink.sheetShown(SystemClock.elapsedRealtime())
|
||||
take(intent)
|
||||
}
|
||||
|
||||
/**
|
||||
* Opened by the wake word: the screen comes on with it (a spoken phrase is not a touch, so
|
||||
* nothing else has woken the phone), and the sheet is remembered as the wake word's, so that
|
||||
* the assistant's own sheet can take its place if that one comes after all.
|
||||
*/
|
||||
private fun woken(intent: Intent?) {
|
||||
byWake = intent?.getBooleanExtra(EXTRA_WAKE, false) == true
|
||||
if (byWake) setTurnScreenOn(true)
|
||||
}
|
||||
|
||||
/**
|
||||
* On screen: only now is the sheet "up" -- for the wake word's pause (which must end when the
|
||||
* sheet is left with Home, not only when it is destroyed) and for whoever waits to hear that
|
||||
* it opened.
|
||||
*/
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
started = true
|
||||
open = WeakReference(this)
|
||||
AssistPresence.shown()
|
||||
AssistLink.sheetShown(SystemClock.elapsedRealtime())
|
||||
// "Heard you. Tap to ask." has been answered, however the sheet was opened.
|
||||
getSystemService(NotificationManager::class.java).cancel(WakeWordService.HEARD_ID)
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
started = false
|
||||
if (open?.get() === this) open = null
|
||||
AssistPresence.hidden()
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
/**
|
||||
* What the way in asked for: a question handed over by the session, listening (the headset's
|
||||
* voice button, the widget's microphone, the Speak shortcut), the last assistant chat (the
|
||||
@@ -158,7 +192,6 @@ class AssistActivity : ComponentActivity() {
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
AssistPresence.hidden()
|
||||
controller.close()
|
||||
super.onDestroy()
|
||||
}
|
||||
@@ -178,6 +211,15 @@ class AssistActivity : ComponentActivity() {
|
||||
/** The sheet, listening. */
|
||||
fun listening(context: Context): Intent = Intent(context, AssistActivity::class.java).setAction(ACTION_LISTEN)
|
||||
|
||||
/** The sheet that is on screen now, if this activity is it. */
|
||||
@Volatile
|
||||
private var open: WeakReference<AssistActivity>? = null
|
||||
|
||||
/** The assistant's own sheet came up: a sheet the wake word had opened in its place goes. */
|
||||
fun closeWoken() {
|
||||
open?.get()?.takeIf { it.byWake }?.finish()
|
||||
}
|
||||
|
||||
/** On the intent the wake word opens the sheet with: turn the screen on. */
|
||||
const val EXTRA_WAKE = "eu.llembas.android.WAKE"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package eu.llembas.android.assist
|
||||
import android.app.KeyguardManager
|
||||
import android.app.assist.AssistStructure
|
||||
import android.app.role.RoleManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
@@ -49,6 +50,11 @@ import kotlinx.coroutines.runBlocking
|
||||
* preinstalled assistant (`CAPTURE_AUDIO_HOTWORD` is a privileged permission).
|
||||
*/
|
||||
class LembasAssistService : VoiceInteractionService() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
AssistLink.created(System.currentTimeMillis())
|
||||
}
|
||||
|
||||
override fun onReady() {
|
||||
super.onReady()
|
||||
current = this
|
||||
@@ -61,12 +67,33 @@ class LembasAssistService : VoiceInteractionService() {
|
||||
}
|
||||
|
||||
override fun onShutdown() {
|
||||
if (current === this) current = null
|
||||
AssistLink.shutdown(System.currentTimeMillis())
|
||||
// Only the instance that is the current one disconnects it: an old one going away late
|
||||
// must not say "not connected" over a new one.
|
||||
if (current === this) {
|
||||
current = null
|
||||
AssistLink.shutdown(System.currentTimeMillis())
|
||||
}
|
||||
Log.i(TAG, "assistant service disconnected by Android")
|
||||
super.onShutdown()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
AssistLink.destroyed(System.currentTimeMillis())
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
/** Android 14+: Android is about to show a session it was asked for -- or, below, could not. Kept for the wake word's record. */
|
||||
override fun onPrepareToShowSession(args: Bundle, showFlags: Int) {
|
||||
AssistLink.prepared(SystemClock.elapsedRealtime())
|
||||
super.onPrepareToShowSession(args, showFlags)
|
||||
}
|
||||
|
||||
override fun onShowSessionFailed(args: Bundle) {
|
||||
AssistLink.showFailed(SystemClock.elapsedRealtime())
|
||||
Log.w(TAG, "Android could not show the assistant's session")
|
||||
super.onShowSessionFailed(args)
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* The service while the system has it bound -- while LLeMbas is the phone's assistant. The
|
||||
@@ -80,6 +107,16 @@ class LembasAssistService : VoiceInteractionService() {
|
||||
private const val TAG = "LLeMbasWake"
|
||||
private val background = CoroutineScope(SupervisorJob() + Dispatchers.Default)
|
||||
|
||||
/**
|
||||
* Whether Android itself uses this service as its voice-interaction service right now.
|
||||
* Holding the assistant role is not the same: Android keeps the service only while a
|
||||
* speech recogniser is set that it accepts, and resets it at start-up otherwise -- the
|
||||
* long press then opens the assistant as an ordinary screen, and nothing is connected
|
||||
* that could open it from the background.
|
||||
*/
|
||||
fun isActive(context: Context): Boolean =
|
||||
runCatching { VoiceInteractionService.isActiveService(context, ComponentName(context, LembasAssistService::class.java)) }.getOrDefault(false)
|
||||
|
||||
/** Whether Android says LLeMbas holds the assistant role (Settings › Default apps › Digital assistant app). */
|
||||
fun holdsRole(context: Context): Boolean =
|
||||
runCatching { context.getSystemService(RoleManager::class.java)?.isRoleHeld(RoleManager.ROLE_ASSISTANT) }.getOrNull() ?: false
|
||||
@@ -104,6 +141,9 @@ class LembasAssistSession(context: Context) :
|
||||
private var controller = AssistController(context, scope)
|
||||
private val current = mutableStateOf(controller)
|
||||
|
||||
/** Whether this session's sheet is up, as far as the wake word's pause is concerned. */
|
||||
private var up = false
|
||||
|
||||
override val lifecycle: Lifecycle get() = registry
|
||||
override val savedStateRegistry: SavedStateRegistry get() = saved.savedStateRegistry
|
||||
|
||||
@@ -152,8 +192,16 @@ class LembasAssistSession(context: Context) :
|
||||
override fun onShow(args: Bundle?, showFlags: Int) {
|
||||
super.onShow(args, showFlags)
|
||||
registry.currentState = Lifecycle.State.RESUMED
|
||||
AssistPresence.shown()
|
||||
// Android calls this again for a show asked for while the sheet is up, and hides once:
|
||||
// the sheet is counted as up once.
|
||||
if (!up) {
|
||||
up = true
|
||||
AssistPresence.shown()
|
||||
}
|
||||
AssistLink.sheetShown(SystemClock.elapsedRealtime())
|
||||
// One sheet, never two: a sheet the wake word opened as a screen of the app, because
|
||||
// this one was slow to come, goes now that this one is here.
|
||||
AssistActivity.closeWoken()
|
||||
// The wake word asks for the sheet listening, whatever Settings says about opening.
|
||||
controller.opened(locked(), listen = args?.getBoolean(AssistActivity.EXTRA_LISTEN) == true)
|
||||
}
|
||||
@@ -165,7 +213,10 @@ class LembasAssistSession(context: Context) :
|
||||
*/
|
||||
override fun onHide() {
|
||||
super.onHide()
|
||||
AssistPresence.hidden()
|
||||
if (up) {
|
||||
up = false
|
||||
AssistPresence.hidden()
|
||||
}
|
||||
controller.close()
|
||||
scope.cancel()
|
||||
scope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||
|
||||
@@ -187,6 +187,8 @@ data class SettingsState(
|
||||
val isAssistant: Boolean = true,
|
||||
/** Whether Android has the assistant service connected right now: without it the wake word cannot open the sheet by itself. */
|
||||
val assistantConnected: Boolean = true,
|
||||
/** Whether Android itself uses LLeMbas's service as its voice assistant (the role can be held without it). */
|
||||
val assistantActive: 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). */
|
||||
@@ -412,6 +414,7 @@ fun SettingsScreen(onBack: () -> Unit, onAddInstance: () -> Unit) {
|
||||
// Read again each time Settings is composed: the person comes back from the system's page.
|
||||
isAssistant = LembasAssistService.holdsRole(context),
|
||||
assistantConnected = assistantConnected,
|
||||
assistantActive = LembasAssistService.isActive(context),
|
||||
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),
|
||||
@@ -741,6 +744,18 @@ internal fun WakeWordGroup(state: SettingsState, actions: SettingsActions, onCho
|
||||
subtitle = stringResource(R.string.wake_not_assistant_line),
|
||||
onClick = actions::assistantSettings,
|
||||
)
|
||||
} else if (!state.assistantActive) {
|
||||
// Chosen as the assistant, yet Android does not run it as its voice assistant:
|
||||
// the long press opens it as an ordinary screen, and nothing is connected that
|
||||
// could open it from the background. Choosing it again puts that right.
|
||||
Rule()
|
||||
SettingRow(
|
||||
Icons.Filled.Assistant,
|
||||
stringResource(R.string.wake_assistant_inactive),
|
||||
subtitle = stringResource(R.string.wake_assistant_inactive_line),
|
||||
tint = palette.warning,
|
||||
onClick = actions::assistantSettings,
|
||||
)
|
||||
} else if (!state.assistantConnected) {
|
||||
// The assistant in name, but Android holds no connection to it at this moment:
|
||||
// the one thing that lets the sheet open from the background is missing.
|
||||
|
||||
@@ -303,11 +303,30 @@ fun wakeAttemptWords(context: Context, attempt: WakeAttempt, zone: ZoneId = Zone
|
||||
WakeWay.Activity.id -> lines += context.getString(R.string.wake_out_activity)
|
||||
WakeWay.Notification.id -> lines += context.getString(R.string.wake_out_notification)
|
||||
}
|
||||
if (attempt.outcome == WakeAttempt.OUT_OPENED || attempt.outcome == WakeAttempt.OUT_TESTED) return lines
|
||||
lines += context.getString(if (attempt.assistant) R.string.wake_role_held else R.string.wake_role_not_held)
|
||||
if (attempt.outcome == WakeAttempt.OUT_TESTED) return lines
|
||||
if (attempt.sheetMs >= 0) lines += context.getString(R.string.wake_sheet_ms, attempt.sheetMs.toString())
|
||||
if (attempt.outcome == WakeAttempt.OUT_OPENED) return lines
|
||||
// Why the assistant's own way was not there, from what Android itself said at that moment.
|
||||
lines += when {
|
||||
!attempt.assistant -> context.getString(R.string.wake_role_not_held)
|
||||
!attempt.recognizers -> context.getString(R.string.wake_no_recognizers)
|
||||
!attempt.active -> context.getString(R.string.wake_not_active)
|
||||
else -> context.getString(R.string.wake_role_held)
|
||||
}
|
||||
if (attempt.waited) lines += context.getString(R.string.wake_waited)
|
||||
if (attempt.showFailed) lines += context.getString(R.string.wake_show_failed)
|
||||
lines += if (attempt.readyAt == 0L) context.getString(R.string.wake_link_never) else context.getString(R.string.wake_link_ready, time(attempt.readyAt))
|
||||
if (attempt.shutdownAt != 0L) lines += context.getString(R.string.wake_link_shutdown, time(attempt.shutdownAt))
|
||||
if (attempt.connectedLater != 0L) lines += context.getString(R.string.wake_link_later, time(attempt.connectedLater))
|
||||
// The rest as it was noted, for whoever looks for the cause: names and values, not a sentence.
|
||||
lines += listOf(
|
||||
"screen=${if (attempt.screenOn) "on" else "off"}",
|
||||
"locked=${attempt.locked}",
|
||||
"visible=${attempt.visible}",
|
||||
"created=${if (attempt.createdAt == 0L) "-" else time(attempt.createdAt)}",
|
||||
"destroyed=${if (attempt.destroyedAt == 0L) "-" else time(attempt.destroyedAt)}",
|
||||
"prepared=${attempt.prepared}",
|
||||
).joinToString(" ")
|
||||
return lines
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ class WakeListener(
|
||||
|
||||
/** Listen as [plans] say, until the flow ends or this is cancelled; the engine is released on the way out. */
|
||||
suspend fun follow(plans: Flow<WakePlan>) = coroutineScope {
|
||||
// Where a heard word is answered: beside the listening, so a pause does not cancel the answer.
|
||||
val answers = this
|
||||
var hearing: Job? = null
|
||||
try {
|
||||
plans.distinctUntilChanged().collect { plan ->
|
||||
@@ -54,7 +56,7 @@ class WakeListener(
|
||||
if (plan.pause != WakePause.None) {
|
||||
say(WakeState.Paused(plan.pause))
|
||||
} else {
|
||||
hearing = launch { hear(plan) }
|
||||
hearing = launch { hear(plan) { phrase -> answers.launch { heard(phrase) } } }
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -80,14 +82,17 @@ class WakeListener(
|
||||
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) {
|
||||
private suspend fun hear(plan: WakePlan, heardIt: (WakePhrase) -> Unit) {
|
||||
var failures = 0
|
||||
while (true) {
|
||||
try {
|
||||
listened = 0
|
||||
listen(plan)
|
||||
failures = 0
|
||||
heard(plan.phrase)
|
||||
// Handed to the caller's scope, not run here: answering the word usually pauses
|
||||
// the listening (the sheet takes the microphone), which cancels this very loop --
|
||||
// and must not cancel the answer with it.
|
||||
heardIt(plan.phrase)
|
||||
// The sheet takes the microphone now (a new plan cancels this); otherwise listen again.
|
||||
delay(HEARD_REST_MS)
|
||||
} catch (e: CancellationException) {
|
||||
|
||||
@@ -31,6 +31,29 @@ data class WakeAttempt(
|
||||
val shutdownAt: Long = 0,
|
||||
/** Set afterwards, when the service was not connected and Android connected it later. */
|
||||
val connectedLater: Long = 0,
|
||||
/**
|
||||
* Whether Android itself said LLeMbas's service is its active voice-interaction service
|
||||
* (`VoiceInteractionService.isActiveService`). The role can be held without it: Android then
|
||||
* opens the assistant as an ordinary screen on a long press, and keeps no connection that
|
||||
* could open it from the background.
|
||||
*/
|
||||
val active: Boolean = false,
|
||||
/** Whether the phone has voice recognisers at all (`FEATURE_VOICE_RECOGNIZERS`): without it Android runs no voice-interaction service. */
|
||||
val recognizers: Boolean = true,
|
||||
val screenOn: Boolean = true,
|
||||
val locked: Boolean = false,
|
||||
/** Whether one of the app's own screens was showing. */
|
||||
val visible: Boolean = false,
|
||||
/** How long the sheet took to say it was up, in ms; -1 when none came. */
|
||||
val sheetMs: Long = -1,
|
||||
/** When the assistant service was last made and destroyed in this run of the app; 0: never. */
|
||||
val createdAt: Long = 0,
|
||||
val destroyedAt: Long = 0,
|
||||
/** Whether the wake waited for Android to connect the service (it was active but not connected yet). */
|
||||
val waited: Boolean = false,
|
||||
/** What Android told the service about this show (API 34+): it prepared one, or it failed. */
|
||||
val prepared: Boolean = false,
|
||||
val showFailed: Boolean = false,
|
||||
) {
|
||||
companion object {
|
||||
/** The sheet came up. */
|
||||
@@ -98,21 +121,32 @@ fun wakeWay(connected: Boolean, screenOn: Boolean, appVisible: Boolean): WakeWay
|
||||
else -> WakeWay.Notification
|
||||
}
|
||||
|
||||
/** What is left when the assistant's own way did not open the sheet. */
|
||||
fun wakeFallback(appVisible: Boolean): WakeWay = if (appVisible) WakeWay.Activity else WakeWay.Notification
|
||||
|
||||
/**
|
||||
* The assistant service's life in this run of the app, as Android told it: when it was made,
|
||||
* connected (`onReady`), disconnected (`onShutdown`), and when a sheet last came up. Written by
|
||||
* the assistant service, the session and the sheet's activity; read when the word is heard.
|
||||
* connected (`onReady`), disconnected (`onShutdown`) and destroyed, what Android said of the last
|
||||
* show it was asked for, and when a sheet last came up. Written by the assistant service, the
|
||||
* session and the sheet's activity; read when the word is heard.
|
||||
*/
|
||||
object AssistLink {
|
||||
@Volatile var createdAt = 0L
|
||||
private set
|
||||
|
||||
@Volatile var destroyedAt = 0L
|
||||
private set
|
||||
|
||||
@Volatile var readyAt = 0L
|
||||
private set
|
||||
|
||||
@Volatile var shutdownAt = 0L
|
||||
private set
|
||||
|
||||
/** On the phone's elapsed clock: when Android last said it prepares to show a session, and when one failed to show. */
|
||||
@Volatile var preparedAt = 0L
|
||||
private set
|
||||
|
||||
@Volatile var showFailedAt = 0L
|
||||
private set
|
||||
|
||||
private val _shown = MutableStateFlow(0L)
|
||||
|
||||
/** When a sheet last came up, on the phone's elapsed clock (ms); 0: not yet. */
|
||||
@@ -123,6 +157,14 @@ object AssistLink {
|
||||
/** Whether Android has the assistant service connected right now. */
|
||||
val connected: StateFlow<Boolean> = _connected.asStateFlow()
|
||||
|
||||
fun created(now: Long) {
|
||||
createdAt = now
|
||||
}
|
||||
|
||||
fun destroyed(now: Long) {
|
||||
destroyedAt = now
|
||||
}
|
||||
|
||||
fun ready(now: Long) {
|
||||
readyAt = now
|
||||
_connected.value = true
|
||||
@@ -133,7 +175,129 @@ object AssistLink {
|
||||
_connected.value = false
|
||||
}
|
||||
|
||||
fun prepared(elapsed: Long) {
|
||||
preparedAt = elapsed
|
||||
}
|
||||
|
||||
fun showFailed(elapsed: Long) {
|
||||
showFailedAt = elapsed
|
||||
}
|
||||
|
||||
fun sheetShown(elapsed: Long) {
|
||||
_shown.value = elapsed
|
||||
}
|
||||
}
|
||||
|
||||
/** What is true of the phone and the assistant at the moment the phrase is heard. */
|
||||
data class WakeFacts(
|
||||
/** The assistant service is connected (`LembasAssistService.current` is there). */
|
||||
val connected: Boolean,
|
||||
/** Android says the service is its active voice-interaction service. */
|
||||
val active: Boolean,
|
||||
/** LLeMbas holds the assistant role. */
|
||||
val role: Boolean,
|
||||
val recognizers: Boolean = true,
|
||||
val screenOn: Boolean = true,
|
||||
val locked: Boolean = false,
|
||||
val visible: Boolean = false,
|
||||
)
|
||||
|
||||
/**
|
||||
* Opening the assistant when the phrase was heard, apart from Android so that the order of what
|
||||
* is tried -- and what is written down about it -- can be tested.
|
||||
*
|
||||
* 1. The assistant's own way, where its service is connected ([wakeWay]). When Android says the
|
||||
* service is active but has not connected it yet, a moment is waited for the connection.
|
||||
* 2. "Opened" only once a sheet says it is up ([sheetCame]).
|
||||
* 3. Otherwise the sheet's activity -- relied on only where Android will start it: the service is
|
||||
* connected (a bound service lets the whole app start activities) or the app is on screen. A
|
||||
* session that was only slow is given a second wait first, so there are never two sheets.
|
||||
* 4. Otherwise a notification to tap.
|
||||
*
|
||||
* [open] returns what happened, for the record.
|
||||
*/
|
||||
class WakeOpener(
|
||||
private val facts: () -> WakeFacts,
|
||||
/** Wait up to the given ms for Android to connect the service; whether it did. */
|
||||
private val awaitConnected: suspend (Long) -> Boolean,
|
||||
/** Ask the connected service to show its sheet; throws what Android throws. */
|
||||
private val showSession: () -> Unit,
|
||||
/** Start the sheet's activity; throws what Android throws. */
|
||||
private val startActivity: () -> Unit,
|
||||
/** Wait up to the given ms for a sheet to say it is up; how long it took, or null. */
|
||||
private val sheetCame: suspend (Long) -> Long?,
|
||||
private val notify: (WakeAttempt) -> Unit,
|
||||
/** What Android said of the show since it was asked: prepared, failed. */
|
||||
private val showSignals: () -> Pair<Boolean, Boolean> = { false to false },
|
||||
private val now: () -> Long = System::currentTimeMillis,
|
||||
) {
|
||||
suspend fun open(phrase: String, link: WakeAttempt = WakeAttempt()): WakeAttempt {
|
||||
var seen = facts()
|
||||
var waited = false
|
||||
if (!seen.connected && seen.active) {
|
||||
// Android's own assistant, only not connected at this instant: it may be on its way.
|
||||
waited = true
|
||||
if (awaitConnected(CONNECT_WAIT_MS)) seen = facts().copy(connected = true)
|
||||
}
|
||||
val way = wakeWay(seen.connected, seen.screenOn, seen.visible)
|
||||
var attempt = link.copy(
|
||||
at = now(),
|
||||
phrase = phrase,
|
||||
way = way.id,
|
||||
assistant = seen.role,
|
||||
active = seen.active,
|
||||
recognizers = seen.recognizers,
|
||||
screenOn = seen.screenOn,
|
||||
locked = seen.locked,
|
||||
visible = seen.visible,
|
||||
waited = waited,
|
||||
)
|
||||
if (way == WakeWay.Session || way == WakeWay.AssistantActivity) {
|
||||
val refused = runCatching { if (way == WakeWay.Session) showSession() else startActivity() }.exceptionOrNull()
|
||||
val took = if (refused == null) sheetCame(SHEET_WAIT_MS) else null
|
||||
val (prepared, failed) = showSignals()
|
||||
attempt = attempt.copy(prepared = prepared, showFailed = failed)
|
||||
if (took != null) return attempt.copy(outcome = WakeAttempt.OUT_OPENED, sheetMs = took)
|
||||
attempt = if (refused != null) {
|
||||
attempt.copy(outcome = WakeAttempt.OUT_REFUSED, detail = describe(refused))
|
||||
} else {
|
||||
attempt.copy(outcome = WakeAttempt.OUT_NO_SHEET)
|
||||
}
|
||||
// The activity was the way that just did not come up: starting it a second time is no fallback.
|
||||
if (way == WakeWay.AssistantActivity && refused == null) return notified(attempt)
|
||||
// A session Android did not refuse may only be slow: a second wait, before anything
|
||||
// else is put on screen beside it.
|
||||
if (refused == null) {
|
||||
sheetCame(SHEET_WAIT_MS)?.let { late -> return attempt.copy(outcome = WakeAttempt.OUT_OPENED, sheetMs = SHEET_WAIT_MS + late) }
|
||||
}
|
||||
} else {
|
||||
attempt = attempt.copy(outcome = WakeAttempt.OUT_NOT_CONNECTED)
|
||||
}
|
||||
// The sheet's activity. Android blocks one started from the background without a word,
|
||||
// so it counts only where it may start -- and only once it says it is up.
|
||||
val started = runCatching { startActivity() }.isSuccess
|
||||
if (started && (seen.connected || seen.visible)) {
|
||||
sheetCame(SHEET_WAIT_MS)?.let { took -> return attempt.copy(fallback = WakeWay.Activity.id, sheetMs = took) }
|
||||
}
|
||||
return notified(attempt)
|
||||
}
|
||||
|
||||
private fun notified(attempt: WakeAttempt): WakeAttempt {
|
||||
val told = attempt.copy(fallback = WakeWay.Notification.id)
|
||||
notify(told)
|
||||
return told
|
||||
}
|
||||
|
||||
private fun describe(e: Throwable): String = listOfNotNull(e.javaClass.simpleName, e.message?.takeIf { it.isNotBlank() }).joinToString(": ").take(200)
|
||||
|
||||
companion object {
|
||||
/** How long a sheet has to say it is up before the way that was tried counts as not having opened it. */
|
||||
const val SHEET_WAIT_MS = 2_500L
|
||||
|
||||
/** How long Android is given to connect a service it says is active. */
|
||||
const val CONNECT_WAIT_MS = 1_000L
|
||||
|
||||
/** The longest an attempt can take: the connection, three waits for a sheet, and a margin. The microphone is held that long. */
|
||||
const val ATTEMPT_MAX_MS = CONNECT_WAIT_MS + 3 * SHEET_WAIT_MS + 1_500L
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package eu.llembas.android.wake
|
||||
|
||||
import android.Manifest
|
||||
import android.app.KeyguardManager
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
@@ -31,6 +32,8 @@ import eu.llembas.android.lembas
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.NonCancellable
|
||||
import kotlinx.coroutines.SupervisorJob
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.flow.drop
|
||||
@@ -38,6 +41,7 @@ import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.flow.takeWhile
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.coroutines.withTimeoutOrNull
|
||||
|
||||
/**
|
||||
@@ -172,7 +176,8 @@ class WakeWordService : LifecycleService() {
|
||||
// A test in Settings takes the word; otherwise the assistant opens.
|
||||
heard = { phrase ->
|
||||
if (WakeStatus.heardInTrial(SystemClock.elapsedRealtime())) {
|
||||
record(WakeAttempt(at = System.currentTimeMillis(), phrase = phrase.words, outcome = WakeAttempt.OUT_TESTED))
|
||||
val tested = WakeAttempt(at = System.currentTimeMillis(), phrase = phrase.words, outcome = WakeAttempt.OUT_TESTED)
|
||||
wakeScope.launch { record(this@WakeWordService, tested) }
|
||||
} else {
|
||||
wake(phrase)
|
||||
}
|
||||
@@ -204,68 +209,56 @@ class WakeWordService : LifecycleService() {
|
||||
}
|
||||
|
||||
/**
|
||||
* The word was heard: the assistant opens listening, by the first way Android allows
|
||||
* ([wakeWay]) -- and what was tried and how it went is written down ([WakeAttempt], kept in
|
||||
* the settings and shown in Settings › Wake word), because a silent "no" here looks to the
|
||||
* The word was heard: the assistant opens listening ([WakeOpener] decides how and checks that
|
||||
* it did), and what was tried and how it went is written down ([WakeAttempt], kept in the
|
||||
* settings and shown in Settings › Wake word), because a silent "no" here looks to the
|
||||
* person like a wake word that does not work.
|
||||
*
|
||||
* A way that Android does not refuse is not yet a sheet on screen: the sheet says when it
|
||||
* is up ([AssistLink.shown]), and when it has not said so in time the fallback follows --
|
||||
* the activity while the app is on screen, else a notification to tap (the activity is
|
||||
* still tried then; where a phone allows it, it opens and takes the notification away).
|
||||
* It runs on the app's own scope, never inside the listening loop: the hold below pauses
|
||||
* the listener, which cancels the loop that heard the word -- and a wake that ran in that
|
||||
* loop was cancelled by its own first step. One at a time: a word heard while the last one
|
||||
* is still being answered is let go.
|
||||
*/
|
||||
private suspend fun wake(phrase: WakePhrase) {
|
||||
// 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 asked = SystemClock.elapsedRealtime()
|
||||
val assistant = LembasAssistService.current
|
||||
val way = wakeWay(connected = assistant != null, screenOn = power().isInteractive, appVisible = AppVisibility.visible)
|
||||
var attempt = WakeAttempt(
|
||||
at = System.currentTimeMillis(),
|
||||
phrase = phrase.words,
|
||||
way = way.id,
|
||||
assistant = LembasAssistService.holdsRole(this),
|
||||
readyAt = AssistLink.readyAt,
|
||||
shutdownAt = AssistLink.shutdownAt,
|
||||
)
|
||||
// The assistant's own ways first, where it is connected.
|
||||
val refused: Throwable? = when (way) {
|
||||
WakeWay.Session -> runCatching { assistant?.showSession(Bundle().apply { putBoolean(AssistActivity.EXTRA_LISTEN, true) }, 0) }.exceptionOrNull()
|
||||
WakeWay.AssistantActivity -> runCatching { assistant?.startActivity(AssistActivity.woken(this)) }.exceptionOrNull()
|
||||
else -> null
|
||||
}
|
||||
if (way == WakeWay.Session || way == WakeWay.AssistantActivity) {
|
||||
if (refused == null && sheetCame(asked)) return record(attempt.copy(outcome = WakeAttempt.OUT_OPENED))
|
||||
attempt = if (refused != null) {
|
||||
attempt.copy(outcome = WakeAttempt.OUT_REFUSED, detail = WakeError(WakeFailure.Engine, refused).detail)
|
||||
} else {
|
||||
attempt.copy(outcome = WakeAttempt.OUT_NO_SHEET)
|
||||
private fun wake(phrase: WakePhrase) {
|
||||
if (waking?.isActive == true) return
|
||||
// The microphone is the sheet's from here, for as long as the attempt can take; once it
|
||||
// is over, for a moment more, and then for as long as a sheet says it is up.
|
||||
AssistPresence.holdFor(WakeOpener.ATTEMPT_MAX_MS)
|
||||
waking = wakeScope.launch {
|
||||
try {
|
||||
val asked = SystemClock.elapsedRealtime()
|
||||
val opener = WakeOpener(
|
||||
facts = { wakeFacts(this@WakeWordService) },
|
||||
awaitConnected = { ms -> withTimeoutOrNull(ms) { AssistLink.connected.first { it } } != null },
|
||||
showSession = {
|
||||
val assistant = LembasAssistService.current ?: error("the assistant service is not connected")
|
||||
assistant.showSession(Bundle().apply { putBoolean(AssistActivity.EXTRA_LISTEN, true) }, 0)
|
||||
},
|
||||
// Through the assistant service where it is connected (the same permission either way: Android lets
|
||||
// the whole app start activities while it holds the service bound).
|
||||
startActivity = { (LembasAssistService.current ?: this@WakeWordService).startActivity(AssistActivity.woken(this@WakeWordService)) },
|
||||
sheetCame = { ms ->
|
||||
withTimeoutOrNull(ms) { AssistLink.shown.first { it >= asked } }?.let { (it - asked).coerceAtLeast(0) }
|
||||
},
|
||||
notify = { attempt ->
|
||||
getSystemService(NotificationManager::class.java).notify(HEARD_ID, wakeHeardNotification(this@WakeWordService, attempt.assistant))
|
||||
},
|
||||
showSignals = { (AssistLink.preparedAt >= asked) to (AssistLink.showFailedAt >= asked) },
|
||||
)
|
||||
val link = WakeAttempt(
|
||||
createdAt = AssistLink.createdAt,
|
||||
destroyedAt = AssistLink.destroyedAt,
|
||||
readyAt = AssistLink.readyAt,
|
||||
shutdownAt = AssistLink.shutdownAt,
|
||||
)
|
||||
record(this@WakeWordService, opener.open(phrase.words, link))
|
||||
} finally {
|
||||
AssistPresence.holdFor(SHEET_GRACE_MS)
|
||||
}
|
||||
} else {
|
||||
attempt = attempt.copy(outcome = WakeAttempt.OUT_NOT_CONNECTED)
|
||||
}
|
||||
// Then what is left: the sheet's activity, relied on only while the app is on screen.
|
||||
val fallback = wakeFallback(AppVisibility.visible)
|
||||
val started = runCatching { startActivity(AssistActivity.woken(this)) }
|
||||
if (fallback == WakeWay.Activity && started.isSuccess && sheetCame(asked)) {
|
||||
return record(attempt.copy(fallback = WakeWay.Activity.id))
|
||||
}
|
||||
getSystemService(NotificationManager::class.java).notify(HEARD_ID, wakeHeardNotification(this, attempt.assistant))
|
||||
record(attempt.copy(fallback = WakeWay.Notification.id))
|
||||
}
|
||||
|
||||
/** Whether a sheet came up since [asked] (the phone's elapsed clock), waiting a moment for it. */
|
||||
private suspend fun sheetCame(asked: Long): Boolean = withTimeoutOrNull(SHEET_WAIT_MS) { AssistLink.shown.first { it >= asked } } != null
|
||||
|
||||
/** Write [attempt] down: in the log under a fixed tag, and first among the last few in the settings. */
|
||||
private suspend fun record(attempt: WakeAttempt) {
|
||||
Log.i(
|
||||
TAG,
|
||||
"wake word heard: way=${attempt.way} outcome=${attempt.outcome} fallback=${attempt.fallback} assistant=${attempt.assistant} " +
|
||||
"readyAt=${attempt.readyAt} shutdownAt=${attempt.shutdownAt} ${attempt.detail}",
|
||||
)
|
||||
runCatching { lembas.instances.savePrefs { it.copy(wakeLog = wakeLogAdd(it.wakeLog, attempt)) } }
|
||||
}
|
||||
private var waking: Job? = null
|
||||
|
||||
private fun power() = getSystemService(PowerManager::class.java)
|
||||
|
||||
@@ -284,8 +277,29 @@ class WakeWordService : LifecycleService() {
|
||||
const val HEARD_ID = 7002
|
||||
private const val SHEET_GRACE_MS = 3_000L
|
||||
|
||||
/** How long a sheet has to say it is up before the way that was tried counts as not having opened it. */
|
||||
private const val SHEET_WAIT_MS = 2_500L
|
||||
/** The app's own scope: a wake and its record outlive the listening loop, and the service too. */
|
||||
private val wakeScope = CoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
|
||||
|
||||
/** What is true at this moment, for the opener and the record. */
|
||||
fun wakeFacts(context: Context): WakeFacts = WakeFacts(
|
||||
connected = LembasAssistService.current != null,
|
||||
active = LembasAssistService.isActive(context),
|
||||
role = LembasAssistService.holdsRole(context),
|
||||
recognizers = context.packageManager.hasSystemFeature(PackageManager.FEATURE_VOICE_RECOGNIZERS),
|
||||
screenOn = context.getSystemService(PowerManager::class.java).isInteractive,
|
||||
locked = context.getSystemService(KeyguardManager::class.java).isKeyguardLocked,
|
||||
visible = AppVisibility.visible,
|
||||
)
|
||||
|
||||
/**
|
||||
* Write [attempt] down: in the log under a fixed tag, and first among the last few in the
|
||||
* settings. Not cancellable: what happened is kept whatever ends meanwhile.
|
||||
*/
|
||||
suspend fun record(context: Context, attempt: WakeAttempt) = withContext(NonCancellable) {
|
||||
Log.i(TAG, "wake word heard: $attempt")
|
||||
runCatching { context.lembas.instances.savePrefs { it.copy(wakeLog = wakeLogAdd(it.wakeLog, attempt)) } }
|
||||
Unit
|
||||
}
|
||||
private const val TAG = "LLeMbasWake"
|
||||
const val ACTION_STOP = "eu.llembas.android.action.WAKE_STOP"
|
||||
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Android připojil asistenta v %1$s.</string>
|
||||
<string name="wake_link_shutdown">Android ho odpojil v %1$s.</string>
|
||||
<string name="wake_link_later">Android ho znovu připojil v %1$s.</string>
|
||||
<string name="wake_sheet_ms">Panel se zobrazil po %1$s ms.</string>
|
||||
<string name="wake_no_recognizers">Tento telefon nemá rozpoznávače hlasu, proto na něm Android nespouští službu hlasového asistenta.</string>
|
||||
<string name="wake_not_active">LLeMbas byl vybrán jako aplikace digitálního asistenta, ale Android ho nepoužíval jako hlasového asistenta.</string>
|
||||
<string name="wake_waited">Chvíli čekal, až ho Android připojí.</string>
|
||||
<string name="wake_show_failed">Android oznámil, že panel asistenta nedokázal zobrazit.</string>
|
||||
<string name="wake_assistant_inactive">Android právě nepoužívá LLeMbas jako hlasového asistenta</string>
|
||||
<string name="wake_assistant_inactive_line">Vyberte LLeMbas jako aplikaci digitálního asistenta znovu: klepněte sem, zvolte jinou aplikaci a potom LLeMbas. Do té doby ho dlouhé stisknutí otevírá jako běžnou obrazovku a budicí slovo může poslat jen oznámení.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas je asistent, ale Android ho právě nemá připojeného</string>
|
||||
<string name="wake_assistant_unbound_line">Dokud ho nepřipojí, budicí slovo nemůže panel otevřít samo. Klepnutím otevřete systémové nastavení asistenta: vyberte jinou aplikaci a potom znovu LLeMbas, tím se připojí.</string>
|
||||
<string name="wake_heard_could_not">Nepodařilo se otevřít samo — klepněte a ptejte se</string>
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Android hatte den Assistenten um %1$s verbunden.</string>
|
||||
<string name="wake_link_shutdown">Android hatte ihn um %1$s getrennt.</string>
|
||||
<string name="wake_link_later">Android hat ihn um %1$s wieder verbunden.</string>
|
||||
<string name="wake_sheet_ms">Das Blatt war nach %1$s ms da.</string>
|
||||
<string name="wake_no_recognizers">Dieses Telefon hat keine Spracherkenner, daher führt Android darauf keinen Sprachassistenten-Dienst aus.</string>
|
||||
<string name="wake_not_active">LLeMbas war als App für den digitalen Assistenten gewählt, aber Android nutzte es nicht als Sprachassistenten.</string>
|
||||
<string name="wake_waited">Kurz gewartet, bis Android ihn verbindet.</string>
|
||||
<string name="wake_show_failed">Android meldete, dass es das Blatt des Assistenten nicht anzeigen konnte.</string>
|
||||
<string name="wake_assistant_inactive">Android nutzt LLeMbas gerade nicht als Sprachassistenten</string>
|
||||
<string name="wake_assistant_inactive_line">Wähle LLeMbas erneut als App für den digitalen Assistenten: Tippe hier, wähle eine andere App und dann LLeMbas. Bis dahin öffnet langes Drücken es als gewöhnlichen Bildschirm, und das Aktivierungswort kann nur eine Benachrichtigung senden.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas ist der Assistent, aber Android hat ihn gerade nicht verbunden</string>
|
||||
<string name="wake_assistant_unbound_line">Solange das so ist, kann das Aktivierungswort das Blatt nicht selbst öffnen. Tippe für die Assistenten-Einstellung des Systems: Eine andere App und dann wieder LLeMbas zu wählen verbindet ihn.</string>
|
||||
<string name="wake_heard_could_not">Ließ sich nicht selbst öffnen — tippe, um zu fragen</string>
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Android había conectado el asistente a las %1$s.</string>
|
||||
<string name="wake_link_shutdown">Android lo había desconectado a las %1$s.</string>
|
||||
<string name="wake_link_later">Android volvió a conectarlo a las %1$s.</string>
|
||||
<string name="wake_sheet_ms">El panel apareció tras %1$s ms.</string>
|
||||
<string name="wake_no_recognizers">Este teléfono no tiene reconocedores de voz, así que Android no ejecuta en él ningún servicio de asistente de voz.</string>
|
||||
<string name="wake_not_active">LLeMbas estaba elegido como app de asistente digital, pero Android no lo usaba como asistente de voz.</string>
|
||||
<string name="wake_waited">Esperó un momento a que Android lo conectara.</string>
|
||||
<string name="wake_show_failed">Android dijo que no pudo mostrar el panel del asistente.</string>
|
||||
<string name="wake_assistant_inactive">Android no está usando LLeMbas como asistente de voz ahora mismo</string>
|
||||
<string name="wake_assistant_inactive_line">Elige de nuevo LLeMbas como app de asistente digital: toca aquí, elige otra app y luego LLeMbas. Hasta entonces la pulsación larga lo abre como una pantalla normal y la palabra de activación solo puede enviar una notificación.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas es el asistente, pero Android no lo tiene conectado ahora mismo</string>
|
||||
<string name="wake_assistant_unbound_line">Hasta que lo conecte, la palabra de activación no puede abrir el panel por sí sola. Toca para ir al ajuste del asistente del sistema: elegir otra app y luego LLeMbas de nuevo lo conecta.</string>
|
||||
<string name="wake_heard_could_not">No pudo abrirse por sí solo: toca para preguntar</string>
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Android avait connecté l’assistant à %1$s.</string>
|
||||
<string name="wake_link_shutdown">Android l’avait déconnecté à %1$s.</string>
|
||||
<string name="wake_link_later">Android l’a reconnecté à %1$s.</string>
|
||||
<string name="wake_sheet_ms">Le panneau était affiché après %1$s ms.</string>
|
||||
<string name="wake_no_recognizers">Ce téléphone n’a pas de reconnaissance vocale, Android n’y exécute donc aucun service d’assistant vocal.</string>
|
||||
<string name="wake_not_active">LLeMbas était choisi comme application d’assistant numérique, mais Android ne l’utilisait pas comme assistant vocal.</string>
|
||||
<string name="wake_waited">A attendu un instant qu’Android le connecte.</string>
|
||||
<string name="wake_show_failed">Android a indiqué qu’il n’avait pas pu afficher le panneau de l’assistant.</string>
|
||||
<string name="wake_assistant_inactive">Android n’utilise pas LLeMbas comme assistant vocal pour l’instant</string>
|
||||
<string name="wake_assistant_inactive_line">Choisissez de nouveau LLeMbas comme application d’assistant numérique : touchez ici, prenez une autre app, puis LLeMbas. D’ici là, l’appui long l’ouvre comme un écran ordinaire et le mot d’activation ne peut qu’envoyer une notification.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas est l’assistant, mais Android ne l’a pas connecté pour l’instant</string>
|
||||
<string name="wake_assistant_unbound_line">Tant que ce n’est pas fait, le mot d’activation ne peut pas ouvrir le panneau de lui-même. Touchez pour le réglage de l’assistant du système : choisir une autre app puis de nouveau LLeMbas le reconnecte.</string>
|
||||
<string name="wake_heard_could_not">N’a pas pu s’ouvrir de lui-même — touchez pour demander</string>
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Az Android ekkor csatlakoztatta az asszisztenst: %1$s.</string>
|
||||
<string name="wake_link_shutdown">Az Android ekkor választotta le: %1$s.</string>
|
||||
<string name="wake_link_later">Az Android ekkor csatlakoztatta újra: %1$s.</string>
|
||||
<string name="wake_sheet_ms">A panel %1$s ms után jelent meg.</string>
|
||||
<string name="wake_no_recognizers">Ezen a telefonon nincs hangfelismerő, ezért az Android nem futtat rajta hangasszisztens-szolgáltatást.</string>
|
||||
<string name="wake_not_active">A LLeMbas volt kiválasztva digitális asszisztens alkalmazásnak, de az Android nem használta hangasszisztensként.</string>
|
||||
<string name="wake_waited">Várt egy pillanatot, hogy az Android csatlakoztassa.</string>
|
||||
<string name="wake_show_failed">Az Android jelezte, hogy nem tudta megjeleníteni az asszisztens paneljét.</string>
|
||||
<string name="wake_assistant_inactive">Az Android most nem használja a LLeMbast hangasszisztensként</string>
|
||||
<string name="wake_assistant_inactive_line">Válaszd újra a LLeMbast digitális asszisztens alkalmazásnak: koppints ide, válassz másik alkalmazást, majd a LLeMbast. Addig a hosszú nyomás közönséges képernyőként nyitja meg, az ébresztőszó pedig csak értesítést tud küldeni.</string>
|
||||
<string name="wake_assistant_unbound">A LLeMbas az asszisztens, de az Android most nem csatlakoztatta</string>
|
||||
<string name="wake_assistant_unbound_line">Amíg nem csatlakoztatja, az ébresztőszó nem tudja magától megnyitni a panelt. Koppints a rendszer asszisztensbeállításához: ha másik alkalmazást, majd újra a LLeMbast választod, csatlakozik.</string>
|
||||
<string name="wake_heard_could_not">Nem tudott magától megnyílni — koppints a kérdezéshez</string>
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Android aveva collegato l’assistente alle %1$s.</string>
|
||||
<string name="wake_link_shutdown">Android l’aveva scollegato alle %1$s.</string>
|
||||
<string name="wake_link_later">Android l’ha ricollegato alle %1$s.</string>
|
||||
<string name="wake_sheet_ms">Il pannello è comparso dopo %1$s ms.</string>
|
||||
<string name="wake_no_recognizers">Questo telefono non ha riconoscitori vocali, quindi Android non vi esegue alcun servizio di assistente vocale.</string>
|
||||
<string name="wake_not_active">LLeMbas era scelto come app di assistente digitale, ma Android non lo usava come assistente vocale.</string>
|
||||
<string name="wake_waited">Ha atteso un momento che Android lo collegasse.</string>
|
||||
<string name="wake_show_failed">Android ha detto di non essere riuscito a mostrare il pannello dell’assistente.</string>
|
||||
<string name="wake_assistant_inactive">Android non sta usando LLeMbas come assistente vocale in questo momento</string>
|
||||
<string name="wake_assistant_inactive_line">Scegli di nuovo LLeMbas come app di assistente digitale: tocca qui, scegli un’altra app e poi LLeMbas. Fino ad allora la pressione prolungata lo apre come una schermata normale e la parola di attivazione può solo inviare una notifica.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas è l’assistente, ma Android non l’ha collegato in questo momento</string>
|
||||
<string name="wake_assistant_unbound_line">Finché non lo collega, la parola di attivazione non può aprire il pannello da sola. Tocca per l’impostazione dell’assistente di sistema: scegliere un’altra app e poi di nuovo LLeMbas lo collega.</string>
|
||||
<string name="wake_heard_could_not">Non è riuscito ad aprirsi da solo — tocca per chiedere</string>
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Android połączył asystenta o %1$s.</string>
|
||||
<string name="wake_link_shutdown">Android rozłączył go o %1$s.</string>
|
||||
<string name="wake_link_later">Android połączył go ponownie o %1$s.</string>
|
||||
<string name="wake_sheet_ms">Panel pojawił się po %1$s ms.</string>
|
||||
<string name="wake_no_recognizers">Ten telefon nie ma rozpoznawania mowy, więc Android nie uruchamia na nim usługi asystenta głosowego.</string>
|
||||
<string name="wake_not_active">LLeMbas był wybrany jako aplikacja asystenta cyfrowego, ale Android nie używał go jako asystenta głosowego.</string>
|
||||
<string name="wake_waited">Chwilę czekał, aż Android go połączy.</string>
|
||||
<string name="wake_show_failed">Android zgłosił, że nie mógł pokazać panelu asystenta.</string>
|
||||
<string name="wake_assistant_inactive">Android nie używa teraz LLeMbas jako asystenta głosowego</string>
|
||||
<string name="wake_assistant_inactive_line">Wybierz ponownie LLeMbas jako aplikację asystenta cyfrowego: dotknij tutaj, wybierz inną aplikację, a potem LLeMbas. Do tego czasu długie naciśnięcie otwiera go jako zwykły ekran, a słowo aktywujące może tylko wysłać powiadomienie.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas jest asystentem, ale Android nie ma go teraz połączonego</string>
|
||||
<string name="wake_assistant_unbound_line">Dopóki go nie połączy, słowo aktywujące nie może samo otworzyć panelu. Dotknij, aby przejść do systemowego ustawienia asystenta: wybranie innej aplikacji, a potem znów LLeMbas, połączy go.</string>
|
||||
<string name="wake_heard_could_not">Nie udało się otworzyć samo — dotknij, aby zapytać</string>
|
||||
|
||||
@@ -491,6 +491,13 @@
|
||||
<string name="wake_link_ready">Android pripojil asistenta o %1$s.</string>
|
||||
<string name="wake_link_shutdown">Android ho odpojil o %1$s.</string>
|
||||
<string name="wake_link_later">Android ho znova pripojil o %1$s.</string>
|
||||
<string name="wake_sheet_ms">Panel sa zobrazil po %1$s ms.</string>
|
||||
<string name="wake_no_recognizers">Tento telefón nemá rozpoznávače hlasu, preto na ňom Android nespúšťa službu hlasového asistenta.</string>
|
||||
<string name="wake_not_active">LLeMbas bol vybraný ako aplikácia digitálneho asistenta, no Android ho nepoužíval ako hlasového asistenta.</string>
|
||||
<string name="wake_waited">Chvíľu čakal, kým ho Android pripojí.</string>
|
||||
<string name="wake_show_failed">Android oznámil, že panel asistenta nedokázal zobraziť.</string>
|
||||
<string name="wake_assistant_inactive">Android práve nepoužíva LLeMbas ako hlasového asistenta</string>
|
||||
<string name="wake_assistant_inactive_line">Vyberte LLeMbas ako aplikáciu digitálneho asistenta znova: ťuknite sem, zvoľte inú aplikáciu a potom LLeMbas. Dovtedy ho dlhé stlačenie otvára ako bežnú obrazovku a budiace slovo môže poslať len oznámenie.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas je asistent, no Android ho práve nemá pripojeného</string>
|
||||
<string name="wake_assistant_unbound_line">Kým ho nepripojí, budiace slovo nemôže panel otvoriť samo. Ťuknutím otvoríte systémové nastavenie asistenta: vyberte inú aplikáciu a potom znova LLeMbas, tým sa pripojí.</string>
|
||||
<string name="wake_heard_could_not">Nepodarilo sa otvoriť samo — ťuknite a pýtajte sa</string>
|
||||
|
||||
@@ -493,6 +493,13 @@
|
||||
<string name="wake_link_ready">Android had connected the assistant at %1$s.</string>
|
||||
<string name="wake_link_shutdown">Android had disconnected it at %1$s.</string>
|
||||
<string name="wake_link_later">Android connected it again at %1$s.</string>
|
||||
<string name="wake_sheet_ms">The sheet was up after %1$s ms.</string>
|
||||
<string name="wake_no_recognizers">This phone has no voice recognisers, so Android runs no voice assistant service on it.</string>
|
||||
<string name="wake_not_active">LLeMbas was chosen as the digital assistant app, but Android was not using it as its voice assistant.</string>
|
||||
<string name="wake_waited">Waited a moment for Android to connect it.</string>
|
||||
<string name="wake_show_failed">Android said it could not show the assistant\'s sheet.</string>
|
||||
<string name="wake_assistant_inactive">Android is not using LLeMbas as its voice assistant right now</string>
|
||||
<string name="wake_assistant_inactive_line">Choose LLeMbas as the digital assistant app again: tap here, pick another app, then LLeMbas. Until then the long press opens it as an ordinary screen, and the wake word can only send a notification.</string>
|
||||
<string name="wake_assistant_unbound">LLeMbas is the assistant, but Android has not connected it right now</string>
|
||||
<string name="wake_assistant_unbound_line">Until it does, the wake word cannot open the sheet by itself. Tap for the system\'s assistant setting: choosing another app and then LLeMbas again connects it.</string>
|
||||
<string name="wake_heard_could_not">Could not open by itself — tap to ask</string>
|
||||
|
||||
@@ -13,6 +13,7 @@ import eu.llembas.android.wake.wakeKeywords
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
import kotlinx.coroutines.cancelAndJoin
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -140,6 +141,33 @@ class WakeListenerTest {
|
||||
job.cancelAndJoin()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun answeringTheWordIsNotCancelledByThePauseItCauses() = runTest {
|
||||
// What a real wake does: its first step pauses the listening (the sheet takes the
|
||||
// microphone), then it waits for the sheet, then it writes down what happened.
|
||||
val plans = MutableStateFlow(plan)
|
||||
var written = false
|
||||
val listener = WakeListener(
|
||||
say = { states += it },
|
||||
engine = { Detector(hearOn = 2) },
|
||||
microphone = { Mic() },
|
||||
heard = {
|
||||
plans.value = plan.copy(pause = WakePause.Assistant)
|
||||
delay(2_500)
|
||||
written = true
|
||||
},
|
||||
work = StandardTestDispatcher(testScheduler),
|
||||
)
|
||||
val job = launch { listener.follow(plans) }
|
||||
runCurrent()
|
||||
// The listening is paused, as asked...
|
||||
assertEquals(WakeState.Paused(WakePause.Assistant), states.last())
|
||||
// ...and the answer goes on to its end all the same.
|
||||
advanceTimeBy(2_501)
|
||||
assertTrue(written)
|
||||
job.cancelAndJoin()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aTapTriesAgainNowAndStartsTheWaitsOver() = runTest {
|
||||
var opens = 0
|
||||
|
||||
@@ -118,28 +118,40 @@ class WakeNotificationTest {
|
||||
listOf("Tue 10 Mar, 08:00:00 · “Hey Assistant”", "Opened the assistant."),
|
||||
words(WakeAttempt(at = at, phrase = "Hey Assistant", way = "session", outcome = WakeAttempt.OUT_OPENED, assistant = true, readyAt = at - 60_000)),
|
||||
)
|
||||
// The assistant in name, never connected in this run of the app: said step by step.
|
||||
// The assistant in name, but Android was not using it: said step by step.
|
||||
val missed = words(
|
||||
WakeAttempt(
|
||||
at = at,
|
||||
phrase = "Hey Assistant",
|
||||
way = "notification",
|
||||
outcome = WakeAttempt.OUT_NOT_CONNECTED,
|
||||
fallback = "notification",
|
||||
assistant = true,
|
||||
connectedLater =
|
||||
at + 30_000,
|
||||
),
|
||||
)
|
||||
assertEquals(
|
||||
listOf(
|
||||
"Tue 10 Mar, 08:00:00 · “Hey Assistant”",
|
||||
"Android had not connected LLeMbas as the assistant, so it could not open the sheet.",
|
||||
"Posted a notification to tap instead.",
|
||||
"LLeMbas was the digital assistant app.",
|
||||
"LLeMbas was chosen as the digital assistant app, but Android was not using it as its voice assistant.",
|
||||
"Android had not connected the assistant since the app started.",
|
||||
"Android connected it again at Tue 10 Mar, 08:00:30.",
|
||||
"screen=on locked=false visible=false created=- destroyed=- prepared=false",
|
||||
),
|
||||
words(
|
||||
WakeAttempt(
|
||||
at = at,
|
||||
phrase = "Hey Assistant",
|
||||
way = "notification",
|
||||
outcome = WakeAttempt.OUT_NOT_CONNECTED,
|
||||
fallback = "notification",
|
||||
assistant = true,
|
||||
connectedLater =
|
||||
at + 30_000,
|
||||
),
|
||||
),
|
||||
missed,
|
||||
)
|
||||
// Active and held, and still not connected: the plain "was the assistant" line, and that it was waited for.
|
||||
val waited =
|
||||
words(WakeAttempt(at = at, phrase = "Hey Assistant", outcome = WakeAttempt.OUT_NOT_CONNECTED, assistant = true, active = true, waited = true))
|
||||
assertEquals("LLeMbas was the digital assistant app.", waited[2])
|
||||
assertEquals("Waited a moment for Android to connect it.", waited[3])
|
||||
// A sheet that came says how long it took.
|
||||
assertEquals(
|
||||
"The sheet was up after 180 ms.",
|
||||
words(WakeAttempt(at = at, phrase = "Hey Assistant", way = "session", outcome = WakeAttempt.OUT_OPENED, sheetMs = 180))[2],
|
||||
)
|
||||
// Android's own words where it refused, and when it had connected and dropped the service.
|
||||
val refused = words(
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
package eu.llembas.android
|
||||
|
||||
import eu.llembas.android.wake.WakeAttempt
|
||||
import eu.llembas.android.wake.WakeFacts
|
||||
import eu.llembas.android.wake.WakeOpener
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* What is tried when the phrase is heard, in which order, and what is written down about it --
|
||||
* without a phone: Android's part is a script here (connected or not, refuses or not, a sheet
|
||||
* comes on the n-th wait or never).
|
||||
*/
|
||||
class WakeOpenerTest {
|
||||
/** One wake against a scripted Android. */
|
||||
private class Phone(
|
||||
var facts: WakeFacts,
|
||||
/** The waits for a sheet, in order: how long each took, or null for "none came". */
|
||||
val sheets: MutableList<Long?> = mutableListOf(),
|
||||
val connects: Boolean = false,
|
||||
val refuses: Throwable? = null,
|
||||
val activityRefused: Throwable? = null,
|
||||
) {
|
||||
val did = mutableListOf<String>()
|
||||
|
||||
val opener = WakeOpener(
|
||||
facts = { facts },
|
||||
awaitConnected = {
|
||||
did += "wait-connect"
|
||||
connects
|
||||
},
|
||||
showSession = {
|
||||
did += "session"
|
||||
refuses?.let { throw it }
|
||||
},
|
||||
startActivity = {
|
||||
did += "activity"
|
||||
activityRefused?.let { throw it }
|
||||
},
|
||||
sheetCame = {
|
||||
did += "wait-sheet"
|
||||
if (sheets.isEmpty()) null else sheets.removeAt(0)
|
||||
},
|
||||
notify = { did += "notify" },
|
||||
now = { 1_000 },
|
||||
)
|
||||
}
|
||||
|
||||
private val assistant = WakeFacts(connected = true, active = true, role = true)
|
||||
|
||||
@Test
|
||||
fun theAssistantsSheetOpensAndIsCountedOnlyOnceItIsUp() = runTest {
|
||||
val phone = Phone(assistant, sheets = mutableListOf(180))
|
||||
val attempt = phone.opener.open("Hey Assistant")
|
||||
assertEquals(listOf("session", "wait-sheet"), phone.did)
|
||||
assertEquals(WakeAttempt.OUT_OPENED, attempt.outcome)
|
||||
assertEquals("session", attempt.way)
|
||||
assertEquals(180L, attempt.sheetMs)
|
||||
assertEquals("", attempt.fallback)
|
||||
assertEquals("Hey Assistant", attempt.phrase)
|
||||
assertTrue(attempt.assistant && attempt.active)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aSlowSessionIsWaitedForAgainAndNothingElseIsPutBesideIt() = runTest {
|
||||
// No sheet in the first wait, then it comes: one sheet, no activity, no notification.
|
||||
val phone = Phone(assistant, sheets = mutableListOf(null, 400))
|
||||
val attempt = phone.opener.open("Hey Assistant")
|
||||
assertEquals(listOf("session", "wait-sheet", "wait-sheet"), phone.did)
|
||||
assertEquals(WakeAttempt.OUT_OPENED, attempt.outcome)
|
||||
assertEquals(WakeOpener.SHEET_WAIT_MS + 400, attempt.sheetMs)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aSessionThatNeverComesFallsToTheActivityThenToTheNotification() = runTest {
|
||||
// Connected, so the activity may start: it is waited for, and counts when it comes.
|
||||
val came = Phone(assistant, sheets = mutableListOf(null, null, 300))
|
||||
val opened = came.opener.open("Hey Assistant")
|
||||
assertEquals(listOf("session", "wait-sheet", "wait-sheet", "activity", "wait-sheet"), came.did)
|
||||
assertEquals(WakeAttempt.OUT_NO_SHEET, opened.outcome)
|
||||
assertEquals("activity", opened.fallback)
|
||||
// Nothing comes at all: the notification, and it is said.
|
||||
val never = Phone(assistant)
|
||||
val told = never.opener.open("Hey Assistant")
|
||||
assertEquals("notify", never.did.last())
|
||||
assertEquals(1, never.did.count { it == "notify" })
|
||||
assertEquals("notification", told.fallback)
|
||||
assertEquals(-1L, told.sheetMs)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun aRefusalIsKeptInAndroidsOwnWords() = runTest {
|
||||
val phone = Phone(assistant, refuses = SecurityException("Caller is not the current voice interaction service"), sheets = mutableListOf(250))
|
||||
val attempt = phone.opener.open("Hey Assistant")
|
||||
// Refused: no waiting for a session that was never asked for; straight to the activity.
|
||||
assertEquals(listOf("session", "activity", "wait-sheet"), phone.did)
|
||||
assertEquals(WakeAttempt.OUT_REFUSED, attempt.outcome)
|
||||
assertEquals("SecurityException: Caller is not the current voice interaction service", attempt.detail)
|
||||
assertEquals("activity", attempt.fallback)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun notConnectedAndNotOnScreenIsANotificationAndSaysWhy() = runTest {
|
||||
// The role held, but Android does not use the service: nothing to wait for.
|
||||
val phone = Phone(WakeFacts(connected = false, active = false, role = true, locked = true, screenOn = false))
|
||||
val attempt = phone.opener.open("Hey Assistant")
|
||||
// The activity is still tried (a phone may allow it), but it is not relied on or waited for.
|
||||
assertEquals(listOf("activity", "notify"), phone.did)
|
||||
assertEquals(WakeAttempt.OUT_NOT_CONNECTED, attempt.outcome)
|
||||
assertEquals("notification", attempt.way)
|
||||
assertEquals("notification", attempt.fallback)
|
||||
assertTrue(attempt.assistant)
|
||||
assertFalse(attempt.active)
|
||||
assertFalse(attempt.waited)
|
||||
assertTrue(attempt.locked)
|
||||
assertFalse(attempt.screenOn)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun activeButNotConnectedYetIsGivenAMomentToConnect() = runTest {
|
||||
val waiting = WakeFacts(connected = false, active = true, role = true)
|
||||
val phone = Phone(waiting, connects = true, sheets = mutableListOf(200))
|
||||
val attempt = phone.opener.open("Hey Assistant")
|
||||
assertEquals(listOf("wait-connect", "session", "wait-sheet"), phone.did)
|
||||
assertEquals(WakeAttempt.OUT_OPENED, attempt.outcome)
|
||||
assertTrue(attempt.waited)
|
||||
// It does not connect in time: the record says that it was waited for.
|
||||
val late = Phone(waiting, connects = false)
|
||||
val missed = late.opener.open("Hey Assistant")
|
||||
assertEquals(listOf("wait-connect", "activity", "notify"), late.did)
|
||||
assertEquals(WakeAttempt.OUT_NOT_CONNECTED, missed.outcome)
|
||||
assertTrue(missed.waited)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onScreenWithoutTheAssistantTheSheetIsTheAppsOwnScreen() = runTest {
|
||||
val phone = Phone(WakeFacts(connected = false, active = false, role = false, visible = true), sheets = mutableListOf(120))
|
||||
val attempt = phone.opener.open("Hey Assistant")
|
||||
assertEquals(listOf("activity", "wait-sheet"), phone.did)
|
||||
assertEquals("activity", attempt.way)
|
||||
assertEquals("activity", attempt.fallback)
|
||||
assertEquals(120L, attempt.sheetMs)
|
||||
assertFalse(attempt.assistant)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun withTheScreenOffTheSheetIsTheActivityAndItIsNotStartedTwice() = runTest {
|
||||
val dark = assistant.copy(screenOn = false)
|
||||
val phone = Phone(dark, sheets = mutableListOf(350))
|
||||
assertEquals("assistant_activity", phone.opener.open("Hey Assistant").way)
|
||||
assertEquals(listOf("activity", "wait-sheet"), phone.did)
|
||||
// It does not come up: a notification, not the same activity once more.
|
||||
val never = Phone(dark)
|
||||
val told = never.opener.open("Hey Assistant")
|
||||
assertEquals(listOf("activity", "wait-sheet", "notify"), never.did)
|
||||
assertEquals(WakeAttempt.OUT_NO_SHEET, told.outcome)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theRecordCarriesWhatTheAssistantServiceHadSaid() = runTest {
|
||||
val phone = Phone(WakeFacts(connected = false, active = false, role = true, recognizers = false))
|
||||
val link = WakeAttempt(createdAt = 10, destroyedAt = 20, readyAt = 11, shutdownAt = 19)
|
||||
val attempt = phone.opener.open("OK Computer", link)
|
||||
assertEquals(1_000L, attempt.at)
|
||||
assertEquals(listOf(10L, 20L, 11L, 19L), listOf(attempt.createdAt, attempt.destroyedAt, attempt.readyAt, attempt.shutdownAt))
|
||||
assertFalse(attempt.recognizers)
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ 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.wakeFallback
|
||||
import eu.llembas.android.wake.wakeKeywords
|
||||
import eu.llembas.android.wake.wakeLogAdd
|
||||
import eu.llembas.android.wake.wakeLogConnected
|
||||
@@ -174,9 +173,6 @@ class WakeTest {
|
||||
assertEquals(WakeWay.Activity, wakeWay(connected = false, screenOn = true, appVisible = true))
|
||||
assertEquals(WakeWay.Notification, wakeWay(connected = false, screenOn = true, appVisible = false))
|
||||
assertEquals(WakeWay.Notification, wakeWay(connected = false, screenOn = false, appVisible = false))
|
||||
// And when the assistant's own way did not open the sheet.
|
||||
assertEquals(WakeWay.Activity, wakeFallback(appVisible = true))
|
||||
assertEquals(WakeWay.Notification, wakeFallback(appVisible = false))
|
||||
repeat(3) { AppVisibility.activityStopped() }
|
||||
assertFalse(AppVisibility.visible)
|
||||
AppVisibility.activityStarted()
|
||||
|
||||
Reference in new issue
Block a user