From 0a72f0850f5123ce50f6e5eb8db8c11297024d8f Mon Sep 17 00:00:00 2001 From: Amit Kumar Date: Thu, 25 Mar 2021 22:18:37 +0530 Subject: [PATCH] Sort /e/ account with first priority and allow user to modify primary account for profile Change-Id: I27755aa319359ec33438f0a6bd470be126fd0f9a --- .../contacts/editor/RawContactEditorView.java | 2 +- .../contacts/model/account/AccountComparator.java | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java index fc41ae99b7..cc801bfc87 100644 --- a/src/com/android/contacts/editor/RawContactEditorView.java +++ b/src/com/android/contacts/editor/RawContactEditorView.java @@ -782,7 +782,7 @@ public class RawContactEditorView extends LinearLayout implements View.OnClickLi } // If we're saving a new contact and there are multiple accounts, add the account selector. - if (mHasNewContact && !mIsUserProfile && mAccounts.size() > 1) { + if (mHasNewContact && mAccounts.size() > 1) { addAccountSelector(mCurrentRawContactDelta); } } diff --git a/src/com/android/contacts/model/account/AccountComparator.java b/src/com/android/contacts/model/account/AccountComparator.java index 70ccf494fb..8bc8fbbf76 100644 --- a/src/com/android/contacts/model/account/AccountComparator.java +++ b/src/com/android/contacts/model/account/AccountComparator.java @@ -38,13 +38,13 @@ public class AccountComparator implements Comparator { return -1; } else if (a.name == null || a.type == null) { return 1; - } else if (isWritableGoogleAccount(a) && a.equals(mDefaultAccount)) { + } else if (isWritableEAccount(a) && a.equals(mDefaultAccount)) { return -1; - } else if (isWritableGoogleAccount(b) && b.equals(mDefaultAccount)) { + } else if (isWritableEAccount(b) && b.equals(mDefaultAccount)) { return 1; - } else if (isWritableGoogleAccount(a) && !isWritableGoogleAccount(b)) { + } else if (isWritableEAccount(a) && !isWritableEAccount(b)) { return -1; - } else if (isWritableGoogleAccount(b) && !isWritableGoogleAccount(a)) { + } else if (isWritableEAccount(b) && !isWritableEAccount(a)) { return 1; } else { int diff = a.name.compareToIgnoreCase(b.name); @@ -65,7 +65,7 @@ public class AccountComparator implements Comparator { } } - private static boolean isWritableGoogleAccount(AccountWithDataSet account) { - return GoogleAccountType.ACCOUNT_TYPE.equals(account.type) && account.dataSet == null; + private static boolean isWritableEAccount(AccountWithDataSet account) { + return "foundation.e.accountmanager.eelo.address_book".equals(account.type) && account.dataSet == null; } } -- GitLab