Skip to content

PassCodeManager: add some logic to avoid counting the same activity twice#11242

Merged
tobiasKaminsky merged 2 commits intomasterfrom
fix/passcode-double-check
Jan 12, 2023
Merged

PassCodeManager: add some logic to avoid counting the same activity twice#11242
tobiasKaminsky merged 2 commits intomasterfrom
fix/passcode-double-check

Conversation

@AlvaroBrey
Copy link
Member

This is very specific to the case where an activity extending from AuthenticatorActivity and running as singleTask
gets restarted, in which case it calls PassCodeManager.onActivityResumed twice (once on onResume and once on onNewIntent).

  • Tests written, or not not needed

…wice

This is very specific to the case where an activity extending from AuthenticatorActivity _and_ running as `singleTask`
gets restarted, in which case it calls `PassCodeManager.onActivityResumed` twice (once on `onResume` and once on `onNewIntent`).

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
@AlvaroBrey
Copy link
Member Author

Looks like mocks arent working on android < P :(

Can't mock PowerManager on Android < 9

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
@github-actions
Copy link

Codacy

Lint

TypemasterPR
Warnings7676
Errors00

SpotBugs

CategoryBaseNew
Bad practice2727
Correctness4444
Dodgy code335335
Internationalization99
Multithreaded correctness99
Performance5858
Security1818
Total500500

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/11242.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #11242 (81db4f7) into master (cd8ed82) will increase coverage by 28.04%.
The diff coverage is 66.66%.

Additional details and impacted files
@@              Coverage Diff              @@
##             master   #11242       +/-   ##
=============================================
+ Coverage      3.21%   31.25%   +28.04%     
- Complexity      426     3359     +2933     
=============================================
  Files           565      565               
  Lines         41568    41577        +9     
  Branches       5627     5629        +2     
=============================================
+ Hits           1337    12996    +11659     
+ Misses        40149    26637    -13512     
- Partials         82     1944     +1862     
Impacted Files Coverage Δ
...owncloud/android/authentication/PassCodeManager.kt 72.05% <66.66%> (+72.05%) ⬆️
.../java/com/owncloud/android/datamodel/GalleryRow.kt 50.00% <0.00%> (ø)
...roid/ui/activity/ReceiveExternalFilesActivity.java 0.36% <0.00%> (+0.36%) ⬆️
...cloud/android/ui/preview/PreviewImageActivity.java 0.55% <0.00%> (+0.55%) ⬆️
...owncloud/android/ui/activity/UserInfoActivity.java 0.58% <0.00%> (+0.58%) ⬆️
...oud/android/ui/activity/NotificationsActivity.java 0.59% <0.00%> (+0.59%) ⬆️
...tcloud/client/database/migrations/RoomMigration.kt 0.66% <0.00%> (+0.66%) ⬆️
...ui/fragment/contactsbackup/BackupListFragment.java 0.94% <0.00%> (+0.94%) ⬆️
...loud/android/ui/activities/ActivitiesActivity.java 1.03% <0.00%> (+1.03%) ⬆️
...cloud/android/ui/activity/ExternalSiteWebView.java 1.11% <0.00%> (+1.11%) ⬆️
... and 282 more

@tobiasKaminsky tobiasKaminsky merged commit 7368809 into master Jan 12, 2023
@delete-merged-branch delete-merged-branch bot deleted the fix/passcode-double-check branch January 12, 2023 07:32
surinder-tsys added a commit to nextmcloud/android that referenced this pull request Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments