diff --git a/briar-android/src/net/sf/briar/android/BriarService.java b/briar-android/src/net/sf/briar/android/BriarService.java index 85339923cc37fdeb5eed47dc36fdd4d691ceb1d9..3582efc54f3962f556827a1bec284669176af2a3 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 40cdc12dc2adaddb4044151358f469b69187bdc0..ef7ecd0a5b972ad3fd1b87f5629e549c86a1eb31 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 c1c0cf0776bcf7d1be75800c4240e37d9e9e5071..95e651bfed31e514f5bfb6da700034d2d454a5fa 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<GroupMessageHeader> 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 adbca52d6ef3c89cd40aa0333f8a9df6bfdf49e3..36eb0cbd8315fef9e5d54c39acd4eb2dac6ccec3 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<GroupId> local = new HashSet<GroupId>(); 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<GroupMessageHeader> 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 3c5699330b6e32670c9a8a81a6698ac3f4b89bdd..2ebd2726090792d02c7134a3b944934fcb126840 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<Contact> 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 1d3f5deb46461f0badd903967da24ba1d962c11f..7232e9d773c6cb9fa1eaa8e2fe8036817a47c2a7 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<Contact> 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 32b453e9d7c88ead1d9b15684c3b4ddcc9df96c2..2367703939ea5f9daffc5ccdddab2e803205a72f 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<GroupStatus> available = new ArrayList<GroupStatus>(); 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 51f0993049984844627c8850cc55fc01efe83aab..4ad6cc09dfc5fc6cb9b32334d155d86cfdeb312f 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 de0bc88d5493d5a0c485ea6a33a2a85322c3ea91..2a134bbaa4a4e0a4e1bf43c5563ca68d3f7a73c6 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<LocalAuthor> 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<LocalGroup> 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 ccc41eb1b05d08a1703bf06ff968425f758d24b7..11beeead21994fc57d0fa5c41def98b0791c07e8 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<Contact> contacts = db.getContacts(); Map<ContactId, Long> 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 6ba4670e75790a2be523ac047e014bbf9d892393..df203717cd0de226f7fa73d9acaf507f9f23d4a3 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<Contact> 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 7793a6a8a46b6cbf0af7ab2c5dac9b8bdf2664f3..e75f6fbf70566e90eba25607e03349e7f05c0110 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<Contact> 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 9604a5c8288b74d42a8ec3be283ad7af630b0ff4..dca814895fde5ca466abcb59a6743f75b6e50f5e 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<GroupMessageHeader> 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 1601f97f27c7ea887abf984361d9c77c5295c91e..fb84b857d734e17abdd2fd1bfa2fe11590116f61 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<GroupMessageHeader> 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 a62f607c3328d182efa5ebfbd213589b207f8ece..00a2b1c65a8e2a63798d831d49a7e4f3d1f4b948 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<GroupStatus> available = new ArrayList<GroupStatus>(); 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 9576d90ef2255101e9c222ceb72470683bde821a..df401605653415ec07be2974428d3e94bc81a3e1 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 779857e43ef51ad36abe41807b247b995db2f4c5..70d72e288aab16c2ebe9c5f6ea36550980abf993 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<LocalAuthor> 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<Group> groups = new ArrayList<Group>(); 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 9a331a03813805c0cf461dfb7aa2dee1e13defd7..48f1c6bfb960a0555a1c36ef34b4eb6e20d0a4f1 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 ac063e7c010bfd1f03805db6796ce94845b77660..926ce1df0e891921122d7844705cef21f35801b4 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<LocalAuthor> 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 68bcd1391e42252a88f8166bb0b775de5bc1e13b..e67052dd32edf72e44a4530f9b92a26a6847af6f 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<PrivateMessageHeader> 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 eacfcc1ecccd52ce04633a50e72e9fce6f01d71c..d5f38caca53106eb19be2fda8e65c9b02cf1634e 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<PrivateMessageHeader> 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 d1b7d3d87bff5972e56f0a8bbfc48057ce368548..5d6245229a2ad648380cd11e01053584c4e91ba2 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 a948891e2160b715479859411f83a34675b983da..f0b4b6bac2f5322b0de038a851f61d9ebb12b523 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<Contact> 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);