Set ContactsProvider Settings so that ungrouped Exchange contacts display by default
Change-Id: Ie7ede23efdd371816c8dc190b8269abd83c5f238
This commit is contained in:
parent
4118beebed
commit
f8a81b94a3
@ -41,6 +41,7 @@ import android.provider.SyncStateContract;
|
|||||||
import android.provider.ContactsContract.Data;
|
import android.provider.ContactsContract.Data;
|
||||||
import android.provider.ContactsContract.Groups;
|
import android.provider.ContactsContract.Groups;
|
||||||
import android.provider.ContactsContract.RawContacts;
|
import android.provider.ContactsContract.RawContacts;
|
||||||
|
import android.provider.ContactsContract.Settings;
|
||||||
import android.provider.ContactsContract.SyncState;
|
import android.provider.ContactsContract.SyncState;
|
||||||
import android.provider.ContactsContract.CommonDataKinds.Email;
|
import android.provider.ContactsContract.CommonDataKinds.Email;
|
||||||
import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
|
import android.provider.ContactsContract.CommonDataKinds.GroupMembership;
|
||||||
@ -141,7 +142,14 @@ public class ContactsSyncAdapter extends AbstractSyncAdapter {
|
|||||||
byte[] data = SyncStateContract.Helpers.get(client,
|
byte[] data = SyncStateContract.Helpers.get(client,
|
||||||
ContactsContract.SyncState.CONTENT_URI, getAccountManagerAccount());
|
ContactsContract.SyncState.CONTENT_URI, getAccountManagerAccount());
|
||||||
if (data == null || data.length == 0) {
|
if (data == null || data.length == 0) {
|
||||||
|
// Initialize the SyncKey
|
||||||
setSyncKey("0", false);
|
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";
|
return "0";
|
||||||
} else {
|
} else {
|
||||||
String syncKey = new String(data);
|
String syncKey = new String(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user