diff options
author | Flavio Lerda <flerda@google.com> | 2011-08-21 14:55:00 +0100 |
---|---|---|
committer | Flavio Lerda <flerda@google.com> | 2011-08-26 10:01:17 +0100 |
commit | 7a24e1c1476b57a6268de8d57e5ef4a2d5f46794 (patch) | |
tree | 5ecc74ae267c0fbf32d0342721ab2acb8e56842e | |
parent | dac99257ff2cca8028afd471699fbcea44c09a1b (diff) | |
download | packages_providers_ContactsProvider-7a24e1c1476b57a6268de8d57e5ef4a2d5f46794.zip packages_providers_ContactsProvider-7a24e1c1476b57a6268de8d57e5ef4a2d5f46794.tar.gz packages_providers_ContactsProvider-7a24e1c1476b57a6268de8d57e5ef4a2d5f46794.tar.bz2 |
Add a few columns for caching to the call log.
These columns store additional information about the contact associated
with a call log entry and are needed by the new functionality present in
the call log.
This change matches the newly defined columns in
android.provider.CallLog.
Bug: 5101753
Change-Id: Ife45e7034af098bf0e1ca35d05bb389a2c47909a
3 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/CallLogProvider.java b/src/com/android/providers/contacts/CallLogProvider.java index f37e62b..8202241 100644 --- a/src/com/android/providers/contacts/CallLogProvider.java +++ b/src/com/android/providers/contacts/CallLogProvider.java @@ -78,6 +78,10 @@ public class CallLogProvider extends ContentProvider { sCallsProjectionMap.put(Calls.CACHED_NUMBER_LABEL, Calls.CACHED_NUMBER_LABEL); sCallsProjectionMap.put(Calls.COUNTRY_ISO, Calls.COUNTRY_ISO); sCallsProjectionMap.put(Calls.GEOCODED_LOCATION, Calls.GEOCODED_LOCATION); + sCallsProjectionMap.put(Calls.CACHED_LOOKUP_URI, Calls.CACHED_LOOKUP_URI); + sCallsProjectionMap.put(Calls.CACHED_MATCHED_NUMBER, Calls.CACHED_MATCHED_NUMBER); + sCallsProjectionMap.put(Calls.CACHED_NORMALIZED_NUMBER, Calls.CACHED_NORMALIZED_NUMBER); + sCallsProjectionMap.put(Calls.CACHED_PHOTO_ID, Calls.CACHED_PHOTO_ID); } private ContactsDatabaseHelper mDbHelper; diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java index edf343d..f7847dd 100644 --- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java +++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java @@ -102,7 +102,7 @@ import java.util.Locale; * 600-699 Ice Cream Sandwich * </pre> */ - static final int DATABASE_VERSION = 614; + static final int DATABASE_VERSION = 615; private static final String DATABASE_NAME = "contacts2.db"; private static final String DATABASE_PRESENCE = "presence_db"; @@ -1162,6 +1162,10 @@ import java.util.Locale; Calls.VOICEMAIL_URI + " TEXT," + Calls.IS_READ + " INTEGER," + Calls.GEOCODED_LOCATION + " TEXT," + + Calls.CACHED_LOOKUP_URI + " TEXT," + + Calls.CACHED_MATCHED_NUMBER + " TEXT," + + Calls.CACHED_NORMALIZED_NUMBER + " TEXT," + + Calls.CACHED_PHOTO_ID + " INTEGER NOT NULL DEFAULT 0," + Voicemails._DATA + " TEXT," + Voicemails.HAS_CONTENT + " INTEGER," + Voicemails.MIME_TYPE + " TEXT," + @@ -2213,6 +2217,11 @@ import java.util.Locale; oldVersion = 614; } + if (oldVersion < 615) { + upgradeToVersion615(db); + oldVersion = 615; + } + if (upgradeViewsAndTriggers) { createContactsViews(db); createGroupsView(db); @@ -3405,6 +3414,15 @@ import java.util.Locale; "FOREIGN KEY(stream_item_id) REFERENCES stream_items(_id));"); } + private void upgradeToVersion615(SQLiteDatabase db) { + // Old calls will not have up to date values for these columns, they will be filled in + // as needed. + db.execSQL("ALTER TABLE calls ADD lookup_uri TEXT DEFAULT NULL;"); + db.execSQL("ALTER TABLE calls ADD matched_number TEXT DEFAULT NULL;"); + db.execSQL("ALTER TABLE calls ADD normalized_number TEXT DEFAULT NULL;"); + db.execSQL("ALTER TABLE calls ADD photo_id INTEGER NOT NULL DEFAULT 0;"); + } + public String extractHandleFromEmailAddress(String email) { Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(email); if (tokens.length == 0) { diff --git a/tests/src/com/android/providers/contacts/CallLogProviderTest.java b/tests/src/com/android/providers/contacts/CallLogProviderTest.java index e337862..3a73c97 100644 --- a/tests/src/com/android/providers/contacts/CallLogProviderTest.java +++ b/tests/src/com/android/providers/contacts/CallLogProviderTest.java @@ -63,7 +63,7 @@ public class CallLogProviderTest extends BaseContactsProvider2Test { Voicemails.SOURCE_DATA, Voicemails.STATE}; /** Total number of columns exposed by call_log provider. */ - private static final int NUM_CALLLOG_FIELDS = 13; + private static final int NUM_CALLLOG_FIELDS = 17; @Override protected Class<? extends ContentProvider> getProviderClass() { |