Merge "Read metadataSyncEnabled flag from N sdk." into ub-contactsdialer-b-dev
diff --git a/src/com/android/contacts/common/preference/ContactsPreferences.java b/src/com/android/contacts/common/preference/ContactsPreferences.java
index 37448e3..5815ef0 100644
--- a/src/com/android/contacts/common/preference/ContactsPreferences.java
+++ b/src/com/android/contacts/common/preference/ContactsPreferences.java
@@ -72,7 +72,7 @@
public static final boolean PREF_DISPLAY_ONLY_PHONES_DEFAULT = false;
- public static final String DO_NOT_SYNC_CONTACT_METADATA_MSG = "Do not sync contact metadata.";
+ public static final String DO_NOT_SYNC_CONTACT_METADATA_MSG = "Do not sync metadata";
public static final String CONTACT_METADATA_AUTHORITY = "com.android.contacts.metadata";
diff --git a/src/com/android/contacts/common/preference/DisplayOptionsPreferenceFragment.java b/src/com/android/contacts/common/preference/DisplayOptionsPreferenceFragment.java
index a8d1460..a8bc234 100644
--- a/src/com/android/contacts/common/preference/DisplayOptionsPreferenceFragment.java
+++ b/src/com/android/contacts/common/preference/DisplayOptionsPreferenceFragment.java
@@ -29,8 +29,10 @@
import com.android.contacts.common.R;
import com.android.contacts.common.activity.LicenseActivity;
+import com.android.contacts.common.compat.MetadataSyncEnabledCompat;
import com.android.contacts.common.model.AccountTypeManager;
import com.android.contacts.common.model.account.AccountWithDataSet;
+import com.android.contacts.common.model.account.GoogleAccountType;
import java.util.List;
@@ -84,9 +86,19 @@
getPreferenceScreen().removePreference(findPreference("accounts"));
}
- // STOPSHIP Show this option when 1) metadata sync is enabled
+ // Show Contact metadata sync option when 1) metadata sync is enabled
// and 2) there is at least one focus google account
- getPreferenceScreen().removePreference(findPreference("contactMetadata"));
+ boolean hasFocusGoogleAccount = false;
+ for (AccountWithDataSet account : accounts) {
+ if (GoogleAccountType.ACCOUNT_TYPE.equals(account.type) && account.dataSet == null) {
+ hasFocusGoogleAccount = true;
+ break;
+ }
+ }
+ if (!hasFocusGoogleAccount
+ || !MetadataSyncEnabledCompat.isMetadataSyncEnabled(getContext())) {
+ getPreferenceScreen().removePreference(findPreference("contactMetadata"));
+ }
}
@Override