Add column for eventual thread topic

Change-Id: I23a66d3ddf2fbdce516c161017713809af458d3d
This commit is contained in:
Marc Blank 2012-04-06 15:19:22 -07:00
parent 05ba972408
commit 8e4b457b86
3 changed files with 38 additions and 4 deletions

View File

@ -71,6 +71,8 @@ $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/EmailGoogle_inte
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email2_intermediates)
$(call add-clean-step, rm -rf $(OUT_DIR)/out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon*)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email*)
$(call add-clean-step, rm -rf $(OUT_DIR)/out/target/common/obj/JAVA_LIBRARIES/com.android.emailcommon*)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Email*)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST

View File

@ -517,6 +517,8 @@ public abstract class EmailContent {
// and the sync adapter might, for example, need more information about the original source
// of the message)
public static final String PROTOCOL_SEARCH_INFO = "protocolSearchInfo";
// Simple thread topic
public static final String THREAD_TOPIC = "threadTopic";
}
public static final class Message extends EmailContent implements SyncColumns, MessageColumns {
@ -562,6 +564,7 @@ public abstract class EmailContent {
public static final int CONTENT_MEETING_INFO_COLUMN = 20;
public static final int CONTENT_SNIPPET_COLUMN = 21;
public static final int CONTENT_PROTOCOL_SEARCH_INFO_COLUMN = 22;
public static final int CONTENT_THREAD_TOPIC_COLUMN = 23;
public static final String[] CONTENT_PROJECTION = new String[] {
RECORD_ID,
@ -575,7 +578,8 @@ public abstract class EmailContent {
MessageColumns.TO_LIST, MessageColumns.CC_LIST,
MessageColumns.BCC_LIST, MessageColumns.REPLY_TO_LIST,
SyncColumns.SERVER_TIMESTAMP, MessageColumns.MEETING_INFO,
MessageColumns.SNIPPET, MessageColumns.PROTOCOL_SEARCH_INFO
MessageColumns.SNIPPET, MessageColumns.PROTOCOL_SEARCH_INFO,
MessageColumns.THREAD_TOPIC
};
public static final int LIST_ID_COLUMN = 0;
@ -710,6 +714,8 @@ public abstract class EmailContent {
public String mProtocolSearchInfo;
public String mThreadTopic;
/**
* Base64-encoded representation of the byte array provided by servers for identifying
* messages belonging to the same conversation thread. Currently unsupported and not
@ -817,6 +823,8 @@ public abstract class EmailContent {
values.put(MessageColumns.SNIPPET, mSnippet);
values.put(MessageColumns.PROTOCOL_SEARCH_INFO, mProtocolSearchInfo);
values.put(MessageColumns.THREAD_TOPIC, mThreadTopic);
return values;
}
@ -851,6 +859,7 @@ public abstract class EmailContent {
mMeetingInfo = cursor.getString(CONTENT_MEETING_INFO_COLUMN);
mSnippet = cursor.getString(CONTENT_SNIPPET_COLUMN);
mProtocolSearchInfo = cursor.getString(CONTENT_PROTOCOL_SEARCH_INFO_COLUMN);
mThreadTopic = cursor.getString(CONTENT_THREAD_TOPIC_COLUMN);
}
public boolean update() {

View File

@ -24,7 +24,6 @@ import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Debug;
import android.provider.ContactsContract;
import android.util.Log;
@ -122,8 +121,9 @@ public final class DBHelper {
// Version 35: Set up defaults for lastTouchedCount for drafts and sent
// Version 36: mblank intentionally left this space
// Version 37: Add flag for settings support in folders
// Version 38&39: Add threadTopic to message (for future support)
public static final int DATABASE_VERSION = 37;
public static final int DATABASE_VERSION = 39;
// Any changes to the database format *must* include update-in-place code.
// Original version: 2
@ -165,7 +165,8 @@ public final class DBHelper {
+ MessageColumns.REPLY_TO_LIST + " text, "
+ MessageColumns.MEETING_INFO + " text, "
+ MessageColumns.SNIPPET + " text, "
+ MessageColumns.PROTOCOL_SEARCH_INFO + " text"
+ MessageColumns.PROTOCOL_SEARCH_INFO + " text, "
+ MessageColumns.THREAD_TOPIC + " text"
+ ");";
// This String and the following String MUST have the same columns, except for the type
@ -903,6 +904,28 @@ public final class DBHelper {
}
oldVersion = 37;
}
if (oldVersion == 37) {
try {
db.execSQL("alter table " + Message.TABLE_NAME
+ " add column " + MessageColumns.THREAD_TOPIC + " text;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 37 to 38 " + e);
}
oldVersion = 38;
}
if (oldVersion == 38) {
try {
db.execSQL("alter table " + Message.DELETED_TABLE_NAME
+ " add column " + MessageColumns.THREAD_TOPIC + " text;");
db.execSQL("alter table " + Message.UPDATED_TABLE_NAME
+ " add column " + MessageColumns.THREAD_TOPIC + " text;");
} catch (SQLException e) {
// Shouldn't be needed unless we're debugging and interrupt the process
Log.w(TAG, "Exception upgrading EmailProvider.db from 38 to 39 " + e);
}
oldVersion = 39;
}
}
@Override