Replace SharedPreferences with typed data stores - #702
Open
m4pl wants to merge 14 commits into
Open
Conversation
SharedPreferences kept every setting, every SAF grant and the last captured item in untyped files, read and written on whichever thread asked. Replace it with three DataStores serialized as JSON - one for what the owner configured, one for the SAF trees, one for what the app has captured - each opened once in a SingletonComponent module and reached only through its repository. A DataMigration per family carries the legacy keys over on first use. An absent field means "unset", so a value equal to today's default is never written and a later change to that default still reaches existing installs. Installs migrated from SharedPreferences are the exception for the per-mode settings, whose defaults the old code wrote out explicitly. Lockscreen isolation now falls out of the wiring rather than a branch inside a store: an ActivityComponent provider hands a SecureActivity an in-memory snapshot of the owner's settings and SAF grants, while captured-media state stays durable so a photo taken from the lockscreen survives the session. Writes now block until the store has committed, where SharedPreferences.apply() returned before the write landed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #686