[PR #3669] [MERGED] PM-10528: Fix user switching issue due to rapid Activity recreation when locking #4329

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

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/3669
Author: @brian-livefront
Created: 8/2/2024
Status: Merged
Merged: 8/2/2024
Merged by: @brian-livefront

Base: mainHead: PM-10528-fix-account-switching-bug


📝 Commits (1)

  • d7af39f Fix user switching issue due to rapid Activity recreation when locking

📊 Changes

1 file changed (+4 additions, -0 deletions)

View changed files

📝 app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt (+4 -0)

📄 Description

🎟️ Tracking

PM-10528

📔 Objective

This PR fixes a bug in which switching from a user with a lock type of "immediate" to an unlocked account from the Vault screen doesn't actually update the Vault screen. The issue is that the fallback logic we have in place for restarting MainActivity whenever a vault locking event occurs (in order to clear out all vault data from memory) is happening too soon and this is interfering with the logic that destroys the current VaultScreen/VaultViewModel and creates a new set. This is a very similar reason why we added a delay of 500 milliseconds before restarting MainActivity whenever a user switch event occurs. This PR just adds the same delay for the locking events. This does not seem to have any visual downsides as far as I can tell and brings great parity to the user switching / vault locking behavior as far as restarting MainActivity is concerned.

📸 Screenshots

Before After

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/3669 **Author:** [@brian-livefront](https://github.com/brian-livefront) **Created:** 8/2/2024 **Status:** ✅ Merged **Merged:** 8/2/2024 **Merged by:** [@brian-livefront](https://github.com/brian-livefront) **Base:** `main` ← **Head:** `PM-10528-fix-account-switching-bug` --- ### 📝 Commits (1) - [`d7af39f`](https://github.com/bitwarden/android/commit/d7af39f5ef23a2af72e31fb2ae5458a8706fedd3) Fix user switching issue due to rapid Activity recreation when locking ### 📊 Changes **1 file changed** (+4 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt` (+4 -0) </details> ### 📄 Description ## 🎟️ Tracking [PM-10528](https://bitwarden.atlassian.net/browse/PM-10528) ## 📔 Objective This PR fixes a bug in which switching from a user with a lock type of "immediate" to an unlocked account from the Vault screen doesn't actually update the Vault screen. The issue is that the fallback logic we have in place for restarting `MainActivity` whenever a vault locking event occurs (in order to clear out all vault data from memory) is happening too soon and this is interfering with the logic that destroys the current `VaultScreen`/`VaultViewModel` and creates a new set. This is a very similar reason why we added a delay of 500 milliseconds before restarting `MainActivity` whenever a user switch event occurs. This PR just adds the same delay for the locking events. This does not seem to have any visual downsides as far as I can tell and brings great parity to the user switching / vault locking behavior as far as restarting `MainActivity` is concerned. ## 📸 Screenshots | Before | After | | --- | --- | | <video src="https://github.com/user-attachments/assets/0eba6b26-3342-4620-9604-10ddf04f115b" /> | <video src="https://github.com/user-attachments/assets/7a31a72b-3a86-43f9-b5a9-1ae572830b71" /> | ## ⏰ 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-10528]: https://bitwarden.atlassian.net/browse/PM-10528?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:43:00 -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#4329