Reschedule pending push decrypt jobs.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-06-25 11:17:42 -07:00
parent af226673da
commit 6c367ac29c

View file

@ -59,6 +59,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
public static final int NO_V1_VERSION = 83;
public static final int SIGNED_PREKEY_VERSION = 83;
public static final int NO_DECRYPT_QUEUE_VERSION = 113;
public static final int PUSH_DECRYPT_SERIAL_ID_VERSION = 131;
private static final SortedSet<Integer> UPGRADE_VERSIONS = new TreeSet<Integer>() {{
add(NO_MORE_KEY_EXCHANGE_PREFIX_VERSION);
@ -68,6 +69,7 @@ public class DatabaseUpgradeActivity extends BaseActivity {
add(NO_V1_VERSION);
add(SIGNED_PREKEY_VERSION);
add(NO_DECRYPT_QUEUE_VERSION);
add(PUSH_DECRYPT_SERIAL_ID_VERSION);
}};
private MasterSecret masterSecret;
@ -217,6 +219,26 @@ public class DatabaseUpgradeActivity extends BaseActivity {
}
}
if (params[0] < PUSH_DECRYPT_SERIAL_ID_VERSION) {
PushDatabase pushDatabase = DatabaseFactory.getPushDatabase(context);
Cursor pushReader = null;
try {
pushReader = pushDatabase.getPending();
while (pushReader != null && pushReader.moveToNext()) {
ApplicationContext.getInstance(getApplicationContext())
.getJobManager()
.add(new PushDecryptJob(getApplicationContext(),
pushReader.getLong(pushReader.getColumnIndexOrThrow(PushDatabase.ID)),
pushReader.getString(pushReader.getColumnIndexOrThrow(PushDatabase.SOURCE))));
}
} finally {
if (pushReader != null)
pushReader.close();
}
}
return null;
}