Clean up any previously scheduled background poll jobs.

pull/354/head
Anton Chekulaev 5 years ago
parent 4fe6c8acfd
commit d178eefd98

@ -93,8 +93,9 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
private static final int lokiV14_BACKUP_FILES = 35;
private static final int lokiV15 = 36;
private static final int lokiV16 = 37;
private static final int lokiV17_CLEAR_BG_POLL_JOBS = 38;
private static final int DATABASE_VERSION = lokiV16;
private static final int DATABASE_VERSION = lokiV17_CLEAR_BG_POLL_JOBS; // Loki - onUpgrade(...) must be updated to use Loki version numbers if Signal makes any database changes
private static final String DATABASE_NAME = "signal.db";
private final Context context;
@ -633,11 +634,17 @@ public class SQLCipherOpenHelper extends SQLiteOpenHelper {
if (oldVersion < lokiV15) {
db.execSQL(SharedSenderKeysDatabase.getCreateOldClosedGroupRatchetTableCommand());
}
if (oldVersion < lokiV16) {
db.execSQL(LokiAPIDatabase.getCreateOpenGroupProfilePictureTableCommand());
}
if (oldVersion < lokiV17_CLEAR_BG_POLL_JOBS) {
// BackgroundPollJob was replaced with BackgroundPollWorker. Clear all the scheduled job records.
db.execSQL("DELETE FROM job_spec WHERE factory_key = 'BackgroundPollJob'");
db.execSQL("DELETE FROM constraint_spec WHERE factory_key = 'BackgroundPollJob'");
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();

Loading…
Cancel
Save