History log of /packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f5c0020b87709f9c4c3de66a49c0893e2c2adebb 10-Nov-2012 Makoto Onuki <omakoto@google.com> Rebuild SQLITE_STAT1 table after drop operations.

The SQLITE_STAT1 table has the estimated number of rows for each table and
index, which is used to calculate a query plan for queries.

The problem is that, DROP TABLE and DROP INDEX appear to remove the
corresponding row from the stats table. This could cause SQLite to choose
inefficient query plans.

This CL will make sure to rebuild the stats table after such operations.

Added a new boolean paramter rebuildSqliteStats to all methods that
exectue DROP TABLE/INDEX. If it's set, they'll call updateSqliteStats() to
rebuild the contents.

Bug 7426624

Change-Id: I1c373b902856d1a24b6c0c8379899a235ee284c4
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d2f6ad6d50b5570327f8cca3b2d2bdcaec36ea90 01-Oct-2012 Makoto Onuki <omakoto@google.com> Make sure to rebuild search index on locale changes...

so that search will still work even after changing the locale.

- Rebuild the search index upon locale changes, as it contains
locale-sensitive data.

- Also make sure to update the in-memory collator in NameNormalizer
upon locale changes.

- Rebuild the search index on the next db upgrade in order to fix the
search index which already contains invalid data.

Bug 7251461

Change-Id: Id579a67de792a52a0091bf76d7c5d374f76f1639
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
a6f9ec007fb108f9f82e73bfdaef7ffc5e67cffc 12-Sep-2012 Yorke Lee <yorkelee@google.com> Skip suffix match if mUseStrictPhoneNumberComparison is true

Don't do the suffix match during the phone number lookup match if
mUseStrictPhoneNumberComparison is true.
Bug: 7000177
Change-Id: I77e60117449cec6c37a9605ba4333a067d02a54c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
6db6c6d74da066cbbe3e3b5b89caf1ba5626d240 07-Sep-2012 Yorke Lee <yorkelee@google.com> Change fallback method for contact matching

Modified the fallback method that is used for contact matching
whenever the original query fails to return a result. We previously
performed a 7 digit match but this resulted in problems such as false
positives when the area code is changed but the last 7 digits of
a number are the same. The new fallback method uses the GB method
of matching via the SQLite function phone_number_compare_loose.

Bug: 7000177
Change-Id: I597b4b9e44ab2c4e4a5381832a3e9dfd0d51cf8f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
38210445730ee04c351c7cc1b3800cfe23e34325 27-Jun-2012 Makoto Onuki <omakoto@google.com> Reorganize import in contacts provider

Change-Id: If3afb134ea36bd93859efcd114885526e1592b91
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ae32283e7fc5b749df96523d8bb343b9068b65ba 09-May-2012 Makoto Onuki <omakoto@google.com> Fix transaction handling in the provider

Fixed issues that will happen when a batch operation for applyBatch()
contain operations for both the contacts db and the profile db.

- Make sure to set the right transaction listener when starting a transaction.
There were cases where we started a transaction on the contacts db but passsing
the profile provider as the listener, and vice versa.

- Make sure transaction callbacks operate on the correct DB.
There were cases where ContactsProvider2.onCommit() and its sbilings would
operate on the profile DB, not on the contacts db.

- Change the transaction finishing order.
When we start transactions on both the contacts and the profile DB, we do so
on the contacts db first, and then on the profile db. But when we clsoe them,
we did it in the same order, which could potentially cause a deadlock.
Now we close them in the reverse order; the profile db first, then the
contacts db.

- Remove mActiveDb.
This wasn't set in switchTo{Profile,Contact}Mode(), but was lazily initialized.
But I wasn't too sure if I always set the right db at the right timing.
Looks like I forgot to do so in a few cases. Let's just remove it and always
explicitly get the database from the current db helper.

Bug 6250673

Change-Id: Idd18fc173596c973d0ff8b6e1b2456715c0f14f8
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d2a4512095ec41ae4b67b65b9dd8986460ae8216 04-May-2012 Makoto Onuki <omakoto@google.com> Remove never used SocialProvider and activity table

Bug 6148750

Change-Id: If63219745973aa2629b95259ec692867f5197e79
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
116d86ddd67330428f9128613b4886fc0ea66221 27-Apr-2012 Makoto Onuki <omakoto@google.com> Make names with special chars searchable.

It's a better fix than I34bfa864, which was only a quick workaround for double
barrelled names.

Now names with other special characters are searchable too.

Also, previously, a query "doublebarrelled" wouldn't match "double-barrelled",
but now it will.

Bug 5592553

Change-Id: Id1d44261f577df7abf701311ed1c86fb093547da
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
e52f5a26d9c12298fca6942859cbb5ae6a66680e 26-Apr-2012 Makoto Onuki <omakoto@google.com> Clean up Phone.NORMALIZED_NUMBERS upgraded from GB

If upgraded from GB, the NORMALIZED_NUMBERS column doesn't really
contain the "normalized" numbers. It's some kind of stripped-out-and-reversed
numbers.

