diff options
author | kaiyiz <kaiyiz@codeaurora.org> | 2014-03-31 12:54:34 +0800 |
---|---|---|
committer | Roman Birg <roman@cyngn.com> | 2014-09-02 14:06:12 -0700 |
commit | 389c8b982daacc00eb19ec77259abbbc08b7094d (patch) | |
tree | d8737505bb15363f9198ca3cd62a821a057e4189 | |
parent | 225876911dfb6c70beb6e48b11d5a8950ef2ce8e (diff) | |
download | packages_apps_ContactsCommon-389c8b982daacc00eb19ec77259abbbc08b7094d.tar.gz packages_apps_ContactsCommon-389c8b982daacc00eb19ec77259abbbc08b7094d.tar.bz2 packages_apps_ContactsCommon-389c8b982daacc00eb19ec77259abbbc08b7094d.zip |
Contacts: Fix show SIM contacts in airplane mode
Contacts filters by local phone account when the contacts to display is
phone. But sim account is appended to the query parameter in airplane
mode. It will cause the query can not distinguish which acount is used
to filter and cause the display error.
It is not necessary to append sim account to query parameter when the
original filter is local phone account.
CRs-Fixed: 639544
Change-Id: I47a9d96fd40954603037c8f461530ef42e2b6416
-rw-r--r-- | src/com/android/contacts/common/list/DefaultContactListAdapter.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/com/android/contacts/common/list/DefaultContactListAdapter.java b/src/com/android/contacts/common/list/DefaultContactListAdapter.java index 242256bd..0418f76e 100644 --- a/src/com/android/contacts/common/list/DefaultContactListAdapter.java +++ b/src/com/android/contacts/common/list/DefaultContactListAdapter.java @@ -192,20 +192,19 @@ public class DefaultContactListAdapter extends ContactListAdapter { getContext().getContentResolver(),Settings.Global.AIRPLANE_MODE_ON, AIRPLANE_MODE_OFF_VALUE) == AIRPLANE_MODE_ON_VALUE; String disabledSimFilter = MoreContactUtils.getDisabledSimFilter(); - // In the case that the filter type is "account type", we should not append without sim - // parameter to the query uri. - boolean isNeedSimFilter = !(filter.filterType == ContactListFilter.FILTER_TYPE_ACCOUNT); - if (isAirMode) { - appendUriQueryParameterWithoutSim(loader, RawContacts.ACCOUNT_TYPE, - SimAccountType.ACCOUNT_TYPE); - } else if (isNeedSimFilter && !TextUtils.isEmpty(disabledSimFilter)) { - appendUriQueryParameterWithoutSim(loader, RawContacts.ACCOUNT_NAME, - disabledSimFilter); - } + switch (filter.filterType) { case ContactListFilter.FILTER_TYPE_ALL_ACCOUNTS: { // We have already added directory=0 to the URI, which takes care of this // filter + // Do not show contacts in SIM card when airplane mode is on + if (isAirMode) { + appendUriQueryParameterWithoutSim(loader, RawContacts.ACCOUNT_TYPE, + SimAccountType.ACCOUNT_TYPE); + } else if (!TextUtils.isEmpty(disabledSimFilter)) { + appendUriQueryParameterWithoutSim(loader, RawContacts.ACCOUNT_NAME, + disabledSimFilter); + } break; } case ContactListFilter.FILTER_TYPE_SINGLE_CONTACT: { @@ -226,6 +225,14 @@ public class DefaultContactListAdapter extends ContactListAdapter { if (isCustomFilterForPhoneNumbersOnly()) { selection.append(" AND " + Contacts.HAS_PHONE_NUMBER + "=1"); } + // Do not show contacts in SIM card when airplane mode is on + if (isAirMode) { + appendUriQueryParameterWithoutSim(loader, RawContacts.ACCOUNT_TYPE, + SimAccountType.ACCOUNT_TYPE); + } else if (!TextUtils.isEmpty(disabledSimFilter)) { + appendUriQueryParameterWithoutSim(loader, RawContacts.ACCOUNT_NAME, + disabledSimFilter); + } break; } case ContactListFilter.FILTER_TYPE_ALL_WITHOUT_SIM: { |