From 8e4b457b86a6c254587dcde4f35a3f1e94097e7d Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Fri, 6 Apr 2012 15:19:22 -0700 Subject: [PATCH] Add column for eventual thread topic Change-Id: I23a66d3ddf2fbdce516c161017713809af458d3d --- CleanSpec.mk | 2 ++ .../emailcommon/provider/EmailContent.java | 11 ++++++- .../com/android/email/provider/DBHelper.java | 29 +++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index d974023c3..b5064f0a3 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -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 diff --git a/email2/emailcommon/src/com/android/emailcommon/provider/EmailContent.java b/email2/emailcommon/src/com/android/emailcommon/provider/EmailContent.java index d253f9442..9265de7a0 100755 --- a/email2/emailcommon/src/com/android/emailcommon/provider/EmailContent.java +++ b/email2/emailcommon/src/com/android/emailcommon/provider/EmailContent.java @@ -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() { diff --git a/email2/src/com/android/email/provider/DBHelper.java b/email2/src/com/android/email/provider/DBHelper.java index bc783ab24..796086ba7 100644 --- a/email2/src/com/android/email/provider/DBHelper.java +++ b/email2/src/com/android/email/provider/DBHelper.java @@ -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