We can't create normalized numbers for them as we don't really know the correct
country for each number (and we can't even rely on CountryDetector during the
upgrade step -- the detector isn't ready at this moment), so let's just null
out those bad numbers. This is how we do for invalid numbers.

phone_lookup.NORMALIZED_NUMBERS also has the same issue, so let's recreate
them in the way DataRowHandlerForPhoneNumber.insert() would when it can't
infar the normalized number. (i.e. when the phone number is invalid.)

Bug 5690851

Change-Id: I756b828e15a50a2f711c01ef22abd2cfa67bad0a
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
72fc27c52127ecb62fd959ec6326fbefbe566e3f 15-Apr-2012 Makoto Onuki <omakoto@google.com> Upgrade step to fill raw_contacts.last_time_contacted.

Replace raw_contacts.last_time_contacted with data_usage_stat.last_time_used
if it's bigger.

Bug 6326418

Change-Id: I052a7fb92e69cf35f8e37a9be1b074f480e96071
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
fb25f3a5a86ca15de8507baf02a357a63032af62 28-Mar-2012 Makoto Onuki <omakoto@google.com> Clear in-memory caches when rolling back transaction

Bug 6245089

Change-Id: I4fe92fbf190090b6e25a411c8c0e2f9885564952
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ce9aaecfe56e708d5f8fa9713e07c013731f27ab 28-Mar-2012 Makoto Onuki <omakoto@google.com> Merge "Revert ""Rollback" mimetype cache""
c65c6bd3a52ece11a7ed60c20d6bf4c000bd70c7 28-Mar-2012 Makoto Onuki <omakoto@google.com> Revert ""Rollback" mimetype cache"

This reverts commit c624ff13d5df4848a6ec605e25ea8469dd677d5d

Due to b/6123232
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
1c8a00185781fa5e1124e9c11463ed58c4a24be1 28-Mar-2012 Makoto Onuki <omakoto@google.com> Merge ""Rollback" mimetype cache"
c624ff13d5df4848a6ec605e25ea8469dd677d5d 28-Mar-2012 Makoto Onuki <omakoto@google.com> "Rollback" mimetype cache

Bug 6239243

Change-Id: Icf473e5178a76fda66b33fc11875f00d87b36c16
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
81567f4a0f7c9c338506bd82f4d33e83c2ccf159 23-Mar-2012 Makoto Onuki <omakoto@google.com> Add new package aggregation.util

Move aggregator related classes into it.

Change-Id: I712fe07ad2bab1e532e3822e3e2797a199329865
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
565b62f354d8b6aadc760092a7dbf483f8bbbe17 08-Mar-2012 Makoto Onuki <omakoto@google.com> Use wall time instead of CPU time for performance log

Apparently what currentThreadTimeMillis() returns is the CPU time,
not wall time, which is not really interesting when we measure
performance. Use the actual wall time instead.

Change-Id: Ibe2e385ff1bdeeb1128a584c79925210dde5525a
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2ff5293c7b60b78eeefceb7053edc39ebafbe8d4 08-Mar-2012 Makoto Onuki <omakoto@google.com> Merge "Don't manually close the database."
112fcec686b81122f9c2ba42fb10b2dc65dc5931 06-Mar-2012 Makoto Onuki <omakoto@google.com> Speed up VISIBLE_CONTACTS update

The delete used to easily take >1 second with 10K contacts.
Now it's just ~1ms.

It's one of the slowest processes during aggregation.

The old SQL looked like this:

DELETE FROM visible_contacts
WHERE _id NOT IN (SELECT _id FROM contacts WHERE [CONTACT_IS_VISIBLE] = 1)
and _id = CONTACT_ID_IN_QUESTION

The problem is the subquery, especially the [CONTACT_IS_VISIBLE] part, is
pretty slow but it queries *all* visible contact IDs at once,

But this really means "Remove CONTACT_ID_IN_QUESTION from visible_contacts,
if it's not visible."

DELETE FROM visible_contacts
WHERE _id IN
(SELECT _id FROM contacts
WHERE _id = CONTACT_ID_IN_QUESTION and [CONTACT_IS_VISIBLE] = 0)

(We use 'IN' rather than '=' here, because this method is used to
update visible_contacts for *all* contacts as well, in which case
we just remoev the the [_id = CONTACT_ID_IN_QUESTION] part from
the selection.)

Change-Id: I73d629f6b352d010eb1deabb7e23d12130be9b3d
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
9b626252d91e451a822f48cd127aef5d609a6257 07-Mar-2012 Makoto Onuki <omakoto@google.com> Don't manually close the database.

Don't close and reopen the database in CDH.getWritableDatabase().
The reason we did this was to sqlite reload the sqlite_stat1 table,
but according to the document running "ANALYZE sqlite_master"
should be suffice. (See http://www.sqlite.org/lang_analyze.html)

Also don't close the database helpers after upgrade in
ContactsUpgradeReceiver. We don't have to do this.

Also, replaced the test-only constructors of the helpers with methods
with more explicit name, in order to make sure only the singleton
instances are used in the main code.

Bug 6104842

Change-Id: I76a7d1b8f7b6462b97f627d722feaa03967cb18f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
49ed71913609193a00059df944f6259e9397b0bd 05-Mar-2012 Makoto Onuki <omakoto@google.com> Move aggregator to its own package

... so that methods used only by ProfileAggregator don't have to be public.

And fix some method visibilities that don't make sense.

Needed to change the bogus ID in PhotoStoreTest; otherwise moving the
aggregator test will make this test fail for some unclear reason.

Bug 6118852

Change-Id: Ic0c022cbf50128f40c70559c1a7cf8e2a6c06fc8
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
a2d163097ec6630101c701723c170b5974262eb5 22-Feb-2012 Makoto Onuki <omakoto@google.com> Don't remove default directories from directories table

The directories table should always contain the DEFAULT and LOCAL_INVISIBLE
directories. Otherwise search would break.

Also re-create all directoires next time the provider starts as a part of
upgrade.

Details:

ContactDirectoryManager has two public methods to update the table:
scanAllPackages() to scan all directories from all installed packages, and
onPackageChanged() to scan only a specific package.

scanAllPackages() is called when an account is added or removed. It always
rules out the default ones when it deletes rows, so this method shouldn't
possibly remove the default ones.

However, onPackageChanged(), which is called when an app is installed or
uninstalled, doesn't check the given package name. If this method is given
the package name of the contacts provider itself, it *will* remove all the
directories that belong to the contacts provider, which are the default ones,
but doesn't re-create them because these are not exported from the provider
like a normal directory.

With this CL onPackageChanged() now checks if the given package name is
of itself, and will ignore the request if so.

Bug 6005231

Change-Id: Ia19dfb1890160315ef9de8aa0530978e547abf7d
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
674f943e22077ae399166d5fe8db96dd3d1f7259 18-Feb-2012 Makoto Onuki <omakoto@google.com> Remove in-memory account cache

Bug 6026073

Change-Id: Ic6057aa2347d1fa4c245ad2f6644ac4d5e8ae3cf
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
e5eefd3998ea1180bd550d2771bd9b83bb5ad6f4 01-Feb-2012 Makoto Onuki <omakoto@google.com> Merge "Fix proguard flags"
833072a525ea45426082d3bac0cd6ae1a8c36f22 27-Jan-2012 Makoto Onuki <omakoto@google.com> Fix proguard flags

Removed the *ForTest exception. It caused issues with guava. Now that
we have NeededForTesting, we don't really need it.

(But didn't change method names from XxxForTest to Xxx, because I still
think using this prefix for test-only methods is a good idea, as it'll
make it easier to catch the use of methods in the main apk that are
not supposed to be used.)

Change-Id: Idccfd7175372b1a2253b19161ae572dae7e1e952
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
872cd1f5d04e9c5d4c4db2822c85cbda62b44b3f 25-Jan-2012 Makoto Onuki <omakoto@google.com> Remove the obsolete account columns from newly created db

Bug 5884869

Change-Id: I2cbec01766883a469fb5558306d6a9b7745845b8
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
1c56fb38aab8d1beb7eb436814d991f5eea08b46 17-Jan-2012 Makoto Onuki <omakoto@google.com> Fix crash at upgrade step 504 due to account ID cache

The account ID column didn't exist at this point, so we should skip the
cache initialization.

Bug 5868343

Change-Id: I5fd479f882abbce2be7bf1278656e8e4b83bc106
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
9ba8463dd030e5e26a4f99dfe2a6ad52b2410d73 11-Jan-2012 Makoto Onuki <omakoto@google.com> Account refactoring follow-up

- Check if there's really a new or removed account in
updateAccountsInBackground() before doing everything else.
If there's none, we'll skip re-scanning directories too.

- Preheat the account cache when the provider starts.

- Use account_id for the account filter query parameters. The contacts URI
now supports the parameters too.

Change-Id: I12e1116890df4c20b354618acfaee9dc009dc68e
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
9d990d339c9e3a9e03f6fe13c260d36665f00e61 16-Dec-2011 Makoto Onuki <omakoto@google.com> Account table refactoring

- Remove the account columns (type, name, data_set) from the
raw_contacts/groups tables and add account_id instead.

- Re-create the accounts table. The new table now has the _ID column. Rows
in this table now has a different lifecyle than before:
-- New row is created as the provider detects a new account during a write
operation to the raw_contacts and groups table.
-- Stale rows are removed upon account removal.

- Removed account consistency check for steam items/photos. We don't do this
kind of check for other tables.

Change-Id: I1ce01590aef70f417fa89426dae762a41d25d656
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
56abe81ced08c7af625b3eb8dd543f9030da9bad 20-Dec-2011 Dave Santoro <dsantoro@google.com> More aggressive fix for phone lookup issues.

Rather than relying on a trailing suffix match on the longer of the
two numbers (the one from caller ID and the one in the database),
this first attempts to do the full internationalized-number-aware
query that we'd normally do, and if no results are returned, falls
back to a comparison of the trailing 7 digits of each number, as
we did in Gingerbread.

Bug: 5742389

Change-Id: I085fe9df336c6d75008423163965c39d91bcd1ce
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
fc42772538fc6f7e2e444cbe6b24e06a3fbf933d 14-Dec-2011 Makoto Onuki <omakoto@google.com> Use ContactContract.Phone instead of internal definition

PhoneColumns was just redundant, and only made it hard to find all usecases
of Phone.NORMALIZED_NUMBER.

Also makred GroupsTest as @MediumTest. Some methods didn't have a size
annotations so they weren't executed as we always have to use the "-e size"
parameter.

Change-Id: I53160219e2ab6b2535cc8be61b07af6312bc92fc
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
28728a8d679bc83425643a7c99a42be20e2e161d 13-Dec-2011 Dave Santoro <dsantoro@google.com> Fix for GB upgrade issue with phone lookups.

This just generalizes a fix that Shaopeng had for Brazilian phone
numbers, in which it was possible that the caller ID number being
checked was shorter than the normalized number we had stored. We
essentially accept a phone number as a match if the shorter of
either (caller ID, normalized number) is a trailing prefix of the
other.

Bug: 5638376
Change-Id: Iea81bc4163cb89169946f9a33f9e15b13e8868ad
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ac2a6e814edb3d5e5bcca28d7d3f3977a489c2ed 18-Nov-2011 Makoto Onuki <omakoto@google.com> Remove hasColumn() and use isInProjection() instead.

When I added hasColumn I didn't realize there was already a similar method.

Bug 5545880

Change-Id: I9ba62a9ff8b3eeab8098626426a37fd84c77d679
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f5f038faf7f3ef460e1c11028d467954840e5f6f 14-Nov-2011 Makoto Onuki <omakoto@google.com> Fix search for hyphenated names

This issue was caused by the combination of the fact that we have two
different imcompatible tokenizers for names, and the fact that our
name-normalizer ignroes all non-letter and non-digit characters.

Basically, the name tokenizer used to build index uses ' ' as the separator,
and the one used to tokenize queries use all non-letter, non-digit characters.

Take the name "Double-barrelled" as an example. The full-text search index
for this looks like "doublebarrelled", because it's treated as one token
(because there's no spaces in it), and the normalzier removes all
non-letter/digits.

On the other hand, the query term "double-barrelled" will be split into
"double" "barrelled", and internally it becomes AND-ed prefix matches
"double* AND barrelled*". Beacuse "barrelled*" doesn't match "doublebarrelled"
the query doesn't hit.

So (for now) let's split names with '-' when buidling the index. With this
CL the index will be "double barrelled" and the query "double-barrelled"
(and also "double barrelled") *will* hit this.

Long-term we probably need a better fix.

Bug 5592553

Change-Id: I34bfa8647eec8d203f8ff7fc8a85f42505054c7c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
72c4b2612a06636343e2803c0c84fdfbd5ba2f63 15-Nov-2011 Daniel Lehmann <lehmannd@google.com> Optimize STREQUENT queries and fix estimated table row counts

- Use id instead of strings for matching mimetypes
- Use inner LIMIT of 25 to prevent the extra subquery
(also fixes correctness)
- Reorder JOIN for data-usage-stat JOIN contacts
- Defeat sqlite3's "optimization" attempt by using +0 on fields
from contacts/data <-- This is huge

Bug:5560534

Change-Id: I412d359afe07f32643cc2faef8735b719686741f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
58795e447fada97b9594bd7ba2e3dca241487d01 02-Nov-2011 Flavio Lerda <flerda@google.com> Add support for looking up SIP addresses.

Current ContactsContract.PhoneLookup only support looking up phone
number. As a consequence SIP address look-ups are done with a generic,
expensive ContactsContract.Data query.

This change adds support for doing a SIP address look-up using
ContactsContract.PhoneLookup by specifying a query parameter.

By doing so, we can do a trivial but crucial optimization: instead of
matching against the MIME type as a string, we can use the _id of the
vnd.android.cursor.item/sip_address MIME type in our database. This
speeds up queries that used to take over 250ms to 1-2ms.

Bug: 5529690
Change-Id: I15e7ed225927882fc0fd0958b7d2cbfede12c590
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
23ba865a6d204ba4aa29d2fad9989e9c44351e81 27-Oct-2011 Makoto Onuki <omakoto@google.com> Speed up query for group tab

- The old query had overhead propotional to the number of groups.
- The Groups.SUMMARY_WITH_PHONES column is still slow, but we don't use it.
- We can use the same technique for Groups.SUMMARY_GROUP_COUNT_PER_ACCOUNT.

The only downside is that, we're changing the FROM clause dynamically according
to the requested column, which is something that we don't usually do.
Overusing this technique could make code less maintainable...

Bug 5092615

Change-Id: I79b01ae2a232bcd8e3b7186288050fed14a36a72
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d1746e09bc7739f3d1449cececc66d5045ada498 15-Oct-2011 Daniel Lehmann <lehmannd@google.com> Use hexadecimal collation key for name searches.

Also allow prefix search on name

Bug:5337763

Change-Id: I039264be0c8309224d8925ded06ab02a64a5ce1b
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
13ed28505ed1af4f0b4a6297c4c6840d91f10c8c 01-Oct-2011 Flavio Lerda <flerda@google.com> Add new column for cached formatted number.

Bug: 5316982
Change-Id: I2870778c8056468730d82794ddae90c74cab85fc
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
8f79445f450755858a88e8a5a0e14d81a0b9ff87 21-Sep-2011 Daisuke Miyakawa <dmiyakawa@google.com> Make search aware of names in "all other contacts"

default_directory doesn't contain contacts which are in
"all other contacts" group (or people who are not in any group),
while in search mode we want those names.

Bug: 5336673
Change-Id: Ib77acdfa6968605a66561f0925d0aa81f4522bb9
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
4c6e300d8cc5c62e74763454f61f9b10690cc618 21-Sep-2011 Dave Santoro <dsantoro@google.com> Cast in_visible_group field as an integer.

This is necessary to allow for queries using selection arguments
for this field to work, since we always bind these as strings
(and SQLite's type affinity won't kick in on function-based view
fields unless we explicitly cast them).

Bug 5118670

Change-Id: Ia4abe247547fbf482f187bf2db7f2df56fc9d601
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
7cf50494501938f175d288077145acf49da8f171 13-Sep-2011 Daniel Lehmann <lehmannd@google.com> Do mimetype filtering based on ID.

Wherever the provider is doing a query based on the mimetype, we can
optimize the SQL performance by switching in the (cached) mimetype ID
and joining against that instead.

Also fixed an issue that was likely leading to hi-res photos being
blown away during photo cleanup.

Bug:5289712
Change-Id: Ic51e4c6b0e5daa8b7a2440692755fd87d387f3f3
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f9b77edaf5855bf6932fbc4b4b4342273669efef 09-Sep-2011 Dave Santoro <dsantoro@google.com> Add data_set for Settings.

Since data_set may be null, it can't be part of the primary key
for the table, so we need to re-create the table and add
provider-side protection from inserting duplicate settings
records.

Bug 5156004

Change-Id: I25ae53c5670087a116058f0daef5b06cb6ce372b
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d4033ddac43ac85aa949040a07d35d9ab9122f4d 01-Sep-2011 Daniel Lehmann <lehmannd@google.com> Merge "Don't share SQLiteStatement between threads. Create on the fly"
11a83441a0f66440dcf1a560194dcc11979f0c2c 01-Sep-2011 Daniel Lehmann <lehmannd@google.com> Don't share SQLiteStatement between threads. Create on the fly

Bug:5229241

Change-Id: I57cda04dbe65afc4b05ddd46dda94b812d0df6bc
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ce39517fb7b9a3e5d8e02a1f68b14f3e09f13542 01-Sep-2011 Dave Santoro <dsantoro@google.com> Cleanup variable referring to removed column.

Bug 5242084

Change-Id: I7c8d00701a5a20c97556bf523faf4c4b9fb8a49a
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
7b0d7b04db42e7a8fd6a511b15da6bcd13f15a3c 31-Aug-2011 Attila Bodis <attila@google.com> Merge "Enable contact matching for incoming calls which only contain local number."
34984173c94fffb45710673f4f92150b87134ce4 26-Aug-2011 Shaopeng Jia <shaopengjia@google.com> Enable contact matching for incoming calls which only contain local
number.

Bug: 5197612
Change-Id: Ia38f097e1e1e8ecad9c41a15d5c7593807d13571
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
5d0a768b56ed4bd0dfef81b8389247ba74766659 08-Aug-2011 Dave Santoro <dsantoro@google.com> Separate the profile out into a separate database.

Fundamentally, this works as follows:
1. A separate, structurally identical database is created for
storing profile data. The view columns for identifying whether
a contact or raw contact belongs to the user's profile are
initialized with constant values for each database.
2. Sequence numbers in the new profile database are set to a very
high value (MAX_LONG - MAX_INT) to designate an ID-space in which
profile data is stored. This is important for distinguishing
between contact and profile requests.
3. Contacts Provider URIs are divided into several sets, bucketed
automatically by a new profile-aware URI matcher.
- URIs that explicitly reference the profile.
- URIs that contain IDs (which may be in the profile ID-space).
- URIs that contain lookup keys (which may be a special profile
lookup key).
- URIs for insertion that may contain a profile ID as the parent
for the inserted record (in content values). These can't be
detected by the URI matcher by itself, so this mapping is
maintained in the provider.
By identifying whether a URI falls into one of these sets, the
contacts provider can efficiently determine whether the request
is intended for the profile database or contacts database.
4. The Contacts Provider holds onto two separate copies of the
following, one each for contacts and profiles:
- Database helper
- Transaction context
- Aggregator
- Photo store (the profile one uses a separate directory)
5. During any query/update/insert/delete/openAssetFile operation,
the URI (and content values, if applicable) are examined to
determine whether the operation is intended for the Contacts DB
or the profile DB. If intended for the profile DB, the provider
is switched (in a thread-local manner) to a profile mode, and the
operation is handed off to the profile provider. The profile
provider does a permission check, substitutes the profile database
as the active DB in the contacts provider, and continues the
operation in the Contacts Provider by calling the in-transaction
or local version of the operation, which does its normal
processing, but with everything pointing at profile-specific
databases, aggregators, etc.
6. If the operation isn't determined to be targeted to the profile
database, the provider is similarly switched (thread-locally) into
contacts mode, and the active DB is set to the contacts DB.
7. For batch operations, we only create a transaction for the
contacts DB initially. If any of the operations in the batch end
up targeting the profile DB, we start a transaction for the
profile DB. When the batch is finished, we check for that and
also commit the profile transaction if there were no errors.

Bug 5204577
Bug 5161066
Bug 5155743
Bug 5087853
Bug 5031883
Bug 5198777
Bug 5230140

Change-Id: Ic43a6625cbb6edf52ea076b084647fb0656e28e5
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
af10329f85c5d8c4196c495a9f0f9a6c6ecbc231 30-Aug-2011 Daniel Lehmann <lehmannd@google.com> Add lookup_key to the StreamItemsView (it was missing in the previous CL)

Bug:5134325
Change-Id: I214f5750a9c445b2bca0cc6a448463c38519bfa1
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
e291c7c5222ccdfc8c0832d7c3bd7f989030dfb1 27-Aug-2011 Daniel Lehmann <lehmannd@google.com> Merge "Fix the creation of the search_index table when the aggregation mode changes"
7a24e1c1476b57a6268de8d57e5ef4a2d5f46794 21-Aug-2011 Flavio Lerda <flerda@google.com> Add a few columns for caching to the call log.

These columns store additional information about the contact associated
with a call log entry and are needed by the new functionality present in
the call log.

This change matches the newly defined columns in
android.provider.CallLog.

Bug: 5101753
Change-Id: Ife45e7034af098bf0e1ca35d05bb389a2c47909a
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2c4caaa35be9f8909e8eee26142c4747bbf65aac 26-Aug-2011 Daniel Lehmann <lehmannd@google.com> Fix the creation of the search_index table when the aggregation mode
changes

Original CL submitted by Google TV

Bug:4485628
Change-Id: I1d964bd153cc4de1b5543970bbfd89ff89587451
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
9b002837367674b7403769f52dc50ab4dbecef71 25-Aug-2011 Daniel Lehmann <lehmannd@google.com> Fix ambiguity for Contacts._ID and RawContacts._ID in Stream Items

Bug:5134325

Change-Id: Id5159a24c9a2aee58e566b9bc03719e7a6ee0f7c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
06c4a28bcdd9ca7c396de41b3bae5f6f43978fb5 17-Aug-2011 Daisuke Miyakawa <dmiyakawa@google.com> Stop using a cached value for auto_add trigger

Trigger must not use the value cached when it is created.

TESTED:
- upgrade a phone device from GB to ICS and see default_directory
works fine
- remove Contacts database, sync with Google account in ICS, and see
all default contacts are shown (bug 5174433)
- do factory reset, set up the device with a Google account, and see
all default contacts are shown

Bug: 5174433
Change-Id: If554b7eba4acfcf7a79309b998ec05e8557da397
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
3e2aeb5c57d968d1dc98ba3f92f658eb7dd0cb7d 13-Aug-2011 Daisuke Miyakawa <dmiyakawa@google.com> Introduce trigger for AUTO_ADD update

AUTO_ADD can be changed after database upgrade.

Also stop using constants in the relevant upgrade code.
The code should use the exact value at that moment, not the latest
values each constant points to in the latest code base.

TESTED:
- GB to ICS migration path with phone device
- HC to ICS migration path with tablet device

Bug: 5153692
Change-Id: I9460a9da42cc3685328f8063c81c72c5f6aec268
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
0bf6b318e3c994294d4a885f57906debd4a0e64e 15-Aug-2011 Daniel Lehmann <lehmannd@google.com> Several DB changes as requested by ES

- Switch from resource ids to names to prevent breakage on package upgrade
Bug:5135277
- Add SYNC1...SYNC4 columns to StreamItems and StreamItemPhotos
Bug:5119385
- Remove ACTION, ACTION_URI from Groups, StreamItems and StreamItemPhotos
(this reduces db size and prevents click intercepting)
Bug:5135808
- Add some raw-contact fields to the StreamItem and StreamItemPhotos query
Bug:5134081

Doing those changes in one block to prevent too many db upgrade steps

Bug:5135277
Change-Id: I1d1661c9a507d9efd4ef334fe21481097e820b7c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
aeaba441ddb05dede8bd86291ca78f42d670d54c 09-Aug-2011 Flavio Lerda <flerda@google.com> Automatically add a geocoded location to entries in the call log.

This change adds a geocoded location value to entries added to the call
log.

One limitation is that this is unaware of changes to the locale. We
needed to decide whether this is fine or if we should update the stored
geocode on locale changes.

Bug: 5129581
Change-Id: I2ad1b3fbd24491df2febf3e1fd615c16dd74398f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
03975f7ca8bb2f95ce95b6c694612c2524e91d13 28-Jul-2011 Dave Santoro <dsantoro@google.com> Fix missing column issue with lookup-by-name query

Also fixed a similar problem for undeleting raw contacts.

Bug 5091427

Change-Id: I043eb51eb53676ee9719834456920a9aff4d3e42
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
43368a3f9e05a979e454e278d6a0e8475f08923d 13-Jul-2011 Dave Santoro <dsantoro@google.com> Provider and DB changes to support data_set field.

The intent of the data set field is to provide a way for multiple
sync adapters from the same account name + type to manage separate
sets of data in the raw_contacts and groups table.

For example, this would allow for Focus groups to be synced in from
Focus via the Google Contacts sync adapter, and for Google+ Circles
to be synced in from the Google+ app, even though both are tied to
the same account name + type.

Bug 5077096

Change-Id: I641c5d233d8d4d70988d209179c4e79bdb9c7ea1
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
b2197b235e3d96e7f70c24d548b7dac52dab88d8 21-Jul-2011 Flavio Lerda <flerda@google.com> Implement IS_READ column in content providers.

Add support for the IS_READ column in the call log and voicemail content
providers. This columns will be used to store whether a call log entry
(currently only voicemail) has been read or otherwise consumed by the
user.

Bug: 5036195
Change-Id: I06840f9820f7d568a738c0307f4294c2b8c66031
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f1efadb1255fd75305b59802f736905b9d66e449 23-Jul-2011 Daisuke Miyakawa <dmiyakawa@google.com> Add group count capability and improve performance

- implement group count feature in group summary uri
- improve performance for the uri
-- starting from data table makes SUMMARY_COUNT
SUMMARY_WITH_PHONES quite slow
- add unit test for group summary uri

Must be after Ibc604770cb61ca9fd92280e58f1cd1bbf30c216a

Bug: 5039532
Change-Id: I58fb1040d9025af2e0820a6de85a4eaf2ae30852
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
6802030a777c0c3ba1dc029c534cca4784260632 16-Jul-2011 Dave Santoro <dsantoro@google.com> Forward-compatibility of old status update API.

With this change, inserts or updates to the old status update API
will be mirrored as stream item inserts or updates in the new
social stream API. This is primarily to bootstrap the new stream
data (which is what the UI will be showing) until such time as data
providers start using the new API.

This change also includes migration to using the new photo storage
system for photos from the social stream API.

Change-Id: I0974444077790f706637dd6b9d1f6f50d204aa6c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f547fd54d7933e1c03af4a8dc10560c71c38f6b8 27-Jun-2011 Dave Santoro <dsantoro@google.com> Large photo storage.

This change adds support for storing large photos for contacts in the
file system. Large photos passed to the provider will be downscaled
and re-encoded as JPEGs before being stored in the usual data BLOB
field (for the thumbnail) and in the photo store (for the display
photo).

See go/large-photo-design for details.

Change-Id: I26a69ac2ccba631962a3ac5c83edb3f45d7cfc7f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
1cdfc9dacc136e99d3c0bc5b4212bc3c973be337 12-Jul-2011 Daniel Lehmann <lehmannd@google.com> Allow a sync adapter to provide an OPEN action for a group

Bug:4413120
Change-Id: I798b586acd200f0713c59f75b2815ce22e8a9c86
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ed6bfd922fd84db21de08c1d12e93c501b86560d 11-Jul-2011 Daniel Lehmann <lehmannd@google.com> Remove restricted white-listing

Bug:4974334
Change-Id: I4dd95089774373d2b67d7e14dc6b7fc40a92d094
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
3b505de6c622d20d40b85b361c1437a89aef82de 08-Jul-2011 Daniel Lehmann <lehmannd@google.com> Provider implementation of stream item API.

The following URIs are supported:
contacts/#/stream_items (query stream items by contact ID)
contacts/lookup/*/stream_items (query stream items by lookup key)
contacts/lookup/*/#/stream_items (query stream items by both)
raw_contacts/#/stream_items (query/insert stream items by raw contact ID)
stream_items (query/insert/update/delete stream items)
stream_items/photo (query/insert/update stream items)
stream_items/# (query/update/delete stream items by ID)
stream_items/#/photo (query/insert/delete stream item photos)
stream_items/#/photo/# (query/update/delete stream item photos by IDs)
stream_items_limit (query limits for stream items and photos)

Change-Id: Ice433c53e18087e5e6295ad9a112062d44b12dd2
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
069fdf5902415ebd6c92e5d889740e0d50cfec8d 04-Jul-2011 Debashish Chatterjee <debashishc@google.com> Added 'voicemail_status' table to contacts database.

Changes in ContactsDatabaseHelper to create a new table
'voicemail_status' table within contacts database. This table shall be
used by the voicemail content provider to serve /status/ uris.

See bug b/4968719 for more details.

Change-Id: Iddddd9f8d4a5cf77ff097204a6139cc9e923d74a
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2f830d3bb66f780937203e9738e046841a070e73 25-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> Use new data usage stat for strequent contacts

Must be with Ie193bb91ee49b18f4a546a1f52be780bb514301d

- use phone-only query parameter in strequent mode
- introduce data_usage_stat View for combining the table
with some of data/raw_contacts columns, which are needed
for strequent uris.
- modify strequent impl for supporting phone-only search
- modify a test for strequent uri handling

Checked performance. We need UNION ALL there and some nasty
hacks with two sub queries.

Bug: 4371572
Change-Id: I8c81747d8a8ae47ce551067fc4dbe2c48f4f48ae
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
59f6477e10203617f504857f7e9aee2fda393f4f 07-Jun-2011 Debashish Chatterjee <debashishc@google.com> Introduced new voicemail fields in 'calls' table.

The 'calls' table is going to be shared between the existing call_log
provider, and to be added voicemail provider. This change adds all the
columns needed to support voicemail in the 'calls' table.

The call_log provider, however, uses only one additional field
'voicemail_uri', whereas all other new fields will exclusively be used the
new voicemail provider. The change also ensures that the voicemail
provider specific fields are not exposed through the call_log provider.

Change-Id: Ieea4b14052b7e7e9db0e674138772b4e06b3f074
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
46abbb56764add30cb6e6506f55d8dededc88113 07-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> Introduce data usage table for per-method ranking.

- have a hidden table for per-method promotion
- make filter API use it (phone, email only)
- add a unit test
- remove an old test using previous API

Must be after: I602c0b83afca674904946f59bbdfc4dca07d46e4

Bug: 4371572
Change-Id: I82052953d5dad42ac171df29248ed25e9b4a2434
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
24c1d384b45a6d3c1cc959062a9d4308335fabbf 28-May-2011 Dave Santoro <dsantoro@google.com> URIs and queries to support profiles.

This change includes:
- A database upgrade to support tracking whether a contact represents the
user's profile (represented as an optional raw contact ID specified
per-account, and looked up in the various views).
- New Contact Provider URIs for retrieving profile-specific data:
- profile: To retrieve the user's profile contact.
- profile/data: To retrieve data for the user's profile contact.
- profile/data/#: To retrieve data for a specific data entry for the user's
profile entry, by data ID.
- profile/entities: To select entities for the user's profile.
- profile/as_vcard: To retrieve the profile as a VCard.
- profile/raw_contacts: To retrieve or insert raw contacts for the user's
profile.
- profile/raw_contacts/#: To retrieve a specific raw contact entry for the
user's profile, by raw contact ID.
- profile/raw_contacts/#/data: To retrieve data for a specific raw contact
entry for the user's profile, by raw contact ID.
- profile/raw_contacts/#/entity: To retrieve raw contact entities for a
specific raw contact entry for the user's profile, by raw contact ID.
- Permission checks to ensure that any access to profile data (whether
explicitly through the above URIs or directly via ID) enforces READ_PROFILE
or WRITE_PROFILE access.
- New and updated tests (including permission check cases for all of the above,
plus query checks for each).

I've also had to move a few large tests to medium to work around
b/3329504. I've also removed the database close step from contacts provider
test teardowns, as it doesn't seem to be necessary, and results in almost a 3x
performance boost on test runs.

Change-Id: I220552c26ad1eb3fbf24fdd865df2fe59fe4a688
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
64c69b650e264d6d3446aa89ce4ff467377dff76 14-Apr-2011 Daniel Lehmann <lehmannd@google.com> Don't create E164 numbers during update (country detector not ready)

Bug:4174796
Change-Id: I1e69253e6c9968f4d52b3213acc09395568a77c2
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
55e5cbf566edd89fc55f4a7f0ef2847084da9b16 25-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Displaying name prefix in the list and detail panel

Bug: 3488074
Change-Id: Ieb13337edbec01dcbd9581500420f47213f972e5
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
8ab0b7a48efe540226253567bcf6fdbc487186a2 25-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Moving updateRawContactDisplayName from aggregator to dbhelper

This is done in preparation for a fix of

Bug: 3488074
Change-Id: I0456a6925a76a4974d7a76ab4dce326f5637d871
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
383d8aa53aa2f74a4b71642de7df2e4b9f2242c8 22-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Fix tests broken by proguard

Bug: 3466915
Change-Id: If506bba3142c7b8fd8ef3a8033693925f51da2ca
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
155accbcb95fc13b984cf0ea8e5498a9c619cbf5 12-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: email suggestions

Also, removing a bunch of dead code

Bug: 2078420
Change-Id: I2c0a9ddd8e60624049b39ac018f87bfabc6574c2
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
92ddc5cdc4d89ee2c6e861ae7b3a3a913ffa0100 12-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: Asian language support

Bug: 2078420
Change-Id: I1a99ad05bb6e30b539134d60f669134b87dbf180
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
197411a6cc3f81b94a34ca207f267d43d8548f04 10-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: removing organization from name lookup

It no longer needs to be in the name lookup table,
because we now have it in the search index and we
don't use it for aggregation.

Bug: 2078420
Change-Id: Iaab128513ff29a38f97c7d880c2aae668a3ef865
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
bd9abbb6b03b4ec1e28ad3fa2fcba5d1eb8609ea 10-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: updating search index on change of visibility

When a contact becomes invisible, the search index will
be cleared. When it becomes visible, the index will be
built.

Bug: 2078420
Change-Id: I1eea88d3d9babc891d112d15d9041d01c383f22f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
05e50fbf9809bf04eceec3d2a2753630dc4f9315 09-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: building full index for all contacts

Bug: 2078420
Change-Id: Ief6db4f4ecc0b6e5adb37a0654a72383099dc138
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f262d56495ac4ea30d31bd050efb116bd4bb4235 08-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: adding internal provider API.

Also, adding the very first data type to FTS: organization.


Bug: 2078420
Change-Id: I64d6f6a63efc838c4c2c80d4311bcc23bae23a67
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ec73c9927a67e4afdd35c1b030254ed7f528655f 27-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Fixing deadlock in contacts provider

Bug: 3396429
Change-Id: I6c84c46b9605ba645e1a70c83db615a620b60200
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
50a7c86b4b49870bd19d5270722be3f1fccaf226 18-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Fixing bad SQL in search.

When the filter is "(@" the provider treats it as an email
address, but it actually is not, so the resulting SQL
has the "WHERE" keyword, but no selection whatsoever.

Bug: 3364240
Change-Id: Ie06ecc27209148253f65fe4f3bd6b3d5c96a7707
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
36d7a981711dc856da815fbc8739ee88c0236a15 17-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Synchronizing assignment of mimetype IDs and similar static data

Bug: 3355307
Change-Id: I259cd808a1079f37577ee355f3ee69ff8d1a4a9c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
a1e177389debb74a51587720464a527a193bffc1 13-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Adding support for contact search by email address and phone number

Bug: 3344700

Change-Id: I832b24bd312d4ce89b1a33678081ad4fc0f74755
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
8d2a74522d7b6f792edc74742b594fcb5251fbe2 06-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> DO NOT MERGE. Using a sqlite3 extension function to restore CTS compatibility

Bug: 3210604
Change-Id: Ic25a948298985c1def52a712df305d4dd16ea215
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d97464c056e8f247e1b33dce0ea2f77eb7f6c009 21-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding an index to aide aggregation on phone numbers

Bug: 3282731
Change-Id: Ief3f7110d75b032b24c5ab9d0dcdaa0846e7c65c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f266e8c568905337960b1fec5379841585af92a7 09-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Excluding invisible contacts from aggregation

Bug: 3184559
Change-Id: If4b75548477cc296107d233fb6678c266fb0ca94
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
5df7e46835c4f103b05407660b4769edd515760f 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Making StructuredNameDataRowHandlers a static inner class

Last step before turning them into top-level classes (really)

Change-Id: Idc84327ed75bd8a30ab3a8f1934860b6473d4a53
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
e8b3427e88d28a00cdcad7d296544f2459dfc629 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Making DataRowHandlers static inner classes

Last step before turning them into top-level classes.

Change-Id: I6d42d591682eb24ab9ec4d0575106ca9d5016865
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2a8fefb86282c06a7669f80e1b2b86d87619dfc2 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Running tests against an in-memory database.

The reduces the total run time for the test suite
from about 600sec to 90sec.

Change-Id: I68b5c17f1710ab7415913f256c925beead4dd825
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
189273b8a9ae75d88690febfbed2d635138799ec 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Moving more logic into ContactDatabaseHelper

This is in preparation for making DataRowHandlers
top-level classes

Change-Id: I861aa3ea5cde977283641317222b6b3d48282d98
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
78fb53bfd973760996fe3a5fe260b1d367574de6 30-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Switching to lazy SQL compilation.

Compiled statements are now created as needed.
This will help with two issues:
1. slow startup performance
2. inability to close and reopen database w/o a restart

Change-Id: I1ec13994979caa92b7d4edc12046b4be0f989ba3
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
3ea7932a47027c8629d3a301e1a16e7d2c8a298d 23-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing GB->HC upgrade path.

Bug: 3219199
Change-Id: Icd6d7dee77b28547e6fac57d300ea81d0a40b56a
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
c039cfb78c40730483fd71178df63ada5826a315 20-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for the new column: Groups.GROUP_IS_READ_ONLY

Change-Id: I9dc91a03d7732544cedf439e0c940c035cbfdb39
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
56f2638b49e6bca97f6aa7b0768a8f1fe6e7b72e 22-Jul-2010 Sang-il, Lee <gendoh@google.com> Support searching with given names for Korean names

Change-Id: Ifd5c8ebf265e7d3f4738dc0f378532f612ba9ef6
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
e0e24418cba10a5184e2966aaa32d5458fa6a387 22-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Backing up cached resource IDs with resource names

During an OTA or an adb sync some resource IDs may
change without an android.intent.action.PACKAGE_* broadcast.

We will now verify resource IDs against their names
and if anything does not match, rescan all packages.

Bug: 3117701
Change-Id: I293c5578b7092482e8dd4637554831f3e6f93cc1
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d0ab3293cc2f3c252b0c1f7e6db7d08dcfe15f3c 19-Oct-2010 Vasu Nori <vnori@google.com> am 09562b6c: bug:3097939 trigger on a table without good index = slow contacts app

Merge commit '09562b6c3a420ded0d02b9bd2290de2dbab9e304'

* commit '09562b6c3a420ded0d02b9bd2290de2dbab9e304':
bug:3097939 trigger on a table without good index = slow contacts app
09562b6c3a420ded0d02b9bd2290de2dbab9e304 18-Oct-2010 Vasu Nori <vnori@google.com> bug:3097939 trigger on a table without good index = slow contacts app

added index on a table without which the contacts app trigger is causing
N**2 linear scans of the contacts table. the bigger the contacts
table size (= N), the worse the prlblem is.

Change-Id: I5124b3b43d929ccaca3c4f4261c16b0ee5f02d61
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
8295d4dd0fa0530c095c8cc9fd0791e6be1b53ce 16-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> resolved conflicts for merge of 117166d0 to master

Change-Id: Icc51fb6eff0431fe5f73f2d4dfa7810fa1c8885b
093b6446d0c63b8d725324ea41369b76ace153df 14-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing the trigger for aggregated presence.

Aggregated presence was not updated properly
when presence was changed to NULL.

Added a test that covers the specific situation.

Bug: 3069107
Change-Id: I52396db7c9006e9f18ec6b7c51b22ba09c0ae480
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
7da074dc59f256a63201439cc9ae24bd2e347a06 13-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing the "duplication" of contacts (manual merge from GB)

This bug was a regression caused by
CL I413231af

When the aggregator decided that it did not
need to aggregate a raw contact despite an
existing match, it would create a duplicate
contact for that raw contact. Fortunately
those "duplicate" contacts are easy to identify
and remove.

Bug: 3091731
Change-Id: I117fdfc636cc540854b130bf0b01d0696b11e1fb
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
cfdc0773948fb9788f31495eb876fae3a069eb3a 13-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing the "duplication" of contacts

This bug was a regression caused by
CL I413231af

When the aggregator decided that it did not
need to aggregate a raw contact despite an
existing match, it would create a duplicate
contact for that raw contact. Fortunately
those "duplicate" contacts are easy to identify
and remove.

Bug: 3091731

Change-Id: Ifef2c212c1ec8d431a0aa2eeb6f34f9e30345194
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
53214b3ed12b0ff9cb589b6559311f2ac142f2e3 08-Oct-2010 Bjorn Bringert <bringert@android.com> Move SyncStateContentProviderHelper to frameworks/ex

Change-Id: Ib776d018678120e962ca1e28f5d14ea7d3b23471
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d6ef718d85724dc482dc88f8c8a87b356e63c0f6 07-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Redefining "All contacts" as members of any group.

Change-Id: I3f55af4aba1994d0f639ab8fbbdfd01434237804
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2b07b826e208e464bbd85d4679aab956bef0bafc 24-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Changing Contact PHOTO_URI to NULL when PHOTO_ID is NULL

Change-Id: I6a1778438752785adfd3bc64bd12ac2595bbf8c0
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
6c47e208236a62c55f396116e087331e05e148f3 23-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing Directory.DEFAULT update logic

After refactoring the code a few times I ended up
with selection parameters that did not match
the selection itself. Oops.

The test also needed to be fixed and upgraded.

Change-Id: Ie2ad3e75c2ed3a5df142d15943ffca67e6c634d4
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
3d67ff829e8acb0f650f155c3c0d377c0f46507a 23-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for PHOTO_URI and PHOTO_THUMBNAIL_URI

Change-Id: I080c3227164eba6804095a4f0cbd82bb5093e161
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
385182830ff0ed84edce9aba2424d2afe99453ce 22-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding a table for Directories.DEFAULT contents

Change-Id: I9d1c15e6df24fbec84e436923abdae75b88c6eac
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
cf832869bcf91b8037d8b7f510a3a213b30764a3 14-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding a missing column to projections

Also fixing a couple of broken tests.

Change-Id: I7e2fef3fd421fe0f6a47a39bbb5b44efb9399b69
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f3082210d83492b4a8591c82e56291514547f5a5 08-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> resolved conflicts for merge of 94c6c5a4 to master

Change-Id: Icaed884619c6b42f2fa595cd075a7ae20df9f706
94c6c5a4a2666efc9236237b5650c73d576e8a61 08-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Rebuilding name lookup for gingerbread

Bug: 2945979
Change-Id: Ibea10ce80023d3f2fa87fe76c5e41fbba9be6c87
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2530512f639c4979fd7371c7dd25dd67e8118124 26-Aug-2010 Bai Tao <michaelbai@google.com> Store the current country code in call log

a. Created a CountryMonitor class to monitor country for CallLog and Contacts Provider
b. Added a new field countryiso in calls table.
c. Upgrade the database to 406.

Change-Id: I894739c65672b017f8d634f0d9cd5dd11ac930d1
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
892a3d9ded5c64a63ae3d5d5c52c59528b466c93 13-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Improved the phone lookup and the phone filter

a. Altered the phone_lookup table to allow the rows with the same data_id.
b. Added E164 and normalized number for a phone number if it is applicable.
c. Improve the phone lookup by using the build in SQLite function.
d. Improve the phone filter by using 'Like filterparam%'

Change-Id: I1b23d0a10e46ef26467fb72528a7999d23e36c5e
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
72e3003a810fb4793a1513d17a40f8ab83d7d0af 05-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Introducing ContactDirectoryManager

Changing the contact directory registration protocol.
Now directory providers are mostly passive,
ContactsProvider2 is in control.

Change-Id: I93815f7dc0a30fde35d70c5fd48bb1a924076ff5
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
a549eb3c9627862a3e45d910d5c981191086a949 30-Jul-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for all-encompassing contact/entities URI.

Change-Id: I65821cf0abe2c8a94abd9168e80a0a098c1e2a1f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
632248ae0053fa99b1f5b4cfaab3e55b7453fcb1 19-Jul-2010 Vasu Nori <vnori@google.com> fix broken gtalk & contacts in master

Change-Id: I6e2dbe2fe6fd7fd1d74e80d66065ad613ec03222
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2d34c281a9b6ebb9db96fc9ac1092c46d5be6b57 18-Jul-2010 Vasu Nori <vnori@google.com> resolved conflicts for merge of aabcd1d3 to master

Change-Id: I458594d5ea2fd0735499b2d17aa4c35b81cb0077
97fd30388bd6530f86679510cd7b43b9c518bcef 17-Jul-2010 Dmitri Plotnikov <dplotnikov@google.com> Implementation for new ContactsContract API

Change-Id: I91eb0bc2184f65185a342aa3761afe8549b9e640
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
aabcd1d34a71ad06ee0a9395331540484f1ceb17 15-Jul-2010 Vasu Nori <vnori@google.com> add chat_mode to presence_db tables: presence, aggregate_presence

Change-Id: I62fc49669217a6136e31164713dc25a5296721ef
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d3d812af96f7d77e13dc60652626b39f25907147 07-Jun-2010 Dmitri Plotnikov <dplotnikov@google.com> Initial implementation of the directory API

Change-Id: If8cb0a1fc32dba0ac47502d9f86b43e0e0add8b8
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
4fc28fe621d98e1a1997c64a1305f95e7a295b5f 07-Jun-2010 Jeff Hamilton <jham@android.com> am c085b3ee: Avoid long running upgrade work on the main thread
c085b3eeebf13ebdfb197444747354a1d6eced2b 04-Jun-2010 Jeff Hamilton <jham@android.com> Avoid long running upgrade work on the main thread

Pre-froyo devices didn't use the shared
preferences to track the locale, so they will
always return null for the "providerLocale" even
if the database has thousands of contacts present
so it's not safe to run the setLocale() work from
the main thread.

Report locale change time in uptimeMillis()
so the report is correct across clock changes.

Bug: 2722569
Change-Id: I493596d657f5e02fca8174d998da1fae1115728d
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2cfbcb88ed85ac0a0bc93f558d5d7928be762102 28-May-2010 Jeff Hamilton <jham@android.com> resolved conflicts for merge of 7109133e to master

Change-Id: Ia0300d116a82a7b006aa863ae807153623c85c47
7109133e650b0b1a69690bda620e64893c027d95 26-May-2010 Jeff Hamilton <jham@android.com> Add a PRE_BOOT_COMPLETED receiver.

It runs the first time after an OTA and either creates
the database or runs the upgrade path on it. This may
take a significatn amount of time so it's done before
the boot animation completes.

Bug: 2713849
Change-Id: I07f2c22a1462e6923cb7b060d561e7fb41a6e82d
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
6ff43a7545880f0b1c0f0a82b3551fb1d0dfa956 25-May-2010 Marco Nelissen <marcone@google.com> In the simulator, everything runs as root, which causes a null pointer
exception in the contacts provider because PackageManager.getPackagesForUid()
returns null in that case.

Change-Id: Id64b5ae663b9df702752b3a5c27e3bef4e241c2c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
cfcc8ff46e014315b1689f124fe9256cd80e9e86 24-May-2010 Dmitri Plotnikov <dplotnikov@google.com> am 758a7562: Cleaning up the contacts DB during upgrade to version 203
758a7562d72b0a6ed336beac508eedf7b369fa20 24-May-2010 Dmitri Plotnikov <dplotnikov@google.com> Cleaning up the contacts DB during upgrade to version 203

Bug: 2709359
Change-Id: I3912e935aba3b5ff40347616843e8caffccacead
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
35da06eb902047d8f3eb1698450d7bfdc41f22d4 19-May-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding garbage collection for the visible_contacts table.

Change-Id: Ied1f328f93149c4e448fe8636f61062f3cc6d28d
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
4394086494fe7909aaca70f56fb4bb08beebf303 19-May-2010 Dmitri Plotnikov <dplotnikov@google.com> Changing the db structure to keep visible contact ids in a separate table.

Change-Id: Ic5a5c671cae7b893c87112b9c014e2797d60d8a3
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
dd5c25c65f09ada246c826fb6d04f0b6d4cf4388 13-Apr-2010 Fred Quintana <fredq@google.com> move favorites and my contacts group handling to the provider and sync adapter

Change-Id: Ia2aa3b7d5ede8ce00adbd957a2cae5d89051cf4c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
80d7871ca31d604cbfd857661d5300bb090076db 16-Apr-2010 Daniel Lehmann <lehmannd@google.com> Add NAME_RAW_CONTACT_ID to view_contacts

Change-Id: Ib889d1cc43e4551b9f7887bf3c808140f2bf16a3
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ee0e6b105832366143e4ddb30beb5bb0e5c81ec5 09-Apr-2010 Bai Tao <michaelbai@google.com> 1. Rebuild locale related RowHandler when locale was changed
2. Don't save adjusted full name style into DB.

Bug: 2582391

Change-Id: I7f6720f59cb452ac19cb7fafac5e704c3d51c2bb
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
69cc3a2b09e2ffb606c6e52a71b604bba526d225 31-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing adding a raw contact to an existing contact.

The issue was that the raw contact was inserted
with the aggregation mode == SUSPENDED, which prevented
it from being aggregated with the other raw contacts
in the same aggregate.

Fixing that by forcing the raw contact out of the
suspended mode when an aggregation exception is added.

Also fixing cosmetic issues missed in the previous CL.

Bug: 2558964
Change-Id: I951db8280e09bd8afd825049320f92c23321ec43
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
33fd566fb6eebdd40a900c0c8a2f6dca894d7829 31-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Cleaning up dangling pointers after account removal.

An aggregated contact points at a raw contact that
contains the contact name. It also points at a photo
row. When we remove an account, we should be fixing
up those pointers. That's exactly what is done
in this CL.

Bug:2557771

Change-Id: I04bc6b23be31ed53b27b48bd2f92eaa1a0838387
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d6e233be3f6b822510db079d3f7a5f89ca11167c 25-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Making contact visibility update null-tolerant

The visibility update query will no longer crash
if there is a contact without a corresponding raw contact
or vice versa.

This situation should not occur in legitimate use cases,
but database corruption could make this happen.

Bug: 2539296
Change-Id: I3169d84191b02683c86b77697b855d36c3c17aa3
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
afbf2a3343d0f8e7ae7cbfbbec60004ed37caf3f 24-Mar-2010 Daniel Lehmann <lehmannd@google.com> Publish NameRawContactId in ContactData-Query
Bug:2534647

Change-Id: I9b063282b0ec430bd7ce64a946ec2699b0406781
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
de8f19d5cc1ef7d5bd76ede6be888dad37112966 24-Feb-2010 Daisuke Miyakawa <dmiyakawa@google.com> Use PHONEBOOK_COLLATOR toward sort keys, assuming sqlite already has the custom collator.

The phonebook collator is newly intruduced for sorting contact list with what people
expect toward phonebook (the term being used in icu4c, so we don't use "addressbook" or
the other term here). Currently the locale ja will be affected since the collator is
enabled only in that locale.

In the future, we may
- introduce the collation toward other locales (e.g. de has phonebook collator already)
- remove this collator if there's some serious side-effect

So, at this time, do not use this collator toward other columns.

Bug: 2373553
Bug: 2373557
Change-Id: I8a7bec5c2a225a07d4e883d43dfd6fdb2e849047
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
743eac356404195f236ad44379fe9d180beb5bf2 19-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Optimizing the "all accounts" query in ContactsProvider2.

Change-Id: Ia6f8d36956397757c7c246585e37462d09c20337
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
b2e27298ae54ec2215eadf98ecc100aedba98d1a 18-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Storing legacy contact status in the database.

We have run into this situation: in a low storage case
contacts were converted, but then the new database
crashed and was recreated as empty. The import process
was not retried because the provider was thinking
that the upgrade was successful based on a value
stored in shared preferences.

Now the value is stored in the target database thus
forcing the provider to restart the import process
if the database gets corrupted after it's complete.

Also, addressing an inconsistency in the provider that
could lead to compiled SQL statements being detached
from their database.

Bug: 2498528


Change-Id: I77e864fa98a86918d31123f4d3488ae1b1b44bc2
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
60de6f6c3c70e53b603a47b0efc80993353a8368 10-Mar-2010 Daniel Lehmann <lehmannd@google.com> Fix lookup of lookup-keys that are encoded (e.g. Exchange)
Bug:2497276

Change-Id: Icc503f48bdb96eac077db9b1279485d0a0034340
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
51f41be3b905c63ccffcdc82ec58cf5f7ded2c34 09-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Rebuilding contacts sort and lookup keys on locale change.

Bug: 2476633
Change-Id: I25ba9521e7247907d4fa8c0148091d9d67e4e389
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
5086b63bf3de5f26f495b640e85259c0ebf5ca47 09-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing ArrayIndexOutOfBoundsException in contact sync

Bug: 2498058
Change-Id: I3390da8f3a884191d720128aace29b906ba73523
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f84478382761d74b9fb98c4189de66002c04cef8 24-Feb-2010 Sang-il, Lee <gendoh@google.com> b/2481029 Support searching with lead consonants for Korean names.

Change-Id: I7d60da3300c61571b293e2bda5a3440a8a35d16c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
08768a0f3434130fa46379c1bbfec93a19094939 06-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Making two changes: extracting actual address from an RFC 822 address and making matching case-insensitive.

Bug: 2254140
Change-Id: I9827f5646664fc2b744c01cc00bd05617ac06fb6
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d806946b6561dca3f34ded156c6ee89a5113996e 05-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Preventing Chinese shorthand keys from being inserted for non-Chinese contacts.

Bug: 2488839
Change-Id: I0999284fb2eb651af7c3cb00d3f991ab157a3b28
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
fa4a38c9d54f3e3aad4674867bb1250f450c0b95 04-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Making exceptions more verbose in ContactsProvider2

Change-Id: I32f7d5d4a4bbd8468ac174d5c0cb4f6521806272
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
04b7ce026c73077d9d982742bc662ea4b3ac74e7 27-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Rebuilding contact name lookup during an upgrade from Eclair.

Bug: 2476275
Change-Id: Icda3e0d57ba053978fc0bc8c7e961db2b8b5a69c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
b06484032125877d1a89785a1a912ca58c12d448 26-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing contact lookup by email or nickname

Bug: 2472887
Change-Id: I7010292dd1f189ae0fc18340ebc263664e1f15f8
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
916f2d7104bfba857412a66b40ed60fea6546222 25-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for contact search snippets

Bug: 2447965

Change-Id: Id531ca694173751392961510e1207215113b323d
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
6c0d1eb7a960d7f8c4a42a9e0ae10487654f5f7e 19-Feb-2010 Paul Westbrook <pwestbro@google.com> Fixed a bug that was causing
the Gmail unit tests to fail

It looks like a trigger was left in the contacts provider to
update the number of times contacted, even though that the
code has been added in ContactsProvider2.updateContactOptions.

Without this fix, the number of times contacted was being
updated twice in the raw_contacts table
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
34469970fb04b9b188b5430f592b0c956a6ea2aa 06-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing contacts.db version.

Change-Id: Ice638d7b66f673db4c9200bf5d2299aa1ab79c21
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
31168f49a3da9b9a9d5346f3d6a8098b76179c9c 06-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing contact lookup by company name and title

Bug: 1360100
Change-Id: Ic897ee1cb9e1c11c858b85b4c0c1d364fabccaad
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
4cd13c4266d8e476e1a49c4b6bcd5b18c33d0de3 21-Jan-2010 Bai Tao <michaelbai@google.com> a. Fix the issue that the FullNameStyle is not updated when user edits the contact or the contacts being synced.
b. Add Chinese sort and search.
c. Adds a CJK check for each contact at runtime. per discussion with component owner, will tune performance later after Korean and Japanese features are added.
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
8be93f4d062ad3919ba48245dd147a49715db82d 21-Jan-2010 Dmitri Plotnikov <dplotnikov@google.com> Optimizing the Contacts Display Setting screen.

Summary:
Given an account with 5020 contacts,
Before this optimization it would take roughly 10sec to
change visibility of either 5000 of them or 20 of them.
After the optimization, changing visibility of 5000 contact
still takes roughly the same time, but changing visiblity
of 20 contacts takes 1.5 sec.

There is another optimization that can be done (mentioned in the
CL that reduces the cost for 5000 contacts from 10sec to
about 3.5sec. That's a bit more involved and a TODO for later.


Change-Id: Iee8f251fdcab50a26b6b02131c0d23fb84aabd46
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
ea509f383588d8810dee2e265e51c0ccb2ec225a 21-Jan-2010 Dmitri Plotnikov <dplotnikov@google.com> am fdbc8f37: am f4a3b7e5: Solving deadlock in ContactProvider2

Merge commit 'fdbc8f3785a4c097a086b2dcfbfcb2d1188cb331'

* commit 'fdbc8f3785a4c097a086b2dcfbfcb2d1188cb331':
Solving deadlock in ContactProvider2
f01c876a92b9c950a0450ed8b706ac5eb2c9b660 20-Jan-2010 Dmitri Plotnikov <dplotnikov@google.com> Support for the RawContacts.NAME_VERIFIED field.

Bug: 2164422
Change-Id: I144819b04bbdb506d9e582de490fd3aa42cb0682
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f4a3b7e523e36679b68edd2af632e26648758ff2 15-Jan-2010 Dmitri Plotnikov <dplotnikov@google.com> Solving deadlock in ContactProvider2

These two threads are deadlocked.

There are two locks involved: database lock (marked with D below and
the object lock on ContactsDatabaseHelper marked with H)

"Binder Thread #2" prio=5 tid=13 MONITOR
| group="main" sCount=1 dsCount=0 s=N obj=0x44bee478 self=0x1205f8
| sysTid=1439 nice=0 sched=0/0 cgrp=default handle=1201736
H at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:~149)
at com.android.providers.contacts.ContactsDatabaseHelper.getMimeTypeId(ContactsDatabaseHelper.java:1512)
at com.android.providers.contacts.ContactsDatabaseHelper.updateAllVisible(ContactsDatabaseHelper.java:1554)
at com.android.providers.contacts.ContactsProvider2.beforeTransactionCommit(ContactsProvider2.java:1989)
at com.android.providers.contacts.SQLiteContentProvider.onCommit(SQLiteContentProvider.java:216)
at android.database.sqlite.SQLiteDatabase.endTransaction(SQLiteDatabase.java:494)
D at com.android.providers.contacts.SQLiteContentProvider.insert(SQLiteContentProvider.java:96)
at com.android.providers.contacts.ContactsProvider2.insert(ContactsProvider2.java:1941)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:150)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:140)
at android.os.Binder.execTransact(Binder.java:287)
at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=11 WAIT
| group="main" sCount=1 dsCount=0 s=N obj=0x44bea248 self=0x125480
| sysTid=1438 nice=0 sched=0/0 cgrp=default handle=1145184
at java.lang.Object.wait(Native Method)
- waiting on <0x5319d0> (a java.lang.VMThread)
at java.lang.Thread.parkFor(Thread.java:1535)
at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
at sun.misc.Unsafe.park(Unsafe.java:317)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:790)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:823)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1153)
at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:200)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:261)
D at android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase.java:305)
at android.database.sqlite.SQLiteStatement.simpleQueryForLong(SQLiteStatement.java:116)
H at com.android.providers.contacts.ContactsDatabaseHelper.getCachedId(ContactsDatabaseHelper.java:1478)
at com.android.providers.contacts.ContactsDatabaseHelper.getMimeTypeId(ContactsDatabaseHelper.java:1513)
at com.android.providers.contacts.ContactsProvider2.query(ContactsProvider2.java:3765)
at android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:117)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:98)
at android.os.Binder.execTransact(Binder.java:287)
at dalvik.system.NativeStart.run(Native Method)

