Merge "Point to correct R file in ContactsCommon tests" into ub-contactsdialer-a-dev
diff --git a/src/com/android/contacts/common/list/ViewPagerTabs.java b/src/com/android/contacts/common/list/ViewPagerTabs.java
index dd1fd9a..f1fb6f9 100644
--- a/src/com/android/contacts/common/list/ViewPagerTabs.java
+++ b/src/com/android/contacts/common/list/ViewPagerTabs.java
@@ -184,8 +184,14 @@
if (mUnreadCounts != null && mUnreadCounts[position] > 0) {
textView.setText(Integer.toString(mUnreadCounts[position]));
textView.setVisibility(View.VISIBLE);
+ iconView.setContentDescription(getResources().getQuantityString(
+ R.plurals.tab_title_with_unread_items,
+ mUnreadCounts[position],
+ tabTitle.toString(),
+ mUnreadCounts[position]));
} else {
textView.setVisibility(View.INVISIBLE);
+ iconView.setContentDescription(tabTitle);
}
tabView = layout;
} else {
diff --git a/src/com/android/contacts/common/model/RawContactModifier.java b/src/com/android/contacts/common/model/RawContactModifier.java
index 63c9a41..c1ee888 100644
--- a/src/com/android/contacts/common/model/RawContactModifier.java
+++ b/src/com/android/contacts/common/model/RawContactModifier.java
@@ -402,6 +402,11 @@
}
public static boolean hasChanges(RawContactDeltaList set, AccountTypeManager accountTypes) {
+ return hasChanges(set, accountTypes, /* excludedMimeTypes =*/ null);
+ }
+
+ public static boolean hasChanges(RawContactDeltaList set, AccountTypeManager accountTypes,
+ Set<String> excludedMimeTypes) {
if (set.isMarkedForSplitting() || set.isMarkedForJoining()) {
return true;
}
@@ -411,7 +416,7 @@
final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
final String dataSet = values.getAsString(RawContacts.DATA_SET);
final AccountType type = accountTypes.getAccountType(accountType, dataSet);
- if (hasChanges(state, type)) {
+ if (hasChanges(state, type, excludedMimeTypes)) {
return true;
}
}
@@ -463,9 +468,11 @@
}
}
- private static boolean hasChanges(RawContactDelta state, AccountType accountType) {
+ private static boolean hasChanges(RawContactDelta state, AccountType accountType,
+ Set<String> excludedMimeTypes) {
for (DataKind kind : accountType.getSortedDataKinds()) {
final String mimeType = kind.mimeType;
+ if (excludedMimeTypes != null && excludedMimeTypes.contains(mimeType)) continue;
final ArrayList<ValuesDelta> entries = state.getMimeEntries(mimeType);
if (entries == null) continue;
diff --git a/src/com/android/contacts/common/preference/ContactsPreferences.java b/src/com/android/contacts/common/preference/ContactsPreferences.java
index 1d7b120..ca38af7 100644
--- a/src/com/android/contacts/common/preference/ContactsPreferences.java
+++ b/src/com/android/contacts/common/preference/ContactsPreferences.java
@@ -21,6 +21,7 @@
import android.content.SharedPreferences.Editor;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Handler;
+import android.preference.PreferenceManager;
import android.provider.Settings;
import android.provider.Settings.SettingNotFoundException;
import android.text.TextUtils;
@@ -238,8 +239,10 @@
/**
* If there are currently no preferences (which means this is the first time we are run),
- * check to see if there are any preferences stored in system settings (pre-L) which can be
- * copied into our own SharedPreferences.
+ * For sort order and display order, check to see if there are any preferences stored in
+ * system settings (pre-L) which can be copied into our own SharedPreferences.
+ * For default account setting, check to see if there are any preferences stored in the previous
+ * SharedPreferences which can be copied into current SharedPreferences.
*/
private void maybeMigrateSystemSettings() {
if (!mPreferences.contains(SORT_ORDER_KEY)) {
@@ -261,5 +264,16 @@
}
setDisplayOrder(displayOrder);
}
+
+ if (!mPreferences.contains(mDefaultAccountKey)) {
+ final SharedPreferences previousPrefs =
+ PreferenceManager.getDefaultSharedPreferences(mContext);
+ final String defaultAccount = previousPrefs.getString(mDefaultAccountKey, null);
+ if (!TextUtils.isEmpty(defaultAccount)) {
+ final AccountWithDataSet accountWithDataSet = AccountWithDataSet.unstringify(
+ defaultAccount);
+ setDefaultAccount(accountWithDataSet);
+ }
+ }
}
}