Loading src/com/android/contacts/common/preference/ContactsPreferences.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -72,7 +72,7 @@ public final class ContactsPreferences implements OnSharedPreferenceChangeListen public static final boolean PREF_DISPLAY_ONLY_PHONES_DEFAULT = false; 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"; public static final String CONTACT_METADATA_AUTHORITY = "com.android.contacts.metadata"; Loading src/com/android/contacts/common/preference/DisplayOptionsPreferenceFragment.java +14 −2 Original line number Original line Diff line number Diff line Loading @@ -29,8 +29,10 @@ import android.preference.PreferenceScreen; import com.android.contacts.common.R; import com.android.contacts.common.R; import com.android.contacts.common.activity.LicenseActivity; 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.AccountTypeManager; import com.android.contacts.common.model.account.AccountWithDataSet; import com.android.contacts.common.model.account.AccountWithDataSet; import com.android.contacts.common.model.account.GoogleAccountType; import java.util.List; import java.util.List; Loading Loading @@ -84,10 +86,20 @@ public class DisplayOptionsPreferenceFragment extends PreferenceFragment { getPreferenceScreen().removePreference(findPreference("accounts")); 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 // and 2) there is at least one focus google account 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")); getPreferenceScreen().removePreference(findPreference("contactMetadata")); } } } @Override @Override public Context getContext() { public Context getContext() { Loading Loading
src/com/android/contacts/common/preference/ContactsPreferences.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -72,7 +72,7 @@ public final class ContactsPreferences implements OnSharedPreferenceChangeListen public static final boolean PREF_DISPLAY_ONLY_PHONES_DEFAULT = false; 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"; public static final String CONTACT_METADATA_AUTHORITY = "com.android.contacts.metadata"; Loading
src/com/android/contacts/common/preference/DisplayOptionsPreferenceFragment.java +14 −2 Original line number Original line Diff line number Diff line Loading @@ -29,8 +29,10 @@ import android.preference.PreferenceScreen; import com.android.contacts.common.R; import com.android.contacts.common.R; import com.android.contacts.common.activity.LicenseActivity; 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.AccountTypeManager; import com.android.contacts.common.model.account.AccountWithDataSet; import com.android.contacts.common.model.account.AccountWithDataSet; import com.android.contacts.common.model.account.GoogleAccountType; import java.util.List; import java.util.List; Loading Loading @@ -84,10 +86,20 @@ public class DisplayOptionsPreferenceFragment extends PreferenceFragment { getPreferenceScreen().removePreference(findPreference("accounts")); 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 // and 2) there is at least one focus google account 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")); getPreferenceScreen().removePreference(findPreference("contactMetadata")); } } } @Override @Override public Context getContext() { public Context getContext() { Loading