microsoft / appcenter-sdk-android

Development repository for the App Center SDK for Android
Other
277 stars 134 forks source link

Fix crash when direct boot #1623

Closed AnatolyPristensky closed 2 years ago

AnatolyPristensky commented 2 years ago

Description

Fix crash when direct boot is used.

Related PRs or issues

1599

AB#91315

DmitriyKirakosyan commented 2 years ago

@AnatolyPristensky I've tested your changes and found a problem. In this case, the updated SDK will create new preferences and thus the previously saved data will be lost. Instead of writing lots of code implementing the migration from old preferences to the new ones, It would make sense to create the protected preferences only in the case of the exception. Let's create normal shared preferences as we did before and handle the error, and only create protected shared preferences in case we catch the error. This way we can avoid supporting the migration between preferences.