ContactsProvider: Update locale before adding call log

Use a final variable to save the locale, so it will not
be changed when we change the system language.

Use a common variable to save the locale and update it
before adding call log.

CRs-Fixed: 500325

Change-Id: If1aae529385e53c32ba8244445efedc1dd283462
Contacts: Fix the issue of contacts with same values only display one

The default aggregation mode was RawContacts.AGGREGATION_MODE_DEFAULT.
At this condition, raw contacts items were aggregated immediately when
insert operation was completed. As a result, items with same valuses
would have same contact_id. So, contacts list only display one vcard
file contacts after imported one vcard file sereral times.

Change aggregation mode from RawContacts.AGGREGATION_MODE_DEFAULT to
RawContacts.AGGREGATION_MODE_SUSPENDED. This will not trigger aggregate
when insert operation was finished and items with same values will have
different id. So, contacts in one vcard file can display several times
after change codes.

Change-Id: I6f7a044fb4fdf93dd41c71d4f382ef24d0b18f11
CRs-Fixed: 509642
ContactsProvider: Support contact filter in smart dialer

Add query function to match the contacts for smart dialer.

Change-Id: I4eee8654699bd4ec6e1ba66f03e80701d3706865
ContactsProvider: add the full field search for contacts

- append the searchable data for custom type

Change-Id: If53b5a8552d4e69d87dde44832f1cb9431242a5b
Add one column for subscription ID in the call log database

- Add the subscription ID column
- Upgrade the database version
- add the support to delete the selected call log

Change-Id: Ica5ac130f9c64dd9457380614126dcd3cc883232
Create local group database

- add local group database and sql operation
- make Phone account as the default account

Change-Id: Ia9b934b2c81f4f99983e5182230fb7376f60a071
Filter SIM contacts with flag

- add account info in the contacts projection
- add flags to filter SIM contacts

Change-Id: I42521a0170633cdb86bcec84157a0cbbcd5d5ff1
Enable home location feature

Check whether home location provider exist and if yes, query the location.

Change-Id: I50a2ae59654289f889a81f97fb9321eeb29e8eaa
Add the column of duration type in calls

- add one column of call's duration type

Change-Id: I094f520074104b1bff87b21bf32058b6fa28cc4d
ContactsProvider: Fix can't search out local groups in mms app

The LocalGroupsProvider isn't exported, so mms app can't
query local groups via ContactsProvider.

Add android:exported property and set value true in
LocalGroupsProvider.

CRs-Fixed: 618763

Change-Id: I9e39fad24b496cc65a9e2cfb9b5f755b0e4bbfd2
ContactsProvider: Add API-getLatinNameLookupKeys() for multi-languages

- Add API for getting multi-languages' name-lookup-keys in
  smart search feature.

CRs-Fixed: 606785

Change-Id: Id991e21c2e103875756055ac41083fc83ca51133
Contacts: Support fuzzy search for telephone number in contacts

In function appendSearchIndexJoin(), for phone number, the SQL
"Like 'xxx%'" only return string start with "xxx" from head and
we should change it to "%xxx%" to support the fuzzy search result.

Modify the SQL string and change "MATCH 'tokens:xxx*'" and
"Like 'xxx%'" mode to "Like '%xxx%'" mode for fuzzy search.

CRs-Fixed: 614723

Change-Id: If0892fb97f9996938b1122d5229ec6a6bb870668
Contacts: Support fuzzy search for phone number

Add '(' and ')' into the SQL to ensure the SQL is rightly
excuted. Only support fuzzy search when there is snippet
column and the filter is phone number.
Enhance the stability of SQL statement and add entry check
for fuzzy search.

CRs-Fixed: 631116

Change-Id: Ibbb0ea3e4fbdc419019ebab0ba4ac54f41b87feb
Fix issue that SIM contact don't display in contact pick view

If the query doesn't indicate which account to select, choose
all contacts including those with empty account.

Change-Id: Ib62081e87a6360ba7b90e2019114734a35e81b9c
CRs-Fixed: 634355
Mms: Fix contacts don't display in phone after import vcf file

The default local account is null.

Change the default local account data to be phone account.

CRs-Fixed: 637849

Change-Id: If1205cd83b7e6f07f5b0077c0464546e4bc8d738
Contacts: Fix fuzzy search do not check the name column issue

When it is fuzzy search for phone number, we should also consider the
name column, like original design.

MATCH will be unavailable if we modify FTS's where statement directly.
So, we will Union phone number fuzzy query to the original SELECT
statement.

CRs-Fixed: 639685

Change-Id: Iff9a7204779bd41d3d416ce00a2ae080a554b27a
Contacts: Fix CTS failure in testGroupsTable/testAddToGroup

Group is inserted into local account if no account is designated,
but account name and account type are null when query contacts groups.

Query local account if no account designated when query contacts groups.

CRs-Fixed: 645031

Change-Id: I3850ba5cdf222b6273cc1d43ac738067f4e9aaf9
Revert "ContactProvider: add another check for local accounts"

This reverts commit 5cb6488665f2e4695e4754b3df9314704e88733d.

Change-Id: I48241044ce2c71aef128cb6fcbf62acdb45f919f
Fix the unitest failure problem

- Fix the problem of test case to make sure it can run normally
- Fix the API problem which can't pass test case

CRs-Fixed: 652947

Change-Id: I028cf298ce4d6e93a75de21d3538355ee0b43bef
ContactsProvider: Upgrade database for new views, columns

* Commit: "Filter SIM contacts with flag" changed views and others
  changed the columns and search index.
* Force a database upgrade to make sure user data is properly migrated.

Change-Id: Icae464779f0f77fb53d0fdbcd946c4d4582baa91