Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #22745 by parameterizing the hardcoded "magic numbers" (50 and 120) in the ensureA2uiReady function of the Android A2UIHandler class. The function previously used fixed values for the number of retry attempts and delay between attempts, which could not be adjusted for different scenarios or devices.
Changes:
- Added two optional parameters to
ensureA2uiReady:numberOfTries(default 50) anddelayToWaitMs(default 120L) - Replaced hardcoded values with the new parameters in the retry loop
| suspend fun ensureA2uiReady( | ||
| a2uiUrl: String, | ||
| numberOfTries: Int = 50, | ||
| delayToWaitMs: Long = 120L |
There was a problem hiding this comment.
The parameter name delayToWaitMs is inconsistent with the codebase convention. Other Android Kotlin files use the simpler naming pattern delayMs for delay parameters in milliseconds. For example, TalkModeManager.kt and VoiceWakeManager.kt both use delayMs: Long as a parameter name. Consider renaming this to delayMs for consistency.
| suspend fun ensureA2uiReady(a2uiUrl: String): Boolean { | ||
| suspend fun ensureA2uiReady( | ||
| a2uiUrl: String, | ||
| numberOfTries: Int = 50, |
There was a problem hiding this comment.
The parameter name numberOfTries is inconsistent with the codebase convention for parameters passed to repeat(). The established pattern in this Android codebase uses the naming format maxXAttempts (e.g., maxScaleAttempts, maxQualityAttempts in JpegSizeLimiter.kt). Consider renaming this to maxAttempts for consistency with the established convention.
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Fixes #22745. Recreating PR 22785 from a clean branch to resolve bot closure.
Greptile Summary
Extracted hardcoded magic numbers (50 retries, 120ms delay) from
ensureA2uiReadyinto configurable parameters with sensible defaults, addressing issue #22745.Confidence Score: 5/5
Last reviewed commit: 498d597