From 0dd7b39bb1636ed7ec9fc38e9df77a580d177551 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Sat, 20 Oct 2018 22:42:35 -0700 Subject: [PATCH] Fix recipient prefrence display problem on Android P. Android P's new ringtone selector is a whole new activity that can cause RecipientPreferenceActivity to go through the full onCreate() flow after the ringtone selection. This could cause a race between setting the preference and reading the preference from the notification channel. Just threw them on a serial executor to guarantee ordering. --- .../thoughtcrime/securesms/RecipientPreferenceActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java index cb58a0ef7..7d821777a 100644 --- a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java +++ b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java @@ -282,7 +282,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi db.setMessageVibrate(recipient, NotificationChannels.getMessageVibrate(context, recipient) ? VibrateState.ENABLED : VibrateState.DISABLED); return null; } - }.execute(); + }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); } } else { customNotificationsPref.setVisible(false); @@ -493,7 +493,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi } return null; } - }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, value); + }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, value); return false; } @@ -562,7 +562,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi } return null; } - }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); + }.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR); return false; }