[PR #6890] [MERGED] [PM-36867] fix: Disable card scanner on F-Droid builds (hotfix v2026.4.1) #93526

Closed
opened 2026-05-27 12:40:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/6890
Author: @SaintPatrck
Created: 5/8/2026
Status: Merged
Merged: 5/8/2026
Merged by: @SaintPatrck

Base: release/hotfix-v2026.4.1-bwpmHead: pm-36867/fdroid-card-scanner-hotfix


📝 Commits (3)

  • 6fe2ded [PM-36867] fix: Disable card scanner on F-Droid builds
  • 3548eba Match flavor-stub convention for unused parameter
  • d720c0c Alphabetize standardImplementation dependencies

📊 Changes

6 files changed (+68 additions, -8 deletions)

View changed files

📝 app/build.gradle.kts (+3 -2)
app/src/fdroid/kotlin/com/bitwarden/ui/platform/feature/cardscanner/util/CardTextAnalyzerImpl.kt (+27 -0)
📝 app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt (+7 -2)
📝 app/src/standard/kotlin/com/bitwarden/ui/platform/feature/cardscanner/util/CardTextAnalyzerImpl.kt (+7 -3)
📝 app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt (+24 -0)
📝 ui/build.gradle.kts (+0 -1)

📄 Description

🎟️ Tracking

📔 Objective

Hotfix port of #6888 to release/hotfix-v2026.4.1-bwpm.

F-Droid builds were crashing on launch because CardTextAnalyzerImpl was constructed eagerly as a default parameter on LocalManagerProvider — its property initializer called ML Kit's TextRecognition.getClient(...) during composition setup at app startup, which fails on devices without functional Google Play Services (GrapheneOS owner profile, restricted GMS, etc.).

F-Droid policy disallows Google ML Kit, so the card scanner is disabled there entirely:

  • ML Kit dependency moves from :ui to :app standardImplementation
  • CardTextAnalyzerImpl is split by flavor: real ML Kit impl in app/src/standard, no-op stub in app/src/fdroid (matching the existing flavor-stub pattern used by LogsManagerImpl, PlayBillingManagerImpl, AppReviewManagerImpl)
  • The standard impl's recognizer is now by lazy so ML Kit is never touched in <init>, hardening against future composition-default mistakes
  • VaultAddEditViewModel.isCardScannerEnabled is gated on !buildInfoManager.isFdroid for both initial state and the runtime feature-flag-update path, so the Scan Card button never renders on F-Droid builds

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/6890 **Author:** [@SaintPatrck](https://github.com/SaintPatrck) **Created:** 5/8/2026 **Status:** ✅ Merged **Merged:** 5/8/2026 **Merged by:** [@SaintPatrck](https://github.com/SaintPatrck) **Base:** `release/hotfix-v2026.4.1-bwpm` ← **Head:** `pm-36867/fdroid-card-scanner-hotfix` --- ### 📝 Commits (3) - [`6fe2ded`](https://github.com/bitwarden/android/commit/6fe2dedf5e0b091000eb07df551debf5365d52fb) [PM-36867] fix: Disable card scanner on F-Droid builds - [`3548eba`](https://github.com/bitwarden/android/commit/3548eba8e67fcc7d3e09a04df3289181c1705ab7) Match flavor-stub convention for unused parameter - [`d720c0c`](https://github.com/bitwarden/android/commit/d720c0c854fe15e223204d6c302d6174f1228a6e) Alphabetize standardImplementation dependencies ### 📊 Changes **6 files changed** (+68 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `app/build.gradle.kts` (+3 -2) ➕ `app/src/fdroid/kotlin/com/bitwarden/ui/platform/feature/cardscanner/util/CardTextAnalyzerImpl.kt` (+27 -0) 📝 `app/src/main/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt` (+7 -2) 📝 `app/src/standard/kotlin/com/bitwarden/ui/platform/feature/cardscanner/util/CardTextAnalyzerImpl.kt` (+7 -3) 📝 `app/src/test/kotlin/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt` (+24 -0) 📝 `ui/build.gradle.kts` (+0 -1) </details> ### 📄 Description ## 🎟️ Tracking - https://bitwarden.atlassian.net/browse/PM-36867 - https://github.com/bitwarden/android/issues/6884 ## 📔 Objective Hotfix port of #6888 to `release/hotfix-v2026.4.1-bwpm`. F-Droid builds were crashing on launch because `CardTextAnalyzerImpl` was constructed eagerly as a default parameter on `LocalManagerProvider` — its property initializer called ML Kit's `TextRecognition.getClient(...)` during composition setup at app startup, which fails on devices without functional Google Play Services (GrapheneOS owner profile, restricted GMS, etc.). F-Droid policy disallows Google ML Kit, so the card scanner is disabled there entirely: - ML Kit dependency moves from `:ui` to `:app` `standardImplementation` - `CardTextAnalyzerImpl` is split by flavor: real ML Kit impl in `app/src/standard`, no-op stub in `app/src/fdroid` (matching the existing flavor-stub pattern used by `LogsManagerImpl`, `PlayBillingManagerImpl`, `AppReviewManagerImpl`) - The standard impl's `recognizer` is now `by lazy` so ML Kit is never touched in `<init>`, hardening against future composition-default mistakes - `VaultAddEditViewModel.isCardScannerEnabled` is gated on `!buildInfoManager.isFdroid` for both initial state and the runtime feature-flag-update path, so the Scan Card button never renders on F-Droid builds --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-27 12:40:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#93526