|
|
|
@ -83,6 +83,15 @@ public class SmsMigrator {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static boolean isAppropriateTypeForMigration(Cursor cursor, int columnIndex) {
|
|
|
|
|
long systemType = cursor.getLong(columnIndex);
|
|
|
|
|
long ourType = SmsDatabase.Types.translateFromSystemBaseType(systemType);
|
|
|
|
|
|
|
|
|
|
return ourType == MmsSmsColumns.Types.BASE_INBOX_TYPE ||
|
|
|
|
|
ourType == MmsSmsColumns.Types.BASE_SENT_TYPE ||
|
|
|
|
|
ourType == MmsSmsColumns.Types.BASE_SENT_FAILED_TYPE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void getContentValuesForRow(Context context, MasterSecret masterSecret,
|
|
|
|
|
Cursor cursor, long threadId,
|
|
|
|
|
SQLiteStatement statement)
|
|
|
|
@ -171,8 +180,12 @@ public class SmsMigrator {
|
|
|
|
|
SQLiteStatement statement = ourSmsDatabase.createInsertStatement(transaction);
|
|
|
|
|
|
|
|
|
|
while (cursor != null && cursor.moveToNext()) {
|
|
|
|
|
getContentValuesForRow(context, masterSecret, cursor, ourThreadId, statement);
|
|
|
|
|
statement.execute();
|
|
|
|
|
int typeColumn = cursor.getColumnIndex(SmsDatabase.TYPE);
|
|
|
|
|
|
|
|
|
|
if (cursor.isNull(typeColumn) || isAppropriateTypeForMigration(cursor, typeColumn)) {
|
|
|
|
|
getContentValuesForRow(context, masterSecret, cursor, ourThreadId, statement);
|
|
|
|
|
statement.execute();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
listener.progressUpdate(new ProgressDescription(progress, cursor.getCount(), cursor.getPosition()));
|
|
|
|
|
}
|
|
|
|
|