-
Notifications
You must be signed in to change notification settings - Fork 843
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
PM-16062 Prevent account locks for ongoing autofill requests #4498
PM-16062 Prevent account locks for ongoing autofill requests #4498
Conversation
…ly for autofill and update restart timeout to look at app created events
No New Or Fixed Issues Found |
*/ | ||
CREATED, | ||
data class Created(val createdForAutofill: Boolean) : AppCreationState() |
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.
Can we make this isCreatedForAutofill
or wasCreatedForAutofill
? I think that might fit boolean patterns in the app a little better. Or maybe even isAutofill
, since the "created" part is already implied?
app/src/main/java/com/x8bit/bitwarden/data/autofill/util/AutofillIntentUtils.kt
Show resolved
Hide resolved
app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/AppCreationState.kt
Show resolved
Hide resolved
checkTimeoutReason = CheckTimeoutReason.APP_RESTARTED, | ||
) | ||
} | ||
private fun handleOnCreated(createdForAutofill: Boolean, isFirstCreated: Boolean) { |
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.
Borderline but if I remember correctly after the first param we'd usually break these onto new lines so its easier to add a 3rd, 4th, etc. later.
} | ||
private fun handleOnCreated(createdForAutofill: Boolean, isFirstCreated: Boolean) { | ||
val userId = activeUserId ?: return | ||
userIdTimerJobMap[userId]?.cancel() |
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.
I'm a little nervous about moving userIdTimerJobMap[userId]?.cancel()
to handleOnCreated
now that I see this. I wonder if we need to keep handleOnForeground
just for this. I believe the intention of this line is to say "whenever the app is foregrounded, we shouldn't have a timer going for the current user". In which case moving this here is a behavior change.
app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerImpl.kt
Show resolved
Hide resolved
@@ -491,27 +486,37 @@ class VaultLockManagerImpl( | |||
|
|||
VaultTimeout.OnAppRestart -> { | |||
// If this is an app restart, trigger the timeout action; otherwise ignore. | |||
if (checkTimeoutReason == CheckTimeoutReason.APP_RESTARTED) { | |||
if (checkTimeoutReason is CheckTimeoutReason.AppCreated) { | |||
// On restart the vault should be locked already but we may need to soft-logout | |||
// the user. |
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 doc likely needs updating because right now its only discussing the firstTimeCreation
case.
…n app is foregrounded
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4498 +/- ##
=========================================
+ Coverage 0 88.93% +88.93%
=========================================
Files 0 459 +459
Lines 0 39853 +39853
Branches 0 5638 +5638
=========================================
+ Hits 0 35444 +35444
- Misses 0 2441 +2441
- Partials 0 1968 +1968 ☔ View full report in Codecov by Sentry. |
private fun handleOnForeground() { | ||
val userId = activeUserId ?: return | ||
userIdTimerJobMap[userId]?.cancel() | ||
} |
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.
Can we leave this function back where it was to make the diff a tiny bit smaller?
app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerImpl.kt
Show resolved
Hide resolved
* @param createdForAutofill if the the creation event is due to an activity being launched | ||
* for autofill. | ||
*/ | ||
data class AppCreated(val firstTimeCreation: Boolean, val createdForAutofill: Boolean) : |
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.
Let's update the formatting to
data class AppCreated(
val firstTimeCreation: Boolean,
val createdForAutofill: Boolean
) :CheckTimeoutReason()
🎟️ Tracking
PM-16062
📔 Objective
VaultLockManager
.VaultLockManager
to check the timeout action instead on events of the activity being created for the first time with the added context of if was created for Autofill purposes.📸 Screenshots
pm16062.mp4
⏰ 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 confirmedissue 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