Removing synchronization from the getCachedId method is benign. Worst case
some value would be read from the database twice - no biggie.

Bug: 2370192
Change-Id: Ia6606d5bf617a8d52daaa1e63f57aeeba6dd0437
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
7cf157b1d04ec54e981012fc0dfa982c9e541a10 14-Jan-2010 Vasu Nori <vnori@google.com> don't set max cachesize anylonger. it is managed by SQLiteDatabase.

max cachesize is now automatically managed by SQLiteDtabase. and there
is no longer the API call used by ContactsDatabaseHelper to set the max
cachesize.
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
bcbd6a5cdd2d1aa6531c592428dc20e0282486c3 06-Jan-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing upgrade logic to contacts.db v.205

The problem was caused by unsynched deleted raw contacts. These
raw contacts don't have a contact_id, which was the cause
of the exception during the upgrage.

Bug: 2338000
Change-Id: I04630bee76edc7ba70324afa88e9dcae9aa99512
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
08e50780099971e8927b258ef2ae93d44f98668c 05-Jan-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing Contacts DB upgrade logic

We would try to create views and triggers before the fields they
reference got added.

Bug: 2353082

Change-Id: I90eb0559cb1a1838e4ad680e4180af57c6254797
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
2d2ec88b7af615b2f05e987da45425be9cace1ba 23-Dec-2009 Tom O'Neill <tomo@google.com> Contacts provider uses LOOKUP_KEY for search result IDs

