diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarAssistant.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarAssistant.kt index 4b72504..5fb996e 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarAssistant.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarAssistant.kt @@ -237,7 +237,12 @@ object CarAssistant { onResult: (String) -> Unit, onError: (String) -> Unit, ) { - val r = SpeechRecognizer.createSpeechRecognizer(context) + // The phone's on-device recognizer when it has one, so the voice stays on the phone. + val r = if (SpeechRecognizer.isOnDeviceRecognitionAvailable(context)) { + SpeechRecognizer.createOnDeviceSpeechRecognizer(context) + } else { + SpeechRecognizer.createSpeechRecognizer(context) + } recognizer = r r.setRecognitionListener(object : RecognitionListener { override fun onReadyForSpeech(params: Bundle?) = onListening() diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt index 1a446dc..42257b0 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/CarSettings.kt @@ -560,7 +560,13 @@ private const val KEY_CLUSTER_VIDEO = "cluster_video_enabled" hiddenAppsFlow.value = AppSettings.getString(app, KEY_HIDDEN_APPS, "") .split(",").filter { it.isNotEmpty() }.toSet() experimentalFeaturesFlow.value = AppSettings.getString(app, KEY_EXPERIMENTAL_FEATURES, "false") == "true" - systemSpeechFlow.value = AppSettings.getString(app, KEY_SYSTEM_SPEECH, "false") == "true" + // Unset: on when the phone recognizes speech on the phone itself, so nothing leaves it and + // Gearslip's own models (about 270 MB in memory) never load. Otherwise Gearslip's models. + systemSpeechFlow.value = when (AppSettings.getString(app, KEY_SYSTEM_SPEECH, "")) { + "true" -> true + "false" -> false + else -> runCatching { android.speech.SpeechRecognizer.isOnDeviceRecognitionAvailable(app) }.getOrDefault(false) + } carSensorsFlow.value = AppSettings.getString(app, KEY_CAR_SENSORS, "false") == "true" adaptiveVideoFlow.value = AppSettings.getString(app, KEY_ADAPTIVE_VIDEO, "false") == "true" clusterVideoFlow.value = AppSettings.getString(app, KEY_CLUSTER_VIDEO, "false") == "true" diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaScreen.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaScreen.kt index 42f1585..4830b43 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaScreen.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/MediaScreen.kt @@ -713,7 +713,7 @@ private fun StageControls(now: NowPlaying, media: CarMedia, modifier: Modifier) Text( now.title.ifEmpty { stringResource(R.string.media_nothing_playing) }, style = MaterialTheme.typography.displaySmall, fontWeight = FontWeight.Bold, - maxLines = 2, overflow = TextOverflow.Ellipsis, + maxLines = 1, overflow = TextOverflow.Ellipsis, autoSize = TextAutoSize.StepBased( minFontSize = if (compact) 20.sp else 22.sp, maxFontSize = MaterialTheme.typography.displaySmall.fontSize, @@ -768,7 +768,7 @@ private fun NowPlayingControls(now: NowPlaying, media: CarMedia, modifier: Modif Text( now.title.ifEmpty { stringResource(R.string.media_nothing_playing) }, style = MaterialTheme.typography.headlineMedium, fontWeight = FontWeight.Bold, - maxLines = 2, overflow = TextOverflow.Ellipsis, + maxLines = 1, overflow = TextOverflow.Ellipsis, ) Text( listOf(now.artist, now.album).filter { it.isNotEmpty() }.joinToString(" - "), @@ -802,7 +802,7 @@ private fun ShortControls(now: NowPlaying, media: CarMedia, modifier: Modifier) Text( now.title.ifEmpty { stringResource(R.string.media_nothing_playing) }, style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.Bold, - maxLines = 2, overflow = TextOverflow.Ellipsis, + maxLines = 1, overflow = TextOverflow.Ellipsis, ) Text( listOf(now.artist, now.album).filter { it.isNotEmpty() }.joinToString(" · "), @@ -845,7 +845,7 @@ private fun CompactPlayer(now: NowPlaying, media: CarMedia, art: android.graphic Text( now.artist, style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant, - maxLines = 2, overflow = TextOverflow.Ellipsis, + maxLines = 1, overflow = TextOverflow.Ellipsis, modifier = Modifier.padding(top = 4.dp), ) } diff --git a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt index d916912..3570ddf 100644 --- a/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt +++ b/gearslip/src/main/java/app/seb3thehacker/gearslip/car/WebApp.kt @@ -147,7 +147,17 @@ fun WebApp(content: String) { Column(Modifier.fillMaxSize()) { // Back steps through the page's history first (the interceptor above), then leaves. if (!fullscreen) { - ScreenHeader(pageTitle.takeUnless { atStart }.orEmpty().ifEmpty { stringResource(R.string.app_browser) }, Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) { + // While the car keyboard is up for an address or a search, the header is where the + // typing shows: the keyboard draws no field of its own, so the words were invisible + // until Enter loaded the search. + val typing = address ?: newBookmark + val heading = when { + // The end of what's typed, where the next letter goes, not the start. + typing != null -> typing.ifEmpty { stringResource(R.string.web_search) } + .let { if (it.length > 40) "…" + it.takeLast(39) else it } + "|" + else -> pageTitle.takeUnless { atStart }.orEmpty().ifEmpty { stringResource(R.string.app_browser) } + } + ScreenHeader(heading, Modifier.padding(horizontal = 16.dp, vertical = 8.dp)) { val url = pageUrl if (!atStart && url != null && url.startsWith("http")) { val saved = remember(bookmarks, url) { BrowserSettings.isBookmarked(url) } diff --git a/gearslip/src/main/res/values/strings.xml b/gearslip/src/main/res/values/strings.xml index 2ffa547..ab86d0d 100644 --- a/gearslip/src/main/res/values/strings.xml +++ b/gearslip/src/main/res/values/strings.xml @@ -239,7 +239,7 @@ Spoken directions Turn it off if your map app\'s own voice already plays in the car. Use the phone\'s speech recognition - On most phones that\'s Google\'s, which may send your voice to Google. + On by default when the phone understands speech on its own, so your voice stays on it and Gearslip doesn\'t load its own voice models. Otherwise the phone\'s service may send your voice to its maker, such as Google. Video quality Light is easier on a phone that runs hot or closes apps. Applies on the next connection. Light (720p) @@ -564,7 +564,7 @@ Directions over the music channel For a car that drops the connection or restarts after a spoken turn. Gearslip mixes each turn into the music instead of using the car\'s directions channel. Gearslip reads each turn aloud through the car\'s speakers, and the music dips while it speaks. Turn it off if your map app\'s own voice already plays in the car. - Listens through the phone\'s own speech service instead of Gearslip\'s. On most phones that\'s Google\'s, which may send your voice to Google. GrapheneOS has none, so Gearslip keeps using its own. + On by default when the phone understands speech on its own, so your voice stays on it. Otherwise the phone\'s service may send your voice to its maker, such as Google. Adds a Vehicle data tile: a live, raw dump of the head unit\'s sensor channel. Field labels (speed, RPM, fuel...) are carried over from other reverse-engineering projects and unverified against this car - treat them as a guess, not a fact, until you\'ve watched one change for yourself. Lowers the picture\'s quality when the car, or its Wi-Fi, can\'t keep up, and raises it again once it can. Takes effect on the next connection. Usable height %1$dpx of 480