diff --git a/briar-android/src/net/sf/briar/android/BriarService.java b/briar-android/src/net/sf/briar/android/BriarService.java index 85339923c..3582efc54 100644 --- a/briar-android/src/net/sf/briar/android/BriarService.java +++ b/briar-android/src/net/sf/briar/android/BriarService.java @@ -31,6 +31,7 @@ public class BriarService extends RoboService { private static final Logger LOG = Logger.getLogger(BriarService.class.getName()); + private final CountDownLatch dbLatch = new CountDownLatch(1); private final CountDownLatch startupLatch = new CountDownLatch(1); private final CountDownLatch shutdownLatch = new CountDownLatch(1); private final Binder binder = new BriarBinder(); @@ -101,6 +102,7 @@ public class BriarService extends RoboService { if(reopened) LOG.info("Database reopened"); else LOG.info("Database created"); } + dbLatch.countDown(); keyManager.start(); if(LOG.isLoggable(INFO)) LOG.info("Key manager started"); int pluginsStarted = pluginManager.start(); @@ -132,6 +134,10 @@ public class BriarService extends RoboService { } } + public void waitForDatabase() throws InterruptedException { + dbLatch.await(); + } + public void waitForStartup() throws InterruptedException { startupLatch.await(); } @@ -169,6 +175,11 @@ public class BriarService extends RoboService { return binder; } + public void waitForDatabase() throws InterruptedException { + waitForBinder(); + ((BriarBinder) binder).getService().waitForDatabase(); + } + public void waitForStartup() throws InterruptedException { waitForBinder(); ((BriarBinder) binder).getService().waitForStartup(); diff --git a/briar-android/src/net/sf/briar/android/HomeScreenActivity.java b/briar-android/src/net/sf/briar/android/HomeScreenActivity.java index 40cdc12dc..ef7ecd0a5 100644 --- a/briar-android/src/net/sf/briar/android/HomeScreenActivity.java +++ b/briar-android/src/net/sf/briar/android/HomeScreenActivity.java @@ -146,7 +146,7 @@ public class HomeScreenActivity extends RoboActivity { service.waitForShutdown(); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); } // Finish the activity and kill the JVM runOnUiThread(new Runnable() { @@ -164,7 +164,7 @@ public class HomeScreenActivity extends RoboActivity { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.addLocalAuthor(a); db.setRating(a.getId(), GOOD); @@ -181,7 +181,7 @@ public class HomeScreenActivity extends RoboActivity { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/blogs/BlogActivity.java b/briar-android/src/net/sf/briar/android/blogs/BlogActivity.java index c1c0cf077..95e651bfe 100644 --- a/briar-android/src/net/sf/briar/android/blogs/BlogActivity.java +++ b/briar-android/src/net/sf/briar/android/blogs/BlogActivity.java @@ -115,7 +115,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection headers = db.getGroupMessageHeaders(groupId); @@ -135,7 +135,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/blogs/BlogListActivity.java b/briar-android/src/net/sf/briar/android/blogs/BlogListActivity.java index adbca52d6..36eb0cbd8 100644 --- a/briar-android/src/net/sf/briar/android/blogs/BlogListActivity.java +++ b/briar-android/src/net/sf/briar/android/blogs/BlogListActivity.java @@ -135,7 +135,7 @@ OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Set local = new HashSet(); for(Group g : db.getLocalGroups()) local.add(g.getId()); @@ -166,7 +166,7 @@ OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -277,7 +277,7 @@ OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection headers = db.getGroupMessageHeaders(g.getId()); @@ -294,7 +294,7 @@ OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -318,7 +318,7 @@ OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); int available = 0; long now = System.currentTimeMillis(); for(GroupStatus s : db.getAvailableGroups()) { @@ -334,7 +334,7 @@ OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/blogs/ConfigureBlogActivity.java b/briar-android/src/net/sf/briar/android/blogs/ConfigureBlogActivity.java index 3c5699330..2ebd27260 100644 --- a/briar-android/src/net/sf/briar/android/blogs/ConfigureBlogActivity.java +++ b/briar-android/src/net/sf/briar/android/blogs/ConfigureBlogActivity.java @@ -164,7 +164,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection contacts = db.getContacts(); long duration = System.currentTimeMillis() - now; @@ -176,7 +176,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -208,7 +208,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); if(subscribe) { if(!wasSubscribed) db.subscribe(group); @@ -225,7 +225,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } runOnUiThread(new Runnable() { diff --git a/briar-android/src/net/sf/briar/android/blogs/CreateBlogActivity.java b/briar-android/src/net/sf/briar/android/blogs/CreateBlogActivity.java index 1d3f5deb4..7232e9d77 100644 --- a/briar-android/src/net/sf/briar/android/blogs/CreateBlogActivity.java +++ b/briar-android/src/net/sf/briar/android/blogs/CreateBlogActivity.java @@ -197,7 +197,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection contacts = db.getContacts(); long duration = System.currentTimeMillis() - now; @@ -209,7 +209,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -240,7 +240,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.addLocalGroup(g); db.subscribe(g); @@ -254,7 +254,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } runOnUiThread(new Runnable() { diff --git a/briar-android/src/net/sf/briar/android/blogs/ManageBlogsActivity.java b/briar-android/src/net/sf/briar/android/blogs/ManageBlogsActivity.java index 32b453e9d..236770393 100644 --- a/briar-android/src/net/sf/briar/android/blogs/ManageBlogsActivity.java +++ b/briar-android/src/net/sf/briar/android/blogs/ManageBlogsActivity.java @@ -78,7 +78,7 @@ implements DatabaseListener, OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); List available = new ArrayList(); for(GroupStatus s : db.getAvailableGroups()) @@ -93,7 +93,7 @@ implements DatabaseListener, OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/blogs/ReadBlogPostActivity.java b/briar-android/src/net/sf/briar/android/blogs/ReadBlogPostActivity.java index 51f099304..4ad6cc09d 100644 --- a/briar-android/src/net/sf/briar/android/blogs/ReadBlogPostActivity.java +++ b/briar-android/src/net/sf/briar/android/blogs/ReadBlogPostActivity.java @@ -206,7 +206,7 @@ implements OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.setReadFlag(messageId, read); long duration = System.currentTimeMillis() - now; @@ -218,7 +218,7 @@ implements OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -239,7 +239,7 @@ implements OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); byte[] body = db.getMessageBody(messageId); long duration = System.currentTimeMillis() - now; @@ -263,7 +263,7 @@ implements OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } catch(UnsupportedEncodingException e) { throw new RuntimeException(e); diff --git a/briar-android/src/net/sf/briar/android/blogs/WriteBlogPostActivity.java b/briar-android/src/net/sf/briar/android/blogs/WriteBlogPostActivity.java index de0bc88d5..2a134bbaa 100644 --- a/briar-android/src/net/sf/briar/android/blogs/WriteBlogPostActivity.java +++ b/briar-android/src/net/sf/briar/android/blogs/WriteBlogPostActivity.java @@ -169,7 +169,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection localAuthors = db.getLocalAuthors(); long duration = System.currentTimeMillis() - now; @@ -180,7 +180,7 @@ implements OnItemSelectedListener, OnClickListener { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -216,7 +216,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection groups = db.getLocalGroups(); long duration = System.currentTimeMillis() - now; @@ -227,7 +227,7 @@ implements OnItemSelectedListener, OnClickListener { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -350,7 +350,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.addLocalGroupMessage(m); long duration = System.currentTimeMillis() - now; @@ -361,7 +361,7 @@ implements OnItemSelectedListener, OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java b/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java index ccc41eb1b..11beeead2 100644 --- a/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java +++ b/briar-android/src/net/sf/briar/android/contact/ContactListActivity.java @@ -4,6 +4,7 @@ import static android.content.Intent.ACTION_SEND; import static android.content.Intent.EXTRA_STREAM; import static android.view.Gravity.CENTER; import static android.view.Gravity.CENTER_HORIZONTAL; +import static android.view.View.GONE; import static android.widget.LinearLayout.HORIZONTAL; import static android.widget.LinearLayout.VERTICAL; import static java.util.logging.Level.INFO; @@ -80,6 +81,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener { list.setLayoutParams(MATCH_WRAP_1); list.setAdapter(adapter); list.setOnItemClickListener(adapter); + list.setVisibility(GONE); layout.addView(list); layout.addView(new HorizontalBorder(this)); @@ -124,7 +126,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection contacts = db.getContacts(); Map times = db.getLastConnected(); @@ -137,7 +139,7 @@ implements OnClickListener, DatabaseListener, ConnectionListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/groups/ConfigureGroupActivity.java b/briar-android/src/net/sf/briar/android/groups/ConfigureGroupActivity.java index 6ba4670e7..df203717c 100644 --- a/briar-android/src/net/sf/briar/android/groups/ConfigureGroupActivity.java +++ b/briar-android/src/net/sf/briar/android/groups/ConfigureGroupActivity.java @@ -162,7 +162,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection contacts = db.getContacts(); long duration = System.currentTimeMillis() - now; @@ -174,7 +174,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -206,7 +206,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); if(subscribe) { if(!wasSubscribed) db.subscribe(group); @@ -223,7 +223,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } runOnUiThread(new Runnable() { diff --git a/briar-android/src/net/sf/briar/android/groups/CreateGroupActivity.java b/briar-android/src/net/sf/briar/android/groups/CreateGroupActivity.java index 7793a6a8a..e75f6fbf7 100644 --- a/briar-android/src/net/sf/briar/android/groups/CreateGroupActivity.java +++ b/briar-android/src/net/sf/briar/android/groups/CreateGroupActivity.java @@ -172,7 +172,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); Group g = groupFactory.createGroup(name); long now = System.currentTimeMillis(); db.subscribe(g); @@ -186,7 +186,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } catch(IOException e) { throw new RuntimeException(e); @@ -206,7 +206,7 @@ SelectContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection contacts = db.getContacts(); long duration = System.currentTimeMillis() - now; @@ -218,7 +218,7 @@ SelectContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/groups/GroupActivity.java b/briar-android/src/net/sf/briar/android/groups/GroupActivity.java index 9604a5c82..dca814895 100644 --- a/briar-android/src/net/sf/briar/android/groups/GroupActivity.java +++ b/briar-android/src/net/sf/briar/android/groups/GroupActivity.java @@ -113,7 +113,7 @@ OnClickListener, OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection headers = db.getGroupMessageHeaders(groupId); @@ -133,7 +133,7 @@ OnClickListener, OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java b/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java index 1601f97f2..fb84b857d 100644 --- a/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java +++ b/briar-android/src/net/sf/briar/android/groups/GroupListActivity.java @@ -133,7 +133,7 @@ OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); int available = 0; long now = System.currentTimeMillis(); for(GroupStatus s : db.getAvailableGroups()) { @@ -161,7 +161,7 @@ OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -272,7 +272,7 @@ OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection headers = db.getGroupMessageHeaders(g.getId()); @@ -288,7 +288,7 @@ OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -312,7 +312,7 @@ OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); int available = 0; long now = System.currentTimeMillis(); for(GroupStatus s : db.getAvailableGroups()) { @@ -328,7 +328,7 @@ OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/groups/ManageGroupsActivity.java b/briar-android/src/net/sf/briar/android/groups/ManageGroupsActivity.java index a62f607c3..00a2b1c65 100644 --- a/briar-android/src/net/sf/briar/android/groups/ManageGroupsActivity.java +++ b/briar-android/src/net/sf/briar/android/groups/ManageGroupsActivity.java @@ -78,7 +78,7 @@ implements DatabaseListener, OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); List available = new ArrayList(); for(GroupStatus s : db.getAvailableGroups()) @@ -93,7 +93,7 @@ implements DatabaseListener, OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/groups/ReadGroupPostActivity.java b/briar-android/src/net/sf/briar/android/groups/ReadGroupPostActivity.java index 9576d90ef..df4016056 100644 --- a/briar-android/src/net/sf/briar/android/groups/ReadGroupPostActivity.java +++ b/briar-android/src/net/sf/briar/android/groups/ReadGroupPostActivity.java @@ -230,7 +230,7 @@ implements OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.setReadFlag(messageId, read); long duration = System.currentTimeMillis() - now; @@ -242,7 +242,7 @@ implements OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -263,7 +263,7 @@ implements OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); byte[] body = db.getMessageBody(messageId); long duration = System.currentTimeMillis() - now; @@ -287,7 +287,7 @@ implements OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } catch(UnsupportedEncodingException e) { throw new RuntimeException(e); @@ -337,7 +337,7 @@ implements OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.setRating(authorId, r); long duration = System.currentTimeMillis() - now; @@ -349,7 +349,7 @@ implements OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java b/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java index 779857e43..70d72e288 100644 --- a/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java +++ b/briar-android/src/net/sf/briar/android/groups/WriteGroupPostActivity.java @@ -172,7 +172,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection localAuthors = db.getLocalAuthors(); long duration = System.currentTimeMillis() - now; @@ -183,7 +183,7 @@ implements OnItemSelectedListener, OnClickListener { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -219,7 +219,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); List groups = new ArrayList(); long now = System.currentTimeMillis(); for(Group g : db.getSubscriptions()) @@ -232,7 +232,7 @@ implements OnItemSelectedListener, OnClickListener { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -352,7 +352,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.addLocalGroupMessage(m); long duration = System.currentTimeMillis() - now; @@ -363,7 +363,7 @@ implements OnItemSelectedListener, OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/identity/CreateIdentityActivity.java b/briar-android/src/net/sf/briar/android/identity/CreateIdentityActivity.java index 9a331a038..48f1c6bfb 100644 --- a/briar-android/src/net/sf/briar/android/identity/CreateIdentityActivity.java +++ b/briar-android/src/net/sf/briar/android/identity/CreateIdentityActivity.java @@ -154,7 +154,7 @@ implements OnEditorActionListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.addLocalAuthor(a); db.setRating(a.getId(), GOOD); @@ -166,7 +166,7 @@ implements OnEditorActionListener, OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } runOnUiThread(new Runnable() { diff --git a/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java b/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java index ac063e7c0..926ce1df0 100644 --- a/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java +++ b/briar-android/src/net/sf/briar/android/invitation/AddContactActivity.java @@ -216,7 +216,7 @@ implements InvitationListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection localAuthors = db.getLocalAuthors(); long duration = System.currentTimeMillis() - now; @@ -227,7 +227,7 @@ implements InvitationListener { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java b/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java index 68bcd1391..e67052dd3 100644 --- a/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/ConversationActivity.java @@ -114,7 +114,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection headers = db.getPrivateMessageHeaders(contactId); @@ -134,7 +134,7 @@ implements DatabaseListener, OnClickListener, OnItemClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java b/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java index eacfcc1ec..d5f38caca 100644 --- a/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/ConversationListActivity.java @@ -98,7 +98,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); for(Contact c : db.getContacts()) { try { @@ -118,7 +118,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -202,7 +202,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Contact contact = db.getContact(c); Collection headers = @@ -219,7 +219,7 @@ implements OnClickListener, DatabaseListener, NoContactsDialog.Listener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } diff --git a/briar-android/src/net/sf/briar/android/messages/ReadPrivateMessageActivity.java b/briar-android/src/net/sf/briar/android/messages/ReadPrivateMessageActivity.java index d1b7d3d87..5d6245229 100644 --- a/briar-android/src/net/sf/briar/android/messages/ReadPrivateMessageActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/ReadPrivateMessageActivity.java @@ -200,7 +200,7 @@ implements OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); db.setReadFlag(messageId, read); long duration = System.currentTimeMillis() - now; @@ -212,7 +212,7 @@ implements OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -233,7 +233,7 @@ implements OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); byte[] body = db.getMessageBody(messageId); long duration = System.currentTimeMillis() - now; @@ -257,7 +257,7 @@ implements OnClickListener { LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } catch(UnsupportedEncodingException e) { throw new RuntimeException(e); diff --git a/briar-android/src/net/sf/briar/android/messages/WritePrivateMessageActivity.java b/briar-android/src/net/sf/briar/android/messages/WritePrivateMessageActivity.java index a948891e2..f0b4b6bac 100644 --- a/briar-android/src/net/sf/briar/android/messages/WritePrivateMessageActivity.java +++ b/briar-android/src/net/sf/briar/android/messages/WritePrivateMessageActivity.java @@ -155,7 +155,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); Collection contacts = db.getContacts(); long duration = System.currentTimeMillis() - now; @@ -166,7 +166,7 @@ implements OnItemSelectedListener, OnClickListener { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -227,7 +227,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); long now = System.currentTimeMillis(); localAuthor = db.getLocalAuthor(a); long duration = System.currentTimeMillis() - now; @@ -238,7 +238,7 @@ implements OnItemSelectedListener, OnClickListener { if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e); } catch(InterruptedException e) { - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } } @@ -277,7 +277,7 @@ implements OnItemSelectedListener, OnClickListener { dbUiExecutor.execute(new Runnable() { public void run() { try { - serviceConnection.waitForStartup(); + serviceConnection.waitForDatabase(); Message m = messageFactory.createPrivateMessage(parentId, "text/plain", body); long now = System.currentTimeMillis(); @@ -292,7 +292,7 @@ implements OnItemSelectedListener, OnClickListener { throw new RuntimeException(e); } catch(InterruptedException e) { if(LOG.isLoggable(INFO)) - LOG.info("Interrupted while waiting for service"); + LOG.info("Interrupted while waiting for database"); Thread.currentThread().interrupt(); } catch(IOException e) { throw new RuntimeException(e);