The lookup key is more stable against merges, etc. than the contact ID,
so we are switching to that for the ID values used in search results.

Bug: 2294798
Change-Id: I09e03212828ec473b69968eb00d490785e15edbe
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
5dd6d5d4acb93adc05f1fde904080787f2397f51 21-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Resubmit: Adding support for new Contacts columns for names and sorting

This is in preparation for fixing bugs:
Bug: 2075641
Bug: 2021660
Bug: 2164422
Bug: 2267198

Change-Id: I7696abe8c8fd17d8854632cc8e818b9e4d2e643c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
bca1c8b44f99528fc123d5547723e44771e8e934 21-Dec-2009 Mike Lockwood <lockwood@android.com> Revert "Merge change Ief95261a"

This reverts commit 003009d47e893df100d4020c708296b23c03d28f, reversing
changes made to 5b3b3ec368625c07a2c94d2199a75099d4d9b8a9.
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
b0812f94fa50c54d06978cdd65651a487c717dff 19-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding support for new Contacts columns for names and sorting

This is in preparation for fixing bugs:
Bug: 2075641
Bug: 2021660
Bug: 2164422
Bug: 2267198

Change-Id: Ief95261a0f4e2c78b216a842cad47f42ef2935c2
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
9b1bd62417ef1764829398a61c3d5df93a924106 10-Dec-2009 Vasu Nori <vnori@google.com> drop a couple of triggers on contacts tables and move them to code.

