[PR #3638] [MERGED] PM-10140: Add caching for large string resources to avoid delays and reduce timeout when retrieving ciphers #4305

Closed
opened 2025-11-26 23:42:39 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/3638
Author: @david-livefront
Created: 7/26/2024
Status: Merged
Merged: 7/29/2024
Merged by: @david-livefront

Base: mainHead: PM-10140-auto-fill-large-vaults


📝 Commits (1)

  • 601438f PM-10140: Add caching for large string resources to avoid delays and reduce timeout when retrieving ciphers

📊 Changes

12 files changed (+230 additions, -100 deletions)

View changed files

📝 app/src/main/java/com/x8bit/bitwarden/data/autofill/provider/AutofillCipherProviderImpl.kt (+1 -1)
app/src/main/java/com/x8bit/bitwarden/data/platform/manager/ResourceCacheManager.kt (+22 -0)
app/src/main/java/com/x8bit/bitwarden/data/platform/manager/ResourceCacheManagerImpl.kt (+32 -0)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/manager/ciphermatching/CipherMatchingManagerImpl.kt (+12 -12)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt (+10 -2)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/util/StringExtensions.kt (+3 -3)
📝 app/src/main/java/com/x8bit/bitwarden/data/platform/util/URIExtensions.kt (+9 -19)
📝 app/src/test/java/com/x8bit/bitwarden/data/autofill/processor/AutofillCipherProviderTest.kt (+2 -2)
app/src/test/java/com/x8bit/bitwarden/data/platform/manager/ResourceCacheManagerTest.kt (+92 -0)
📝 app/src/test/java/com/x8bit/bitwarden/data/platform/manager/ciphermatching/CipherMatchingManagerTest.kt (+14 -10)
📝 app/src/test/java/com/x8bit/bitwarden/data/util/StringExtensionsTest.kt (+8 -8)
📝 app/src/test/java/com/x8bit/bitwarden/data/util/UriExtensionsTest.kt (+25 -43)

📄 Description

🎟️ Tracking

PM-10140

📔 Objective

This PR addresses some issues we have seen with autofill on accounts with extremely large amounts of ciphers (3000+). The OS is timing out the autofill operation because we are taking longer than 5 seconds. To address this issue we have added some caching to the process of retrieving the suffix resources which is currently queried once for each cipher and can be a fairly expensive operation. In addition to this, we have also lowered our internal timeout for retrieving ciphers from 5 seconds to 2 seconds.

Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation or informed the documentation team

🦮 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

🔄 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/3638 **Author:** [@david-livefront](https://github.com/david-livefront) **Created:** 7/26/2024 **Status:** ✅ Merged **Merged:** 7/29/2024 **Merged by:** [@david-livefront](https://github.com/david-livefront) **Base:** `main` ← **Head:** `PM-10140-auto-fill-large-vaults` --- ### 📝 Commits (1) - [`601438f`](https://github.com/bitwarden/android/commit/601438fd8034f2034d6d327fde0669fb88543c30) PM-10140: Add caching for large string resources to avoid delays and reduce timeout when retrieving ciphers ### 📊 Changes **12 files changed** (+230 additions, -100 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/com/x8bit/bitwarden/data/autofill/provider/AutofillCipherProviderImpl.kt` (+1 -1) ➕ `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/ResourceCacheManager.kt` (+22 -0) ➕ `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/ResourceCacheManagerImpl.kt` (+32 -0) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/ciphermatching/CipherMatchingManagerImpl.kt` (+12 -12) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt` (+10 -2) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/util/StringExtensions.kt` (+3 -3) 📝 `app/src/main/java/com/x8bit/bitwarden/data/platform/util/URIExtensions.kt` (+9 -19) 📝 `app/src/test/java/com/x8bit/bitwarden/data/autofill/processor/AutofillCipherProviderTest.kt` (+2 -2) ➕ `app/src/test/java/com/x8bit/bitwarden/data/platform/manager/ResourceCacheManagerTest.kt` (+92 -0) 📝 `app/src/test/java/com/x8bit/bitwarden/data/platform/manager/ciphermatching/CipherMatchingManagerTest.kt` (+14 -10) 📝 `app/src/test/java/com/x8bit/bitwarden/data/util/StringExtensionsTest.kt` (+8 -8) 📝 `app/src/test/java/com/x8bit/bitwarden/data/util/UriExtensionsTest.kt` (+25 -43) </details> ### 📄 Description ## 🎟️ Tracking [PM-10140](https://bitwarden.atlassian.net/browse/PM-10140) ## 📔 Objective This PR addresses some issues we have seen with autofill on accounts with extremely large amounts of ciphers (3000+). The OS is timing out the autofill operation because we are taking [longer than 5 seconds](https://android.googlesource.com/platform/frameworks/base/+/master/services/autofill/java/com/android/server/autofill/RemoteFillService.java#328). To address this issue we have added some caching to the process of retrieving the suffix resources which is currently queried once for each cipher and can be a fairly expensive operation. In addition to this, we have also lowered our internal timeout for retrieving ciphers from 5 seconds to 2 seconds. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+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 [PM-10140]: https://bitwarden.atlassian.net/browse/PM-10140?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ --- <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 2025-11-26 23:42:39 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#4305