aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTa-wei Yen <twyen@google.com>2017-01-20 18:31:41 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2017-01-20 18:31:45 +0000
commiteb063d5cf7d957263d19f83400aa1eee5ef41020 (patch)
treec29e41d01f30bd79848c36fd1b49629fc52fa4df
parent8e796d593de3fac9249b2bf744d699b129ab3e90 (diff)
parent27bedb2f415f7bf33f351c6b2575a0087577c077 (diff)
downloadContactsProvider-eb063d5cf7d957263d19f83400aa1eee5ef41020.tar.gz
Merge "Add voicemail backup/restore columns" into nyc-mr2-dev
-rw-r--r--src/com/android/providers/contacts/CallLogDatabaseHelper.java23
-rw-r--r--src/com/android/providers/contacts/VoicemailContentTable.java8
-rw-r--r--tests/src/com/android/providers/contacts/VoicemailProviderTest.java8
3 files changed, 37 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/CallLogDatabaseHelper.java b/src/com/android/providers/contacts/CallLogDatabaseHelper.java
index 67c548a6..c88b742d 100644
--- a/src/com/android/providers/contacts/CallLogDatabaseHelper.java
+++ b/src/com/android/providers/contacts/CallLogDatabaseHelper.java
@@ -37,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 = 3;
+ private static final int DATABASE_VERSION = 4;
private static final boolean DEBUG = false; // DON'T SUBMIT WITH TRUE
@@ -151,7 +151,11 @@ public class CallLogDatabaseHelper {
Voicemails.TRANSCRIPTION + " TEXT," +
Voicemails.STATE + " INTEGER," +
Voicemails.DIRTY + " INTEGER NOT NULL DEFAULT 0," +
- Voicemails.DELETED + " INTEGER NOT NULL DEFAULT 0" +
+ Voicemails.DELETED + " INTEGER NOT NULL DEFAULT 0," +
+ Voicemails.BACKED_UP + " INTEGER NOT NULL DEFAULT 0," +
+ Voicemails.RESTORED + " INTEGER NOT NULL DEFAULT 0," +
+ Voicemails.ARCHIVED + " INTEGER NOT NULL DEFAULT 0," +
+ Voicemails.IS_OMTP_VOICEMAIL + " INTEGER NOT NULL DEFAULT 0" +
");");
db.execSQL("CREATE TABLE " + Tables.VOICEMAIL_STATUS + " (" +
@@ -185,6 +189,10 @@ public class CallLogDatabaseHelper {
if (oldVersion < 3) {
upgradeToVersion3(db);
}
+
+ if (oldVersion < 4) {
+ upgradeToVersion4(db);
+ }
}
}
@@ -243,6 +251,17 @@ public class CallLogDatabaseHelper {
}
/**
+ * Add {@link Voicemails.BACKED_UP} {@link Voicemails.ARCHIVE} {@link
+ * Voicemails.IS_OMTP_VOICEMAIL} column to the CallLog database.
+ */
+ private void upgradeToVersion4(SQLiteDatabase db) {
+ db.execSQL("ALTER TABLE calls ADD backed_up INTEGER NOT NULL DEFAULT 0");
+ db.execSQL("ALTER TABLE calls ADD restored INTEGER NOT NULL DEFAULT 0");
+ db.execSQL("ALTER TABLE calls ADD archived INTEGER NOT NULL DEFAULT 0");
+ db.execSQL("ALTER TABLE calls ADD is_omtp_voicemail INTEGER NOT NULL DEFAULT 0");
+ }
+
+ /**
* 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/VoicemailContentTable.java b/src/com/android/providers/contacts/VoicemailContentTable.java
index 24a02bc7..75f95741 100644
--- a/src/com/android/providers/contacts/VoicemailContentTable.java
+++ b/src/com/android/providers/contacts/VoicemailContentTable.java
@@ -70,6 +70,10 @@ public class VoicemailContentTable implements VoicemailTable.Delegate {
.add(Voicemails.DIRTY)
.add(Voicemails.DELETED)
.add(Voicemails.LAST_MODIFIED)
+ .add(Voicemails.BACKED_UP)
+ .add(Voicemails.RESTORED)
+ .add(Voicemails.ARCHIVED)
+ .add(Voicemails.IS_OMTP_VOICEMAIL)
.add(OpenableColumns.DISPLAY_NAME)
.add(OpenableColumns.SIZE)
.build();
@@ -105,6 +109,10 @@ public class VoicemailContentTable implements VoicemailTable.Delegate {
.add(Voicemails.DIRTY)
.add(Voicemails.DELETED)
.add(Voicemails.LAST_MODIFIED)
+ .add(Voicemails.BACKED_UP)
+ .add(Voicemails.RESTORED)
+ .add(Voicemails.ARCHIVED)
+ .add(Voicemails.IS_OMTP_VOICEMAIL)
.add(OpenableColumns.DISPLAY_NAME, createDisplayName(context))
.add(OpenableColumns.SIZE, "NULL")
.build();
diff --git a/tests/src/com/android/providers/contacts/VoicemailProviderTest.java b/tests/src/com/android/providers/contacts/VoicemailProviderTest.java
index 72667314..697c17c5 100644
--- a/tests/src/com/android/providers/contacts/VoicemailProviderTest.java
+++ b/tests/src/com/android/providers/contacts/VoicemailProviderTest.java
@@ -147,6 +147,10 @@ public class VoicemailProviderTest extends BaseVoicemailProviderTest {
values.put(Voicemails.SOURCE_DATA, "foo");
values.put(Voicemails.PHONE_ACCOUNT_COMPONENT_NAME, "dummy_name");
values.put(Voicemails.PHONE_ACCOUNT_ID, "dummy_account");
+ values.put(Voicemails.BACKED_UP, 1);
+ values.put(Voicemails.RESTORED, 1);
+ values.put(Voicemails.ARCHIVED, 1);
+ values.put(Voicemails.IS_OMTP_VOICEMAIL, 1);
int count = mResolver.update(uri, values, null, null);
assertEquals(1, count);
assertStoredValues(uri, values);
@@ -762,6 +766,10 @@ public class VoicemailProviderTest extends BaseVoicemailProviderTest {
values.put(Voicemails.HAS_CONTENT, 0);
values.put(Voicemails.SOURCE_DATA, "1234");
values.put(Voicemails.STATE, Voicemails.STATE_INBOX);
+ values.put(Voicemails.BACKED_UP, 0);
+ values.put(Voicemails.RESTORED, 0);
+ values.put(Voicemails.ARCHIVED, 0);
+ values.put(Voicemails.IS_OMTP_VOICEMAIL, 0);
return values;
}