From f8a81b94a3de67e8dcd6a83b06079c2656f511a8 Mon Sep 17 00:00:00 2001 From: Marc Blank Date: Thu, 27 Aug 2009 11:00:59 -0700 Subject: [PATCH] Set ContactsProvider Settings so that ungrouped Exchange contacts display by default Change-Id: Ie7ede23efdd371816c8dc190b8269abd83c5f238 --- src/com/android/exchange/adapter/ContactsSyncAdapter.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/com/android/exchange/adapter/ContactsSyncAdapter.java b/src/com/android/exchange/adapter/ContactsSyncAdapter.java index ca3cb53f7..ca0f9c982 100644 --- a/src/com/android/exchange/adapter/ContactsSyncAdapter.java +++ b/src/com/android/exchange/adapter/ContactsSyncAdapter.java @@ -41,6 +41,7 @@ import android.provider.SyncStateContract; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.Groups; import android.provider.ContactsContract.RawContacts; +import android.provider.ContactsContract.Settings; import android.provider.ContactsContract.SyncState; import android.provider.ContactsContract.CommonDataKinds.Email; import android.provider.ContactsContract.CommonDataKinds.GroupMembership; @@ -141,7 +142,14 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter { byte[] data = SyncStateContract.Helpers.get(client, ContactsContract.SyncState.CONTENT_URI, getAccountManagerAccount()); if (data == null || data.length == 0) { + // Initialize the SyncKey setSyncKey("0", false); + // Make sure ungrouped contacts for Exchange are defaultly visible + ContentValues cv = new ContentValues(); + cv.put(Groups.ACCOUNT_NAME, mAccount.mEmailAddress); + cv.put(Groups.ACCOUNT_TYPE, Eas.ACCOUNT_MANAGER_TYPE); + cv.put(Settings.UNGROUPED_VISIBLE, true); + client.insert(Settings.CONTENT_URI, cv); return "0"; } else { String syncKey = new String(data);