Skip to content

fix(actions): stop 'ring my phone' ringing until force-close#126

Merged
abdulsaheel merged 2 commits into
OpenStrap:mainfrom
dannymcc:fix/ring-phone-auto-stop
Jul 23, 2026
Merged

fix(actions): stop 'ring my phone' ringing until force-close#126
abdulsaheel merged 2 commits into
OpenStrap:mainfrom
dannymcc:fix/ring-phone-auto-stop

Conversation

@dannymcc

@dannymcc dannymcc commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #115.

Problem

The double-tap ring my phone action played the default system ringtone but never held a reference to it and never stopped it. TYPE_RINGTONE loops by design, so it rang until the app was force-closed. Repeated taps stacked more unstoppable ringtones on top.

Fix (native, NativeChannels.kt)

  • Retain the Ringtone in activeRingtone so it can actually be stopped.
  • Auto-stop after 30 s (Handler.postDelayed) — it can never ring forever again.
  • A second double-tap while ringing stops it early (toggle).
  • Stop any in-progress ring before starting a new one (no stacking).

Find-my-phone norm: rings ~30 s, or until you double-tap again.

Testing

Verified by inspection — native Kotlin, and there's no CI/SDK here to run a build. Needs on-device confirmation: double-tap rings the phone, auto-stops at 30 s, and a second double-tap stops it early.

Summary by CodeRabbit

  • Bug Fixes
    • Improved “find my phone” ring behavior with more reliable ringtone selection, including an alarm fallback when needed.
    • Updated the ring action to act as a toggle: re-triggering stops the currently playing ringtone.
    • Added controlled auto-stop after a fixed timeout.
    • Preserved vibration alerts and enabled looping playback on supported Android versions.

The ring-phone action played the default TYPE_RINGTONE but kept no reference
to it and never stopped it, so it looped until the app was force-closed (OpenStrap#115);
repeated taps stacked more unstoppable ringtones. Retain the Ringtone, auto-stop
after 30s, let a second double-tap stop it early, and stop any in-progress ring
before starting a new one.
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ed70d1ad-4ef7-4230-acdf-734987ead506

📥 Commits

Reviewing files that changed from the base of the PR and between f8ea14a and 888377f.

📒 Files selected for processing (1)
  • android/app/src/main/kotlin/wtf/openstrap/openstrap_edge/NativeChannels.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • android/app/src/main/kotlin/wtf/openstrap/openstrap_edge/NativeChannels.kt

📝 Walkthrough

Walkthrough

NativeChannels retains ringtone playback state, supports repeated-trigger cancellation, applies ringtone and alarm fallbacks, enables looping on newer Android versions, and automatically stops playback after a timeout.

Changes

Ringtone control

Layer / File(s) Summary
Ringtone playback lifecycle
android/app/src/main/kotlin/wtf/openstrap/openstrap_edge/NativeChannels.kt
Adds main-thread timeout state, retains the active ringtone, toggles playback on repeated ringPhone actions, applies ringtone fallback resolution and API-specific looping, triggers vibration, and cancels scheduled or active playback through stopRing.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main fix: stopping the ringing phone behavior that previously persisted until force-close.
Linked Issues check ✅ Passed The code adds stop/start toggling and a 30-second auto-stop, which addresses the endless ringing bug in #115.
Out of Scope Changes check ✅ Passed The change stays focused on ringtone lifecycle control in NativeChannels.kt and adds no unrelated behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@android/app/src/main/kotlin/wtf/openstrap/openstrap_edge/NativeChannels.kt`:
- Around line 377-383: In the ring-start flow around rt.play(), register the
fail-safe ringStopRunnable and post its delayed callback before calling
vibrate(ctx). Keep the existing callback removal and RING_TIMEOUT_MS scheduling,
then invoke vibration afterward so a vibration exception cannot prevent timeout
registration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cb6cddb6-ac59-4666-b77b-fa51bc138782

📥 Commits

Reviewing files that changed from the base of the PR and between f8a1c1d and f8ea14a.

📒 Files selected for processing (1)
  • android/app/src/main/kotlin/wtf/openstrap/openstrap_edge/NativeChannels.kt

vibrate() can throw and perform() swallows it; scheduling the fail-safe stop
first ensures a vibration failure can't leave the ringtone running with no
scheduled stop. Addresses CodeRabbit review on OpenStrap#126.
@abdulsaheel
abdulsaheel merged commit c2452d5 into OpenStrap:main Jul 23, 2026
1 check passed
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.

double-tap-to-ring-my-phone bug keeps on ringing mobile until force closing the app

2 participants