the triggers in question are the ones that update times_contacted column in
contacts, raw_contacts tables. these triggers had to be rewritten to make
them work woth sqlite 3.6.20 (current version of sqlite in android is 3.5.9).
so, instead of rewriting them, taking this opportunity to moving them to code.
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
4a318ba1f6aff725e99b4a141fd4c3dc8a112b7a 03-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Getting rid of some dead code

Change-Id: I5f14b939976d4385a2410e8b01ed05bdba271e1c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
fada1f08e7ffc8012bf2175f61f3ef3270eba9ec 02-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding a new column to Contacts: NAME_RAW_CONTACT_ID

This is in preparation for fixing bugs:
http://b/2075641
http://b/2021660
http://b/2164422
http://b/2267198
and merge with eclair-china CLs having to do with sorting using pinyin names.

Change-Id: Ifa5b442e9230a8f4fe07334c394a775f18c09218
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
7f61664c2b587e27f52edcb9a8b91986154ec637 26-Nov-2009 Vasu Nori <vnori@google.com> change BEFORE triggers to AFTER triggers - to make them work with sqlite 3.6.20 & beyond
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
9e7bf1b00c1bac90510cef7776224e0fd3d8908a 21-Nov-2009 Vasu Nori <vnori@google.com> Setup ContactsProvider with compiled-sql statement cache.
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
71037c010a0b7c882284fc1ed8584a378d926b83 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing database versioning broken for a brief time in CL 32247

