Skip to content

Conversation

phil1995
Copy link
Collaborator

Limits the background activity of the FileProviderExtension and thus fixes #206.
Due to the invalidation of the working set introduced in #156 a new enumeration of the working set was periodically triggered by the Files app in the case of a locked vault. This led to increased and unnecessary background activity of the FileProviderExtension.

This has now been fixed as follows:
When a vault is locked, the working set is invalidated once - this updates the sync anchor, which now has the invalidated flag set. If a subsequent enumerateChanges(for:from:) for the sync anchor fails with the invalidated flag set, the working set is not invalidated again, but the Files app is simply informed that there were no changes to the working set. This breaks the loop and the next time the vault is successfully unlocked, the working set will be enumerated from scratch again and the sync anchor will be updated, i.e. the updated date will be renewed and the invalidated flag will be removed.

Furthermore, XPC connections were not invalidated which caused the reference count for the FileProviderExtension to remain incremented after using an XPC connection. This has now also been fixed so that the FileProviderExtension object does not have to be held in memory longer than necessary.

@phil1995 phil1995 added this to the 2.2.4 milestone Apr 19, 2022
@phil1995 phil1995 requested a review from tobihagemann April 19, 2022 16:24
@phil1995 phil1995 merged commit bea9a36 into develop Apr 19, 2022
@phil1995 phil1995 deleted the bugfix/limit-fileprovider-background-activity branch April 19, 2022 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

High consumption of battery due to background activities
2 participants