mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Removed unnecessary conditionals from logging statements.
Very important stuff.
This commit is contained in:
@@ -2,7 +2,6 @@ package org.briarproject.android;
|
||||
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NO_ANIMATION;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
|
||||
import static java.util.logging.Level.INFO;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.logging.Logger;
|
||||
@@ -88,12 +87,11 @@ public class BriarActivity extends RoboFragmentActivity {
|
||||
BriarService service = ((BriarBinder) binder).getService();
|
||||
service.waitForStartup();
|
||||
// Shut down the service and wait for it to shut down
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Shutting down service");
|
||||
LOG.info("Shutting down service");
|
||||
service.shutdown();
|
||||
service.waitForShutdown();
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while waiting for service");
|
||||
LOG.warning("Interrupted while waiting for service");
|
||||
}
|
||||
finishAndExit();
|
||||
}
|
||||
@@ -104,7 +102,7 @@ public class BriarActivity extends RoboFragmentActivity {
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
finish();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Exiting");
|
||||
LOG.info("Exiting");
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
@@ -117,8 +115,7 @@ public class BriarActivity extends RoboFragmentActivity {
|
||||
lifecycleManager.waitForDatabase();
|
||||
task.run();
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interrupted while waiting for database");
|
||||
LOG.warning("Interrupted while waiting for database");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.briarproject.android;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
|
||||
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static java.util.logging.Level.WARNING;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
@@ -61,14 +60,14 @@ public class BriarService extends RoboService implements EventListener {
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Created");
|
||||
LOG.info("Created");
|
||||
if(created.getAndSet(true)) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Already created");
|
||||
LOG.info("Already created");
|
||||
stopSelf();
|
||||
return;
|
||||
}
|
||||
if(databaseConfig.getEncryptionKey() == null) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("No database key");
|
||||
LOG.info("No database key");
|
||||
stopSelf();
|
||||
return;
|
||||
}
|
||||
@@ -92,7 +91,7 @@ public class BriarService extends RoboService implements EventListener {
|
||||
db.addListener(BriarService.this);
|
||||
started = true;
|
||||
} else {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Startup failed");
|
||||
LOG.info("Startup failed");
|
||||
showStartupFailureNotification();
|
||||
stopSelf();
|
||||
}
|
||||
@@ -130,7 +129,7 @@ public class BriarService extends RoboService implements EventListener {
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Destroyed");
|
||||
LOG.info("Destroyed");
|
||||
stopForeground(true);
|
||||
notificationManager.clearNotifications();
|
||||
// Stop the services in a background thread
|
||||
@@ -167,8 +166,7 @@ public class BriarService extends RoboService implements EventListener {
|
||||
if(LOG.isLoggable(WARNING))
|
||||
LOG.log(WARNING, e.toString(), e);
|
||||
} catch(InterruptedException e) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Interruped while waiting for database");
|
||||
LOG.info("Interruped while waiting for database");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DashboardActivity extends BriarActivity {
|
||||
long handle = i.getLongExtra("briar.LOCAL_AUTHOR_HANDLE", -1);
|
||||
if(failed) {
|
||||
finish();
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Exiting");
|
||||
LOG.info("Exiting");
|
||||
System.exit(0);
|
||||
} else if(handle == -1) {
|
||||
// The activity has been launched before
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SplashScreenActivity extends RoboSplashActivity {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Guice startup took " + duration + " ms");
|
||||
if(System.currentTimeMillis() >= EXPIRY_DATE) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Expired");
|
||||
LOG.info("Expired");
|
||||
startActivity(new Intent(this, ExpiredActivity.class));
|
||||
} else {
|
||||
SharedPreferences prefs = getSharedPreferences("db", MODE_PRIVATE);
|
||||
|
||||
@@ -233,15 +233,15 @@ ConnectionListener {
|
||||
loadContacts();
|
||||
} else if(e instanceof ContactRemovedEvent) {
|
||||
// Reload the conversation, expecting NoSuchContactException
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Contact removed, reloading");
|
||||
LOG.info("Contact removed, reloading");
|
||||
reloadContact(((ContactRemovedEvent) e).getContactId());
|
||||
} else if(e instanceof MessageAddedEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message added, reloading");
|
||||
LOG.info("Message added, reloading");
|
||||
ContactId source = ((MessageAddedEvent) e).getContactId();
|
||||
if(source == null) loadContacts();
|
||||
else reloadContact(source);
|
||||
} else if(e instanceof MessageExpiredEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message expired, reloading");
|
||||
LOG.info("Message expired, reloading");
|
||||
loadContacts();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,17 +369,17 @@ implements EventListener, OnClickListener, OnItemClickListener {
|
||||
if(e instanceof ContactRemovedEvent) {
|
||||
ContactRemovedEvent c = (ContactRemovedEvent) e;
|
||||
if(c.getContactId().equals(contactId)) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Contact removed");
|
||||
LOG.info("Contact removed");
|
||||
finishOnUiThread();
|
||||
}
|
||||
} else if(e instanceof MessageAddedEvent) {
|
||||
GroupId g = ((MessageAddedEvent) e).getGroup().getId();
|
||||
if(g.equals(groupId)) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message added, reloading");
|
||||
LOG.info("Message added, reloading");
|
||||
loadHeaders();
|
||||
}
|
||||
} else if(e instanceof MessageExpiredEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message expired, reloading");
|
||||
LOG.info("Message expired, reloading");
|
||||
loadHeaders();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,16 +299,16 @@ OnClickListener, OnItemClickListener {
|
||||
public void eventOccurred(Event e) {
|
||||
if(e instanceof MessageAddedEvent) {
|
||||
if(((MessageAddedEvent) e).getGroup().getId().equals(groupId)) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message added, reloading");
|
||||
LOG.info("Message added, reloading");
|
||||
loadHeaders();
|
||||
}
|
||||
} else if(e instanceof MessageExpiredEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message expired, reloading");
|
||||
LOG.info("Message expired, reloading");
|
||||
loadHeaders();
|
||||
} else if(e instanceof SubscriptionRemovedEvent) {
|
||||
SubscriptionRemovedEvent s = (SubscriptionRemovedEvent) e;
|
||||
if(s.getGroup().getId().equals(groupId)) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Subscription removed");
|
||||
LOG.info("Subscription removed");
|
||||
finishOnUiThread();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,24 +262,23 @@ implements EventListener, OnClickListener, OnItemClickListener {
|
||||
if(e instanceof MessageAddedEvent) {
|
||||
Group g = ((MessageAddedEvent) e).getGroup();
|
||||
if(groups.containsKey(g.getId())) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message added, reloading");
|
||||
LOG.info("Message added, reloading");
|
||||
loadHeaders(g);
|
||||
}
|
||||
} else if(e instanceof MessageExpiredEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Message expired, reloading");
|
||||
LOG.info("Message expired, reloading");
|
||||
loadHeaders();
|
||||
} else if(e instanceof RemoteSubscriptionsUpdatedEvent) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Remote subscriptions changed, reloading");
|
||||
LOG.info("Remote subscriptions changed, reloading");
|
||||
loadAvailable();
|
||||
} else if(e instanceof SubscriptionAddedEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Group added, reloading");
|
||||
LOG.info("Group added, reloading");
|
||||
loadHeaders();
|
||||
} else if(e instanceof SubscriptionRemovedEvent) {
|
||||
Group g = ((SubscriptionRemovedEvent) e).getGroup();
|
||||
if(groups.containsKey(g.getId())) {
|
||||
// Reload the group, expecting NoSuchSubscriptionException
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Group removed, reloading");
|
||||
LOG.info("Group removed, reloading");
|
||||
loadHeaders(g);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,14 +116,13 @@ implements EventListener, OnItemClickListener {
|
||||
|
||||
public void eventOccurred(Event e) {
|
||||
if(e instanceof RemoteSubscriptionsUpdatedEvent) {
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info("Remote subscriptions changed, reloading");
|
||||
LOG.info("Remote subscriptions changed, reloading");
|
||||
loadGroups();
|
||||
} else if(e instanceof SubscriptionAddedEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Group added, reloading");
|
||||
LOG.info("Group added, reloading");
|
||||
loadGroups();
|
||||
} else if(e instanceof SubscriptionRemovedEvent) {
|
||||
if(LOG.isLoggable(INFO)) LOG.info("Group removed, reloading");
|
||||
LOG.info("Group removed, reloading");
|
||||
loadGroups();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user