Change-Id: Ia34f0ca9dbc9ae25f7a817031cdf01b5ec6a109d
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
3410a80f4aafe5685da61c217808d2bf21d55dfc 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> resolved conflicts for merge of 1c8e40c1 to eclair-mr2

Change-Id: I5c8e9e76c79a5c70d214bc0b28360c41c07e7b85
1c8e40c18f92722b9bec6e8ce2e345a9828efa16 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing legacy contacts API breakage uncovered by CTS tests

Bug: http://b/2236480
Change-Id: I653a0c0c012f7f125e75e5436cdf66e31402444c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
e2d20aa1ab5de52ee4a4f5ba3cffcc1166a0b44f 04-Nov-2009 Jeff Sharkey <jsharkey@android.com> resolved conflicts for merge of bf6a7e4d to eclair-mr2
bf6a7e4dece49ba4e7cda17f7ed9250aeb82f731 03-Nov-2009 Jeff Sharkey <jsharkey@android.com> Expose IS_RESTRICTED field through queryEntities() views.

Part of fixing http://b/2223256
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
36045476d2cc7c9c2f985307e87cb6bbc4cfe434 19-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2 optimization: performing phone matching entirely in the database

In order to perform phone number matching efficiently, we now store the minimum caller ID
digits in a new column in the phone_lookup table.

