diff options
author | Ta-wei Yen <twyen@google.com> | 2017-01-19 16:23:45 -0800 |
---|---|---|
committer | Ta-wei Yen <twyen@google.com> | 2017-01-19 17:18:47 -0800 |
commit | 27bedb2f415f7bf33f351c6b2575a0087577c077 (patch) | |
tree | 43a1658539bb3167f9f662306212f172d063bf29 /src | |
parent | 640e0827443fbdaed0e402b8af53cdad97d04bc6 (diff) | |
download | ContactsProvider-27bedb2f415f7bf33f351c6b2575a0087577c077.tar.gz |
Add voicemail backup/restore columns
BACKED_UP and RESTORED are required for dialer voicemail backup/restore
feature for N MR2. As there are no API bump the fields will be hidden
in NMR2. These fields will be made public in O.
ARCHIVED and IS_OMTP_VOICEMAIL is not used for NMR2, but added in
advance to avoid multiple database upgrades.
Test: VoicemailProviderTest
Bug: 34463609
Change-Id: I95ef21950337ca1f8bc79cc0493f7c302ec05617
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/providers/contacts/CallLogDatabaseHelper.java | 23 | ||||
-rw-r--r-- | src/com/android/providers/contacts/VoicemailContentTable.java | 8 |
2 files changed, 29 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(); |