Disclosure: I'm the developer of Bolo, and this post is published from my account. It was drafted and published by an AI agent working on my behalf from the project's source code.
Bolo (search "Bolo AI" on Google Play) shows a small floating mic next to a text field, only while the on-screen keyboard is open. A bug report said: close the keyboard, open it, close it, open it again quickly, and the mic is gone while the keyboard is plainly on screen. The phone log made the cause clear, and it is a pattern worth knowing: one signal was being used to switch itself off and then used as proof.
The log, in four lines
- The input restarted after a send.
- A safety check read "keyboard may be gone": one transient read while the keyboard re-laid out.
- The same check switched window tracking off, to save battery.
- With tracking off, the list of windows the service can see is empty. Every confirming check then also read "no keyboard", so the mic was hidden over an open keyboard.
The confirmation was not independent. Its answer was produced by step 3.
The rule that fixes it
Two small functions, kept in one object so they can be tested without a phone:
internal object WindowTrackingPolicy {
fun mayStopTracking(trackingOn: Boolean, keyboardSeen: Boolean, bubbleShowing: Boolean) =
trackingOn && !keyboardSeen && !bubbleShowing
fun canConfirmKeyboardGone(trackingOn: Boolean) = trackingOn
}
- "No keyboard" counts as evidence only while tracking is on. An empty window list with tracking off means "I am not looking", not "it is closed".
- Tracking may stop only once no mic is on screen. The battery saving is for after the mic is hidden, never what hides it.
And in the delayed hide, if tracking is off, the service turns it on and re-checks instead of hiding:
if (bubbleManager.isShowing() && !WindowTrackingPolicy.canConfirmKeyboardGone(windowTrackingEnabled)) {
setWindowTracking(true)
schedulePendingHide(KEYBOARD_CLOSE_CONFIRM_MS)
return@Runnable}```
## Test it by replaying the log
The test does not mock Android. It models only the parts that decide the mic (tracking flag, mic showing, "keyboard seen" cache) and replays the real timeline, once with the old rule and once with the new one:
```kotlin
@Test fun `old rule hides the mic over an open keyboard`() {
val old = Replay(newRule = false); runLog(old)
assertFalse(old.tracking); assertFalse(old.bubbleShowing)
}
@Test fun `new rule keeps the mic while the keyboard stays open`() {
val fixed = Replay(newRule = true); runLog(fixed)
assertTrue(fixed.tracking); assertTrue(fixed.bubbleShowing)
}
Keeping the old-rule test is deliberate: it proves the replay reproduces the bug, so the passing new-rule test means something. Two more tests pin the other directions: close-open-open (the last state wins) and a real close (the mic still hides, and tracking then stops).
The general lesson
When a check can change the conditions under which later checks run, a confirmation taken afterwards is not a second opinion. Either re-establish the conditions before confirming, or never let the check that saves resources run while the thing it affects is still on screen.
Bolo's Accessibility use is limited to detecting text fields so the mic can appear next to them.
Made by the developer whose account published this; drafted and published by an AI agent.
Top comments (0)