Bug: http://b/2148602

Change-Id: I2f61f79212e296fde92c35768047f11f997903d4
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
47ab23770b9f010a5e5277cda68267fe0613a1cc 13-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2185274] Optimizing queries used by Google Voice

Change-Id: If9a8aee57f3d344f98ddc1462c34113b2194241f
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
fda634f3eeff6aed8e8dddca92fc07aa44befedd 13-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2183494] Deleting status updates when a contacts account is removed

Change-Id: Ia9e86786ed11b3fca60b274edc6495b77838bc46
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
a0e72d9b20207ec244f92ace2917932990f2bc8b 06-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2134623] Optimizing the view_data view, which was doing a full scan of the data table.

Also,
[Issue 2168777] Making sure QuickConnect header links to a visible contact (if available)


Change-Id: I0baab1d532ced7f3ac78ea80ab7700850cacbfa1
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
46b7bfa3728bf878d1a9dac9fea35fa629975e1b 05-Oct-2009 Fred Quintana <fredq@google.com> - create a Uri for and expose the contacts entities uri
- change the EntityIterator to use that Uri
- fix the column naming in the entities view
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
b5a3163481794babda78716e576e35818de0cc03 04-Oct-2009 Dianne Hackborn <hackbod@google.com> Work on issue #2163789: Way too much logging

