Skip to content

ring: stop the torch when a volume key silences the alarm (EchoConnect stack) - #42

Open
adityavardhansharma wants to merge 1 commit into
feat/echoconnect-own-filesfrom
fix/ring-torch-echoconnect
Open

adityavardhansharma wants to merge 1 commit into
feat/echoconnect-own-filesfrom
fix/ring-torch-echoconnect

Conversation

@adityavardhansharma

@adityavardhansharma adityavardhansharma commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

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

RetriggerView in GreptileConfidence Score: 3/5

Fix the volume-event checks before merging so quick key presses stop the torch and unrelated volume changes do not cancel the alarm.

Findings

  1. P1 Quick silence leaves torch flashing ▶
  2. P1 Other volume changes stop ringing ▶

Summary

The PR adds volume-change listening, a bounded wake lock, and an elapsed-time deadline to Ring.kt.

  • Volume changes now stop the phone's ring and flashing torch.
  • The ring keeps blinking until its two-minute limit.

Reviews (1) · Last reviewed commit: "ring: stop the torch when a volume key s..." · Reviewed by Greptile

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-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fd4f16ac-e4bd-43bc-a1d4-75e4df7e7af1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment on lines +25 to +26
// Our own jump to full alarm volume broadcasts too; ignore the first moment.
if (i.action == VOLUME_CHANGED && SystemClock.elapsedRealtime() - since < 1_000) return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant