From d6179bc12b756c5f917c3ac91aa7e7494e7dd654 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Wed, 12 Aug 2015 10:44:27 -0700 Subject: [PATCH] Update notifications on background thread. // FREEBIE --- .../securesms/DatabaseUpgradeActivity.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/org/thoughtcrime/securesms/DatabaseUpgradeActivity.java b/src/org/thoughtcrime/securesms/DatabaseUpgradeActivity.java index 2abc4574ae..f149d60f7e 100644 --- a/src/org/thoughtcrime/securesms/DatabaseUpgradeActivity.java +++ b/src/org/thoughtcrime/securesms/DatabaseUpgradeActivity.java @@ -88,7 +88,7 @@ public class DatabaseUpgradeActivity extends BaseActivity { .execute(VersionTracker.getLastSeenVersion(this)); } else { VersionTracker.updateLastSeenVersion(this); - MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret); + updateNotifications(this, masterSecret); startActivity((Intent)getIntent().getParcelableExtra("next_intent")); finish(); } @@ -123,6 +123,16 @@ public class DatabaseUpgradeActivity extends BaseActivity { } } + private void updateNotifications(final Context context, final MasterSecret masterSecret) { + new AsyncTask() { + @Override + protected Void doInBackground(Void... params) { + MessageNotifier.updateNotification(context, masterSecret); + return null; + } + }.execute(); + } + public interface DatabaseUpgradeListener { public void setProgress(int progress, int total); } @@ -230,7 +240,7 @@ public class DatabaseUpgradeActivity extends BaseActivity { @Override protected void onPostExecute(Void result) { VersionTracker.updateLastSeenVersion(DatabaseUpgradeActivity.this); - MessageNotifier.updateNotification(DatabaseUpgradeActivity.this, masterSecret); + updateNotifications(DatabaseUpgradeActivity.this, masterSecret); startActivity((Intent)getIntent().getParcelableExtra("next_intent")); finish();