aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2023-04-13 21:14:03 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-13 21:14:03 +0000
commit749bfb4cd832e7f15c92ad9c3028b83326c4520c (patch)
tree1c358ec077a4a25d18bf5aeb04694786e4ac7915 /src
parenta87c785dcc50758aceff34305c0139a7157b44a4 (diff)
parent0d692362f586db0ee1a17c1ed82fa26617b4c1ae (diff)
downloadContactsProvider-749bfb4cd832e7f15c92ad9c3028b83326c4520c.tar.gz
Merge "Remove migrateFromLegacyTables()" am: 0a9fbf4046 am: daac31af1d am: 0d692362f5
Original change: https://android-review.googlesource.com/c/platform/packages/providers/ContactsProvider/+/2480578 Change-Id: I6f9cf252009c3d4deec1909a068c93dd2ff78c7d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'src')
-rw-r--r--src/com/android/providers/contacts/CallLogDatabaseHelper.java82
1 files changed, 0 insertions, 82 deletions
diff --git a/src/com/android/providers/contacts/CallLogDatabaseHelper.java b/src/com/android/providers/contacts/CallLogDatabaseHelper.java
index 0b29d991..63ba17da 100644
--- a/src/com/android/providers/contacts/CallLogDatabaseHelper.java
+++ b/src/com/android/providers/contacts/CallLogDatabaseHelper.java
@@ -204,7 +204,6 @@ public class CallLogDatabaseHelper {
VoicemailContract.Status.SOURCE_TYPE + " TEXT" +
");");
- migrateFromLegacyTables(db);
}
@Override
@@ -533,87 +532,6 @@ public class CallLogDatabaseHelper {
mPhoneAccountHandleMigrationUtils.migrateIccIdToSubId(db);
}
- /**
- * Perform the migration from the contacts2.db (of the latest version) to the current calllog/
- * voicemail status tables.
- */
- private void migrateFromLegacyTables(SQLiteDatabase calllog) {
- final SQLiteDatabase contacts = getContactsWritableDatabaseForMigration();
-
- if (contacts == null) {
- Log.w(TAG, "Contacts DB == null, skipping migration. (running tests?)");
- return;
- }
- if (DEBUG) {
- Log.d(TAG, "migrateFromLegacyTables");
- }
-
- if ("1".equals(PropertyUtils.getProperty(calllog, DbProperties.DATA_MIGRATED, ""))) {
- return;
- }
-
- Log.i(TAG, "Migrating from old tables...");
-
- contacts.beginTransaction();
- try {
- if (!tableExists(contacts, LegacyConstants.CALLS_LEGACY)
- || !tableExists(contacts, LegacyConstants.VOICEMAIL_STATUS_LEGACY)) {
- // This is fine on new devices. (or after a "clear data".)
- Log.i(TAG, "Source tables don't exist.");
- return;
- }
- calllog.beginTransaction();
- try {
-
- final ContentValues cv = new ContentValues();
-
- try (Cursor source = contacts.rawQuery(
- "SELECT * FROM " + LegacyConstants.CALLS_LEGACY, null)) {
- while (source.moveToNext()) {
- cv.clear();
-
- DatabaseUtils.cursorRowToContentValues(source, cv);
-
- calllog.insertOrThrow(Tables.CALLS, null, cv);
- }
- }
-
- try (Cursor source = contacts.rawQuery("SELECT * FROM " +
- LegacyConstants.VOICEMAIL_STATUS_LEGACY, null)) {
- while (source.moveToNext()) {
- cv.clear();
-
- DatabaseUtils.cursorRowToContentValues(source, cv);
-
- calllog.insertOrThrow(Tables.VOICEMAIL_STATUS, null, cv);
- }
- }
-
- contacts.execSQL("DROP TABLE " + LegacyConstants.CALLS_LEGACY + ";");
- contacts.execSQL("DROP TABLE " + LegacyConstants.VOICEMAIL_STATUS_LEGACY + ";");
-
- // Also copy the last sync time.
- PropertyUtils.setProperty(calllog, DbProperties.CALL_LOG_LAST_SYNCED,
- PropertyUtils.getProperty(contacts,
- LegacyConstants.CALL_LOG_LAST_SYNCED_LEGACY, null));
-
- Log.i(TAG, "Migration completed.");
-
- calllog.setTransactionSuccessful();
- } finally {
- calllog.endTransaction();
- }
-
- contacts.setTransactionSuccessful();
- } catch (RuntimeException e) {
- // We don't want to be stuck here, so we just swallow exceptions...
- Log.w(TAG, "Exception caught during migration", e);
- } finally {
- contacts.endTransaction();
- }
- PropertyUtils.setProperty(calllog, DbProperties.DATA_MIGRATED, "1");
- }
-
@VisibleForTesting
static boolean tableExists(SQLiteDatabase db, String table) {
return DatabaseUtils.longForQuery(db,