Skip to content
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

fix: bypassing app lock after timeout #2324

Merged
merged 3 commits into from
Oct 13, 2023
Merged

Conversation

saleniuk
Copy link
Contributor


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

There was an issue with locking logic that allowed the user to bypass entering passcode by reseting the timer.

Solutions

Removed keeping the timestamp in the data store, because according to acceptance criteria: "If the user kills the app, then a password is required even if the minute is not over", so it was additionally making the logic more complex than it should be. Thanks of that, the logic responsible for checking the lock and app visibility state and calculating the lock timeout could be simplified to not operate on timestamps but just provide a delay.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

  • set up the app lock
  • put app into background and wait 60s fot the app to be locked
  • open app - it should be locked
  • put app into background and open right away - it should still be locked

PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

Test Results

645 tests  +1   645 ✔️ +1   6m 42s ⏱️ - 1m 21s
  93 suites ±0       0 💤 ±0 
  93 files   ±0       0 ±0 

Results for commit c3ec807. ± Comparison against base commit d3d6bf7.

This pull request removes 12 and adds 13 tests. Note that renamed tests count towards both.
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndAppOpen_whenAppClosedAndOpenedAgainAfterLockTimeout_thenDoNotRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndAppOpen_whenAppClosedAndOpenedAgainBeforeLockTimeout_thenDoNotRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndInitialTimestamp_whenAppOpenedAfterLockTimeout_thenDoNotRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndInitialTimestamp_whenAppOpenedBeforeLockTimeout_thenDoNotRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndNoInitialTimestamp_whenAppOpenedAfterLockTimeout_thenDoNotRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndNoInitialTimestamp_whenAppOpenedBeforeLockTimeout_thenDoNotRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndAppOpen_whenAppClosedAndOpenedAgainAfterLockTimeout_thenRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndAppOpen_whenAppClosedAndOpenedAgainBeforeLockTimeout_thenDoNotRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndInitialTimestamp_whenAppOpenedAfterLockTimeout_thenRequirePasscode()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndInitialTimestamp_whenAppOpenedBeforeLockTimeout_thenDoNotRequirePasscode()
…
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndAppOpenedUnlocked_whenAppClosedAndOpenedAgainAfterLockTimeout_thenNotLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndAppOpenedUnlocked_whenAppClosedAndOpenedAgainBeforeLockTimeout_thenNotLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndAppOpenedUnlocked_whenAppClosedAndWaitedLessThanTimeout_thenNotLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabledAndAppOpenedUnlocked_whenAppClosedAndWaitedMoreThanTimeout_thenNotLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockDisabled_whenAppInitiallyOpened_thenNotLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndAppOpenedLocked_whenAppClosedAndOpenedBeforeLockTimeout_thenShouldStillBeLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndAppOpenedLocked_whenAppIsUnlocked_thenNotLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndAppOpenedUnlocked_whenAppClosedAndOpenedAgainAfterLockTimeout_thenLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndAppOpenedUnlocked_whenAppClosedAndOpenedAgainBeforeLockTimeout_thenNotLocked()
com.wire.android.ui.home.appLock.LockCodeTimeManagerTest ‑ givenLockEnabledAndAppOpenedUnlocked_whenAppClosedAndWaitedLessThanTimeout_thenNotLocked()
…

♻️ This comment has been updated with latest results.

@codecov
Copy link

codecov bot commented Oct 13, 2023

Codecov Report

Merging #2324 (c3ec807) into develop (d3d6bf7) will decrease coverage by 0.01%.
The diff coverage is 80.76%.

@@              Coverage Diff              @@
##             develop    #2324      +/-   ##
=============================================
- Coverage      41.27%   41.26%   -0.01%     
- Complexity      1051     1052       +1     
=============================================
  Files            328      328              
  Lines          11924    11924              
  Branches        1589     1585       -4     
=============================================
- Hits            4922     4921       -1     
  Misses          6533     6533              
- Partials         469      470       +1     
Files Coverage Δ
...ire/android/feature/ObserveAppLockConfigUseCase.kt 90.00% <100.00%> (ø)
...rc/main/kotlin/com/wire/android/ui/WireActivity.kt 0.00% <0.00%> (ø)
...tlin/com/wire/android/datastore/GlobalDataStore.kt 11.29% <0.00%> (-1.21%) ⬇️
...ire/android/ui/home/appLock/LockCodeTimeManager.kt 89.28% <90.90%> (-6.87%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3d6bf7...c3ec807. Read the comment docs.

@github-actions
Copy link
Contributor

APKs built during tests are available here. Scroll down to Artifacts!

@AndroidBob
Copy link
Collaborator

Build 1290 succeeded.

The build produced the following APK's:

@ohassine ohassine added this pull request to the merge queue Oct 13, 2023
Merged via the queue into develop with commit 04c06e3 Oct 13, 2023
14 checks passed
@ohassine ohassine deleted the fix/applock_time_manager_logic branch October 13, 2023 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants