2016-05-16 23:00:04 +02:00
|
|
|
package nodomain.freeyourgadget.gadgetbridge;
|
2016-05-15 00:09:34 +02:00
|
|
|
|
|
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
|
|
import android.database.sqlite.SQLiteOpenHelper;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2016-05-16 23:00:04 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
2016-05-15 00:09:34 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.AbstractActivitySample;
|
2016-05-16 23:00:04 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
|
2016-05-15 00:09:34 +02:00
|
|
|
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A dummy DBHandler that does nothing more than implementing the release() method.
|
|
|
|
* It is solely used for locking concurrent access to the database session.
|
|
|
|
*/
|
|
|
|
public class LockHandler implements DBHandler {
|
|
|
|
|
2016-05-16 23:00:04 +02:00
|
|
|
private final DaoSession session;
|
2016-05-15 00:09:34 +02:00
|
|
|
|
2016-05-16 23:00:04 +02:00
|
|
|
public LockHandler(DaoSession daoSession) {
|
|
|
|
session = daoSession;
|
2016-05-15 00:09:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void close() {
|
2016-05-16 23:00:04 +02:00
|
|
|
GBApplication.releaseDB();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void closeDb() {
|
2016-05-15 00:09:34 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public SQLiteOpenHelper getHelper() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2016-05-16 23:00:04 +02:00
|
|
|
@Override
|
|
|
|
public DaoSession getDaoSession() {
|
|
|
|
return session;
|
|
|
|
}
|
|
|
|
|
2016-05-15 00:09:34 +02:00
|
|
|
@Override
|
|
|
|
public SQLiteDatabase getWritableDatabase() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|