General: Reduce debug log noise during normal operation#550
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
AppleDeviceProfile's auto-generatedtoStringembedded the IRK and the proximity-payload AES key as raw byte arrays. AnyPodDevice.toString()(logged from numerous flow observers) cascaded those into logs and into support bundles. OverrodeAppleDeviceProfile.toStringto redact the two key fields. Same issue inProximityMessage.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.setupCommonEventHandlers(used by 25+ flow chains) wrapped every emission with.onEach { log("$identifier.onEach(): $it") }. For chains emittingPodDevice(BlePodMonitor, popUpCase) this dumped 4–5 KB of nestedtoStringper 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.MonitorModeStatesnapshot (mode, address sets, profile/AAP-session presence) and gated bydistinctUntilChanged.hasProfilesis carried separately because an empty profile list and a list of profiles withaddress == nullwould otherwise both produce an empty address set despite taking different downstream branches.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.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 naivevalue == previousdowngrade would also silence the device's confirmation of user-initiated changes. Per project memory, AAP protocol data must stay logged anyway.LogCatLoggerandFileLoggerwrite every priority. Level downgrades only help logcat viewers that filter by level — they do NOT shrink the support-bundle file logs. Only thedistinctUntilChangedgate and the removed per-emission log actually shrink file-log volume.MonitorServiceandPodFactoryhad no direct unit tests. Extracted the newMonitorModeStatederivation into a purebuildMonitorModeStateand addedMonitorModeStateTestcovering the empty / null-address / mixed profile cases, address derivation fromBluetoothDevice2, AAP session flag, and data-class equality (the propertydistinctUntilChangedrelies on).