Skip to content

CircleToSearch with multi search engine support for all android

Kotlin

fix: hardware button launch triggers

AKS Labse4f461417ed9
diff --git a/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt b/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt
index cab839e..9bccabb 100644
--- a/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/CircleToSearchAccessibilityService.kt
@@ -88,21 +88,27 @@ private fun stickerCornerRadius(width: Int, height: Int, density: Float): Float
maxOf(16f * density, minOf(width, height) * 0.127f)
// --- Hardware button trigger prefs (all in app_prefs, default off) ---
+// NOTE: only volume keys can be observed — the power key is intercepted by the
+// system before any app or accessibility service sees it, so power-based
+// triggers (double power, power + volume) are not possible and are not offered.
private const val KEY_TRIGGER_DOUBLE_VOL_UP = "trigger_double_vol_up"
/** Opacity of the floating bubble while it is docked (half hidden behind a screen edge). */
private const val DOCKED_BUBBLE_ALPHA = 0.45f
private const val KEY_TRIGGER_DOUBLE_VOL_DOWN = "trigger_double_vol_down"
-private const val KEY_TRIGGER_DOUBLE_POWER = "trigger_double_power"
-private const val KEY_TRIGGER_POWER_VOL_UP = "trigger_power_vol_up"
-private const val KEY_TRIGGER_POWER_VOL_DOWN = "trigger_power_vol_down"
+private const val KEY_TRIGGER_LONG_VOL_UP = "trigger_long_vol_up"
+private const val KEY_TRIGGER_LONG_VOL_DOWN = "trigger_long_vol_down"
private const val KEY_TRIGGER_VOL_UP_DOWN = "trigger_vol_up_down"
-// Two presses of a single button within this window count as a double-tap
-private const val KEY_DOUBLE_TAP_MS = 350L
+// Two presses of a single button within this window count as a double-tap.
+// Reference remapper apps (Button Mapper & friends) default to ~400-450ms
+// with a tunable range; 350ms made detection feel flaky for slower taps.
+private const val KEY_DOUBLE_TAP_MS = 450L
// After a trigger fires, ignore presses for this long so one gesture can't
// fire twice (e.g. the second tap of a double-tap counting again later)
private const val KEY_TRIGGER_COOLDOWN_MS = 900L
+// Holding a volume key counts as long-press after this many ms
+private const val KEY_VOL_LONG_PRESS_MS = 600L
// Shape variants for the bottom-edge long-press overlays.
private enum class BottomEdgeShape { ARC_LEFT, ARC_RIGHT, SEMICIRCLE }
@@ -994,7 +1000,11 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
// Clear repository at the source to prevent any "ghost" flash of old data
BitmapRepository.clear()
-
+
+ takeScreenshotNow(searchModeOverride)
+ }
+
+ private fun takeScreenshotNow(searchModeOverride: Boolean?) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
takeScreenshot(
Display.DEFAULT_DISPLAY,
@@ -1757,18 +1767,41 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
override fun onInterrupt() {}
// --- Hardware button triggers ---
- // With FLAG_REQUEST_FILTER_KEY_EVENTS every volume/power press flows through
- // onKeyEvent. Volume/power are NEVER consumed (always return false), so volume
- // still adjusts and power still sleeps — presses are only observed to launch the
- // overlay. HOME is the one exception: a long-press is claimed by us (the release
- // is consumed) because this ROM routes long-press-home into the launcher's
- // contextual search, which fails silently, instead of dispatching assist — so
- // we detect the hold ourselves and a consumed UP prevents the stray "go home".
- private var lastVolUpDown = 0L
- private var lastVolDownDown = 0L
- private var lastPowerDown = 0L
+ // Volume-key triggers consume ONLY the events that belong to a trigger
+ // gesture. A double-tap-enabled key holds its first tap for the double-tap
+ // window: a second tap fires the trigger (no panel, clean screenshot), but
+ // an unresolved single tap is replayed as a completely normal volume press
+ // (panel included) via AudioManager. Keys with only a hold trigger keep
+ // taps fully normal and fire on the hold. Keys with no trigger configured
+ // pass everything straight to the system. The power key is intercepted by
+ // the system before any app sees it, so power-based triggers are impossible
+ // and not offered. HOME is the one exception: a long-press is claimed by
+ // us (the release is consumed) because this ROM routes long-press-home
+ // into the launcher's contextual search, which fails silently, instead of
+ // dispatching assist — so we detect the hold ourselves and a consumed UP
+ // prevents the stray "go home".
private var lastTriggerFiredAt = 0L
private val keysCurrentlyDown = mutableSetOf<Int>()
+ // Long-press volume: timer-based (like HOME) so it works even when the
+ // OEM never delivers repeat events. volLongKey is the key currently held
+ // (or -1); volLongFired stops further volume ramping once the hold has
+ // fired the trigger.
+ private var volLongKey = -1
+ private var volLongFired = false
+ // Double-tap detection: a consumed first DOWN waits out the double-tap
+ // window. If a second tap arrives it's a trigger; if the window expires
+ // the press is replayed as a NORMAL volume press (panel included), so an
+ // ordinary single tap is never swallowed. Maps are keyed by keyCode.
+ private val volPendingDownAt = mutableMapOf<Int, Long>()
+ private val volResolveRunnables = mutableMapOf<Int, Runnable>()
+ private val triggerHandler = android.os.Handler(android.os.Looper.getMainLooper())
+ private val audioManager by lazy { getSystemService(Context.AUDIO_SERVICE) as android.media.AudioManager }
+ private val volLongRunnable = Runnable {
+ if (volLongKey == -1) return@Runnable
+ volLongFired = true
+ android.util.Log.d("CircleToSearch", "Volume long-press fired")
+ fireHardwareTrigger()
+ }
private val homeKeyHandler = android.os.Handler(android.os.Looper.getMainLooper())
private var homeDownEventTime = 0L
private var homeLongPressTriggered = false
@@ -1783,8 +1816,31 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
val code = event.keyCode
when (event.action) {
android.view.KeyEvent.ACTION_DOWN -> {
- // Long-press repeats must not count as new presses
- if (event.repeatCount != 0) return false
+ val now = android.os.SystemClock.uptimeMillis()
+ // Repeats of a held key.
+ if (event.repeatCount != 0) {
+ if (code == android.view.KeyEvent.KEYCODE_VOLUME_UP ||
+ code == android.view.KeyEvent.KEYCODE_VOLUME_DOWN
+ ) {
+ if (!keyHasTriggers(code)) return false
+ if (volLongFired) return true // hold fired; stop here
+ if (volPendingDownAt.containsKey(code)) {
+ // Holding: this can't be a double-tap anymore.
+ cancelVolPending(code)
+ if (!longTriggerFor(code)) {
+ // No hold trigger on this key → behave like a
+ // normal hold: keep ramping with the panel.
+ replayVolumeStep(code)
+ }
+ // Hold trigger on: wait silently for its timer.
+ return true
+ }
+ // Long-only key: the system owns the repeats (we only
+ // consumed the initial DOWN and replayed it).
+ return false
+ }
+ return false
+ }
if (code == android.view.KeyEvent.KEYCODE_HOME) {
homeDownEventTime = event.eventTime
homeLongPressTriggered = false
@@ -1797,54 +1853,65 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
return false // short tap must still behave like the Home button
}
if (code != android.view.KeyEvent.KEYCODE_VOLUME_UP &&
- code != android.view.KeyEvent.KEYCODE_VOLUME_DOWN &&
- code != android.view.KeyEvent.KEYCODE_POWER
+ code != android.view.KeyEvent.KEYCODE_VOLUME_DOWN
) return false
- val now = android.os.SystemClock.uptimeMillis()
- keysCurrentlyDown.add(code)
+ // This key has no triggers configured → completely normal.
+ if (!keyHasTriggers(code)) return false
+ // Right after a trigger, keep everything normal for a moment.
if (now - lastTriggerFiredAt < KEY_TRIGGER_COOLDOWN_MS) return false
- var fire = false
- when (code) {
- android.view.KeyEvent.KEYCODE_VOLUME_UP -> {
- if (prefs.getBoolean(KEY_TRIGGER_DOUBLE_VOL_UP, false) &&
- now - lastVolUpDown <= KEY_DOUBLE_TAP_MS
- ) fire = true
- lastVolUpDown = now
- if (!fire && prefs.getBoolean(KEY_TRIGGER_POWER_VOL_UP, false) &&
- android.view.KeyEvent.KEYCODE_POWER in keysCurrentlyDown
- ) fire = true
- if (!fire && prefs.getBoolean(KEY_TRIGGER_VOL_UP_DOWN, false) &&
- android.view.KeyEvent.KEYCODE_VOLUME_DOWN in keysCurrentlyDown
- ) fire = true
+ // Self-heal: this key being still marked down means its UP was
+ // missed (screen off mid-press, OEM quirks) — stale state would
+ // poison combo detection and the long-press swallow flag.
+ if (code in keysCurrentlyDown) {
+ cancelVolPending(code)
+ if (code == volLongKey) {
+ triggerHandler.removeCallbacks(volLongRunnable)
+ volLongKey = -1
}
- android.view.KeyEvent.KEYCODE_VOLUME_DOWN -> {
- if (prefs.getBoolean(KEY_TRIGGER_DOUBLE_VOL_DOWN, false) &&
- now - lastVolDownDown <= KEY_DOUBLE_TAP_MS
- ) fire = true
- lastVolDownDown = now
- if (!fire && prefs.getBoolean(KEY_TRIGGER_POWER_VOL_DOWN, false) &&
- android.view.KeyEvent.KEYCODE_POWER in keysCurrentlyDown
- ) fire = true
- if (!fire && prefs.getBoolean(KEY_TRIGGER_VOL_UP_DOWN, false) &&
- android.view.KeyEvent.KEYCODE_VOLUME_UP in keysCurrentlyDown
- ) fire = true
+ volLongFired = false
+ }
+ keysCurrentlyDown.add(code)
+
+ // Gesture already complete?
+ var fire = false
+ if (prefs.getBoolean(KEY_TRIGGER_VOL_UP_DOWN, false)) {
+ val other = if (code == android.view.KeyEvent.KEYCODE_VOLUME_UP) {
+ android.view.KeyEvent.KEYCODE_VOLUME_DOWN
+ } else {
+ android.view.KeyEvent.KEYCODE_VOLUME_UP
}
- android.view.KeyEvent.KEYCODE_POWER -> {
- if (prefs.getBoolean(KEY_TRIGGER_DOUBLE_POWER, false) &&
- now - lastPowerDown <= KEY_DOUBLE_TAP_MS
- ) fire = true
- lastPowerDown = now
- if (!fire && prefs.getBoolean(KEY_TRIGGER_POWER_VOL_UP, false) &&
- android.view.KeyEvent.KEYCODE_VOLUME_UP in keysCurrentlyDown
- ) fire = true
- if (!fire && prefs.getBoolean(KEY_TRIGGER_POWER_VOL_DOWN, false) &&
- android.view.KeyEvent.KEYCODE_VOLUME_DOWN in keysCurrentlyDown
- ) fire = true
+ if (other in keysCurrentlyDown) fire = true
+ }
+ if (!fire && doubleTapTriggerFor(code) && volPendingDownAt.containsKey(code)) {
+ fire = true
+ }
+ if (fire) {
+ cancelVolPending(code)
+ val other = if (code == android.view.KeyEvent.KEYCODE_VOLUME_UP) {
+ android.view.KeyEvent.KEYCODE_VOLUME_DOWN
+ } else {
+ android.view.KeyEvent.KEYCODE_VOLUME_UP
}
+ cancelVolPending(other)
+ triggerHandler.removeCallbacks(volLongRunnable)
+ volLongKey = -1
+ fireHardwareTrigger()
+ return true
+ }
+
+ if (tapTriggerFor(code)) {
+ // Possibly the first tap of a double-tap: hold the press and
+ // decide after the window (trigger, or replay as normal).
+ scheduleVolResolve(code)
+ if (longTriggerFor(code)) armVolLongPress(code)
+ return true
}
- if (fire) fireHardwareTrigger()
+ // Long-press trigger only: the tap itself must stay normal.
+ replayVolumeStep(code)
+ armVolLongPress(code)
+ return true
}
android.view.KeyEvent.ACTION_UP -> {
if (code == android.view.KeyEvent.KEYCODE_HOME) {
@@ -1864,19 +1931,109 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
}
return false // normal short tap → Home behaves as usual
}
- keysCurrentlyDown.remove(code)
+ if (code == android.view.KeyEvent.KEYCODE_VOLUME_UP ||
+ code == android.view.KeyEvent.KEYCODE_VOLUME_DOWN
+ ) {
+ if (code == volLongKey) {
+ triggerHandler.removeCallbacks(volLongRunnable)
+ volLongKey = -1
+ }
+ keysCurrentlyDown.remove(code)
+ // Re-arm long-press only once neither volume key is held anymore.
+ if (android.view.KeyEvent.KEYCODE_VOLUME_UP !in keysCurrentlyDown &&
+ android.view.KeyEvent.KEYCODE_VOLUME_DOWN !in keysCurrentlyDown
+ ) volLongFired = false
+ if (!keyHasTriggers(code)) return false
+ // A pending first tap keeps waiting for its possible second
+ // tap (the resolve timer replays it as normal if none).
+ if (volPendingDownAt.containsKey(code)) return true
+ // Long-only key: pass the release through — the tap itself
+ // was already replayed as a normal press.
+ return false
+ }
}
}
// Never consume: system keeps full normal button behavior
return false
}
+ /** True while at least one trigger toggle exists for this specific key. */
+ private fun keyHasTriggers(code: Int): Boolean =
+ tapTriggerFor(code) || longTriggerFor(code)
+
+ /** Double-tap (or the both-keys combo, which uses this key as a tap). */
+ private fun tapTriggerFor(code: Int): Boolean =
+ doubleTapTriggerFor(code) || prefs.getBoolean(KEY_TRIGGER_VOL_UP_DOWN, false)
+
+ private fun doubleTapTriggerFor(code: Int): Boolean =
+ if (code == android.view.KeyEvent.KEYCODE_VOLUME_UP) prefs.getBoolean(KEY_TRIGGER_DOUBLE_VOL_UP, false)
+ else prefs.getBoolean(KEY_TRIGGER_DOUBLE_VOL_DOWN, false)
+
+ private fun longTriggerFor(code: Int): Boolean =
+ if (code == android.view.KeyEvent.KEYCODE_VOLUME_UP) prefs.getBoolean(KEY_TRIGGER_LONG_VOL_UP, false)
+ else prefs.getBoolean(KEY_TRIGGER_LONG_VOL_DOWN, false)
+
+ /**
+ * Replays a volume step exactly like the physical key would: volume changes
+ * AND the system panel appears (FLAG_SHOW_UI). Used for taps/holds that
+ * turned out not to be a trigger gesture, so the user loses nothing.
+ */
+ private fun replayVolumeStep(code: Int) {
+ // AOSP signature is (direction, suggestedStreamType, flags) — the two
+ // trailing args were once swapped here, which dropped FLAG_SHOW_UI
+ // (invisible adjustment on the wrong stream = "tap does nothing").
+ audioManager.adjustSuggestedStreamVolume(
+ if (code == android.view.KeyEvent.KEYCODE_VOLUME_UP) android.media.AudioManager.ADJUST_RAISE
+ else android.media.AudioManager.ADJUST_LOWER,
+ android.media.AudioManager.USE_DEFAULT_STREAM_TYPE,
+ android.media.AudioManager.FLAG_SHOW_UI or android.media.AudioManager.FLAG_PLAY_SOUND,
+ )
+ }
+
+ /** Consumes the first tap and waits out the double-tap window. */
+ private fun scheduleVolResolve(code: Int) {
+ cancelVolPending(code)
+ volPendingDownAt[code] = android.os.SystemClock.uptimeMillis()
+ val runnable = Runnable {
+ volPendingDownAt.remove(code)
+ // No second tap arrived → this was a normal single tap: replay it
+ // as a regular volume press so the panel and volume behave stock.
+ replayVolumeStep(code)
+ }
+ volResolveRunnables[code] = runnable
+ triggerHandler.postDelayed(runnable, KEY_DOUBLE_TAP_MS)
+ }
+
+ private fun cancelVolPending(code: Int) {
+ volResolveRunnables.remove(code)?.let { triggerHandler.removeCallbacks(it) }
+ volPendingDownAt.remove(code)
+ }
+
+ private fun armVolLongPress(code: Int) {
+ triggerHandler.removeCallbacks(volLongRunnable)
+ volLongKey = code
+ triggerHandler.postDelayed(volLongRunnable, KEY_VOL_LONG_PRESS_MS)
+ }
+
+ /** Distinct click so a fired trigger never feels silent or ambiguous. */
+ private fun hapticTriggerFeedback() {
+ try {
+ val vibrator = getSystemService(Context.VIBRATOR_SERVICE) as android.os.Vibrator
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
+ vibrator.vibrate(android.os.VibrationEffect.createPredefined(android.os.VibrationEffect.EFFECT_CLICK))
+ } else {
+ @Suppress("DEPRECATION")
+ vibrator.vibrate(20)
+ }
+ } catch (_: Exception) {}
+ }
+
private fun fireHardwareTrigger() {
lastTriggerFiredAt = android.os.SystemClock.uptimeMillis()
// Reset double-tap state so this gesture can't fire a second time
- lastVolUpDown = 0L
- lastVolDownDown = 0L
- lastPowerDown = 0L
+ cancelVolPending(android.view.KeyEvent.KEYCODE_VOLUME_UP)
+ cancelVolPending(android.view.KeyEvent.KEYCODE_VOLUME_DOWN)
+ hapticTriggerFeedback()
android.util.Log.d("CircleToSearch", "Hardware button trigger fired")
performCapture(null)
}
@@ -1946,6 +2103,7 @@ class CircleToSearchAccessibilityService : AccessibilityService() {
override fun onDestroy() {
super.onDestroy()
instance = null
+ triggerHandler.removeCallbacksAndMessages(null)
runCatching { translatorBridge?.destroy() }
translatorBridge = null
prefs.unregisterOnSharedPreferenceChangeListener(prefsListener)
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt
index da1adad..cfb48ff 100644
--- a/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/OverlaySettingsScreen.kt
@@ -122,9 +122,8 @@ private class OverlaySettingsState(context: Context) {
val HW_TRIGGER_KEYS = listOf(
"trigger_double_vol_up",
"trigger_double_vol_down",
- "trigger_double_power",
- "trigger_power_vol_up",
- "trigger_power_vol_down",
+ "trigger_long_vol_up",
+ "trigger_long_vol_down",
"trigger_vol_up_down"
)
}
@@ -310,7 +309,7 @@ private fun TriggersSettingsScreen(
SettingsGroup {
SettingsToggleItem(
title = stringResource(R.string.trigger_double_vol_up_title),
- subtitle = stringResource(R.string.trigger_hw_subtitle),
+ subtitle = stringResource(R.string.trigger_hw_vol_subtitle),
icon = Icons.AutoMirrored.Filled.VolumeUp,
checked = state.hwTriggers["trigger_double_vol_up"] ?: false,
onCheckedChange = { state.setTrigger("trigger_double_vol_up", it) }
@@ -318,34 +317,26 @@ private fun TriggersSettingsScreen(
SettingsGroupDivider()
SettingsToggleItem(
title = stringResource(R.string.trigger_double_vol_down_title),
- subtitle = stringResource(R.string.trigger_hw_subtitle),
+ subtitle = stringResource(R.string.trigger_hw_vol_subtitle),
icon = Icons.AutoMirrored.Filled.VolumeDown,
checked = state.hwTriggers["trigger_double_vol_down"] ?: false,
onCheckedChange = { state.setTrigger("trigger_double_vol_down", it) }
)
SettingsGroupDivider()
SettingsToggleItem(
- title = stringResource(R.string.trigger_double_power_title),
- subtitle = stringResource(R.string.trigger_hw_subtitle),
- icon = Icons.Default.PowerSettingsNew,
- checked = state.hwTriggers["trigger_double_power"] ?: false,
- onCheckedChange = { state.setTrigger("trigger_double_power", it) }
- )
- SettingsGroupDivider()
- SettingsToggleItem(
- title = stringResource(R.string.trigger_power_vol_up_title),
- subtitle = stringResource(R.string.trigger_hw_subtitle),
- icon = Icons.Default.Add,
- checked = state.hwTriggers["trigger_power_vol_up"] ?: false,
- onCheckedChange = { state.setTrigger("trigger_power_vol_up", it) }
+ title = stringResource(R.string.trigger_long_vol_up_title),
+ subtitle = stringResource(R.string.trigger_hw_long_subtitle),
+ icon = Icons.AutoMirrored.Filled.VolumeUp,
+ checked = state.hwTriggers["trigger_long_vol_up"] ?: false,
+ onCheckedChange = { state.setTrigger("trigger_long_vol_up", it) }
)
SettingsGroupDivider()
SettingsToggleItem(
- title = stringResource(R.string.trigger_power_vol_down_title),
- subtitle = stringResource(R.string.trigger_hw_subtitle),
- icon = Icons.Default.Add,
- checked = state.hwTriggers["trigger_power_vol_down"] ?: false,
- onCheckedChange = { state.setTrigger("trigger_power_vol_down", it) }
+ title = stringResource(R.string.trigger_long_vol_down_title),
+ subtitle = stringResource(R.string.trigger_hw_long_subtitle),
+ icon = Icons.AutoMirrored.Filled.VolumeDown,
+ checked = state.hwTriggers["trigger_long_vol_down"] ?: false,
+ onCheckedChange = { state.setTrigger("trigger_long_vol_down", it) }
)
SettingsGroupDivider()
SettingsToggleItem(
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleAppInfoScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleAppInfoScreen.kt
index 0b26a20..513dc04 100644
--- a/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleAppInfoScreen.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleAppInfoScreen.kt
@@ -123,9 +123,8 @@ private data class AppInfoData(
private val HW_TRIGGER_KEYS = listOf(
"trigger_double_vol_up",
"trigger_double_vol_down",
- "trigger_double_power",
- "trigger_power_vol_up",
- "trigger_power_vol_down",
+ "trigger_long_vol_up",
+ "trigger_long_vol_down",
"trigger_vol_up_down",
)
diff --git a/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleHomeScreen.kt b/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleHomeScreen.kt
index d2c0408..ec2ddf9 100644
--- a/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleHomeScreen.kt
+++ b/app/src/main/java/com/akslabs/circletosearch/ui/wobblepulldown/WobbleHomeScreen.kt
@@ -40,7 +40,6 @@ import androidx.compose.material.icons.automirrored.filled.VolumeUp
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Assistant
import androidx.compose.material.icons.filled.Layers
-import androidx.compose.material.icons.filled.PowerSettingsNew
import androidx.compose.material.icons.filled.TouchApp
import androidx.compose.material.icons.filled.Tune
import androidx.compose.material.icons.filled.Widgets
@@ -123,28 +122,33 @@ private const val BOTTOM_EDGE_MARKER = "cts_bottom_edge"
private val HW_TRIGGER_KEYS = listOf(
"trigger_double_vol_up",
"trigger_double_vol_down",
- "trigger_double_power",
- "trigger_power_vol_up",
- "trigger_power_vol_down",
+ "trigger_long_vol_up",
+ "trigger_long_vol_down",
"trigger_vol_up_down",
)
private val HW_TRIGGER_TITLES = listOf(
R.string.trigger_double_vol_up_title,
R.string.trigger_double_vol_down_title,
- R.string.trigger_double_power_title,
- R.string.trigger_power_vol_up_title,
- R.string.trigger_power_vol_down_title,
+ R.string.trigger_long_vol_up_title,
+ R.string.trigger_long_vol_down_title,
R.string.trigger_vol_up_down_title,
)
+private val HW_TRIGGER_SUBTITLES = listOf(
+ R.string.trigger_hw_vol_subtitle,
+ R.string.trigger_hw_vol_subtitle,
+ R.string.trigger_hw_long_subtitle,
+ R.string.trigger_hw_long_subtitle,
+ R.string.trigger_hw_subtitle,
+)
+
private val HW_TRIGGER_ICONS: List<ImageVector>
get() = listOf(
Icons.AutoMirrored.Filled.VolumeUp,
Icons.AutoMirrored.Filled.VolumeDown,
- Icons.Default.PowerSettingsNew,
- Icons.Default.Add,
- Icons.Default.Add,
+ Icons.AutoMirrored.Filled.VolumeUp,
+ Icons.AutoMirrored.Filled.VolumeDown,
Icons.Default.Add,
)
@@ -857,7 +861,7 @@ private fun HomeHwSheet(
if (index > 0) HomeRowDivider()
HomeToggleItem(
title = stringResource(HW_TRIGGER_TITLES[index]),
- subtitle = stringResource(R.string.trigger_hw_subtitle),
+ subtitle = stringResource(HW_TRIGGER_SUBTITLES[index]),
icon = HW_TRIGGER_ICONS[index],
checked = hwTriggers[key] ?: false,
enabled = a11yGranted,
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1581e1c..163c833 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -396,8 +396,8 @@
<string name="home_bottom_mid_title">Mid</string>
<string name="home_corner_size">Corner size</string>
<string name="home_mid_size">Mid size</string>
- <string name="home_assistant_setup_subtitle">Set as default assistant to use the home button and swipes</string>
- <string name="home_assistant_ready_subtitle">Home button and bottom-edge gestures work automatically</string>
+ <string name="home_assistant_setup_subtitle">Set as default assistant, then long-press the Home button to launch Circle to Search</string>
+ <string name="home_assistant_ready_subtitle">Long-press the Home button (or hold the gesture bar) to launch Circle to Search</string>
<string name="home_ready">Ready</string>
<string name="home_set_up">Set up</string>
<string name="home_hw_title">Hardware buttons</string>
@@ -428,11 +428,12 @@
<string name="trigger_bubble_subtitle">Floating button you can drag anywhere tap to start</string>
<string name="trigger_double_vol_up_title">Double-tap Volume Up</string>
<string name="trigger_double_vol_down_title">Double-tap Volume Down</string>
- <string name="trigger_double_power_title">Double-tap Power</string>
- <string name="trigger_power_vol_up_title">Power + Volume Up</string>
- <string name="trigger_power_vol_down_title">Power + Volume Down</string>
+ <string name="trigger_long_vol_up_title">Hold Volume Up</string>
+ <string name="trigger_long_vol_down_title">Hold Volume Down</string>
<string name="trigger_vol_up_down_title">Volume Up + Volume Down</string>
<string name="trigger_hw_subtitle">Starts Circle to Search</string>
+ <string name="trigger_hw_vol_subtitle">Double-tap starts Circle to Search; a single tap still works normally</string>
+ <string name="trigger_hw_long_subtitle">Hold briefly starts Circle to Search; tapping still works normally</string>
<string name="trigger_qs_title">Quick Settings tile</string>
<string name="trigger_qs_subtitle">Add the CTS tile from the Quick Settings edit screen</string>
<string name="trigger_hw_notice">Hardware button triggers need the accessibility service enabled.</string>