[SettingsProvider] limit individual setting length

Long settings cannot be preserved due to the size limit of the
serialization. Limit individual setting's length to a certain size to
prevent the loss of data. Also try and catch the serialization exception
so that subsequent settings can still be preserved.

BUG: 260079172
BUG: 285337459
Test: Manual with steps in b/260079172#comment7
Test: Observe the PoC app crashes when trying to attack. Observe the
following exception in the logcat:

05-24 23:29:05.064 21080 22714 E DatabaseUtils:
java.lang.IllegalStateException: The name or the value of your setting:
[notification_sound] is too long. The max length allowed for the name or
the value string is 32768.

Test: atest SettingsStateTest
Merged-In: I9ece88a1c721cfdf2b19ad931b912c83df1a6f85
Change-Id: I9ece88a1c721cfdf2b19ad931b912c83df1a6f85
(cherry picked from commit 83dee20468be1550e0526cad0add5f683dd6c59f)
2 files changed