diff options
5 files changed, 17 insertions, 13 deletions
diff --git a/src/com/android/contacts/common/model/AccountTypeManager.java b/src/com/android/contacts/common/model/AccountTypeManager.java index ba303c4d..86d6a06e 100644 --- a/src/com/android/contacts/common/model/AccountTypeManager.java +++ b/src/com/android/contacts/common/model/AccountTypeManager.java @@ -461,6 +461,10 @@ class AccountTypeManagerImpl extends AccountTypeManager extensionPackages.addAll(accountType.getExtensionPackageNames()); } + // Add the local account, it does not appear in SyncAdapterTypes. + AccountType localAccountType = new PhoneAccountType(mContext, mContext.getPackageName()); + addAccountType(localAccountType, accountTypesByTypeAndDataSet, accountTypesByType); + // If any extension packages were specified, process them as well. if (!extensionPackages.isEmpty()) { Log.d(TAG, "Registering " + extensionPackages.size() + " extension packages"); diff --git a/src/com/android/contacts/common/model/account/AccountType.java b/src/com/android/contacts/common/model/account/AccountType.java index 27b5bc5f..dcb99b89 100755 --- a/src/com/android/contacts/common/model/account/AccountType.java +++ b/src/com/android/contacts/common/model/account/AccountType.java @@ -59,12 +59,6 @@ public abstract class AccountType { private static final String TAG = "AccountType"; /** - * Local phone-storage account - * @hide - */ - public static final String LOCAL_ACCOUNT = "phone-local"; - - /** * The {@link RawContacts#ACCOUNT_TYPE} these constraints apply to. */ public String accountType = null; @@ -298,6 +292,9 @@ public abstract class AccountType { public CharSequence getDisplayLabel(Context context) { CharSequence label = null; updateAuthDescriptions(context); + if (PhoneAccountType.ACCOUNT_TYPE.equals(accountType)) { + return context.getResources().getString(R.string.local_storage_account); + } if (mTypeToAuthDescription.containsKey(accountType)) { try { AuthenticatorDescription desc = mTypeToAuthDescription.get(accountType); diff --git a/src/com/android/contacts/common/model/account/PhoneAccountType.java b/src/com/android/contacts/common/model/account/PhoneAccountType.java index 7e2e1e52..fbd1d5a1 100644 --- a/src/com/android/contacts/common/model/account/PhoneAccountType.java +++ b/src/com/android/contacts/common/model/account/PhoneAccountType.java @@ -49,6 +49,7 @@ import com.google.android.collect.Lists; public class PhoneAccountType extends BaseAccountType{ private static final String TAG = "PhoneAccountType"; + public static final String ACCOUNT_NAME = SimContactsConstants.PHONE_NAME; public static final String ACCOUNT_TYPE = SimContactsConstants.ACCOUNT_TYPE_PHONE; public static final int FLAGS_PERSON_NAME = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS | EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME; diff --git a/src/com/android/contacts/common/util/AccountsListAdapter.java b/src/com/android/contacts/common/util/AccountsListAdapter.java index 2e1c44ae..15af0aba 100755 --- a/src/com/android/contacts/common/util/AccountsListAdapter.java +++ b/src/com/android/contacts/common/util/AccountsListAdapter.java @@ -68,10 +68,10 @@ public final class AccountsListAdapter extends BaseAdapter { mAccountTypes = AccountTypeManager.getInstance(context); mAccounts = getAccounts(accountListFilter); - // Add a virtual local storage account to allow user to store its contacts in the phone - String localAccountName = context.getString(R.string.local_storage_account); - mAccounts.add(0, new AccountWithDataSet(localAccountName, AccountType.LOCAL_ACCOUNT, null)); - + // Add the virtual local storage account to allow user to store its contacts in the phone + mAccounts.add(0, new AccountWithDataSet(PhoneAccountType.ACCOUNT_NAME, + PhoneAccountType.ACCOUNT_TYPE, + null)); if (currentAccount != null && !mAccounts.isEmpty() && !mAccounts.get(0).equals(currentAccount) diff --git a/src/com/android/contacts/common/vcard/SelectAccountActivity.java b/src/com/android/contacts/common/vcard/SelectAccountActivity.java index 5ee36bc6..eef6b467 100644 --- a/src/com/android/contacts/common/vcard/SelectAccountActivity.java +++ b/src/com/android/contacts/common/vcard/SelectAccountActivity.java @@ -23,9 +23,11 @@ import android.os.Bundle; import android.util.Log; import com.android.contacts.common.R; +import com.android.contacts.common.SimContactsConstants; import com.android.contacts.common.model.AccountTypeManager; import com.android.contacts.common.model.account.AccountType; import com.android.contacts.common.model.account.AccountWithDataSet; +import com.android.contacts.common.model.account.PhoneAccountType; import com.android.contacts.common.util.AccountSelectionUtil; import java.util.List; @@ -60,16 +62,16 @@ public class SelectAccountActivity extends Activity { final AccountTypeManager accountTypes = AccountTypeManager.getInstance(this); final List<AccountWithDataSet> accountList = accountTypes.getAccounts(true); if (accountList.size() == 0) { - Log.w(LOG_TAG, "Select phone-local storage account"); + Log.w(LOG_TAG, "Select local storage account"); finish(); return; } Log.i(LOG_TAG, "The number of available accounts: " + accountList.size()); - // Add a virtual local storage account to allow user to store its contacts in the phone + // Add the local storage account to allow user to store its contacts in the phone AccountWithDataSet localAccount = new AccountWithDataSet( - getString(R.string.local_storage_account), AccountType.LOCAL_ACCOUNT, null); + PhoneAccountType.ACCOUNT_NAME, PhoneAccountType.ACCOUNT_TYPE, null); accountList.add(0, localAccount); // Multiple accounts. Let users to select one. |