[PR #2539] [MERGED] [PM-724] reset lock delay when returning from activity result #29633

Closed
opened 2026-04-18 13:34:58 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/2539
Author: @mpbw2
Created: 5/25/2023
Status: Merged
Merged: 5/25/2023
Merged by: @mpbw2

Base: masterHead: bugfix/relock


📝 Commits (1)

  • 982006e reset lock delay when returning from activity result

📊 Changes

5 files changed (+16 additions, -6 deletions)

View changed files

📝 src/Android/MainActivity.cs (+3 -0)
📝 src/App/App.xaml.cs (+1 -1)
📝 src/App/Pages/Vault/AttachmentsPageViewModel.cs (+1 -1)
📝 src/Core/Abstractions/IVaultTimeoutService.cs (+2 -1)
📝 src/Core/Services/VaultTimeoutService.cs (+9 -3)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

To smooth out the process of using external functions (file selection, camera, etc.) in Android while also using immediate for vault timeout, a delay in locking was introduced to give users 60 seconds to perform the task outside of the Bitwarden app. Upon returning to the app however, the delay remained active so if the user backgrounded-then-foregrounded the app within the 60-second window, the immediate lock failed to fire (locking worked normally again once the delay time expired). This PR sets a flag to notify the app when the task connected to activity result is complete, so the delay can be reset immediately upon return.

Note that we're introducing a second value (the bool) instead of adjusting the delay directly in OnActivityResult to act as a second factor against intent forgery. The flag is meaningless unless the delay is set which can only happen when file selection is requested by a human (outside of any intent receivers).

Closes #2255

Code changes

  • VaultTimeoutService: Added ResetTimeoutDelay bool and reset logic inside ShouldTimeoutAsync method (also renamed DelayLockAndLogoutMs to DelayTimeoutMs for consistency)
  • MainActivity.cs: Enable ResetTimeoutDelay in OnActivityResult
  • Other: Renamed DelayLockAndLogoutMs to DelayTimeoutMs

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

🔄 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/2539 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 5/25/2023 **Status:** ✅ Merged **Merged:** 5/25/2023 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `master` ← **Head:** `bugfix/relock` --- ### 📝 Commits (1) - [`982006e`](https://github.com/bitwarden/android/commit/982006e1de44fadfef1751a8b040dc7073062399) reset lock delay when returning from activity result ### 📊 Changes **5 files changed** (+16 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/MainActivity.cs` (+3 -0) 📝 `src/App/App.xaml.cs` (+1 -1) 📝 `src/App/Pages/Vault/AttachmentsPageViewModel.cs` (+1 -1) 📝 `src/Core/Abstractions/IVaultTimeoutService.cs` (+2 -1) 📝 `src/Core/Services/VaultTimeoutService.cs` (+9 -3) </details> ### 📄 Description ## Type of change - [X] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> To smooth out the process of using external functions (file selection, camera, etc.) in Android while also using `immediate` for vault timeout, a delay in locking [was introduced](https://github.com/bitwarden/mobile/pull/1626) to give users 60 seconds to perform the task outside of the Bitwarden app. Upon returning to the app however, the delay remained active so if the user backgrounded-then-foregrounded the app within the 60-second window, the immediate lock failed to fire (locking worked normally again once the delay time expired). This PR sets a flag to notify the app when the task connected to activity result is complete, so the delay can be reset immediately upon return. Note that we're introducing a second value (the bool) instead of adjusting the delay directly in `OnActivityResult` to act as a second factor against intent forgery. The flag is meaningless unless the delay is set which can only happen when file selection is requested by a human (outside of any intent receivers). Closes #2255 ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **VaultTimeoutService:** Added `ResetTimeoutDelay` bool and reset logic inside `ShouldTimeoutAsync` method (also renamed `DelayLockAndLogoutMs` to `DelayTimeoutMs` for consistency) * **MainActivity.cs:** Enable `ResetTimeoutDelay` in `OnActivityResult` * **Other:** Renamed `DelayLockAndLogoutMs` to `DelayTimeoutMs` ## Before you submit - Please check for formatting errors (`dotnet format --verify-no-changes`) (required) - Please add **unit tests** where it makes sense to do so (encouraged but not required) - If this change requires a **documentation update** - notify the documentation team - If this change has particular **deployment requirements** - notify the DevOps team --- <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-04-18 13:34:58 -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#29633