Store schema version in database. Dev task #50.

If the schema of the database is incompatible with the schema expected
by the code, the database throws a DbSchemaException. LifecycleManager
indicates the error to BriarService, which uses HomeScreenActivity to
show a notification and quit the app.
This commit is contained in:
akwizgran
2014-01-09 21:00:40 +00:00
parent c779d7b95a
commit 623e7330ed
20 changed files with 237 additions and 117 deletions

View File

@@ -48,7 +48,7 @@ class LifecycleManagerImpl implements LifecycleManager {
executors.add(e);
}
public void startServices() {
public boolean startServices() {
try {
if(LOG.isLoggable(INFO)) LOG.info("Starting");
boolean reopened = db.open();
@@ -64,12 +64,16 @@ class LifecycleManagerImpl implements LifecycleManager {
if(started) LOG.info("Service started: " + name);
else LOG.info("Service failed to start: " + name);
}
if(!started) return false;
}
startupLatch.countDown();
return true;
} catch(DbException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return false;
} catch(IOException e) {
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
return false;
}
}