am f8a81b94: Set ContactsProvider Settings so that ungrouped Exchange contacts display by default

Merge commit 'f8a81b94a3de67e8dcd6a83b06079c2656f511a8'

* commit 'f8a81b94a3de67e8dcd6a83b06079c2656f511a8':
  Set ContactsProvider Settings so that ungrouped Exchange contacts display by default
This commit is contained in:
Marc Blank 2009-08-27 14:07:14 -07:00 committed by Android Git Automerger
commit a7c02325e6

View File

@ -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);