Skip to content

Commit

Permalink
Allow a sync adapter to provide an OPEN action for a group
Browse files Browse the repository at this point in the history
Bug:4413120
Change-Id: I798b586acd200f0713c59f75b2815ce22e8a9c86
  • Loading branch information
Daniel Lehmann committed Jul 12, 2011
1 parent ed6bfd9 commit 1cdfc9d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/com/android/providers/contacts/ContactsDatabaseHelper.java
Expand Up @@ -100,7 +100,7 @@
* 600-699 Ice Cream Sandwich
* </pre>
*/
static final int DATABASE_VERSION = 606;
static final int DATABASE_VERSION = 607;

private static final String DATABASE_NAME = "contacts2.db";
private static final String DATABASE_PRESENCE = "presence_db";
Expand Down Expand Up @@ -370,8 +370,12 @@ public interface GroupsColumns {

public static final String CONCRETE_ID = Tables.GROUPS + "." + BaseColumns._ID;
public static final String CONCRETE_SOURCE_ID = Tables.GROUPS + "." + Groups.SOURCE_ID;
public static final String CONCRETE_ACCOUNT_NAME = Tables.GROUPS + "." + Groups.ACCOUNT_NAME;
public static final String CONCRETE_ACCOUNT_TYPE = Tables.GROUPS + "." + Groups.ACCOUNT_TYPE;
public static final String CONCRETE_ACCOUNT_NAME =
Tables.GROUPS + "." + Groups.ACCOUNT_NAME;
public static final String CONCRETE_ACCOUNT_TYPE =
Tables.GROUPS + "." + Groups.ACCOUNT_TYPE;
public static final String CONCRETE_ACTION = Tables.GROUPS + "." + Groups.ACTION;
public static final String CONCRETE_ACTION_URI = Tables.GROUPS + "." + Groups.ACTION_URI;
}

public interface ActivitiesColumns {
Expand Down Expand Up @@ -1015,6 +1019,8 @@ public void onCreate(SQLiteDatabase db) {
Groups.TITLE + " TEXT," +
Groups.TITLE_RES + " INTEGER," +
Groups.NOTES + " TEXT," +
Groups.ACTION + " TEXT," +
Groups.ACTION_URI + " TEXT," +
Groups.SYSTEM_ID + " TEXT," +
Groups.DELETED + " INTEGER NOT NULL DEFAULT 0," +
Groups.GROUP_VISIBLE + " INTEGER NOT NULL DEFAULT 0," +
Expand Down Expand Up @@ -1638,6 +1644,8 @@ private static void createGroupsView(SQLiteDatabase db) {
+ Groups.TITLE + ","
+ Groups.TITLE_RES + ","
+ Groups.NOTES + ","
+ Groups.ACTION + ", "
+ Groups.ACTION_URI + ", "
+ Groups.SYSTEM_ID + ","
+ Groups.DELETED + ","
+ Groups.GROUP_VISIBLE + ","
Expand Down Expand Up @@ -1988,6 +1996,12 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
oldVersion = 606;
}

if (oldVersion < 607) {
upgradeViewsAndTriggers = true;
upgradeToVersion607(db);
oldVersion = 607;
}

if (upgradeViewsAndTriggers) {
createContactsViews(db);
createGroupsView(db);
Expand Down Expand Up @@ -3111,6 +3125,11 @@ private void upgradeToVersion606(SQLiteDatabase db) {
// provide ALTER TABLE DROP COLUMN. As they have DEFAULT 0, we can keep but ignore them
}

private void upgradeToVersion607(SQLiteDatabase db) {
db.execSQL("ALTER TABLE groups ADD COLUMN action TEXT");
db.execSQL("ALTER TABLE groups ADD COLUMN action_uri TEXT");
}

public String extractHandleFromEmailAddress(String email) {
Rfc822Token[] tokens = Rfc822Tokenizer.tokenize(email);
if (tokens.length == 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/com/android/providers/contacts/ContactsProvider2.java
Expand Up @@ -756,6 +756,8 @@ interface RawContactsQuery {
.add(Groups.SYSTEM_ID)
.add(Groups.DELETED)
.add(Groups.NOTES)
.add(Groups.ACTION)
.add(Groups.ACTION_URI)
.add(Groups.SHOULD_SYNC)
.add(Groups.FAVORITES)
.add(Groups.AUTO_ADD)
Expand Down

0 comments on commit 1cdfc9d

Please sign in to comment.