Merge "add display_originating_address in the mms raw db" am: e97e181075 am: d89d3822a6 am: df6552816d
am: 6f3e3fd3ba
Change-Id: Ic75939c78bce522607a4477081238e6bc2a11f2e
diff --git a/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java b/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
index 45d4f01..c9051d6 100644
--- a/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
+++ b/src/com/android/providers/telephony/MmsSmsDatabaseHelper.java
@@ -239,7 +239,7 @@
private static boolean sFakeLowStorageTest = false; // for testing only
static final String DATABASE_NAME = "mmssms.db";
- static final int DATABASE_VERSION = 65;
+ static final int DATABASE_VERSION = 66;
private final Context mContext;
private LowStorageMonitor mLowStorageMonitor;
@@ -894,7 +894,10 @@
"sub_id INTEGER DEFAULT " + SubscriptionManager.INVALID_SUBSCRIPTION_ID + ", " +
"pdu TEXT," + // the raw PDU for this part
"deleted INTEGER DEFAULT 0," + // bool to indicate if row is deleted
- "message_body TEXT);"); // message body
+ "message_body TEXT," + // message body
+ "display_originating_addr TEXT);"
+ // email address if from an email gateway, otherwise same as address
+ );
db.execSQL("CREATE TABLE attachments (" +
"sms_id INTEGER," +
@@ -1455,6 +1458,22 @@
} finally {
db.endTransaction();
}
+ // fall through
+ case 65:
+ if (currentVersion <= 65) {
+ return;
+ }
+
+ db.beginTransaction();
+ try {
+ upgradeDatabaseToVersion66(db);
+ db.setTransactionSuccessful();
+ } catch (Throwable ex) {
+ Log.e(TAG, ex.getMessage(), ex);
+ break;
+ } finally {
+ db.endTransaction();
+ }
return;
}
@@ -1748,6 +1767,16 @@
}
}
+ private void upgradeDatabaseToVersion66(SQLiteDatabase db) {
+ try {
+ db.execSQL("ALTER TABLE " + SmsProvider.TABLE_RAW
+ + " ADD COLUMN display_originating_addr TEXT");
+ } catch (SQLiteException e) {
+ Log.e(TAG, "[upgradeDatabaseToVersion66] Exception adding column "
+ + "display_originating_addr; " + e);
+ }
+ }
+
@Override
public synchronized SQLiteDatabase getWritableDatabase() {
SQLiteDatabase db = super.getWritableDatabase();