diff options
author | Stephen Bird <sbird@cyngn.com> | 2015-12-21 17:54:25 -0800 |
---|---|---|
committer | Stephen Bird <sbird@cyngn.com> | 2016-03-18 10:42:08 -0700 |
commit | 2e198269f1cfac6c31e1b231ce47e3bc4f67bbe8 (patch) | |
tree | c7fff61c708cb54be0dc901b7863c4c479448c1e | |
parent | 832a3d681c78007f090ccfd456c1b9e42e8fb4a4 (diff) | |
download | packages_providers_ContactsProvider-2e198269f1cfac6c31e1b231ce47e3bc4f67bbe8.zip packages_providers_ContactsProvider-2e198269f1cfac6c31e1b231ce47e3bc4f67bbe8.tar.gz packages_providers_ContactsProvider-2e198269f1cfac6c31e1b231ce47e3bc4f67bbe8.tar.bz2 |
[4/4] Add column for storing origin in CallLog
We use this origin column to determine which parts of the application/os
are used to make calls most often.
Ticket: CD-517
Change-Id: I254a4731e7618b6dd523bf6ba567d2a5dffd3c01
-rw-r--r-- | src/com/android/providers/contacts/CallLogProvider.java | 5 | ||||
-rw-r--r-- | src/com/android/providers/contacts/ContactsDatabaseHelper.java | 18 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/com/android/providers/contacts/CallLogProvider.java b/src/com/android/providers/contacts/CallLogProvider.java index 9070e78..1443247 100644 --- a/src/com/android/providers/contacts/CallLogProvider.java +++ b/src/com/android/providers/contacts/CallLogProvider.java @@ -84,7 +84,8 @@ public class CallLogProvider extends ContentProvider { Calls.DURATION, Calls.DATA_USAGE, Calls.PHONE_ACCOUNT_COMPONENT_NAME, - Calls.PHONE_ACCOUNT_ID + Calls.PHONE_ACCOUNT_ID, + ContactsDatabaseHelper.CallColumns.ORIGIN }; static final String[] MINIMAL_PROJECTION = new String[] { Calls._ID }; @@ -141,6 +142,8 @@ public class CallLogProvider extends ContentProvider { sCallsProjectionMap.put(Calls.CACHED_PHOTO_ID, Calls.CACHED_PHOTO_ID); sCallsProjectionMap.put(Calls.CACHED_PHOTO_URI, Calls.CACHED_PHOTO_URI); sCallsProjectionMap.put(Calls.CACHED_FORMATTED_NUMBER, Calls.CACHED_FORMATTED_NUMBER); + sCallsProjectionMap.put(ContactsDatabaseHelper.CallColumns.ORIGIN, + ContactsDatabaseHelper.CallColumns.ORIGIN); } private HandlerThread mBackgroundThread; diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java index c84c97f..12a6f56 100644 --- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java +++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java @@ -121,7 +121,7 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { * 1000-1099 M * </pre> */ - static final int DATABASE_VERSION = 1011; + static final int DATABASE_VERSION = 1012; public interface Tables { public static final String CONTACTS = "contacts"; @@ -585,6 +585,10 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { String CONTACT_ID = "presence_contact_id"; } + public interface CallColumns { + String ORIGIN = "origin"; + } + public interface AggregatedPresenceColumns { String CONTACT_ID = "presence_contact_id"; String CONCRETE_CONTACT_ID = Tables.AGGREGATED_PRESENCE + "." + CONTACT_ID; @@ -1527,6 +1531,7 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { Calls.CACHED_PHOTO_ID + " INTEGER NOT NULL DEFAULT 0," + Calls.CACHED_PHOTO_URI + " TEXT," + Calls.CACHED_FORMATTED_NUMBER + " TEXT," + + CallColumns.ORIGIN + " TEXT," + Voicemails._DATA + " TEXT," + Voicemails.HAS_CONTENT + " INTEGER," + Voicemails.MIME_TYPE + " TEXT," + @@ -2915,6 +2920,11 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { oldVersion = 1011; } + if (oldVersion < 1012) { + upgradeToVersion1012(db); + oldVersion = 1012; + } + if (upgradeViewsAndTriggers) { createContactsViews(db); createGroupsView(db); @@ -4464,6 +4474,12 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { db.execSQL("DROP TABLE IF EXISTS metadata_sync"); } + // Add origin column to record where a call came from via the origin extra. + private void upgradeToVersion1012(SQLiteDatabase db) { + db.execSQL("ALTER TABLE " + Tables.CALLS + " ADD " + CallColumns.ORIGIN + + " TEXT DEFAULT NULL;"); + } + public String extractHandleFromEmailAddress(String email) { Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(email); if (tokens.length == 0) { |