-
Notifications
You must be signed in to change notification settings - Fork 927
PM-28408: Update CameraPreview composable to address flakey test #6178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| androidx-biometrics = { group = "androidx.biometric", name = "biometric", version.ref = "androidxBiometrics" } | ||
| androidx-browser = { module = "androidx.browser:browser", version.ref = "androidxBrowser" } | ||
| androidx-camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "androidxCamera" } | ||
| androidx-camera-compose = { module = "androidx.camera:camera-compose", version.ref = "androidxCamera" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds native compose support for the camera, something that did not exist previously.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
|
Claude finished @david-livefront's task —— View job Code Review CompleteOverall Assessment: APPROVE with minor recommendations This PR successfully modernizes the camera implementation by migrating from Summary of Changes
FindingsFinding 1: Comment accuracy issue in QrCodeAnalyzerImpl.kt DetailsThe comment at ui/src/main/kotlin/com/bitwarden/ui/platform/feature/qrcodescan/util/QrCodeAnalyzerImpl.kt:22-23 states "ensure that only 1 QR code is analyzed at a time" but this is ambiguous given the behavioral change. Old behavior: Flag prevented multiple QR scans permanently (one-shot) The author confirmed this is intentional to allow re-scanning. The comment should clarify this distinction: /**
* Prevents concurrent processing of frames. The flag resets after each frame
* completes processing, allowing multiple QR codes to be scanned sequentially.
*/
private var isQrCodeInAnalysis: Boolean = falseThis makes the behavioral intent clearer for future maintainers. Finding 2: Potential test synchronization consideration DetailsThe new implementation introduces async initialization via
If the flaky test persists, consider whether tests need to wait for Reference: ui/src/main/kotlin/com/bitwarden/ui/platform/components/camera/CameraPreview.kt:44-67 Positive Observations
|
ui/src/main/kotlin/com/bitwarden/ui/platform/components/camera/CameraPreview.kt
Show resolved
Hide resolved
ui/src/main/kotlin/com/bitwarden/ui/platform/feature/qrcodescan/util/QrCodeAnalyzerImpl.kt
Outdated
Show resolved
Hide resolved
289ddb2 to
896dd14
Compare
ui/src/main/kotlin/com/bitwarden/ui/platform/components/camera/CameraPreview.kt
Outdated
Show resolved
Hide resolved
ui/src/main/kotlin/com/bitwarden/ui/platform/feature/qrcodescan/util/QrCodeAnalyzerImpl.kt
Outdated
Show resolved
Hide resolved
| ), | ||
| ) | ||
|
|
||
| qrCodeRead = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to only allow 1 QR code to be read but now we allow other to be processed once the code has been processed
|
Great job! No new security vulnerabilities introduced in this pull request |
58440a2 to
1f89dc1
Compare
ui/src/main/kotlin/com/bitwarden/ui/platform/feature/qrcodescan/util/QrCodeAnalyzerImpl.kt
Show resolved
Hide resolved
ui/src/main/kotlin/com/bitwarden/ui/platform/components/camera/CameraPreview.kt
Outdated
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6178 +/- ##
=======================================
Coverage 85.24% 85.24%
=======================================
Files 724 724
Lines 52899 52901 +2
Branches 7687 7687
=======================================
+ Hits 45092 45094 +2
Misses 5126 5126
Partials 2681 2681 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1f89dc1 to
0626947
Compare
andrebispo5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good. Let's see if it fixes the problem 🤞
|
Thanks @andrebispo5 |

🎟️ Tracking
PM-28408
📔 Objective
This PR updates the way the
CameraPreviewworks in order to fix a flakey test. I was never able to reproduce this issue in a controlled scenario, so this is a 🤞 moment. 😄⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes