fixup after merge from master
diff --git a/src/com/android/providers/contacts/ContactsProvider.java b/src/com/android/providers/contacts/ContactsProvider.java
index 6b239ab..20cac98 100644
--- a/src/com/android/providers/contacts/ContactsProvider.java
+++ b/src/com/android/providers/contacts/ContactsProvider.java
@@ -1672,7 +1672,7 @@
String[] whereArgs;
if (account != null) {
whereString = "_sync_account=? AND _sync_account_type=? AND name=?";
- whereArgs = new String[]{account.mName, account.mType, Groups.GROUP_ANDROID_STARRED};
+ whereArgs = new String[]{account.name, account.type, Groups.GROUP_ANDROID_STARRED};
} else {
whereString = "_sync_account is null AND name=?";
whereArgs = new String[]{Groups.GROUP_ANDROID_STARRED};
@@ -1969,8 +1969,8 @@
}
if (account == null && mAccounts.length > 0) {
// TODO(fredq) change this to pick the account that is syncable for contacts
- values.put(SyncConstValue._SYNC_ACCOUNT, mAccounts[0].mName);
- values.put(SyncConstValue._SYNC_ACCOUNT_TYPE, mAccounts[0].mType);
+ values.put(SyncConstValue._SYNC_ACCOUNT, mAccounts[0].name);
+ values.put(SyncConstValue._SYNC_ACCOUNT_TYPE, mAccounts[0].type);
}
}
}
@@ -2067,8 +2067,8 @@
mValuesLocal.clear();
mValuesLocal.put(Groups.NAME, Groups.GROUP_ANDROID_STARRED);
mValuesLocal.put(Groups._SYNC_DIRTY, 1);
- mValuesLocal.put(Groups._SYNC_ACCOUNT, account == null ? null : account.mName);
- mValuesLocal.put(Groups._SYNC_ACCOUNT_TYPE, account == null ? null : account.mType);
+ mValuesLocal.put(Groups._SYNC_ACCOUNT, account == null ? null : account.name);
+ mValuesLocal.put(Groups._SYNC_ACCOUNT_TYPE, account == null ? null : account.type);
long groupId = mGroupsInserter.insert(mValuesLocal);
starredGroupInfo = new ContentValues();
starredGroupInfo.put(Groups._ID, groupId);
@@ -2689,7 +2689,7 @@
db.delete(sSettingsTable, "_sync_account IS NULL AND key=?", new String[]{key});
} else {
db.delete(sSettingsTable, "_sync_account=? AND _sync_account_type=? AND key=?",
- new String[]{account.mName, account.mType, key});
+ new String[]{account.name, account.type, key});
}
long rowId = db.insert(sSettingsTable, Contacts.Settings.KEY, values);
if (rowId < 0) {
@@ -2778,7 +2778,7 @@
Account syncAccount, String syncId) {
fixupPeopleStarredOnGroupRename(oldName, newName,
"_sync_account=? AND _sync_account_type=? AND _sync_id=?",
- new String[]{syncAccount.mName, syncAccount.mType, syncId});
+ new String[]{syncAccount.name, syncAccount.type, syncId});
}
void fixupPeopleStarredOnGroupRename(String oldName, String newName, long groupId) {
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java
index dbcb25b..3827a05 100644
--- a/src/com/android/providers/contacts/ContactsProvider2.java
+++ b/src/com/android/providers/contacts/ContactsProvider2.java
@@ -272,7 +272,7 @@
}
public static final String DEFAULT_ACCOUNT_TYPE = "com.google.GAIA";
- public static final String FEATURE_APPS_FOR_DOMAIN = "google_or_dasher";
+ public static final String FEATURE_LEGACY_HOSTED_OR_GOOGLE = "legacy_hosted_or_google";
/** Contains just the contacts columns
* @deprecated*/
@@ -1342,8 +1342,8 @@
account = valuesAccount;
}
if (account != null) {
- values.put(RawContacts.ACCOUNT_NAME, account.mName);
- values.put(RawContacts.ACCOUNT_TYPE, account.mType);
+ values.put(RawContacts.ACCOUNT_NAME, account.name);
+ values.put(RawContacts.ACCOUNT_TYPE, account.type);
}
return true;
}
@@ -1481,14 +1481,14 @@
// as the contact refered to by rawContactId
c = db.query(Tables.GROUPS, new String[]{RawContacts._ID},
Clauses.GROUP_HAS_ACCOUNT_AND_SOURCE_ID,
- new String[]{sourceId, account.mName, account.mType}, null, null, null);
+ new String[]{sourceId, account.name, account.type}, null, null, null);
try {
if (c.moveToNext()) {
return c.getLong(0);
} else {
ContentValues groupValues = new ContentValues();
- groupValues.put(Groups.ACCOUNT_NAME, account.mName);
- groupValues.put(Groups.ACCOUNT_TYPE, account.mType);
+ groupValues.put(Groups.ACCOUNT_NAME, account.name);
+ groupValues.put(Groups.ACCOUNT_TYPE, account.type);
groupValues.put(Groups.SOURCE_ID, sourceId);
long groupId = db.insert(Tables.GROUPS, Groups.ACCOUNT_NAME, groupValues);
if (groupId < 0) {
@@ -2948,8 +2948,8 @@
protected Account getDefaultAccount() {
AccountManager accountManager = AccountManager.get(getContext());
try {
- Account[] accounts = accountManager.blockingGetAccountsWithTypeAndFeatures(
- DEFAULT_ACCOUNT_TYPE, new String[] {FEATURE_APPS_FOR_DOMAIN});
+ Account[] accounts = accountManager.getAccountsByTypeAndFeatures(DEFAULT_ACCOUNT_TYPE,
+ new String[] {FEATURE_LEGACY_HOSTED_OR_GOOGLE}, null, null).getResult();
if (accounts != null && accounts.length > 0) {
return accounts[0];
}
diff --git a/src/com/android/providers/contacts/LegacyApiSupport.java b/src/com/android/providers/contacts/LegacyApiSupport.java
index 04f601d..fe814f0 100644
--- a/src/com/android/providers/contacts/LegacyApiSupport.java
+++ b/src/com/android/providers/contacts/LegacyApiSupport.java
@@ -787,8 +787,8 @@
values, People.TIMES_CONTACTED);
OpenHelper.copyLongValue(mValues, RawContacts.STARRED,
values, People.STARRED);
- mValues.put(RawContacts.ACCOUNT_NAME, mAccount.mName);
- mValues.put(RawContacts.ACCOUNT_TYPE, mAccount.mType);
+ mValues.put(RawContacts.ACCOUNT_NAME, mAccount.name);
+ mValues.put(RawContacts.ACCOUNT_TYPE, mAccount.type);
Uri contactUri = mContactsProvider.insert(RawContacts.CONTENT_URI, mValues);
long rawContactId = ContentUris.parseId(contactUri);
@@ -940,8 +940,8 @@
OpenHelper.copyStringValue(mValues, Groups.SYSTEM_ID,
values, android.provider.Contacts.Groups.SYSTEM_ID);
- mValues.put(Groups.ACCOUNT_NAME, mAccount.mName);
- mValues.put(Groups.ACCOUNT_TYPE, mAccount.mType);
+ mValues.put(Groups.ACCOUNT_NAME, mAccount.name);
+ mValues.put(Groups.ACCOUNT_TYPE, mAccount.type);
Uri uri = mContactsProvider.insert(Groups.CONTENT_URI, mValues);
return ContentUris.parseId(uri);
@@ -1376,18 +1376,18 @@
private void applyRawContactsAccount(SQLiteQueryBuilder qb, Uri uri) {
StringBuilder sb = new StringBuilder();
sb.append(RawContacts.ACCOUNT_NAME + "=");
- DatabaseUtils.appendEscapedSQLString(sb, mAccount.mName);
+ DatabaseUtils.appendEscapedSQLString(sb, mAccount.name);
sb.append(" AND " + RawContacts.ACCOUNT_TYPE + "=");
- DatabaseUtils.appendEscapedSQLString(sb, mAccount.mType);
+ DatabaseUtils.appendEscapedSQLString(sb, mAccount.type);
qb.appendWhere(sb.toString());
}
private void applyGroupAccount(SQLiteQueryBuilder qb, Uri uri) {
StringBuilder sb = new StringBuilder();
sb.append(Groups.ACCOUNT_NAME + "=");
- DatabaseUtils.appendEscapedSQLString(sb, mAccount.mName);
+ DatabaseUtils.appendEscapedSQLString(sb, mAccount.name);
sb.append(" AND " + Groups.ACCOUNT_TYPE + "=");
- DatabaseUtils.appendEscapedSQLString(sb, mAccount.mType);
+ DatabaseUtils.appendEscapedSQLString(sb, mAccount.type);
qb.appendWhere(sb.toString());
}
diff --git a/tests/src/com/android/providers/contacts/BaseContactsProvider2Test.java b/tests/src/com/android/providers/contacts/BaseContactsProvider2Test.java
index e57f1ee..1be7c5a 100644
--- a/tests/src/com/android/providers/contacts/BaseContactsProvider2Test.java
+++ b/tests/src/com/android/providers/contacts/BaseContactsProvider2Test.java
@@ -116,8 +116,8 @@
return uri;
}
return uri.buildUpon()
- .appendQueryParameter(RawContacts.ACCOUNT_NAME, account.mName)
- .appendQueryParameter(RawContacts.ACCOUNT_TYPE, account.mType)
+ .appendQueryParameter(RawContacts.ACCOUNT_NAME, account.name)
+ .appendQueryParameter(RawContacts.ACCOUNT_TYPE, account.type)
.build();
}
@@ -425,8 +425,8 @@
assertTrue(c.isNull(c.getColumnIndexOrThrow(Groups.ACCOUNT_NAME)));
assertTrue(c.isNull(c.getColumnIndexOrThrow(Groups.ACCOUNT_TYPE)));
} else {
- assertEquals(account.mName, c.getString(c.getColumnIndexOrThrow(Groups.ACCOUNT_NAME)));
- assertEquals(account.mType, c.getString(c.getColumnIndexOrThrow(Groups.ACCOUNT_TYPE)));
+ assertEquals(account.name, c.getString(c.getColumnIndexOrThrow(Groups.ACCOUNT_NAME)));
+ assertEquals(account.type, c.getString(c.getColumnIndexOrThrow(Groups.ACCOUNT_TYPE)));
}
}