Run notification reminder broadcast in an AsyncTask

Fixes #4016
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-09-04 09:40:59 -07:00
parent fd61fcef0d
commit 5ef65f039d

View File

@ -26,6 +26,7 @@ import android.database.Cursor;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.Spannable;
@ -416,10 +417,17 @@ public class MessageNotifier {
public static final String REMINDER_ACTION = "org.thoughtcrime.securesms.MessageNotifier.REMINDER_ACTION";
@Override
public void onReceive(Context context, Intent intent) {
public void onReceive(final Context context, final Intent intent) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
MasterSecret masterSecret = KeyCachingService.getMasterSecret(context);
int reminderCount = intent.getIntExtra("reminder_count", 0);
MessageNotifier.updateNotification(context, masterSecret, true, true, reminderCount + 1);
return null;
}
}.execute();
}
}