Skip to content

Hidden Debug screen + diagnostic logging for USB audio path#81

Merged
patrickrb merged 1 commit into
mainfrom
feat/debug-log-screen
May 29, 2026
Merged

Hidden Debug screen + diagnostic logging for USB audio path#81
patrickrb merged 1 commit into
mainfrom
feat/debug-log-screen

Conversation

@patrickrb
Copy link
Copy Markdown
Owner

Summary

Adds a hidden in-app Debug screen so users can diagnose problems (especially the car-dash USB audio routing issue from #80) without needing adb. Unlocked Android-developer-options style: tap the version row in Settings → About 7 times.

While we're at it, this also wires the USB audio open path into debug.log so the screen actually has useful signal. Previously those failures only went to logcat.

What's in it

  • GeneralVariables.fileLog() — static helper any class can call. Same format as existing per-class loggers.
  • MicRecorder.openUsbAudioInput() — every step now logs success/failure with context (device found, USB permission, open(), hasInput(), activateInput(48000)). The constructor logs the final routing decision (USB direct vs AudioRecord with mic fallback, including whether setPreferredDevice returned true).
  • Persistence: debugModeEnabled boolean in GeneralVariables, loaded by DatabaseOpr like other config flags.
  • AboutDialog: tap-counter on the version text. 7 taps → flips the flag, persists, toasts confirmation.
  • SettingsScreen: conditional Debug row under FAQ & Support, visible only when unlocked.
  • DebugLogScreen (new): full-screen Dialog with auto-refreshing tail (last 500 lines, every 2s), Share via FileProvider, Clear, and a Logcat: ON/OFF toggle that appends logcat -d --pid=<self> output for richer runtime detail during an active repro.
  • filepaths.xml: exposes external-files-path so the share intent can hand debug.log to the chooser.

Test plan

  • assembleDebug compiles clean.
  • Pixel 8: tap version 7x → toast appears, Debug row shows up in settings, screen opens, debug.log tail visible, Share opens chooser with debug.log, Clear empties the log, Logcat toggle adds new lines.
  • Car-dash Android 11 tablet: after Play update, pick (USB direct) in Audio Input, open Debug screen, share debug.log. Lines like openUsbAudioInput: NO USB permission... or activateInput(48000) FAILED ... should tell us exactly where the raw USB path is dying.

🤖 Generated with Claude Code

Surfaces the structured event log so users can diagnose problems
(particularly USB audio routing on car-dash tablets) without needing
adb. Unlocked by tapping the version row in About 7 times, matching
the Android developer-options convention. Hidden from normal users.

Includes:
- GeneralVariables.fileLog() static helper any class can call.
- MicRecorder + openUsbAudioInput() now record which step succeeded
  or failed (device-found, USB permission, open(), hasInput(),
  activateInput(48000)) and the final routing decision. Previously
  these went only to logcat, which a non-adb user can't see.
- debugModeEnabled persisted via the existing config DB.
- DebugLogScreen: auto-refreshing tail of debug.log, Share intent
  through FileProvider, Clear, and an optional logcat capture toggle
  that adds the running app's own logcat output for richer detail
  during an active repro.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@patrickrb patrickrb merged commit 6115c15 into main May 29, 2026
2 checks passed
@patrickrb patrickrb deleted the feat/debug-log-screen branch May 29, 2026 14:01
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