[SettingsProvider] clean up if a setting failed to be serialized

Previously, if a setting is partially serialized with an error, the code
doesn't clean it up but proceeds to the next setting. This can cause
parsing errors on the next reboot. This CL captures such error and
deletes the problematic setting before trying again to persist the rest
of the settings. This makes sure that the final file doesn't contain any
partially serialized settings.

BUG: 295555884
Test: manually forcing a setting write to parially fail
Change-Id: I13337d9cbd325c0b6f9e526b3dc44bd4d03e3bd0
1 file changed