The phone's own speech recognition is used by default when it works on the phone itself, song titles keep to one line, and the browser shows what you type

This commit is contained in:
Seb3thehacker committed 2026-11-29 18:09:09 -08:00
1 parent 27ea575107
commit 00e92274b0
5 files changed
+30 -9

No files matched your search

@@ -237,7 +237,12 @@ object CarAssistant {
onResult: (String) -> Unit, onResult: (String) -> Unit,
onError: (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 recognizer = r
r.setRecognitionListener(object : RecognitionListener { r.setRecognitionListener(object : RecognitionListener {
override fun onReadyForSpeech(params: Bundle?) = onListening() override fun onReadyForSpeech(params: Bundle?) = onListening()
@@ -560,7 +560,13 @@ private const val KEY_CLUSTER_VIDEO = "cluster_video_enabled"
hiddenAppsFlow.value = AppSettings.getString(app, KEY_HIDDEN_APPS, "") hiddenAppsFlow.value = AppSettings.getString(app, KEY_HIDDEN_APPS, "")
.split(",").filter { it.isNotEmpty() }.toSet() .split(",").filter { it.isNotEmpty() }.toSet()
experimentalFeaturesFlow.value = AppSettings.getString(app, KEY_EXPERIMENTAL_FEATURES, "false") == "true" 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" carSensorsFlow.value = AppSettings.getString(app, KEY_CAR_SENSORS, "false") == "true"
adaptiveVideoFlow.value = AppSettings.getString(app, KEY_ADAPTIVE_VIDEO, "false") == "true" adaptiveVideoFlow.value = AppSettings.getString(app, KEY_ADAPTIVE_VIDEO, "false") == "true"
clusterVideoFlow.value = AppSettings.getString(app, KEY_CLUSTER_VIDEO, "false") == "true" clusterVideoFlow.value = AppSettings.getString(app, KEY_CLUSTER_VIDEO, "false") == "true"
@@ -713,7 +713,7 @@ private fun StageControls(now: NowPlaying, media: CarMedia, modifier: Modifier)
Text( Text(
now.title.ifEmpty { stringResource(R.string.media_nothing_playing) }, now.title.ifEmpty { stringResource(R.string.media_nothing_playing) },
style = MaterialTheme.typography.displaySmall, fontWeight = FontWeight.Bold, style = MaterialTheme.typography.displaySmall, fontWeight = FontWeight.Bold,
maxLines = 2, overflow = TextOverflow.Ellipsis, maxLines = 1, overflow = TextOverflow.Ellipsis,
autoSize = TextAutoSize.StepBased( autoSize = TextAutoSize.StepBased(
minFontSize = if (compact) 20.sp else 22.sp, minFontSize = if (compact) 20.sp else 22.sp,
maxFontSize = MaterialTheme.typography.displaySmall.fontSize, maxFontSize = MaterialTheme.typography.displaySmall.fontSize,
@@ -768,7 +768,7 @@ private fun NowPlayingControls(now: NowPlaying, media: CarMedia, modifier: Modif
Text( Text(
now.title.ifEmpty { stringResource(R.string.media_nothing_playing) }, now.title.ifEmpty { stringResource(R.string.media_nothing_playing) },
style = MaterialTheme.typography.headlineMedium, fontWeight = FontWeight.Bold, style = MaterialTheme.typography.headlineMedium, fontWeight = FontWeight.Bold,
maxLines = 2, overflow = TextOverflow.Ellipsis, maxLines = 1, overflow = TextOverflow.Ellipsis,
) )
Text( Text(
listOf(now.artist, now.album).filter { it.isNotEmpty() }.joinToString(" - "), listOf(now.artist, now.album).filter { it.isNotEmpty() }.joinToString(" - "),
@@ -802,7 +802,7 @@ private fun ShortControls(now: NowPlaying, media: CarMedia, modifier: Modifier)
Text( Text(
now.title.ifEmpty { stringResource(R.string.media_nothing_playing) }, now.title.ifEmpty { stringResource(R.string.media_nothing_playing) },
style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.Bold, style = MaterialTheme.typography.headlineSmall, fontWeight = FontWeight.Bold,
maxLines = 2, overflow = TextOverflow.Ellipsis, maxLines = 1, overflow = TextOverflow.Ellipsis,
) )
Text( Text(
listOf(now.artist, now.album).filter { it.isNotEmpty() }.joinToString(" · "), listOf(now.artist, now.album).filter { it.isNotEmpty() }.joinToString(" · "),
@@ -845,7 +845,7 @@ private fun CompactPlayer(now: NowPlaying, media: CarMedia, art: android.graphic
Text( Text(
now.artist, now.artist,
style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant,
maxLines = 2, overflow = TextOverflow.Ellipsis, maxLines = 1, overflow = TextOverflow.Ellipsis,
modifier = Modifier.padding(top = 4.dp), modifier = Modifier.padding(top = 4.dp),
) )
} }
@@ -147,7 +147,17 @@ fun WebApp(content: String) {
Column(Modifier.fillMaxSize()) { Column(Modifier.fillMaxSize()) {
// Back steps through the page's history first (the interceptor above), then leaves. // Back steps through the page's history first (the interceptor above), then leaves.
if (!fullscreen) { 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 val url = pageUrl
if (!atStart && url != null && url.startsWith("http")) { if (!atStart && url != null && url.startsWith("http")) {
val saved = remember(bookmarks, url) { BrowserSettings.isBookmarked(url) } val saved = remember(bookmarks, url) { BrowserSettings.isBookmarked(url) }
+2 -2
View File
@@ -239,7 +239,7 @@
<string name="car_spoken_directions">Spoken directions</string> <string name="car_spoken_directions">Spoken directions</string>
<string name="car_spoken_directions_note">Turn it off if your map app\'s own voice already plays in the car.</string> <string name="car_spoken_directions_note">Turn it off if your map app\'s own voice already plays in the car.</string>
<string name="car_phone_speech">Use the phone\'s speech recognition</string> <string name="car_phone_speech">Use the phone\'s speech recognition</string>
<string name="car_phone_speech_note">On most phones that\'s Google\'s, which may send your voice to Google.</string> <string name="car_phone_speech_note">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.</string>
<string name="car_video_quality">Video quality</string> <string name="car_video_quality">Video quality</string>
<string name="car_video_quality_note">Light is easier on a phone that runs hot or closes apps. Applies on the next connection.</string> <string name="car_video_quality_note">Light is easier on a phone that runs hot or closes apps. Applies on the next connection.</string>
<string name="choice_video_light">Light (720p)</string> <string name="choice_video_light">Light (720p)</string>
@@ -564,7 +564,7 @@
<string name="car_directions_over_music">Directions over the music channel</string> <string name="car_directions_over_music">Directions over the music channel</string>
<string name="car_directions_over_music_note">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.</string> <string name="car_directions_over_music_note">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.</string>
<string name="carset_directions_note">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.</string> <string name="carset_directions_note">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.</string>
<string name="carset_phone_speech_note">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.</string> <string name="carset_phone_speech_note">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.</string>
<string name="carset_vehicle_data_note">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.</string> <string name="carset_vehicle_data_note">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.</string>
<string name="carset_adaptive_note">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.</string> <string name="carset_adaptive_note">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.</string>
<string name="carset_usable_height">Usable height %1$dpx of 480</string> <string name="carset_usable_height">Usable height %1$dpx of 480</string>