Dr.No from mcleron.

Change-Id: I070c01e01a08bfe6203302c98cb37fbfd1cb82a5
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
3296d3469bce0041a6cefc44d0486a2a7d0c9f82 30-Sep-2009 Jeff Sharkey <jsharkey@android.com> Offer separate social projection when requesting data rows.

Part of fixing http://b/2126683
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
0f5116227592cb8e724542c598daffa383964679 01-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Making contacts provider tests run again

Change-Id: Ie85b0dd312368bf04e2343471265c51437dea6f1
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
f80d9ab92d69e579edce069406f2c1b3280e58d3 01-Oct-2009 Fred Quintana <fredq@google.com> use Events for birthdays
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
d91272b48f97243533c6580981e12a4847b5783f 30-Sep-2009 Jeff Hamilton <jham@android.com> Read the unrestricted pacakages list from XML.

Change-Id: I9af814b8bb1b95051a0371d1e3d3769c052ffd95
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
763100dcfabb368e72f25d24fe181c352bdb66d6 29-Sep-2009 Evan Millar <emillar@google.com> Read query parameter REQUESTING_PACKAGE_PARAM_KEY to determine whether to restrict data.

The requesting package is compared against a white list of packages that
have permission to see restricted data.

Change-Id: I4fcf19f99be68998f6e5b12e2d32b9fe56de68ec
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java
b38ed2c5ffeb20efc677b4a9229db4a00603aa8d 29-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Renaming OpenHelper to ContactsDatabaseHelper

Change-Id: Iccdf1ebcd8a3ab430941c957f712bb9e7dd2706c
/packages/providers/ContactsProvider/src/com/android/providers/contacts/ContactsDatabaseHelper.java