Harden notification channels.

There's odd corner cases where channels can be duplicated. This commit
adds some hard checks where we trim any dead channels, and unset any
notification channels from recipients whose notification channel isn't
present in the system settings.
This commit is contained in:
Greyson Parrelli
2019-01-30 10:19:03 -08:00
parent ba67796992
commit e3b22dabce
2 changed files with 87 additions and 40 deletions

View File

@@ -282,6 +282,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
RecipientDatabase db = DatabaseFactory.getRecipientDatabase(getContext());
db.setMessageRingtone(recipient, NotificationChannels.getMessageRingtone(context, recipient));
db.setMessageVibrate(recipient, NotificationChannels.getMessageVibrate(context, recipient) ? VibrateState.ENABLED : VibrateState.DISABLED);
NotificationChannels.ensureCustomChannelConsistency(context);
return null;
}
}.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR);