Repository navigation
ring: stop the torch when a volume key silences the alarm (EchoConnect stack) - #42
adityavardhansharma wants to merge 1 commit into
Conversation
When the ring page isn't in front (phone unlocked, heads-up only), Android handles the volume key itself and silences the insistent alarm without telling the app, so the flashlight kept blinking. Listen for volume changes while ringing and stop everything. Hold a wake lock capped at the 2 minute limit so the blink loop and timeout can't stall with the torch lit while the CPU sleeps, and check the deadline inside the blink loop too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 613c76d)
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
| // Our own jump to full alarm volume broadcasts too; ignore the first moment. | ||
| if (i.action == VOLUME_CHANGED && SystemClock.elapsedRealtime() - since < 1_000) return |
There was a problem hiding this comment.
Quick silence leaves torch flashing
A volume key pressed during the first second is ignored. When the phone shows only the alarm notification, Android can silence the sound while this guard drops the event. The torch then keeps flashing until another stop action or the two-minute timeout. Ignore the app’s own volume change specifically rather than dropping every volume event for one second.
| override fun onReceive(c: Context, i: Intent) { | ||
| // Our own jump to full alarm volume broadcasts too; ignore the first moment. | ||
| if (i.action == VOLUME_CHANGED && SystemClock.elapsedRealtime() - since < 1_000) return | ||
| if (ringing) stop(c) |
There was a problem hiding this comment.
Other volume changes stop ringing
VOLUME_CHANGED_ACTION reports volume changes, not just key presses. If a background app changes media volume after the first second, this callback also calls stop(c), even though nobody asked to stop finding the phone. That cancels the alarm and turns off the torch. Distinguish those changes from the intended volume-key action before stopping the alarm.
Cherry-pick of 613c76d from main onto the EchoConnect stack, so the next APK release includes it.
When a volume key silenced the ring alarm, the torch kept flashing. Pressing a volume key now stops the torch too.
The release built from this branch is EchoConnect 0.0.3, the first one signed with the permanent key.
🤖 Generated with Claude Code
Fix the volume-event checks before merging so quick key presses stop the torch and unrelated volume changes do not cancel the alarm.
Findings
Summary
The PR adds volume-change listening, a bounded wake lock, and an elapsed-time deadline to
Ring.kt.Reviews (1) · Last reviewed commit: "ring: stop the torch when a volume key s..." · Reviewed by Greptile