Skip to content

General: Reduce debug log noise during normal operation#550

Merged
d4rken merged 6 commits into
mainfrom
refactor/reduce-log-noise
Apr 25, 2026
Merged

General: Reduce debug log noise during normal operation#550
d4rken merged 6 commits into
mainfrom
refactor/reduce-log-noise

Conversation

@d4rken

@d4rken d4rken commented Apr 25, 2026

Copy link
Copy Markdown
Member

What changed

Reduces debug log volume during normal operation and stops two paths from leaking AirPods pairing secrets into logs.

No user-facing functional change. The behavioral changes are all in what gets written to logcat / the support-bundle file logger.

Technical Context

  • Privacy: encryption keys no longer logged. AppleDeviceProfile's auto-generated toString embedded the IRK and the proximity-payload AES key as raw byte arrays. Any PodDevice.toString() (logged from numerous flow observers) cascaded those into logs and into support bundles. Overrode AppleDeviceProfile.toString to redact the two key fields. Same issue in ProximityMessage.Decrypter — both its success and failure logs printed the encryption key as a hex string per-advertisement. Stripped the key from those two log strings.
  • Volume: per-emission flow logger removed. setupCommonEventHandlers (used by 25+ flow chains) wrapped every emission with .onEach { log("$identifier.onEach(): $it") }. For chains emitting PodDevice (BlePodMonitor, popUpCase) this dumped 4–5 KB of nested toString per advertisement. Removed the per-emission line; onStart / onCompletion / cancellation / error logging stays. Call sites that genuinely need per-emission visibility can add an inline .onEach { log… } with whatever content makes sense for that flow.
  • Volume: MonitorService state block re-evaluated on every upstream emission. Now keyed on a typed MonitorModeState snapshot (mode, address sets, profile/AAP-session presence) and gated by distinctUntilChanged. hasProfiles is carried separately because an empty profile list and a list of profiles with address == null would otherwise both produce an empty address set despite taking different downstream branches.
  • Volume: PodFactory "Pod created" downgraded to VERBOSE. Fires per BLE advertisement (multiple per second per nearby device); only RSSI / reliability change between adjacent emissions.
  • Redundancy: dropped two paired noise logs. WidgetManager.refreshWidgets() is always preceded by an explanatory log at the call site (App.kt's "Main device changed" / "Pro status changed"); the inner log was pure echo. WidgetSettings.getWidgetProfile() logged on every read of an unchanged value — pure getter spam.
  • AAP Setting: X = Y [was: Y] re-emission noise was considered and deliberately not gated: the AAP engine optimistically updates state when the app sends a setting command, so a naive value == previous downgrade would also silence the device's confirmation of user-initiated changes. Per project memory, AAP protocol data must stay logged anyway.
  • LogCatLogger and FileLogger write every priority. Level downgrades only help logcat viewers that filter by level — they do NOT shrink the support-bundle file logs. Only the distinctUntilChanged gate and the removed per-emission log actually shrink file-log volume.
  • Test coverage: MonitorService and PodFactory had no direct unit tests. Extracted the new MonitorModeState derivation into a pure buildMonitorModeState and added MonitorModeStateTest covering the empty / null-address / mixed profile cases, address derivation from BluetoothDevice2, AAP session flag, and data-class equality (the property distinctUntilChanged relies on).

@d4rken d4rken merged commit 175aef9 into main Apr 25, 2026
10 checks passed
@d4rken d4rken deleted the refactor/reduce-log-noise branch April 25, 2026 14:19
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