diff options
author | Ta-wei Yen <twyen@google.com> | 2016-05-25 12:13:41 -0700 |
---|---|---|
committer | Ta-wei Yen <twyen@google.com> | 2016-05-25 12:13:41 -0700 |
commit | 21c692d49ce7ad6f9414d46ac2410d3f2e4c4d20 (patch) | |
tree | bea582145c015049cd8a0b617a35881529628e17 | |
parent | 176e5bcd6c1248a30fc6af9ef22d25aea7228d47 (diff) | |
download | ContactsProvider-21c692d49ce7ad6f9414d46ac2410d3f2e4c4d20.tar.gz |
Add SOURCE_TYPE field to VoicemailStatus table
+ Bump callog database version to 3
Bug:26944391
Change-Id: Ie4d7e67658247445c45f9f413902eda205bf2541
3 files changed, 20 insertions, 3 deletions
diff --git a/src/com/android/providers/contacts/CallLogDatabaseHelper.java b/src/com/android/providers/contacts/CallLogDatabaseHelper.java index 76c04321..67c548a6 100644 --- a/src/com/android/providers/contacts/CallLogDatabaseHelper.java +++ b/src/com/android/providers/contacts/CallLogDatabaseHelper.java @@ -24,6 +24,7 @@ import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.provider.CallLog.Calls; import android.provider.VoicemailContract; +import android.provider.VoicemailContract.Status; import android.provider.VoicemailContract.Voicemails; import android.util.Log; @@ -36,7 +37,7 @@ import com.android.providers.contacts.util.PropertyUtils; public class CallLogDatabaseHelper { private static final String TAG = "CallLogDatabaseHelper"; - private static final int DATABASE_VERSION = 2; + private static final int DATABASE_VERSION = 3; private static final boolean DEBUG = false; // DON'T SUBMIT WITH TRUE @@ -164,7 +165,8 @@ public class CallLogDatabaseHelper { VoicemailContract.Status.DATA_CHANNEL_STATE + " INTEGER," + VoicemailContract.Status.NOTIFICATION_CHANNEL_STATE + " INTEGER," + VoicemailContract.Status.QUOTA_OCCUPIED + " INTEGER DEFAULT -1," + - VoicemailContract.Status.QUOTA_TOTAL + " INTEGER DEFAULT -1" + + VoicemailContract.Status.QUOTA_TOTAL + " INTEGER DEFAULT -1," + + VoicemailContract.Status.SOURCE_TYPE + " TEXT" + ");"); migrateFromLegacyTables(db); @@ -179,6 +181,10 @@ public class CallLogDatabaseHelper { if (oldVersion < 2) { upgradeToVersion2(db); } + + if (oldVersion < 3) { + upgradeToVersion3(db); + } } } @@ -229,6 +235,14 @@ public class CallLogDatabaseHelper { } /** + * Add the {@link Status.SOURCE_TYPE} Column to the VoicemailStatus Database. + */ + private void upgradeToVersion3(SQLiteDatabase db) { + db.execSQL("ALTER TABLE " + Tables.VOICEMAIL_STATUS + " ADD " + Status.SOURCE_TYPE + + " TEXT"); + } + + /** * Perform the migration from the contacts2.db (of the latest version) to the current calllog/ * voicemail status tables. */ diff --git a/src/com/android/providers/contacts/VoicemailStatusTable.java b/src/com/android/providers/contacts/VoicemailStatusTable.java index c07d4b16..963df07e 100644 --- a/src/com/android/providers/contacts/VoicemailStatusTable.java +++ b/src/com/android/providers/contacts/VoicemailStatusTable.java @@ -49,6 +49,7 @@ public class VoicemailStatusTable implements VoicemailTable.Delegate { .add(Status.VOICEMAIL_ACCESS_URI) .add(Status.QUOTA_OCCUPIED) .add(Status.QUOTA_TOTAL) + .add(Status.SOURCE_TYPE) .build(); private static final Object DATABASE_LOCK = new Object(); diff --git a/tests/src/com/android/providers/contacts/VoicemailProviderTest.java b/tests/src/com/android/providers/contacts/VoicemailProviderTest.java index 27e72c28..b4c9e049 100644 --- a/tests/src/com/android/providers/contacts/VoicemailProviderTest.java +++ b/tests/src/com/android/providers/contacts/VoicemailProviderTest.java @@ -29,7 +29,6 @@ import android.provider.VoicemailContract.Voicemails; import android.test.MoreAsserts; import android.test.suitebuilder.annotation.SmallTest; -import android.test.suitebuilder.annotation.Suppress; import com.android.common.io.MoreCloseables; import java.io.FileNotFoundException; @@ -572,6 +571,8 @@ public class VoicemailProviderTest extends BaseVoicemailProviderTest { values.put(Status.DATA_CHANNEL_STATE, Status.DATA_CHANNEL_STATE_NO_CONNECTION); values.put(Status.NOTIFICATION_CHANNEL_STATE, Status.NOTIFICATION_CHANNEL_STATE_MESSAGE_WAITING); + values.put(Status.SOURCE_TYPE, + "vvm_type_test2"); int count = mResolver.update(uri, values, null, null); assertEquals(1, count); assertStoredValues(uri, values); @@ -753,6 +754,7 @@ public class VoicemailProviderTest extends BaseVoicemailProviderTest { values.put(Status.CONFIGURATION_STATE, Status.CONFIGURATION_STATE_OK); values.put(Status.DATA_CHANNEL_STATE, Status.DATA_CHANNEL_STATE_OK); values.put(Status.NOTIFICATION_CHANNEL_STATE, Status.NOTIFICATION_CHANNEL_STATE_OK); + values.put(Status.SOURCE_TYPE, "vvm_type_test"); return values; } |