• Home
  • History
  • Annotate
  • only in /packages/providers/ContactsProvider/src/com/android/providers/contacts/
History log of /packages/providers/ContactsProvider/src/com/android/providers/contacts/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
8c892903f8eac55db45cdbf232ec7c2bc697ff48 02-Jun-2018 Ta-wei Yen <twyen@google.com> Fix VoicemailContentProvider not notifying status changes

In ag/3423779 the VoicemailContentProvider is changed to only notify
changes that touches columns in the voicemail content table, and
voicemail status changes are no longer notified.

Change-Id: Iff71b4de7dc050a6928a73feafccee9699b61dec
Fixes: 80102094
Test: tradefed ContactsProviderTests
bModifierWithNotification.java
04efcfc5f3227f54dfc9138a0fcdbb8af3f052fc 02-Apr-2018 Makoto Onuki <omakoto@google.com> Avoid stringbuilder explosion

Change-Id: Ifd60098d5a5738063a5b5831a857802327f42774
Fixes: 76175892
Test: ContactsProviderTests
earchIndexManager.java
til/CappedStringBuilder.java
eef856198870eb06a86d9f901a747f5259177965 26-Mar-2018 Makoto Onuki <omakoto@google.com> Client access stats for calllog

This prints # of requests made by clients, per calling UID, with total
time spent for their requests.

Sample output:

PROVIDER ContentProviderRecord{a16090d u0 com.android.providers.contacts/.CallLogProvider} pid=2417
Client:
Process uptime: 4 minutes

Client activities:
UID Query Insert Update Delete Batch Insert Update Delete Sec
1000 1 4 0 0 0 0 0 0 0.161
10022 1 0 0 0 0 0 0 0 0.068
10062 336 2 0 0 0 0 0 0 5.361

Change-Id: I4b6f7e58dd8dc971408220edaae11ce6f24c43f5
Fix: 76037330
Bug: 76037330
Test: build & boot, dumpsys activity provider com.android.providers.contacts/.CallLogProvider
allLogProvider.java
8b924e2e51c026e769343e883ee21a5c05d1eaa1 21-Mar-2018 Makoto Onuki <omakoto@google.com> Move provider access stats to frameworks/base

Bug: 76037330
Test: boot and dumpsys activity provider ContactsProvider2
Change-Id: I2d10d69da9ddb5536ff3ef0aef2cfc3a711a20bd
bstractContactsProvider.java
ontactsProvider2.java
rofileProvider.java
ae1f9edc0c877c2ccc32ae8b30de974271def420 13-Feb-2018 Jeff Davidson <jpd@google.com> Allow carrier-privileged apps to access voicemail provider.

Bug: 70041899
Test: TreeHugger + tests in CL topic
Change-Id: Icd80caa6f755f549f2433ac4dcacb4a77c962077
Merged-In: Icd80caa6f755f549f2433ac4dcacb4a77c962077
(cherry picked from commit 9c57007fb2e6bbb3d0303320ce6938751240c1c7)
oicemailContentProvider.java
oicemailNotifier.java
oicemailPermissions.java
a46b29830088c91a21ce390cd5981740ac3bc08b 11-Jan-2018 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Allow Voicemails to be inserted as not new."
0cd861f7a1a3c853152e92dc79282ac748712602 10-Jan-2018 Ta-wei Yen <twyen@google.com> Allow Voicemails to be inserted as not new.

Inserting voicemails as new will cause dialer to send notifications to
the user. For initial syncs this is undesirable. Previously the NEW
column is only available to call log.

Change-Id: Ib01720dcec841d2f17016eac4efab6e13e9b0d6c
Fixes: 69482089
Test: CTS
oicemailContentTable.java
0c37d7518d22c34dc68a613b65a673c47f48f6a8 05-Jan-2018 Ta-wei Yen <twyen@google.com> Don't update DIRTY flag when updating non-voicemail columns

Caching contact data should not cause an upload.

Fixes: 71605105
Test: VoicemailProviderTest
Change-Id: I9301c00ccb14580c5c20268a3e4bbe1f0bbb52f5
bModifierWithNotification.java
oicemailContentTable.java
5c56c636263f75acd976208f0702e5c6eee5c9ac 05-Dec-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Implement preferred phone account columns"
028b73bebdb9cac09de3b93a82ccb72ad3238ed6 29-Nov-2017 Ta-wei Yen <twyen@google.com> Implement preferred phone account columns

Fixes: 69868483
Test: CtsProviderTestCases
Change-Id: Ib8af85b5c618c1a2c62bc6c09daae057521de5d6
ontactsDatabaseHelper.java
ontactsProvider2.java
78ce51eacb3c0da4ea8fe88541d040a85b1bb9e6 30-Nov-2017 Ta-wei Yen <twyen@google.com> Implement DIRTY_RETAIN constant

Previously the DIRTY flag can only be automatically or explicitly set.
There are no option to express "This operation does not change the DIRTY
flag". This causes issue when the voicemail source is downloading
changes from the server instead of uploading and would clobber the flag.

After this CL, if DIRTY is updated with DIRTY_RETAIN, the flag will not
be updated for the operation.

Change-Id: I23a23a11f7d2177d10b65bbc33875b7eb838f7c1
Fixes: 64371667
Test: CtsProviderTestCases#VoicemailContractTest
bModifierWithNotification.java
5e097c0c0e687c80ae46006a692dc12393903126 18-Oct-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Implement bulkInsert for VoicemailProvider"
c28f7969399fcb667d02de4030fba0fc40ff9130 16-Oct-2017 Ta-wei Yen <twyen@google.com> Implement bulkInsert for VoicemailProvider

DbModifierWithNotification will only generate one aggregated notification
during bulk insert.

Test: VoicemailProviderTest
Change-Id: Ie808400d666c073642bdda175f714f9f3e2c68d6
Fixes: 21281858
allLogProvider.java
atabaseModifier.java
bModifierWithNotification.java
oicemailContentProvider.java
oicemailContentTable.java
oicemailNotifier.java
oicemailStatusTable.java
oicemailTable.java
6b2cd56c398cde2acacf8f24abb1b638bdb03546 13-Oct-2017 Tingting Wang <tingtingw@google.com> Trigger FSA sync on favorite membership insert.

Like other data item insert/update, when inserting favorite group
membership to a raw contact, it should also mark the raw contact
dirty and trigger FSA sync.

Test: run adb shell am instrument -e class com.android.providers.contacts.ContactsProvider2Test -w \
com.android.providers.contacts.tests/android.test.InstrumentationTestRunner

BUG 65121762

Change-Id: I37201d2084da4b0cba427781a0e37ff33dba2b71
ontactsProvider2.java
2724dead51116d8281433435ba9e152f839fac4c 01-Sep-2017 Fyodor Kupolov <fkupolov@google.com> Close idle connections to release RAM

Close idle connections after 30s of inactivity to release RAM.
Savings: ~2.5mb on marlin, ~1mb on low-ram devices

Test: manual reboot and dumpsys meminfo android.process.acore after 2min
Test: com.android.providers.contacts.util.CallLogProviderTest, UserUtilsTest
Bug: 63398887
Change-Id: I6e53a80ee2a0268f2d1da3ecfa480c41c7b19a04
allLogDatabaseHelper.java
ontactsDatabaseHelper.java
517d590dc73e5efcf7c94e2431faec2473924ca2 07-Jul-2017 Makoto Onuki <omakoto@google.com> Make CP2 low-ram friendly

- Switch to ArrayMap|Set
- No common nickname DB on lowram devices
- Don't use WAL for profile DB, ever
- Don't use WAL for contacts2.db on lowram devices

Bug 63340057
Test: adb shell am instrument -w -e package android.provider.cts.contacts \
android.provider.cts/android.support.test.runner.AndroidJUnitRunner
Test: bit ContactsProviderTests

Change-Id: I16a6b41762874590c487ac82020bd1da7d7c0a0a
allLogProvider.java
ontactLocaleUtils.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForGroupMembership.java
bModifierWithNotification.java
egacyApiSupport.java
ameSplitter.java
hotoPriorityResolver.java
hotoStore.java
earchIndexManager.java
ransactionContext.java
ggregation/AbstractContactAggregator.java
ggregation/ContactAggregator.java
ggregation/ContactAggregator2.java
ggregation/util/CommonNicknameCache.java
ggregation/util/ContactAggregatorHelper.java
ggregation/util/ContactMatcher.java
ggregation/util/RawContactMatcher.java
ggregation/util/RawContactMatchingCandidates.java
til/DbQueryUtils.java
87c3705de38346099ead721ef66c3a153042ee4b 09-Jun-2017 kenji oda <kenji.x.oda@sonymobile.com> Merge "Disable a phone number log" am: 44c11b854e
am: 467525fa3c

Change-Id: Ie2ffc66d41bd99d55f4f348ed7715e3638b4d9f2
44c11b854e615a007eda9760f9c9d0323c9c73ba 09-Jun-2017 Treehugger Robot <treehugger-gerrit@google.com> Merge "Disable a phone number log"
cd0c8902dbd364f680646ee468342c1ec65f0581 16-Mar-2017 kenji oda <kenji.x.oda@sonymobile.com> Disable a phone number log

A phone number is privacy data.
Therefore, it should be prevented from logging

Change-Id: I8b6452b2012b7e98459cdf18bdef6ddf3fe44d50
ontactsProvider2.java
dc72d6de7a9a545d18fb4f46f5a726c6fa00abef 06-Jun-2017 Makoto Onuki <omakoto@google.com> Allow updating TIMES_CONTACTED again.
am: f752e4fbe3

Change-Id: Ia2e838b3515ce05da7a5ec783940a537293f8f6e
f752e4fbe36b30346c33c97a12ed7bb2bcf4256c 05-Jun-2017 Makoto Onuki <omakoto@google.com> Allow updating TIMES_CONTACTED again.

Explicitly setting to TIMES_CONTACTED was allowed on pre-N builds.

We tried to disable it for O, but turned out some system apps are using it.

Let's re-open it.

Test: adb shell am instrument -w com.android.providers.contacts.tests
Test: adb shell am instrument -w -e package android.provider.cts.contacts android.provider.cts/android.support.test.runner.AndroidJUnitRunner
Bug: 35321783
Change-Id: I07af087256cc9908b031bd8dfbd9fad479d4681f
ontactsProvider2.java
6139f5ca72674cdf88eea6f82f7cf61241f631e6 30-May-2017 Makoto Onuki <omakoto@google.com> Change WTF to e/w
am: 544cb78646

Change-Id: I9ed7c746a50f4a13e79f8d291993c7db59baa797
544cb78646d1631f502762ac52594ea8d478b1d6 30-May-2017 Makoto Onuki <omakoto@google.com> Change WTF to e/w

Fix 62191439
Test: adb shell am instrument -w com.android.providers.contacts.tests

Change-Id: Ifbf97ce83e180e2f66483f1d15463c8015e17d8d
ontactsDatabaseHelper.java
ontactsProvider2.java
9805122df1cd098678b5349b509198ae1d95e211 26-May-2017 Ta-wei Yen <twyen@google.com> Allow voicemail DIRTY flag to be explicity set
am: 58a1f876fb

Change-Id: Ie1cb636aa5714b464afc8aac0873000ec8363d40
58a1f876fb972d290bba505365605ab6f4087c7f 25-May-2017 Ta-wei Yen <twyen@google.com> Allow voicemail DIRTY flag to be explicity set

The DIRTY flag is used to indicate there are local changes that needs
to be uploaded to the server. Previously this flag is automatically set
to 1 if the modifying package does not own the voicemail. For example
when dialer marked the voicemail as read, ContactsProvider will mark
it as dirty, and the source telephony will query for dirty entries
and upload it to the server.

After visual voicemail is unbundled, the voicemail source is no longer
guaranteed to be separated from the voicemail UI.

In this CL, the DIRTY field will no longer be overriden if the caller
sets the field.

Bug: 38302993
Test: CtsProviderTestCases

Change-Id: I4a3d08a7ab2b9d61d271ae548ecdbc358af48f3e
bModifierWithNotification.java
fa76abec36a133ed32d522a1fc697f0d570cda67 12-May-2017 taiki tsutsumi <taiki.x.tsutsumi@sonymobile.com> Merge "Fixed the issue that unknown contact sort" am: 4ed9805ba3 am: 7f539c63f5
am: 9a8d0484df

Change-Id: I70141444a884ac93391b4ffab62e85302e6b3c4e
6000b7dc911fe05857882c2d5de38c4ef9a7ff4f 07-Dec-2016 taiki tsutsumi <taiki.x.tsutsumi@sonymobile.com> Fixed the issue that unknown contact sort

Change the header of unknown contact to #.
When using JapaneseContactUtil and ChineseTWContactUtils,
change the sort index of Number Bucket.

affected area:
When including Japanese and Chinese.
This utility class provides specialized handling for locale specific.
information: labels, name lookup keys.

Change-Id: Ie60d647d2b9823194c5f7319f7e57a2f370b4e3a
ontactLocaleUtils.java
bcec6b7482ad50f2ca9025b3b20624dd89b7c000 18-Apr-2017 mike dooley <mdooley@google.com> Adding voicemail transcription state to voicemail database

This database change involves 2 related cl's, one to define the new
column and one to update the database schema (ag/2129944, ag/2129909)

Test: run cts -t android.provider.cts.contacts.VoicemailContractTest -m CtsProviderTestCases
Bug: 37340510
Change-Id: I277ab08b88699c81db7af425368714660aff094e
allLogDatabaseHelper.java
allLogProvider.java
oicemailContentTable.java
3460479f9af14569315a4ece03ac12118e28e1ca 29-Mar-2017 Tyler Gunn <tgunn@google.com> Change namespace for internal only intent.

Test: Manual
Bug: 35271104
Merged-In: I2defdf0235ddc97f76f4e0dfae3fbb0ba4f42074
Change-Id: I2defdf0235ddc97f76f4e0dfae3fbb0ba4f42074
bModifierWithNotification.java
f5cef5e0dd08c59300ed062f9b6464d07fb143e1 31-Mar-2017 Tyler Gunn <tgunn@google.com> Merge "Change namespace for internal only intent."
am: 841935dff4

Change-Id: I788f402c88429a0a8becd62319009ff0ae53b094
febc670e583078076573e9b7eb3be8045353a268 29-Mar-2017 Tyler Gunn <tgunn@google.com> Change namespace for internal only intent.

Test: Manual
Bug: 35271104
Change-Id: I2defdf0235ddc97f76f4e0dfae3fbb0ba4f42074
bModifierWithNotification.java
4563b8c5320759689abd09846cbd2bf84b4e0a50 25-Mar-2017 Ricky Wai <rickywai@google.com> Merge "Schedule re-scan contacts directory provider if directory is force updated"
40af6e611d9fe06031ee9748fbcc94a34f9de5da 24-Mar-2017 Ricky Wai <rickywai@google.com> Schedule re-scan contacts directory provider if directory is force updated

Test: CTS should pass as usual, hope it can deflake some directory tests
Bug: 36371719
Change-Id: I477d7f90f48aac90ad4f88471f107a5a4986e7f6
ontactDirectoryManager.java
ontactsProvider2.java
1467a85d2c3e05c059bd260312b46eff99666552 23-Mar-2017 Makoto Onuki <omakoto@google.com> Show how long operations took for each UID in dumpsys.

Test: adb shell am instrument -w com.android.providers.contacts.tests
Test: manual
Bug: 36514278
Change-Id: I3ac1a18bc780c32f886ef16c5e429b1f654dae85
bstractContactsProvider.java
ontactsProvider2.java
rofileProvider.java
459639bbe313d2424fa27ece3d7511452ff7eac9 14-Mar-2017 Makoto Onuki <omakoto@google.com> Add DB upgrade step to update the views

Bug: 36089513
Test: Manual test
Test: adb shell am instrument -w com.android.providers.contacts.tests
Change-Id: I755cf889c40530d53e3511841db67e4e296d3838
ontactsDatabaseHelper.java
6d6be558693ec480b281e6614894f22ca5161944 14-Mar-2017 Makoto Onuki <omakoto@google.com> Don't blur less than 10.

Bug: 36089513
Test: adb shell am instrument -w com.android.providers.contacts.tests
Change-Id: I20c541973cfb4e2cef7b66c5373513e77b208264
ontactsDatabaseHelper.java
eef9ef50ecefc5bb91728c94627068916311311a 09-Mar-2017 Makoto Onuki <omakoto@google.com> Don't set broadcast result code. Not needed.

Fix: 36039140
Test: adb shell am instrument -w com.android.providers.contacts.tests

Change-Id: Icc4d3d0b32c2144702b52108a303540dac346581
ontactsPackageMonitor.java
251436e82288f4d0849f200b7b7f76c64cae56d3 07-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Loosen SQL check"
8411b174dee903acf8f7d16a8f46da2a7265f1ab 07-Mar-2017 Makoto Onuki <omakoto@google.com> Loosen SQL check

Bug: 36004581
Test: adb shell am instrument -w com.android.providers.contacts.tests

Change-Id: Ifbbb88aff802d9c7cbf107f752996a0506e2a31a
ontactsDatabaseHelper.java
qlite/DatabaseAnalyzer.java
442d7200fb77e2a6d0d3c8d1b17b3b8090581b02 06-Mar-2017 Makoto Onuki <omakoto@google.com> Don't use manifest receiver

- Only use a runtime receiver to handle package broadcasts.
We still do mostly the same tasks in the receiver.

- Also remove the BG service used by the voicemail provider.

- When the voicemail provider starts, remove records made by
packages that have been uninstalled.

- The package receiver was used to update GAL providers too.
The previous CL already takes care of scanning GAL providers on
startup.

Test: adb shell am instrument -w com.android.providers.contacts.tests

Bug 35388445
Bug 35385207

Change-Id: I743a769bd51e2acdbd13df1440cce04b35331fda
allLogDatabaseHelper.java
allLogProvider.java
ontactsPackageMonitor.java
ontactsProvider2.java
ackageIntentReceiver.java
oicemailCleanupService.java
oicemailContentProvider.java
oicemailContentTable.java
oicemailStatusTable.java
oicemailTable.java
til/PackageUtils.java
fcc2655b0fca7032fcde306660da303c85125218 04-Mar-2017 Makoto Onuki <omakoto@google.com> Rescan all GAL providers when GAL provider packages have...

been added or removed at startup.

Bug 35388445
Test: adb shell am instrument -w com.android.providers.contacts.tests

Change-Id: Ifc8a9498151e5523e3657cd006e7831d68389f67
ontactDirectoryManager.java
ontactsDatabaseHelper.java
ontactsUpgradeReceiver.java
b95db86983d47262f670ad11b83d6f254f17f229 01-Mar-2017 Makoto Onuki <omakoto@google.com> Improve debug logging

Test: adb shell am instrument -w com.android.providers.contacts.tests
... with and without the verbose logging.

Test: manual tests
Change-Id: Ia685d15b6cce1e828766c63b08c477d1d7c114fd
allLogProvider.java
oicemailContentProvider.java
7fee0934416ba2d240a3ff4d43419ba415337a85 01-Mar-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Shutdown worker thread when not needed"
607e7e3208b8b40633b3e2c1990cf8af2e7bf174 01-Mar-2017 Makoto Onuki <omakoto@google.com> Shutdown worker thread when not needed

We need to add a couple more handle threads. Before doing so,
let's make sure we don't keep worker threads forever.

Bug 35388445
Test: adb shell am instrument -e class com.android.providers.contacts.ContactsTaskSchedulerTest -w com.android.providers.contacts.tests

Change-Id: I5806e9932ee9141b6a3cf14b457d9b9b785df43c
allLogProvider.java
ontactsProvider2.java
ontactsTaskScheduler.java
beeee64617684297013c023ece2eb2d5e8f94376 25-Feb-2017 Makoto Onuki <omakoto@google.com> Sanity check against contact-id = 0

Test: adb shell am instrument -w com.android.providers.contacts.tests

Bug 35756516

Change-Id: I3627fab41781b9d547f69320ff2519708d81135b
ggregation/AbstractContactAggregator.java
343f231980f4f4035b18e0402cb07d3523de0db4 22-Feb-2017 Makoto Onuki <omakoto@google.com> Some cleanup for CP2

- Get ContactDirectoryManager's debug flag from sys prop.
- Introduce a debug sys prop to all scan directories.
- Some clean up for voicemail provider too
ContentProvider.getCallingPackage() didn't used to exist, so it has
custom code for that. Now we can just use getCallingPackage().

Test: adb shell am instrument -w com.android.providers.contacts.tests
Change-Id: Ic16d598251f4bc0bb84b0b71dac2366f195425fe
ontactDirectoryManager.java
oicemailContentProvider.java
16b994f6256a10916b1a125f76a9feb1ba02df2d 13-Feb-2017 Fyodor Kupolov <fkupolov@google.com> Send explicit broadcast to settings on profile update

As of O, android.provider.Contacts.PROFILE_CHANGED is no longer delivered
to manifest receivers.

Test: manual - create new user and set it up
Bug: 35272094
Change-Id: Ib25b675e89e628f7a9aa26ef13d311394ebaccfd
rofileProvider.java
63bb78af06e34968cd2ee33775589bc4df4bd195 30-Jan-2017 Makoto Onuki <omakoto@google.com> Revive CONTACTS_DATABASE_CREATED, and...

Remove STATUS_CHANGE_NOTIFICATION_CONTENT_URI.

Bug 33390320
Test: adb shell am instrument -w -e size small com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size medium com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size large com.android.providers.contacts.tests
Test: cts-tradefed run cts --skip-device-info --skip-preconditions --skip-system-status-check com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a -m CtsContactsProviderWipe

Change-Id: I10052a0682cb4bde0d94f6a22c50d0cff3a253fe
ontactsDatabaseHelper.java
83325beb00ac157d31edc68d9a61d68c92fa43b7 20-Jan-2017 Ta-wei Yen <twyen@google.com> Add voicemail backup/restore columns am: 27bedb2f41
am: 3a4795d738

Change-Id: I921f574f89dc5a72cf0d18a05e20a75568909655
3a4795d7387bd31be50f5adf04b694fb4b00b0ca 20-Jan-2017 Ta-wei Yen <twyen@google.com> Add voicemail backup/restore columns
am: 27bedb2f41

Change-Id: I54730a8379b0aa85b8a1fd9f5b913b4bc656377a
27bedb2f415f7bf33f351c6b2575a0087577c077 20-Jan-2017 Ta-wei Yen <twyen@google.com> Add voicemail backup/restore columns

BACKED_UP and RESTORED are required for dialer voicemail backup/restore
feature for N MR2. As there are no API bump the fields will be hidden
in NMR2. These fields will be made public in O.

ARCHIVED and IS_OMTP_VOICEMAIL is not used for NMR2, but added in
advance to avoid multiple database upgrades.

Test: VoicemailProviderTest
Bug: 34463609
Change-Id: I95ef21950337ca1f8bc79cc0493f7c302ec05617
allLogDatabaseHelper.java
oicemailContentTable.java
9765ceb8b0852d054cac7a12b219b216a535c9b9 18-Jan-2017 Makoto Onuki <omakoto@google.com> Merge "Add ProviderStatus.DATABASE_CREATION_TIMESTAMP"
5358da6ad10305f9359373ec3cc876a09d8d4e92 12-Jan-2017 Makoto Onuki <omakoto@google.com> Add ProviderStatus.DATABASE_CREATION_TIMESTAMP

Also stop sending CONTACTS_DATABASE_CREATED

Test: adb shell am instrument -w -e size small com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size medium com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size large com.android.providers.contacts.tests

Bug 33390320

Change-Id: I135fc66aee70d31d0547aa3e8bbcbf3f7ccf514f
ontactsDatabaseHelper.java
ontactsProvider2.java
rofileDatabaseHelper.java
51b15e88e873d21f1683db021b0ee72059c02126 17-Jan-2017 Ta-wei Yen <twyen@google.com> Prevent LAST_MODIFIED from changing after deletion am: 687bef960a
am: 79733da1e9

Change-Id: I6678fcd89d52a1cd46ace7b6d97b2e24d4b06c96
812dcc20c82958e2641e4e0e9173108ce412b4a0 11-Jan-2017 Tingting Wang <tingtingw@google.com> Set metadata_dirty Not dirty when there's metadata change.

Also notifyChange to ContactsContract.AUTHORITY when there 's normal
change or metadata change.

BUG 34159109
Test: Manual - Made metadata change when metadata_sync is disabled/enabled.
Test: adb shell am instrument -w -e size small com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size medium com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size large com.android.providers.contacts.tests

Change-Id: I9e06920f7fb1d2fb024723ec38d6e0683e046577
ontactsProvider2.java
a1f5c57819937d4e9302e0db68211de377f89cc3 15-Dec-2016 Makoto Onuki <omakoto@google.com> Fix unit tests

(Note this contains MR2 failure, Ica46934c too.)

Bug 33589515

Test: adb shell am instrument -w -e size small com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size medium com.android.providers.contacts.tests
Test: adb shell am instrument -w -e size large com.android.providers.contacts.tests
Change-Id: I67af719f60796e3753e67dfd743278953daa2c10
ontactsProvider2.java
5f4bb46edec0c016413eeccf0733147dae58837e 15-Nov-2016 Suprabh Shukla <suprabh@google.com> Using correct variable

Wrong variable for name was being used in the toString() of
SearchIndexManager.IndexBuilder

Bug: 25363717
Change-Id: Ief811312c8e953f44ad1430f76107b49137f123a
earchIndexManager.java
9203f686cce0340248c52cbb7344820de017b7d1 08-Nov-2016 Suprabh Shukla <suprabh@google.com> Adding null checks to PackageIntentReceiver in contacts provider

An explicit broadcast with null values was resulting in
android.process.acore crashing due to NPE.

Test: Manual - running shell command 'adb shell am broadcast -n
com.android.providers.contacts/.PackageIntentReceiver' no longer crashes
android.process.acore

Bug: 32071885
Change-Id: I9fdf5bbf1abe8056af37b8588f81f332c209b7fa
ackageIntentReceiver.java
687bef960a8309410ee1ba0da06a012914bef88e 08-Nov-2016 Ta-wei Yen <twyen@google.com> Prevent LAST_MODIFIED from changing after deletion

Previously LAST_MODIFIED is updated every time any modification is done
to a row, even if it is marked as deleted. A deleted row should not
be changed other then undeleting it, but it is hard to enforce this
on existing clients. Instead, LAST_MODIFIED will freeze at the moment
it was deleted.

In this CL, before the values are updated a separate query will update
LAST_MODIFIED for all rows that will be affected, unless it is already
marked as deleted. If a update will unmark the rows as deleted, a rows
will have its' LAST_MODIFIED updated.

Fixes: 31975372
Test: runtest contactsprov
Note: In the current master most of the contacts provider tests are
broken due to UserManager changed to use getApplicationContext()
on its' constructor, which is not mocked by the test context.
This CL is tested with the change reverted.

Change-Id: I7ce1e98fa14932c50e84bb9ef6b2549e93faddc4
allLogProvider.java
bModifierWithNotification.java
de560120994ec0ce00f82e9af78ed53bd9e4f08b 22-Oct-2016 Makoto Onuki <omakoto@google.com> Add more tests

Test: ./run-all-tests.sh

Change-Id: Ib7db8e429a6da41363cfdb430e8ab3b0cda408dd
ontactsDatabaseHelper.java
ontactsProvider2.java
355b24b56cc6cad20cf028c8339ce09045313407 18-Oct-2016 Makoto Onuki <omakoto@google.com> Follow-up to Ief2b93ce and more tests

Bug 31753890

Test: CTS, ./run-all-tests.sh

cts-tradefed run cts-dev --skip-device-info --skip-preconditions \
--skip-system-status-check \
com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker \
-a armeabi-v7a -m CtsProviderTestCases

Change-Id: I9f60647ac1d7214f82a2ea59ece5649e5bf26463
ontactsProvider2.java
633530760cb2110489598352ab831563e7b8f2cf 17-Oct-2016 Makoto Onuki <omakoto@google.com> Merge "Don't expose raw usage stats to clients; return "low-res" values."
bcb842628fa52eec2ff52cfa5e5c3690fa86bb0f 14-Oct-2016 Makoto Onuki <omakoto@google.com> Pass caller packager name to GAL provider, work profile case

Bug 32072962

Test: cts-tradefed run cts-dev --skip-device-info \
--skip-preconditions --skip-system-status-check \
com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker \
-a armeabi-v7a -m CtsDevicePolicyManagerTestCases \
-t 'com.android.cts.devicepolicy.ManagedProfileTest#testManagedContactsUris'

Change-Id: I855d16b1ff37d78bc5ec869c23fe31f61a684df5
ontactsProvider2.java
931012409e6a8995f928d644787d588008757c7f 12-Oct-2016 Makoto Onuki <omakoto@google.com> Pass client package name to GAL providers

Test: Manually tested with a corp account and verified with the log

Bug 32072962

Change-Id: Ib7af131ff3bb9d6f5f373c604d8748bc38ed12ad
ontactsProvider2.java
e2e9ac275e487ce558579ee65ff8f122cf498b07 06-Oct-2016 Makoto Onuki <omakoto@google.com> Don't expose raw usage stats to clients; return "low-res" values.

- "times_used" now return values after the following conversion:
value == 0 -> 0
value < 10 -> 1
10 <= value <= 19 -> 10
20 <= value <= 29 -> 20
:
:

- "last_time_used" now returns values in day granularity.

Test: run-all-tests.sh
Test: cts-tradefed run cts-dev --skip-device-info --skip-preconditions --skip-system-status-check \
com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker -a armeabi-v7a \
-m CtsProviderTestCases

Bug 31753890

Change-Id: Ief2b93ce7775bb6482c03ceb1ba0fd367d51eed8
ontactsDatabaseHelper.java
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
ggregation/AbstractContactAggregator.java
qlite/SqlChecker.java
d4ed51f955ec1f577bb6f7e61dc2c56f41183ddf 08-Oct-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Cleaned up upgrade steps for versions older than JB"
6b0a72bfa83bfd3adb3969fa939de8a9a145aeeb 05-Oct-2016 Suprabh Shukla <suprabh@google.com> Cleaned up upgrade steps for versions older than JB

Removed all upgrade steps from before jellybean. On any older version of
android, the database will upgrade to the current version by simply
dropping all the tables and calling onCreate.

Test: Manually tested by upgrading a version 621 database taken from an
old ics device to the current version 1200 and comparing the schema with
a fresh 1200 version database. Both schemas match.

Bug: 31559016
Change-Id: I73876a3059cb6fd86024f8dc33e941c893d9b35e
ontactsDatabaseHelper.java
fd4b8de05ffcd78e65f27763eade96f186c368b6 06-Oct-2016 Makoto Onuki <omakoto@google.com> Support making a "snapshot" of databases during tests.

- We normally use in-memory DBs in unit tests because that's faster.
Add a flag to switch to file-based DBs so we can copy them.

- Also cleaned up the getDatabaseHelper() methods -- we had two,
one with no arguments and the other without, and it wasn't clear
which ones should be used when. Now the one that takes a context
is renamed to make it clear the distinction.

Test: run-all-tests.sh with and without the flag set.

Change-Id: I376674a94e35a3314d91813debbeee5b3814f4a9
bstractContactsProvider.java
ontactsDatabaseHelper.java
ontactsProvider2.java
rofileDatabaseHelper.java
rofileProvider.java
68c0db255a381d0fdf4ef613f4ac0429ee14a829 30-Sep-2016 Makoto Onuki <omakoto@google.com> Add secondary tests that run on separate process

- Test all URIs that are supported, and make sure they can be queried.

- Removed the URLs that were actually not implemented.

- Fix a bug in ProfileAwareUriMatcher

Test: run-all-tests.sh

Change-Id: I5a898ac44b3a7b22b404f764ae40f00f16d44340
egacyApiSupport.java
rofileAwareUriMatcher.java
4658e9872de6d0b8d0dbdead10edad639f0125f7 28-Sep-2016 Suprabh Shukla <suprabh@google.com> Enabling WAL

Enabled write ahead logging and made transactions non-exclusive so they
do not block threads that are trying to read from the database

Test: We use in-memory databases for testing, which means we cannot use
WAL there. To verify that WAL is indeed enabled, manually check that
the following log appears in the logcat, when opening the database:
ContactsDatabaseHelper: WAL enabled for contacts2.db: true

Bug: 30830389
Bug: 31600627
Change-Id: I47f452b837c823fd33e85aa799d0ca60ed970d73
ontactMetadataProvider.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ontactsTransaction.java
3ef6a5aaa0e822a3862a252c4ee4b32153bd157b 29-Sep-2016 Makoto Onuki <omakoto@google.com> Merge "Report invalid SQL with non-crashing 'wtf' rather than crash"
79e61b15a11698197da4bb78cd1be469a38b9c35 28-Sep-2016 Makoto Onuki <omakoto@google.com> Report invalid SQL with non-crashing 'wtf' rather than crash

- Also allow the use of "default_directory".

Test: unit tests
Bug 31801512

Change-Id: I9261c6e71fdd96449c98ef62084cfe0b21419f9a
ontactsDatabaseHelper.java
ontactsProvider2.java
rofileDatabaseHelper.java
qlite/DatabaseAnalyzer.java
c0774967193892aa2cd84bdc6bcd13168f2a02d0 28-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Removing mimetype and package cache"
9d70f53e0d2eda1356af27b2a083c96257ff872e 20-Sep-2016 Makoto Onuki <omakoto@google.com> SQL token checker to detect uses of hidden tables/columns

- Detect invalid SQL code (e.g. contains a semi-colon)
in not only WHERE for query() but in other places too.

- Disallow use of the word "select" and table/view names
in the supplied code to prevent subqueries.

- This mechanism will be used to hide columns in the futire too.

Test: adb shell am instrument -w com.android.providers.contacts.tests

Bug 31559073

Change-Id: Ib4293b4caf7e341186ee8bd4cc2d7dad7155c48d
ontactsDatabaseHelper.java
ontactsProvider2.java
qlite/DatabaseAnalyzer.java
qlite/SqlChecker.java
a2286cca9eb5e5e31a2803345438145b3f0641d1 20-Sep-2016 Suprabh Shukla <suprabh@google.com> Removing mimetype and package cache

We need to remove caches since after enabling WAL, we will have writers
work in non-exclusive transactions (b/31600627) which might lead to
readers reading uncommitted values if the cache is updated and the
transaction fails.
Test: Added a test testGetCommonMimeTypeIds to test the prepopulated
cache for common mimetypes added in this change. Verified that existing
tests in ContactsProvider2Test and ContactsDatabaseHelperTest pass.

Bug: 31599660
Change-Id: I804ae9e952029a7f1b702347f866cb5e5d951f3e
ontactsDatabaseHelper.java
ontactsProvider2.java
d1b4bef03452af250ca3930cbfb2a52ad0ab0ab4 20-Sep-2016 Suprabh Shukla <suprabh@google.com> Merge "Moving presence tables to the contacts db"
38e9dedbabfcc39c904cbc02672185b709f079c3 15-Sep-2016 Sandy Roberts <sandyroberts@google.com> Remove unneeded import ActivityManagerNative

Change-Id: I8bf4ce8a4fbc1735f23b932a66355ccfe2a1d952
ontactsUpgradeReceiver.java
5bd50638dcbef7a6d565698aecb9a2b451055168 10-Sep-2016 Suprabh Shukla <suprabh@google.com> Moving presence tables to the contacts db

Presence tables were stored in a separate in-memory database. Moving
them to the main persistent database so we can enable WAL.

Bug: 28599963
Change-Id: I9475dab06230726ae7c7d7bde7ed9d69104ca448
ontactsDatabaseHelper.java
8cb2f5576ade8d0a5d7750b239d800400cfbe79b 13-Sep-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "Adding column display_name_alt to phone_lookup"
e6bd43bb42dfbef18d4f7b57375d5a71214d03ae 07-Sep-2016 Suprabh Shukla <suprabh@google.com> Adding column display_name_alt to phone_lookup

Clients like Dialer have to run a separate query just to
get display name alternative. Adding it to the phone lookup projection
columns.

Bug: 25022549
Change-Id: Ic3d08d096c0b909f7a9a6cb9bd2c137fa4df1191
ontactsProvider2.java
172b2adb776cb107cd5dbd09eca96e26351d408c 09-Sep-2016 Chris Smith <cjs@google.com> Merge "Make DbQueryUtils.escapeLikeValue() escape escape chars."
d129874069194e8a9f4bfee55e951ae3b650a315 08-Sep-2016 Makoto Onuki <omakoto@google.com> Fix the labeling issue when mixing Japanese/Trad-Chinese. am: 4b0653168f am: a2788d48d9
am: 2780e3c60b

Change-Id: I1f8c79d54a7634a7351de51d66c5a3e391201f7f
e9e0f18594b4e346dede853073cf7488ee8d86ee 08-Sep-2016 Chris Smith <cjs@google.com> Make DbQueryUtils.escapeLikeValue() escape escape chars.

If the escape char we choose is present in the value it
also needs to be escaped for it to be treated literally.

From the SQLite docs:

The escape character followed by a percent symbol (%),
underscore (_), or a second instance of the escape
character itself matches a literal percent symbol,
underscore, or a single escape character, respectively.

Change-Id: Id3e401576ced26b69fe9f06d8f462733faad330e
til/DbQueryUtils.java
4b0653168fa54d3744585c031e609330cd15d2f1 07-Sep-2016 Makoto Onuki <omakoto@google.com> Fix the labeling issue when mixing Japanese/Trad-Chinese.

When JapaneseContactUtils is used, stroke counts shouldn't
be used.

Bug 31115382

Change-Id: If5ed2efb04fbd9d5b945544ba8fa113d658a3fd0
ontactLocaleUtils.java
ocaleSet.java
0220fa1c7b231796c250af2d9dd5750ae84771f6 06-Sep-2016 Makoto Onuki <omakoto@google.com> Fix thread leaks in unit tests

Now all the tests can be run with a single command:
$ adb shell am instrument -w com.android.providers.contacts.tests

Bug 26253504

Change-Id: I46bc7c54e4812e6171fb2078f21c1460b4734c96
allLogProvider.java
ontactsProvider2.java
ebe1a7cf6379f8fa193b4aaf1e3efc519d7d37d3 31-Aug-2016 Makoto Onuki <omakoto@google.com> Fix multi-locale issues am: 2ee1d54fa1 am: f9aa1ae196
am: 9c0e061072

Change-Id: I684a50f261922138062fc080db66354f17c440fc
2ee1d54fa1e22b2c88897c1a60e7f642a81f9562 29-Aug-2016 Makoto Onuki <omakoto@google.com> Fix multi-locale issues

- Don't ignore LOCALE_CHANGED sent when CP2 is already updating
locales.

- Don't add multiple Chinese locales.

- Don't add any Chinese locales after Japanese.

- Also fix the flakiness in the test.

Bug 31115382

Change-Id: Ib17d08f7947cb02aa7052d8ed6b67690361c47bf
ontactLocaleUtils.java
ontactsProvider2.java
ocaleSet.java
93c1fdd1bf2fe8ac716c7fcd03eaac560122da46 25-Aug-2016 Suprabh Shukla <suprabh@google.com> Removing pre-compiled sql statements

SQLiteStatements are not thread safe so sharing statements between
threads without any synchronization can result in a crash. Removing them
since the speed optimization obtained by using these precompiled
statements is also not significant

Bug: 6119226
Change-Id: If8b19d2b7758ab942e750c5a6e4df107c48074b4
ontactsDatabaseHelper.java
a0722de4886cdc06acf344052b70954415d25d80 13-Aug-2016 Ta-wei Yen <twyen@google.com> Mark voicemail as not new if it is updated as read

The voicemail notifications are tracking new voicemails. Once the
voicemail is set as read on the server it should no longer be treated
as new.

ACTION_NEW_VOICEMAIL will also be broadcasted when this event happens

+ Raise performance logging of VoicemailContentProvider.onCreate to
INFO as it should be related to b/29837276

Change-Id: Ic57bcbc6e8c0e61e1fe741ac1518bd5c6535fd7f
Fixes: 30105817
Bug: 29837276
allLogProvider.java
atabaseModifier.java
bModifierWithNotification.java
oicemailContentProvider.java
oicemailContentTable.java
oicemailStatusTable.java
579bcb61285c36b31668cfffc1931afaeb12f12e 09-Aug-2016 Ta-wei Yen <twyen@google.com> Allow the phone account to be queried for voicemail status

The column PHONE_ACCOUNT_COMPONENT_NAME and PHONE_ACCOUNT_ID is in
VoicemailContract.Status, but it was not added to the
VoicemailStatusTable projection so it was not queryable.

Bug: 30709089
Change-Id: I2551fc0821cf313fc066cd9014e52c73afdfc7bc
oicemailStatusTable.java
00fc3f9350bab201a3fd5659422c0ba85bf7d7ef 12-Jul-2016 Ta-wei Yen <twyen@google.com> Fix cursor leaking when inserting voicemail status.

Change-Id: If3679eb678e88d535fb474d625dccae20c205d0b
Fixes: 30101310
oicemailStatusTable.java
21c692d49ce7ad6f9414d46ac2410d3f2e4c4d20 25-May-2016 Ta-wei Yen <twyen@google.com> Add SOURCE_TYPE field to VoicemailStatus table

+ Bump callog database version to 3

Bug:26944391
Change-Id: Ie4d7e67658247445c45f9f413902eda205bf2541
allLogDatabaseHelper.java
oicemailStatusTable.java
a156e670c44e4178821650b7f488b429405757a1 18-May-2016 Seigo Nonaka <nona@google.com> Fix build break.

The LocaleList location is changed from android.util to android.os by
Ia8de2ee9df3dd0a42b1fe84574439519b680fe18

Bug: 28819696
Change-Id: I8fb59f6d2b3ca4294fec93d809608a3685d6b34e
ontactLocaleUtils.java
ocaleSet.java
3f2a995bfc639b1b7295e98cd129f46c0d692ddc 13-May-2016 Makoto Onuki <omakoto@google.com> Merge "Disable strict mode check on shared preferences to avoid logspam" into nyc-dev
b9082df14ae712c27d4fe663710e51cc7ae590db 12-May-2016 Tingting Wang <tingtingw@google.com> Merge "Use CONTACT_METADATA_SYNC_ENABLED." into nyc-dev
58328ea632c606828c73a2634a2e55dc8960348b 11-May-2016 Makoto Onuki <omakoto@google.com> Disable strict mode check on shared preferences to avoid logspam

Bug 28417330

Change-Id: I9dd1df3e30aeb98d5075a9d249cd799ad5dd95fb
astScrollingIndexCache.java
a49f8a4df4a805a7ac0034e587e1d1ebcc87e685 11-May-2016 Tingting Wang <tingtingw@google.com> Use CONTACT_METADATA_SYNC_ENABLED.

BUG 28295805

Change-Id: I115d95c47a5b5f48d9b34dcf09ea9028a870b073
ontactsProvider2.java
a27f51a4850ae800fde5952a658f4882bd5a550b 10-May-2016 Tony Mak <tonymak@google.com> Add test for EnterpriseGuard to test against the newly added user setting

Added test for user setting is off. We restore the setting when the test
finishes.

Bug: 28583241

Change-Id: Ifdc72b27b21f6884787bcb37fac4ec56a2bb49ce
nterprise/EnterprisePolicyGuard.java
a9d2c06a03a653954629ff10070ebbe4ea87d526 06-May-2016 Tony Mak <tonymak@google.com> Fix enterprise contacts APIs naming and docs

Bug: 28295752
Change-Id: I36c4328766d8edf0b3f6c5644443794c3a824c3b
ontactsProvider2.java
nterprise/EnterpriseContactsCursorWrapper.java
nterprise/EnterprisePolicyGuard.java
40bd9994e10f85c2c4acf2647f042b8a72dcdcef 04-May-2016 Tony Mak <tonymak@google.com> Merge "Honor the user setting MANAGED_PROFILE_CONTACT_REMOTE_SEARCH" into nyc-dev
13c52d12c2af39d7782e5fd75702d5a42b594b6f 29-Apr-2016 Ricky Wai <rickywai@google.com> Move cp2.scanPackagesByUid() to worker thread

So now cp2.scanPackagesByUid() and scanAllPackages will not
run in parallel.

Bug: 28334569
Change-Id: Ie36feb54b13ae80b9cceb4c6dc69365c67db345d
ontactDirectoryManager.java
ontactsProvider2.java
bafc0ea98ff3fb11d2deec4328abe822474fcd45 26-Apr-2016 Tony Mak <tonymak@google.com> Honor the user setting MANAGED_PROFILE_CONTACT_REMOTE_SEARCH

Bug: 28281560
Change-Id: Ieb3723a9f681fc6be5bafd132e50f646f80a8e13
nterprise/EnterprisePolicyGuard.java
814cc51f8f2add0f3f579d35cb2694f9fb8cfaf1 21-Apr-2016 Victor Chang <vichang@google.com> Merge "Fix PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI API" into nyc-dev
c9613fe3972909f3bffb2b235536281bd21bc093 20-Apr-2016 Victor Chang <vichang@google.com> Fix PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI API

PHOTO_URI can contain 3 types of uris.
ContactsContract.DisplayPhoto.CONTENT_URI (display_photo/#) case was missed.
It happens when PHOTO_FILE_ID is not null.

Added unit test

Bug: 28240255
Change-Id: Ib89de2db4eb7e9cc0b837569b8aa51553aa111fb
nterprise/EnterpriseContactsCursorWrapper.java
6bfd56ca40fe795ee330bb1a25a9edef06e40ae3 20-Apr-2016 Walter Jang <wjang@google.com> Revert using Urdu instead of Arabic in default label locales

Bug 28241432

Change-Id: I10f6376b34eb61901bbcca780431ec3ece8a9452
ontactLocaleUtils.java
c8ad9ce59d7ca2c10f4652ee3a0ef4e5d003f767 22-Mar-2016 Brad Ebinger <breadley@google.com> Add VIA number column to CallLog Database

Add a column to the CallLog Database that records the secondary line
number that an incoming call has been received on. More specifically, a
call is assumed to be considered a "VIA number" if the call's incoming
line number does not match the number registered with the SIM card.

BUG: 25594198
Change-Id: I7d9bbcbbcfffd20f75b8d5b1fecc292722028d45
allLogDatabaseHelper.java
allLogProvider.java
6364dc89b6c90dab11997bd360a1e80d9bf282ca 17-Mar-2016 Jeff Sharkey <jsharkey@android.com> Follow framework refactoring.

Bug: 27531029
Change-Id: Ib2339aad1d4266e3cfbe49eb2f469740272a09bb
allLogDatabaseHelper.java
4d089e6ae79b011abbd6495b5181674d91561188 15-Mar-2016 Makoto Onuki <omakoto@google.com> Fix flakey vcard test

When the test fails, I see an error from MemoryFile, which is used
in ParcelFileDescriptor.fromData(). However the thing is this
method is deprecated -- so I rewrote it to use a pipe instead.

Bug 27335482

Change-Id: Ib75d9e93ac2610d3145889fe269abeec3d7c3dee
ontactsProvider2.java
63b0203a07ea9f8b61834ea6dec66562b961f410 08-Mar-2016 Tony Mak <tonymak@google.com> Merge "Update error msg when corp lookup key is not supported" into nyc-dev
5e854ef150a090cd0e77f2b9ebf4ef8609ac6135 08-Mar-2016 Tony Mak <tonymak@google.com> Update error msg when corp lookup key is not supported

Bug: 27146678
Change-Id: I3f0dfadde30d3fc30a914498580cc0febfbc0b36
ontactLookupKey.java
dc573da99e53cfbade8bdd2df844b1dbde796983 01-Mar-2016 Ricky Wai <rickywai@google.com> Merge "Fix contacts vcard cannot be shared in other profiles" into nyc-dev
03d89375880bd5693026cf2dcacc1810629cbc90 01-Mar-2016 Tony Mak <tonymak@google.com> Merge "We should allow cross-profile PHONES and RAW_CONTACT_ENTITIES's uri" into nyc-dev
32df9b1bf75f441607c63a5df2b7b569592407f7 29-Feb-2016 Tony Mak <tonymak@google.com> We should allow cross-profile PHONES and RAW_CONTACT_ENTITIES's uri

These uris are used by bluetooth.

Bug: 27375721
Change-Id: I15f24fb4f11e022e5243717914d25b78e9f34a8f
nterprise/EnterprisePolicyGuard.java
74fc057898957137fd72802a3bd753315df36b89 24-Feb-2016 Victor Chang <vichang@google.com> Merge "Make sure photo_uri rewrite logic doesn't cause FileNotFoundException" into nyc-dev
9e1226825cdacdb15e1bc508dff66dd36b8f947e 23-Feb-2016 Victor Chang <vichang@google.com> Make sure photo_uri rewrite logic doesn't cause FileNotFoundException

Now it strictly follows the following logic
1. display photo uri -> display photo corp uri
2. photo uri -> photo corp uri
3. otherwise, return null

It should make sure if OEM returns something different in photo_uri field,
the original implementation may cause FileNotFoundException as CP2 rewrites it into photo uri/display photo uri
It's actually the OEM's job to fix EnterpriseContactsCursorWrapper if they return something different photo_uri field.

This CL is just to prevent such case to happen. There is nothing wrong with the existing code in CP2.
It's just in case OEM changes implementation of photo_uri in CP2.

Unit test is also added to make sure OEMs understand EnterpriseContactsCursorWrapper.

Bug:26483932
Change-Id: I62be24e9cd171a74d85504ee93be0bd96cf0e0a0
nterprise/EnterpriseContactsCursorWrapper.java
8609f2b0aa1de993bd8f5e0f65eee8f8d46d6664 23-Feb-2016 Tingting Wang <tingtingw@google.com> Notify focus sync adapter for contact metadata change.

Notify focus sync adapter and also mark its raw contact as dirty
if there is contact metadata change.
For metadata change, starred,pinned,send_to_voicemail,data usage,
aggregation is covered in this cl. For data primary info, it has
been processed in the old logic.

BUG 27301947

Change-Id: I5ffda518f345a6174b38cfacf7df7cf294cfaa04
ontactsProvider2.java
e3443220edd7afdba6e5c4259232ad2b253fa1c8 22-Feb-2016 Tingting Wang <tingtingw@google.com> Notify change for rawContact metadata change.

Also apply change to Contacts table if there is change in RawContacts
send_to_voicemail.

BUG 27295917
BUG 27296055

Change-Id: I2d85ea18ad1d341bcd2f576b21b405826265677c
ontactsProvider2.java
ggregation/AbstractContactAggregator.java
932a4eed2d8a5b58dc8335a826a9b156aa01e903 22-Feb-2016 Ricky Wai <rickywai@google.com> Fix contacts vcard cannot be shared in other profiles

Bug: 24970042
Change-Id: I394e5025a41f7e9892c4f1698c6da9296a59e6c8
nterprise/EnterprisePolicyGuard.java
b716ac69042174eb9b5a00d132a27e32b5693caa 17-Feb-2016 Tony Mak <tonymak@google.com> [CP2] Add new API PhoneLookup.CONTACT_ID

It is a mistake that we put contact id in PhoneLookup._ID.
But for SIP query, the contact id is put in Data.CONTACT_ID instead.
For backward-compability issue, we can't revert the change, but to
save developer from having logic like below, PhoneLookup.CONTACT_ID is
introduced.

if (sip) {
get contact id in Data.CONTACT_ID column
} else {
get contact id in PhoneLookup._ID column
}

So for sip query, we put contact id in PhoneLookup.CONTACT_ID.
For other phone lookup query, we put contact id in both PhoneLookup.ID
and PhoneLookup.CONTACT_ID.

BUG:27149017

Change-Id: I4155da29bbacdda0d43164b0ce11c7224a4eee67
ontactsProvider2.java
nterprise/EnterpriseContactsCursorWrapper.java
1be77f3307e29ec07b81882bfbcf5d6845e68501 17-Feb-2016 Tingting Wang <tingtingw@google.com> Add null check when parsing JSON for contact metadata.

BUG 27207444

Change-Id: Ibb1f9b08e729ef1e62205170b42f01d2be73ce34
etadataEntryParser.java
b44b5e621015cf5bf68cc2eec8ca6102af8739b3 10-Feb-2016 Tingting Wang <tingtingw@google.com> Fix wrong param when notifyChange to metadata sync.

BUG 27123286

Change-Id: I34e51619455f9d1cf5660a9ec21b8a734ed737c1
ontactsProvider2.java
b2609837fb18f8b4871ce76d81aab2806b1d8074 10-Feb-2016 Ricky Wai <rickywai@google.com> Merge "Fix failed enterprise unit tests in CP2" into nyc-dev
d2f3ed91e988e487ab4213c5c27659097d490c18 10-Feb-2016 Ricky Wai <rickywai@google.com> Fix failed enterprise unit tests in CP2

Changes:
- queryCorpContactsProvider will throw exception if
it receives non-cp2 query
- Resolved the conflicts between ag/861964 and ag/861953
so test cases will check empty cursor not null cursor
- Remove getCorpUserHandle(c) in tests as no code using it.
(Proguard will stripped out unused method in CP2 and cause test fails)

Bug: 27114665
Change-Id: I33e87ada0bc1b62174c9a0d9df8840ba3fa23a3c
ontactsProvider2.java
nterprise/EnterprisePolicyGuard.java
til/UserUtils.java
56bb2f6d67417270a6ef0cb1cbb24ae2c313c4be 09-Feb-2016 Makoto Onuki <omakoto@google.com> Only allow whitelisted app to access ContactMetadataProvider

Bug 26822055

Change-Id: I215bee01b1262ec269653161cd9e36cbe69d885e
ontactMetadataProvider.java
6fac54d637e6f9eaaa147cba7b534bb058be2654 09-Feb-2016 Tony Mak <tonymak@google.com> Merge "Clean up enterprise uri related code in CP2" into nyc-dev
6a4e1923005b12e8375c24775f8089a94a08a2e6 09-Feb-2016 Ricky Wai <rickywai@google.com> Merge "Centralize EnterprisePolicyGuard checking code in CP2." into nyc-dev
38c0331383a23d5de26f2fef26c39cade2b41e74 05-Feb-2016 Walter Jang <wjang@google.com> Put contacts with no name at the end of the alphabetic index

We do this by changing the default bucket from 0 to the extra
number bucket created to move presumed phone numbers to the
position after the alphabetic index.

Screenshots go/b21736630

Bug 21736630

Change-Id: I586cda9daa6cf215f991c5b94fb89a569c89daa8
ontactLocaleUtils.java
ontactsDatabaseHelper.java
fc59cc45836bc9c07afc9b44a622488106b706e6 08-Feb-2016 Tony Mak <tonymak@google.com> Clean up enterprise uri related code in CP2

1. Replace all (projection != null) ? projection : xxxDefault code
with createEmptyCursor

2. Merge CONTACTS_FILTER_ENTERPRISE uri handling code into
queryFilterEnterprise.

3. Remove function rewriteQueryParameters as it is only used in
CONTACTS_FILTER_ENTERPRISE code.

4. Merge queryPhoneLookupEnterprise and queryEmailsLookupEnterprise

5. Pull out function convertToLocalUri and add tests for it.

Bug:26978948
Bug:27061543

Change-Id: I2ed8eb88fdc53783622566dd37f79763014dca03
ontactsProvider2.java
6438a1b52b1e0fac58ddbb54b6a364c32c57f00b 04-Feb-2016 Ricky Wai <rickywai@google.com> Centralize EnterprisePolicyGuard checking code in CP2.

Also modifed enterprise policy guard checking code checking from primary CP2 to work CP2,
So all cross profile queries to CP2 will be checked in CP2's query().

Bug: 26558513

Change-Id: Ib1e212817c4fe398551c581e8b5b92c6cf510a55
ontactsProvider2.java
nterprise/EnterprisePolicyGuard.java
85914ae47ef3c9cf7068cdd570c6d07df5f6f24b 02-Feb-2016 Makoto Onuki <omakoto@google.com> Improve and clean up multi-locale support

Addressed comments on I4ff7e7d51

Bug 26142164

Change-Id: I0cb10d47375adfb8efffb1102adb3daa9043bbf1
ontactLocaleUtils.java
ocaleSet.java
5a9557efdbd30b9e3ea7bffea428cfa36de2518b 28-Jan-2016 Makoto Onuki <omakoto@google.com> Merge "Use LocaleList to support multi-locale to improve name "bucketing"."
107886e618f5af5dce9ea343cfa12ddc44c6ce17 27-Jan-2016 Ta-wei Yen <twyen@google.com> Merge "Implement UPSERT for VoicemailStatusTable#insert"
155ff44c5809da846b841011923b7e81dede303d 27-Jan-2016 Ta-wei Yen <twyen@google.com> Implement UPSERT for VoicemailStatusTable#insert

When putting data into the voicemail status table we used to have 2
separate database operations:
1) check if the index exists
2) insert into the database if not exist, or update if exists.
This is a potential race condition if 2 threads try to write at the
same time, pointed out in ag/838999

This CL solve it by changing the semantic of INSERT to "UPSERT",
"Update or insert", which is a single database operation of
"insert into the database if not exist, or update if exists"

SQLite does not directly support UPSERT, and doing so in a single
query is complicated. Instead insert, query, update, and delete in
VoicemailStatusTable is changed to be synchronized with a singleton, so there can only
be one thread doing a set of operations on the table at once.

Large traffic on VoicemailStatusTable is unlikely so the synchronization
cost is acceptable.

Bug:26451384
Change-Id: I6c03bd2720cbb05738cb3059fd19d65156244e20
oicemailStatusTable.java
2a237a4ade82ac8b3c3b9d6ce36cfb0fe6afe702 25-Jan-2016 Makoto Onuki <omakoto@google.com> Use LocaleList to support multi-locale to improve name "bucketing".

We used to keep the previous locale on the locale change event
and used it as the secondary locale, but now that the framework
officially supports "LocaleList", we switch to the new mechanism.

On the contacts app, this affects the name "buckets". Adding more
locales means you may get more buckets for the letters specific to
these locales.

- Now ContactLocaleUtilsTest doesn't check supported collators.
Turned out quite a few collators were considered missing (because now
they're tied to languages, not language-country pares?) and were
simply skipped. In the meantime, apparently the labels for some
languages have changed.

Bug 26142164

Change-Id: I4ff7e7d51d000adb6b996eb77da07af5cd44849f
ontactLocaleUtils.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ocaleSet.java
64ef027f6b8e4c78193969076a7d03f58d3d7db2 26-Jan-2016 Ricky Wai <rickywai@google.com> Handle null corp cursor result correctly

Bug: 26560753
Change-Id: I204602028b65f9f34ff8cc8db1ce958a6912fcaf
ontactsProvider2.java
7d8c2d4c22024478a36cc57b9288ca5e7b3fb7e6 22-Jan-2016 Victor Chang <vichang@google.com> Merge "Fix long lines (>100) in ContactsProvider"
f3dc1eddc0bc9f25f450465b5565aad7d84174a9 22-Jan-2016 Victor Chang <vichang@google.com> Fix long lines (>100) in ContactsProvider

Change-Id: I2d0f3a68863a390b98f64449a8338269c347c58a
ontactsProvider2.java
f0d1c9f87b8153b104b5f13133fe4e857c5673df 22-Jan-2016 Makoto Onuki <omakoto@google.com> Merge "[FBE] Introduce shadow calllog provider [2/2]"
f3bd980c0ec03db2538e86cadee2c1559f02c85b 12-Jan-2016 Makoto Onuki <omakoto@google.com> [FBE] Introduce shadow calllog provider [2/2]

Introduce a new provider that's a clone of the calllog provider but
is EA.

The provider is hidden and requires MANAGE_USERS to access, and responsible
for storing calllog entries that are inserted when the real provider is still
encrypted. When the real provider starts, it copies the entries from the shadow
as well as user-0's real provider, and clears the shadow.

Also fix b/26516259

Bug 26183949

Change-Id: If44b46709e2e7b1651b41c09d900e1cb2777dc56
allLogDatabaseHelper.java
allLogProvider.java
hadowCallLogProvider.java
cd2141bede514a5e222ef5a48f017c96395eb0d2 20-Jan-2016 Ricky Wai <rickywai@google.com> Make sure CP2 enterprise queries work when FBE is enabled

Bug: 26679081
Change-Id: Ib58c609d490f72f92dc680c3c8c71ccf3c06219f
ontactsProvider2.java
43d1d1a6e5d41aa2bce851ab89ddaa91036d2559 19-Jan-2016 Makoto Onuki <omakoto@google.com> Merge "Re-scan all directories only after OTAs."
09a3f70ebd97c739d01393f4b3748b0eaf548f02 16-Jan-2016 Makoto Onuki <omakoto@google.com> Re-scan all directories only after OTAs.

Currently CP2 scans all directory packages every time it starts,
which is a more or less slow operation.

With this change, we only do it only when after OTAs (when the OS
version changes).

Bug 26062101

Change-Id: Ifa3d6c29dacfa01572dfee31581d607f287390f9
ontactDirectoryManager.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ontactsUpgradeReceiver.java
6cbbe5bc1c00965f1e9c5648e94d1c82b113ef64 15-Jan-2016 Tony Mak <tonymak@google.com> Add directory support for EMAILS_LOOKUP_ENTERPRISE uri

Bug=26561677

Change-Id: I79c5d3dd204772bbe45010634b2dadaf4c8b4fd1
ontactsProvider2.java
1c720c47fdf502f527b05843ec9eca65289d5283 06-Jan-2016 Victor Chang <vichang@google.com> Show photo of enterprise directory contact in personal dialer

Implement the following uri conversion for enterprise directory photo uri
1. Personal CP2: content://com.android.contacts/directory_file_enterprise/content%3A%2F%2Fcom.google.contacts.gal.provider%2F<PATH>?directory=1000000003
2. Corp CP2: content://12@com.android.contacts/directory_file_enterprise/content%3A%2F%2Fcom.google.contacts.gal.provider%2F<PATH>?directory=3
3. GalProvider: content%3A%2F%2Fcom.google.contacts.gal.provider%2F<PATH>

BUG=25981851

Change-Id: I0e0ea19d589d54a39881f5ecc7d0257dde83ddde
ontactsProvider2.java
nterprise/EnterpriseContactsCursorWrapper.java
nterprise/EnterprisePolicyGuard.java
9be8c68e62112d607d0f31066df8c0b9c9587340 14-Jan-2016 Victor Chang <vichang@google.com> Merge "Create a new device policy for controlling work contacts search"
6040ab71df843cbb9562ded8b819bfff1c0d9838 05-Jan-2016 Victor Chang <vichang@google.com> Create a new device policy for controlling work contacts search

Extra things:
1. fixed b/26399207
2. ContactsActor.java is changed to avoid failed unit test
because of using getSystemService(serviceClass) in EnterprisePolicyGuard
3. Make ContactsProvider2.sUriMatcher and all uri codes public

BUG=25981902, 26399207

Change-Id: I0025b809a39ff31663a15cfbcdfd087a98187c44
ontactsProvider2.java
nterprise/EnterprisePolicyGuard.java
til/UserUtils.java
9dc4a04ae33e707ce6dd7a9af6b921e8b4db69ce 06-Jan-2016 Victor Chang <vichang@google.com> Fixed enterprise caller id photo not displayed in IncallUI

BUG=26420066

Change-Id: Ib135f7e35a699547b548a145f1ad16a89a72fae9
ontactsProvider2.java
9c3e7ad61675bcd13e8895fac60010544be0f6db 06-Jan-2016 Victor Chang <vichang@google.com> Show thumbnail photo in regular search in dialer

This CL fixes that regular search can't display photo

BUG=26082618

Change-Id: Iefd6ccd984e94f13797efd272b9cba15180909ba
ontactsProvider2.java
dc653a5c1bed274512ce41e4a6129a65d2b0eeac 22-Dec-2015 Makoto Onuki <omakoto@google.com> Move CallLog and VoiceMailStatus to their own DB.

- Move the "calls" and "voicemail_status" tables to the new
"calllog.db" database.

- Migrate all data into it.

- Remove the old tables in contacts2.db

- VoicemailContract.Status.SOURCE_PACKAGE is no longer UNIQUE

Bug 26247586

Change-Id: I003d49b8fb150c21a34830bc62e8c816ce2cd8cd
allLogDatabaseHelper.java
allLogProvider.java
ontactsDatabaseHelper.java
ontactsUpgradeReceiver.java
bModifierWithNotification.java
oicemailContentProvider.java
oicemailContentTable.java
oicemailStatusTable.java
til/PropertyUtils.java
2c3e6a13ddff52263271284fab9a13d4434110f3 08-Jan-2016 Zheng Fu <zhengfu@google.com> Merge "Respect join aggregation exceptions when breaking up an aggregation."
69699e64b6fec7b06489e64c79763c9b16ab4c7e 08-Jan-2016 Ta-wei Yen <twyen@google.com> Merge "Add BaseDatabaseHelperUpgradeTest and ContactsDatabaseHelperUpgradeTest"
0ef6fe74c10e27d2e1b602a81a52f9c4053fdb03 07-Jan-2016 Zheng Fu <zhengfu@google.com> Respect join aggregation exceptions when breaking up an aggregation.

Currently during aggregation, the candidate set will be broken up if
there is a separate aggregation exception. This change is to keep the
raw contacts with join exceptions aggregated in this case.

Bug:25086633
Change-Id: Iab79b844d8f0850a610a612a5bcf7c430372f95d
ggregation/ContactAggregator2.java
87a9fc205e3d8a61c5e53d1d281e27728b615e20 23-Dec-2015 Tingting Wang <tingtingw@google.com> Fix bugs on Lychee CP2 part.

1) If backup_id is updated (or created by sync adapter), re-notify
metadata network if there's dirty change before.
2) If backup_id is created by focus sync adapter and there's metadata
in metadata_sync table, merge them for the new backup_id.

BUG 26310045

Change-Id: I8af3e67564bd387b2417ceb6ccc353e51ff57dcd
ontactsProvider2.java
ransactionContext.java
87d2149d759d86b77def5fa5f6d55a92d96d5c26 23-Dec-2015 Ta-wei Yen <twyen@google.com> Add BaseDatabaseHelperUpgradeTest and ContactsDatabaseHelperUpgradeTest

Test database structure of create/upgrade of a DatabaseHelper
ContactsDatabaseHelperUpgradeTest only covers version newer than 1108.

Change-Id: I44092d77818c209d66c67bc02b1a66ec24cb668f
Signed-off-by: Ta-wei Yen <twyen@google.com>
ontactsDatabaseHelper.java
4d65991c43113b45a929ecd838e2dcf4322edefa 26-Nov-2015 Victor Chang <vichang@google.com> Fix phone_lookup_enterprise decodes phonenumber twice

BUG=25900607

Change-Id: Ib68bd7ab04bc9da0a9abcc846e3441326776574a
ontactsProvider2.java
e8cdd9c437177da67ec41e24bc81e3c2d0a3efb3 21-Dec-2015 Tingting Wang <tingtingw@google.com> Re-calculate hash_id for photo field.

In the old logic, we use data15 to compute the hash_id for a photo.
But data15 values are not the same for the original value and synced
value from the server, because there're some different compressing method
used in CP2 and focus sync adapter.
Because there's only one photo for each raw_contact, in the current cl
we only used photo mimetype to generate hash_id.

BUG 25955017

Change-Id: I0cdc8583f6f32ea2dab69de241ad2c6c05332319
ontactsDatabaseHelper.java
ataRowHandler.java
6a7519df9e4462bfc02f28f0b066280307541905 21-Dec-2015 Ta-wei Yen <twyen@google.com> Fix CallLogProviderTest

Test cases has not been updated for a while.

+ Check userHandle == USER_SYSTEM and isManagedProfile() instead of
isSameProfileGroup() in syncEntriesFromPrimaryUser().
+ Check LAST_MODIFIED for CRUD operation on Calls table.
+ Calls.ADD_FOR_ALL_USERS = 1 defaulted to getTestCallLogValues()

Change-Id: I19a10e5a26951dae69a1481f142d6c398b56e09a
allLogProvider.java
52cb1f8391fdf93ad90d675585a9c7e385e4a8d6 14-Dec-2015 Ta-wei Yen <twyen@google.com> Add QUOTA_OCCUPIED and QUOTA_TOTAL to VOICEMAIL_STATUS table.

Add LAST_MODIFIED to CALLS table.

+ Bump database version to 1109
+ Update LAST_MODIFIED when CALLS table is inserted/updated/
marked deleted.

Bug:22013880
Bug:25197644

Change-Id: I19512dd93179def0dafb386894acf09b0a49fb1b
allLogProvider.java
ontactsDatabaseHelper.java
bModifierWithNotification.java
oicemailContentTable.java
oicemailStatusTable.java
ef2742aca104b82d1de746327b0fbf188eb88ccf 14-Dec-2015 Tyler Gunn <tgunn@google.com> Fix ContactsProvider2 NumberFormatException when parsing directory ID.

This used to be: if (directory != null), so I presume this should still be
!TextUtils.isEmpty() with the new style.

Bug: 26175069
Change-Id: Ie81a157b2cdb78efc1dc839cec10544d9cd68e2b
ontactsProvider2.java
52f827cacd48607b1415272bf5ad949443589296 14-Dec-2015 Victor Chang <vichang@google.com> Merge "Fix trailing slash in ENTERPRISE_CONTENT_FILTER_URI"
9b1dfa16ae2478940beca65b69b445cc6697b250 09-Dec-2015 Ricky Wai <rickywai@google.com> Make enterprise uri can work with regular directory id

Bug: 25998131
Change-Id: I7db75eff1e2fd49ee5fdd5bc0ea5756a140749e8
ontactsProvider2.java
c903289fe6f11b6f8ef3d3a392a7f0d08576edc1 09-Dec-2015 Victor Chang <vichang@google.com> Fix trailing slash in ENTERPRISE_CONTENT_FILTER_URI

BUG=26097781

Change-Id: I5bcebed108eacb89e6529b0d1bd720066731c740
ontactsProvider2.java
96efe76f799d07b496a4601ab0e506c51cff4e99 08-Dec-2015 Tony Mak <tonymak@google.com> Implement Email.ENTERPRISE_CONTENT_FILTER_URI

Bug: 26074697

Change-Id: I433f10887d8261abd7904d14a4b5a7f77b88ac17
ontactsProvider2.java
355f770df05ca4160ab795e8eaefc1dc33519fee 08-Dec-2015 Tingting Wang <tingtingw@google.com> Update directories when initializing ContactsProvider. am: 59af846139
am: 6e8b2e3e5c

* commit '6e8b2e3e5c79013e44631a6f42594049abbba61f':
Update directories when initializing ContactsProvider.
fd0bf6fa8b4e701de5785a53b5981c62ad6fadab 30-Nov-2015 Victor Chang <vichang@google.com> Implement CALLABLES_FILTER_ENTERPRISE and PHONES_FILTER_ENTERPRISE in CP2

BUG=25899500

Change-Id: I8e468b00f51d98360fc4c1cb675d2f98549337d7
ontactsProvider2.java
793bfd7bc8fd222b880514d605891490f759dd04 07-Dec-2015 Ricky Wai <rickywai@google.com> Merge "Add CONTACTS_FILTER_ENTERPRISE in ContactsProvider"
6e8b2e3e5c79013e44631a6f42594049abbba61f 07-Dec-2015 Tingting Wang <tingtingw@google.com> Update directories when initializing ContactsProvider.
am: 59af846139

* commit '59af846139224607b667c61ee191bf363ef929ba':
Update directories when initializing ContactsProvider.
59af846139224607b667c61ee191bf363ef929ba 05-Dec-2015 Tingting Wang <tingtingw@google.com> Update directories when initializing ContactsProvider.

This is to fix a bug when reading exchange provider. Updating directories
can fix it without factory reset or account changed.

BUG 22398175

Change-Id: I36e05ff5f7bc83dc25ab165e5f5fb122bbe6c160
ontactsProvider2.java
b09db7c9924641f6263b0f5d01bae80be1c8cde4 04-Dec-2015 Ricky Wai <rickywai@google.com> Merge "Add Work Directory APIs in Contacts Provider"
d83fa00b08e7ddfa75b0d9361ab1dcb081b17b89 04-Dec-2015 Ricky Wai <rickywai@google.com> Add CONTACTS_FILTER_ENTERPRISE in ContactsProvider

TODO: Fix test cases after feature is completed
Bug: 25839367

Change-Id: If2f9a24f1edb6d27ab4421361e273b81e0cfc205
ontactsProvider2.java
7e854d0735da44c6610e489a5a67e793f2719027 09-Nov-2015 Ricky Wai <rickywai@google.com> Add Work Directory APIs in Contacts Provider

Also let Enterprise PhoneLookup API can query local or corp directory.

Bug: 25786494
Change-Id: I6a0acb83481c84aa1df5be94541778fb3e1bf261
ontactsProvider2.java
4abe55a6883557aa2e5e87433bb17341430f3fca 01-Dec-2015 Jay Shrauner <shrauner@google.com> Fix NPE in matchingNumberStartsWithStar

Check for null phoneNumber before dereferencing.

Bug:25941069
Change-Id: Ic30eeeac7e954db1898d05193a11f09d8595cad9
honeLookupWithStarPrefix.java
213ca91e286828417232694ee384386cb817c339 25-Nov-2015 Tony Mak <tonymak@google.com> Merge "Add field ADD_FOR_ALL_USERS in calllog table"
8bb52d886082c2c331bc513ce9f15c93ebf558cc 25-Nov-2015 Tony Mak <tonymak@google.com> Add field ADD_FOR_ALL_USERS in calllog table

We make use of this field to indicate a call should be copied from
primary user to all users or not.

Change-Id: I5f809656eb2bd581c1a080ca47635321839ae810
allLogProvider.java
ontactsDatabaseHelper.java
538413376d6608f1765e0913be72ff9c5c3c9891 25-Nov-2015 Makoto Onuki <omakoto@google.com> Show per-app CP2 usage in bugreport

Note we don't persist the numbers, so they're number since CP2
started.

Bug 24949200

Sample output:
Client activities:
UID Query Insert Update Delete Batch Insert Update Delete:
10010 2 0 0 0 0 0 0 0
10011 26 0 0 0 0 0 0 0
10048 185 3 3 0 9 1013 150 1
10057 37 0 0 0 0 0 0 0

Change-Id: Ia68ea8090cc569fb4483560944db126964875458
bstractContactsProvider.java
ontactsProvider2.java
rofileProvider.java
f45c0a2612c7cdf6ee29242e65a30476537cc699 24-Nov-2015 Makoto Onuki <omakoto@google.com> Show basic contacts stats in bugreport.

Bug 24949200

Example output:

PROVIDER ContentProviderRecord{5b986d5 u0 com.android.providers.contacts/.ContactsProvider2} pid=18434
Client:

Contact aggregator type: class com.android.providers.contacts.aggregation.ContactAggregator2

FastScrollingIndex stats:
request=0 miss=0 (0%) avg time=0ms

Contacts stats:
Database: Contacts
Accounts:
1 makoto.android.6@gmail.com com.google (null)
2 makoto.android.1@gmail.com com.google (null)
3 makoto.android.1@gmail.com com.google plus

Contacts:
# of visible: 2343
# of invisible: 3103
Max # of raw contacts: 3
Avg # of raw contacts: 1.001933612632936

Raw contacts (per account):
1 total # of raw contacts: 2018, max # per contact: 3, avg # per contact: 1.0009920634920635
2 total # of raw contacts: 1077, max # per contact: 2, avg # per contact: 1.0009293680297398
3 total # of raw contacts: 14, max # per contact: 1, avg # per contact: 1.0

Data (per account):
1 total # of data:15763, max # per raw contact: 15, avg # per raw contact: 7.811199207135778
2 total # of data:6887, max # per raw contact: 20, avg # per raw contact: 6.394614670380687
3 total # of data:95, max # per raw contact: 10, avg # per raw contact: 6.785714285714286

Database: Profile
Accounts:
1 makoto.android.1@gmail.com com.google plus

Contacts:
# of visible: 0
# of invisible: 1
Max # of raw contacts: 1
Avg # of raw contacts: 1.0

Raw contacts (per account):
1 total # of raw contacts: 1, max # per contact: 1, avg # per contact: 1.0

Data (per account):
1 total # of data:6, max # per raw contact: 6, avg # per raw contact: 6.0

Change-Id: Iae9f1f904b623a4f64684da99b825b2cb1127758
bstractContactsProvider.java
ontactsProvider2.java
rofileProvider.java
d3f3a7b4c4578a0494f54391215fd4e53e85a60c 28-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Merge "Clean up USER_OWNER in contacts provider"
ea7be853d5b68b05f44c7d937ce9498f3a0e6e34 26-Oct-2015 Hall Liu <hallliu@google.com> Fix typo in upgrading database version

(cherry picked from commit f09380c33acf83116c2f3becca7892a523ce6db0)

Change-Id: Ib3e94f7b51e5b0de2eff52278bb79628ea5445c1
ontactsDatabaseHelper.java
43f1b98c998a24c15879f9416ad8d7bceef765a1 26-Oct-2015 Hall Liu <hallliu@google.com> Add post_dial_digits column to calls table on creation

Bug: 25267178

(cherry picked from commit ab5dd2cb7e12fc59fc0ee747d7c08ae5e008eb1b)

Change-Id: I92f1fe7def98150290f283ebc2368f293100e917
ontactsDatabaseHelper.java
17f41872cac002cf4aa7d0e27ebfcc9d782c7873 15-Oct-2015 Hall Liu <hallliu@google.com> Add support for post dial digits to logs

Bug: 24955678
Change-Id: I4304146ceb446145faeeaf06641c8d8547607f79
allLogProvider.java
ontactsDatabaseHelper.java
6e9c8b7b8406f35dd3a1a2d6d163447d243933f6 14-Oct-2015 Xiaohui Chen <xiaohuic@google.com> Clean up USER_OWNER in contacts provider

Change-Id: I50c33778c5aac6f3d451e746430f2d649c471cd1
allLogProvider.java
d8a020c98d0f53acb0c10465848a9b6096f88739 14-Oct-2015 Santos Cordon <santoscordon@google.com> am a09cc1cf: am 1a0b0952: am 1da0bdf7: am b50aef55: Update calllogbackup\'s new package name.

* commit 'a09cc1cf5881701605867bc3b920dfc8b2d42b51':
Update calllogbackup's new package name.
a09cc1cf5881701605867bc3b920dfc8b2d42b51 14-Oct-2015 Santos Cordon <santoscordon@google.com> am 1a0b0952: am 1da0bdf7: am b50aef55: Update calllogbackup\'s new package name.

* commit '1a0b0952083186a1f5e7a9b48a96604d49056a97':
Update calllogbackup's new package name.
b50aef5535403ca212f5785529e4b2f1709fe107 13-Oct-2015 Santos Cordon <santoscordon@google.com> Update calllogbackup's new package name.

Bug: 24783945
Change-Id: I8e37520649abfff3f55652376456bc8ee561285a
bModifierWithNotification.java
7e04f2e7d77080bad5678c9c908ca91bb8c1a765 18-Sep-2015 Tingting Wang <tingtingw@google.com> Modify CP2 part to support new People backend API.

Aggregation type is changed to "AUTOMATIC" from "UNSET" in People
API proto. Change it in CP2 to support the new string.

BUG 24168448

Change-Id: I15d0fe612aab96fa565f91ecc9afa4a4db86a0b4
ontactsProvider2.java
4129ee36939c899a8f875fb9625a6b8f27163c6a 16-Sep-2015 Tingting Wang <tingtingw@google.com> Fix bugs on ContactMetadataProvider.

1) Modify update method to support insert sync state if it's
not existing.
2) If the account is not in CP2, do nothing when upserting metadata
sync and sync state, do not throw an exception.

BUG 24139392

Change-Id: I9edb8c63bf8b8793a1d479fe41d7cc9f0bed72eb
ontactMetadataProvider.java
84e6cadff1217f4fc066b68d764af5eb09ca1f33 14-Sep-2015 Tingting Wang <tingtingw@google.com> Fix bug when upgrading CP2 to generate hash_id column.

Remove selection "hash_id is null", because we will update this column
later, and the query result will be reduced after updating hash_id.
(Cursor will be refilled if a raw size is too large)

BUG 24061463

Change-Id: Ia70810b6521b5f6b3d2c7644d6bdc557445fc1b8
ontactsDatabaseHelper.java
6423c02762d2975d02a06ea5c7b4e2955a3a4bed 04-Sep-2015 Tingting Wang <tingtingw@google.com> Modify ContactMetadataProvider to support upsert.

To make Lychee sync adapter easy to upsert a metadata to
MetadataSync table, modify ContactMetadataProvider update and
insert methods to support upsert in insert() method.
That is, update it if inserting an existing raw, and do not
support update by calling update().

BUG 23795463

Change-Id: I4fdde36839a90b440f377ce15bd1ab51b9c6ce39
ontactMetadataProvider.java
ontactsDatabaseHelper.java
7087614bab5bb6bdd37293b2477c1bc9745f3a73 26-Aug-2015 Tingting Wang <tingtingw@google.com> Delete aggregation exceptions that are in CP2 not server.

When syncing down metadata from server to CP2 local tables,
if aggregation exceptions are in local but not in server side,
delete them from CP2.

BUG 23557858

Change-Id: Idc65ab9f8e2f04f60b0fbdc71b6a8e825aa09ff9
ontactsProvider2.java
95f9dd1f662efbc546bc1d126200235cf3a428a8 21-Aug-2015 Zheng Fu <zhengfu@google.com> Notify metadata change if a new raw contact is inserted by sync adapter.

Bug:23287952
Change-Id: I3a3b1f1e73aaf655c0d30a494473b1bebf71b3f3
ontactsProvider2.java
1757d8a3026ed77f213621c4adeee718049ac712 19-Aug-2015 Jay Shrauner <shrauner@google.com> am f3eb0748: Merge "Fix lookupkey encoding/decoding"

* commit 'f3eb0748aae1c42f5de2c4f848ef6196e6d297ae':
Fix lookupkey encoding/decoding
54852a92900a2031e00993ffde2376d6afb75873 19-Aug-2015 Tingting Wang <tingtingw@google.com> Merge "Update metadata tables when removing an account."
63ab7eb15ab99510ab3cd77e761dbca60662e787 18-Aug-2015 Tingting Wang <tingtingw@google.com> Update metadata tables when removing an account.

Delete rows from metadata_sync and metadata_sync_state tables
when removing an account from CP2.

BUG 23287168

Change-Id: I091995f77db6d44dc9793d8cb6cb4c6011a0f2ce
ontactsProvider2.java
5192ea69f0598d7f3a9954babdcd6825695c34c0 13-Aug-2015 Jay Shrauner <shrauner@google.com> Fix lookupkey encoding/decoding

Change ContactLookupKey.parse() to no longer decode the lookup key
and update the CP2 callers that were calling lookupContactIdByLookupKey
with encoded lookup keys to match the callers that were not.

Bug:23183735
Change-Id: I3803150a5ce83c2b40b042b5d0a6b7bfd45cfe5d
ontactLookupKey.java
ontactsProvider2.java
8a1ccb9a37d4ffed78209270d56d89543433574c 18-Aug-2015 Jay Shrauner <shrauner@google.com> Merge "Fix lookupkey encoding/decoding"
29dde64ebead6d59bf50d5af0d760df17c50ef55 17-Aug-2015 Tingting Wang <tingtingw@google.com> Revert "Modify metadata provider to support query other tables."

This reverts commit 20521ce66e4a90fe16a4e55368e60bffe264c525.

Change-Id: Ibcfaee186fdd37a69ee748a115ebef2867bce734
ontactMetadataProvider.java
6d6b2a5cd3d639bb0f878334b46720845ef92aa6 13-Aug-2015 Jay Shrauner <shrauner@google.com> Fix lookupkey encoding/decoding

Change ContactLookupKey.parse() to no longer decode the lookup key
and update the CP2 callers that were calling lookupContactIdByLookupKey
with encoded lookup keys to match the callers that were not.

Bug:23183735
Change-Id: I3803150a5ce83c2b40b042b5d0a6b7bfd45cfe5d
ontactLookupKey.java
ontactsProvider2.java
439e5f4848386eb775c512c23ab892115150d007 13-Aug-2015 Jay Shrauner <shrauner@google.com> Fix broken unit tests

Read/write social streams permissions were removed.

Bug:
Change-Id: I044f18e602d860e334005182d37fbc5734780707
ontactsProvider2.java
fe67080ab4be0077d5e2a636cc4f2070658a004d 12-Aug-2015 Zheng Fu <zhengfu@google.com> Add api to access metadata_sync_state table.

Bug:23038060
Change-Id: I921c3968f5d80ebc0a9bf3f6173987d3ab7db873
ontactMetadataProvider.java
768bb48979d176cf141cab927b22eedda40e4b2c 10-Aug-2015 Tingting Wang <tingtingw@google.com> Merge "Modify metadata provider to support query other tables."
20521ce66e4a90fe16a4e55368e60bffe264c525 08-Aug-2015 Tingting Wang <tingtingw@google.com> Modify metadata provider to support query other tables.

Metadata sync adapter needs to query raw contact, data, data usage
and aggregation exceptions tables to get metadata related info.

BUG 23041918

Change-Id: I387c7d592126ad5abc297863c99a5660e888a82c
ontactMetadataProvider.java
0a1138c5aecd4b88a56aaffb39d01451b835ea81 07-Aug-2015 Zheng Fu <zhengfu@google.com> Add metadata_sync_state table to facilitate contact metadata sync.

Bug:23038060
Change-Id: I92d13e60bb909c88af66b36a05856c534d3ac7be
ontactsDatabaseHelper.java
9031dd21c4877951407c0c61936c09efdbefb190 31-Jul-2015 Narayan Kamath <narayan@google.com> am 9c469cc3: am d08759a9: Merge "Use ICU4J transliterator directly."

* commit '9c469cc39d5b25ab30e8e090ad800b8c181ffbb5':
Use ICU4J transliterator directly.
9c469cc39d5b25ab30e8e090ad800b8c181ffbb5 31-Jul-2015 Narayan Kamath <narayan@google.com> am d08759a9: Merge "Use ICU4J transliterator directly."

* commit 'd08759a9810ad87dedfd9953cb24939e2ae6f278':
Use ICU4J transliterator directly.
abceb391e5fde7c9e3fe3988c7e91051fd1385d4 31-Jul-2015 Zheng Fu <zhengfu@google.com> am d94d4e4f: am fe1d054d: am 657beb09: am f40e1d68: am 63a78131: Don\'t show aggregation suggestions for contacts itself.

* commit 'd94d4e4fa26403be300df4a089fdee87353c5ba5':
Don't show aggregation suggestions for contacts itself.
d94d4e4fa26403be300df4a089fdee87353c5ba5 31-Jul-2015 Zheng Fu <zhengfu@google.com> am fe1d054d: am 657beb09: am f40e1d68: am 63a78131: Don\'t show aggregation suggestions for contacts itself.

* commit 'fe1d054db0d6222d89e395cbf6520ac8ff7fe496':
Don't show aggregation suggestions for contacts itself.
63a781313c71c966f9ca44a0cb3c13b477981f52 30-Jul-2015 Zheng Fu <zhengfu@google.com> Don't show aggregation suggestions for contacts itself.

Bug:22224442
Change-Id: I82a52daef157b0280329402a90fd9a8becd60034
ggregation/AbstractContactAggregator.java
599753c83f4d0b4acb7c07f493b1f2accd78778e 29-Jul-2015 Rayhaan Jaufeerally <rayhaan@google.com> Use ICU4J transliterator directly.

This change inlines the use of the ICU4J transliterator whose
wrapper class is being removed in the following change:
https://android-review.git.corp.google.com/#/c/162045/

Change-Id: Ie94032b7ac0effb9d8c0093e1ab443224cb62a56
ontactLocaleUtils.java
anziToPinyin.java
c635ef107047450f4dd5b633ffa5ccd085a83014 28-Jul-2015 Zheng Fu <zhengfu@google.com> am cbae3b0b: am fb4b2705: am 5a47ebdd: am ed6a10c2: am b049fb09: Default contact aggregator to ContactAggregator2.

* commit 'cbae3b0bb4b0889825ee1fafa3bf86fb16f33077':
Default contact aggregator to ContactAggregator2.
cbae3b0bb4b0889825ee1fafa3bf86fb16f33077 28-Jul-2015 Zheng Fu <zhengfu@google.com> am fb4b2705: am 5a47ebdd: am ed6a10c2: am b049fb09: Default contact aggregator to ContactAggregator2.

* commit 'fb4b2705725087d21ee8e1289ff52169c6c58b0a':
Default contact aggregator to ContactAggregator2.
b049fb09ba37aafc5c12dd93ebf15d219e6dc726 28-Jul-2015 Zheng Fu <zhengfu@google.com> Default contact aggregator to ContactAggregator2.

New aggregator has been tested via gservice flag.
Now we make it default regardless of the gservice flag.

Bug:22355413
Change-Id: Iff9464dfc7bdd6342eafecc22e052786edd37acd
ontactsProvider2.java
b4ea647c930f79b3dbc658e6b9309531ea90ab9c 24-Jul-2015 Narayan Kamath <narayan@google.com> am dd61f6e1: resolved conflicts for merge of beb0cff6 to mnc-dr-dev-plus-aosp

* commit 'dd61f6e14ffac3043ae59e426b12424bd66a9de9':
Switch to use ICU4J's Alphabetic Index.
dd61f6e14ffac3043ae59e426b12424bd66a9de9 24-Jul-2015 Narayan Kamath <narayan@google.com> resolved conflicts for merge of beb0cff6 to mnc-dr-dev-plus-aosp

Change-Id: Ie112762012deae2f130f8c268ad4efac67648418
6553bea6290dfbd9dfabd0a19ef97cc1d24fc9cb 23-Jul-2015 ccornelius <ccornelius@google.com> Switch to use ICU4J's Alphabetic Index.

Revise tests for expected ellipsis in overflow buckets and for
Ukrainian in English locale.

Change-Id: Ia61000de8f87b3c336f46818f886ba69d9c9f06e
ontactLocaleUtils.java
c392922d52e7a32463c117a25c52333feef3c701 18-Jul-2015 Zheng Fu <zhengfu@google.com> am 5ff0223b: am 82cb1d2d: am 4f1e51fe: am 8879cc75: am e5bd832d: Fix failing tests due to logic changes in the new aggregator.

* commit '5ff0223bd9b1ee8b32f53c7b42126200bbb0e27a':
Fix failing tests due to logic changes in the new aggregator.
5ff0223bd9b1ee8b32f53c7b42126200bbb0e27a 18-Jul-2015 Zheng Fu <zhengfu@google.com> am 82cb1d2d: am 4f1e51fe: am 8879cc75: am e5bd832d: Fix failing tests due to logic changes in the new aggregator.

* commit '82cb1d2d62841fc74ce6dfe4919780f45a52a3f4':
Fix failing tests due to logic changes in the new aggregator.
e5bd832dd7743f98fd816f7e6568f715015764bd 18-Jul-2015 Zheng Fu <zhengfu@google.com> Fix failing tests due to logic changes in the new aggregator.

1. All the raw contacts with same name and no data will group together,
so we need to assign different names in this test.
2. We don't have split step anymore, so there is no unpin operation.
3. Fix Long comparison in the aggregator.

Bug:22566083
Change-Id: I1a963bf17866e7569012e4cceca034e7c8312aa3
ggregation/AbstractContactAggregator.java
ggregation/ContactAggregator2.java
9cdb133fc4bfad7e56230fed11d083f12b5cf805 18-Jul-2015 Zheng Fu <zhengfu@google.com> am 6222aefa: am a266119d: am 72445532: am 0dc8027b: am f3d2981b: Should update aggregate data after marking raw contact deleted.

* commit '6222aefa60179ecc82be084703968496e0e1a233':
Should update aggregate data after marking raw contact deleted.
6222aefa60179ecc82be084703968496e0e1a233 18-Jul-2015 Zheng Fu <zhengfu@google.com> am a266119d: am 72445532: am 0dc8027b: am f3d2981b: Should update aggregate data after marking raw contact deleted.

* commit 'a266119d041fe28deb0c5364ad1cc2b3ec90d90b':
Should update aggregate data after marking raw contact deleted.
f3d2981b53b7d4715da1d35f5425b19766a92f8b 17-Jul-2015 Zheng Fu <zhengfu@google.com> Should update aggregate data after marking raw contact deleted.

Bug:22564056
Change-Id: Ic9ea29ee9fd72ff12a977565fba4f4e9be285b23
ontactsProvider2.java
57e9f37768d0e122ea042d1e1fd4c38a518a4378 16-Jul-2015 Zheng Fu <zhengfu@google.com> am 64bbd182: am ece8c3ec: am a99fa8a5: am 8a079b92: am 8d4e5229: Merge "Performance turning for aggregator 1. Move identification matching to secondary 2. In the first stage, do secondary matching only if there is no structured name 3. Aggregate all the raw contacts w

* commit '64bbd1829c4a143160e7e03fde0261aeadbd67d4':
Performance turning for aggregator 1. Move identification matching to secondary 2. In the first stage, do secondary matching only if there is no structured name 3. Aggregate all the raw contacts without structured name if they have matching secondary data 4. Remove approximate name matching in aggregator. (This will not impact the name variant, such as John and Johathan matching)
64bbd1829c4a143160e7e03fde0261aeadbd67d4 16-Jul-2015 Zheng Fu <zhengfu@google.com> am ece8c3ec: am a99fa8a5: am 8a079b92: am 8d4e5229: Merge "Performance turning for aggregator 1. Move identification matching to secondary 2. In the first stage, do secondary matching only if there is no structured name 3. Aggregate all the raw contacts without struct

* commit 'ece8c3ecfc258ec9e58c0c3b8b07339b051858b1':
Performance turning for aggregator 1. Move identification matching to secondary 2. In the first stage, do secondary matching only if there is no structured name 3. Aggregate all the raw contacts without structured name if they have matching secondary data 4. Remove approximate name matching in aggregator. (This will not impact the name variant, such as John and Johathan matching)
8d4e5229580e589cbdc6cc962024ffb830dfecae 16-Jul-2015 Zheng Fu <zhengfu@google.com> Merge "Performance turning for aggregator 1. Move identification matching to secondary 2. In the first stage, do secondary matching only if there is no structured name 3. Aggregate all the raw contacts without structured name if they have matching secondary data 4. Remove approximate name matching in aggregator. (This will not impact the name variant, such as John and Johathan matching)" into mnc-dev
772eda381913cc74f9d6f861c4236b95bb75ed9f 15-Jul-2015 Zheng Fu <zhengfu@google.com> Performance turning for aggregator
1. Move identification matching to secondary
2. In the first stage, do secondary matching only if there is no
structured name
3. Aggregate all the raw contacts without structured name if they
have matching secondary data
4. Remove approximate name matching in aggregator. (This will not
impact the name variant, such as John and Johathan matching)

Bug:22200630
Bug:21931859
Change-Id: I295e283dbe1929e20b80272027df226c01bc2f74
ggregation/ContactAggregator2.java
ggregation/util/RawContactMatcher.java
8c40af8bee303998d7f7416d6de56a390b5bc04a 16-Jul-2015 Chenjie Luo <cjluo@google.com> am 1fd58d17: am bcf0492b: am 7e89ca37: am 8389c727: am 37a30e36: Merge "Remove extra logging with privacy info" into mnc-dev

* commit '1fd58d171fd87b9b9e932872a37673c367227547':
Remove extra logging with privacy info
1fd58d171fd87b9b9e932872a37673c367227547 16-Jul-2015 Chenjie Luo <cjluo@google.com> am bcf0492b: am 7e89ca37: am 8389c727: am 37a30e36: Merge "Remove extra logging with privacy info" into mnc-dev

* commit 'bcf0492b076053dc775852cc8d7d4fde0bfcc845':
Remove extra logging with privacy info
39867c22b1335d866d21a2c5c3b3e5123045d550 15-Jul-2015 Chenjie Luo <cjluo@google.com> Remove extra logging with privacy info

Bug: 22075764, 22379601
Change-Id: I05a27684641083fa3ce172d4ffa6b5ff0718af19
ontactsProvider2.java
e91d40981dc987fd5a0b4c4f0b89791f69bea7d7 14-Jul-2015 Zheng Fu <zhengfu@google.com> am 8697c675: am c4de8153: am ee3253ca: am 43f9a00c: am cc9ce6b1: Dealing with some edge cases with soft deleted contacts. 1. Exlude soft deleted contacts for aggregator algorithm upgrade. 2. Make sure to update the contacts.name_raw_contact_id column for soft deleted

* commit '8697c675d86672d5f491042c0aeb7ae4ab3476ee':
Dealing with some edge cases with soft deleted contacts. 1. Exlude soft deleted contacts for aggregator algorithm upgrade. 2. Make sure to update the contacts.name_raw_contact_id column for soft deleted raw contact.
8697c675d86672d5f491042c0aeb7ae4ab3476ee 14-Jul-2015 Zheng Fu <zhengfu@google.com> am c4de8153: am ee3253ca: am 43f9a00c: am cc9ce6b1: Dealing with some edge cases with soft deleted contacts. 1. Exlude soft deleted contacts for aggregator algorithm upgrade. 2. Make sure to update the contacts.name_raw_contact_id column for soft deleted raw contact.

* commit 'c4de8153f8ec59e13adad16ca6db58888874495b':
Dealing with some edge cases with soft deleted contacts. 1. Exlude soft deleted contacts for aggregator algorithm upgrade. 2. Make sure to update the contacts.name_raw_contact_id column for soft deleted raw contact.
cc9ce6b1c8f9d7c4d8b4da96003ce74ccaa636cc 11-Jul-2015 Zheng Fu <zhengfu@google.com> Dealing with some edge cases with soft deleted contacts.
1. Exlude soft deleted contacts for aggregator algorithm upgrade.
2. Make sure to update the contacts.name_raw_contact_id column for
soft deleted raw contact.

Bug:22378846
Change-Id: I53a48ced645f9b00b708b4b9d88518a529834f89
ontactsProvider2.java
ggregation/AbstractContactAggregator.java
atabase/ContactsTableUtil.java
7bda7dce944b965a0d0ff531de64c3c830881d35 08-Jul-2015 Zheng Fu <zhengfu@google.com> am 9c30dc2e: am f88d6c91: am 5ca831dc: Fix bug in aggregation suggestions in new contacts aggregator.

* commit '9c30dc2e290c5fff5b4b6eb218590d800f830e5f':
Fix bug in aggregation suggestions in new contacts aggregator.
9c30dc2e290c5fff5b4b6eb218590d800f830e5f 08-Jul-2015 Zheng Fu <zhengfu@google.com> am f88d6c91: am 5ca831dc: Fix bug in aggregation suggestions in new contacts aggregator.

* commit 'f88d6c91f739b4c13a9d3b63734e6369bd1a9d38':
Fix bug in aggregation suggestions in new contacts aggregator.
5ca831dc33dfa16821647e14e377c484df823c80 08-Jul-2015 Zheng Fu <zhengfu@google.com> Fix bug in aggregation suggestions in new contacts aggregator.

New contact aggregator is using rawContactsMatcher, which is keyed by
rawContactId instead of contactId. So we need to remove bestMatches
with duplicate contactId for calculating the aggregation suggestions.

Bug:22224442
Change-Id: I9e77400a5b09ec28d5bc120706cd4dfe2e296d56
ggregation/AbstractContactAggregator.java
951b633b3f2c66be92d335098fcf85a84dcaa6cd 03-Jul-2015 Sudheer Shanka <sudheersai@google.com> am 1b5690a8: am 8a7c1d87: am 1d48d5a9: Copy ringtone uri when rewriting cursor from corp profile.

* commit '1b5690a8fa44093450174e746c33a23ff03c8c31':
Copy ringtone uri when rewriting cursor from corp profile.
1b5690a8fa44093450174e746c33a23ff03c8c31 01-Jul-2015 Sudheer Shanka <sudheersai@google.com> am 8a7c1d87: am 1d48d5a9: Copy ringtone uri when rewriting cursor from corp profile.

* commit '8a7c1d87138c02cdd823fd926d5c4a31fd39db5c':
Copy ringtone uri when rewriting cursor from corp profile.
1d48d5a992c32d37bc9535686d96569680639cfa 30-Jun-2015 Sudheer Shanka <sudheersai@google.com> Copy ringtone uri when rewriting cursor from corp profile.

This will make it possible to change ringtone of a contact
in the corp profile to any internal system sound. But if it
is set to a custom sound, then it will be ignored.

Bug: 21754741
Change-Id: I7f510dd3a8ddce4587f3728cbe36ef5a1f386bdc
ontactsProvider2.java
ef7688a32726a6ef3339b62d60b47a3fd22ad168 24-Jun-2015 Nancy Chen <nancychen@google.com> am d167f7bf: am ea37fdec: am 41f8def2: Merge "Fix read voicemails being marked as "new"." into mnc-dev

* commit 'd167f7bfed24b1694cde0cc8bbad3d82303560cf':
Fix read voicemails being marked as "new".
d167f7bfed24b1694cde0cc8bbad3d82303560cf 23-Jun-2015 Nancy Chen <nancychen@google.com> am ea37fdec: am 41f8def2: Merge "Fix read voicemails being marked as "new"." into mnc-dev

* commit 'ea37fdecc39ae59e78bfa423fb79e3b2b1ec7e33':
Fix read voicemails being marked as "new".
41f8def240346c6e65af7f31fce2628d802dd880 23-Jun-2015 Nancy Chen <nancychen@google.com> Merge "Fix read voicemails being marked as "new"." into mnc-dev
5c466282ff1ebecb37c93dcb6d6ccfc845330e65 20-Jun-2015 Nancy Chen <nancychen@google.com> Fix read voicemails being marked as "new".

Originally was comparing content values with "1" but some other sources
use "true", check for boolean value instead of integer value.

Bug: 21281858
Change-Id: I0124311ba7343826d094c621e6b2899053d6dabf
oicemailContentTable.java
bab7b86e9405118149a171d64e56778fafe012da 23-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 8e0f8c35: am 0371d431: am c8ceb951: Merge "Remove read/write social stream permissions" into mnc-dev

* commit '8e0f8c35d503821c8974ff5a9a5e2829ba5aff2a':
Remove read/write social stream permissions
49825ae047bdc4206a0faeed44ec22e4a8560682 23-Jun-2015 Makoto Onuki <omakoto@google.com> am 38d20abb: am 96541885: am e090212b: Always atomically drop & create search index.

* commit '38d20abbcfd4fe2372ed5b6ed573fca52c7c2a0d':
Always atomically drop & create search index.
8e0f8c35d503821c8974ff5a9a5e2829ba5aff2a 23-Jun-2015 Svet Ganov <svetoslavganov@google.com> am 0371d431: am c8ceb951: Merge "Remove read/write social stream permissions" into mnc-dev

* commit '0371d431e0954ba818f29c63b03bdc4927a09e7c':
Remove read/write social stream permissions
c8ceb95134cfc2cd67454343c3235dbbf6b97b48 23-Jun-2015 Svet Ganov <svetoslavganov@google.com> Merge "Remove read/write social stream permissions" into mnc-dev
38d20abbcfd4fe2372ed5b6ed573fca52c7c2a0d 23-Jun-2015 Makoto Onuki <omakoto@google.com> am 96541885: am e090212b: Always atomically drop & create search index.

* commit '9654188540a5a900ba5d80f5f955c46887c3f398':
Always atomically drop & create search index.
e5c93646562f58a27d7fecfc9a9b5e0fc7180371 23-Jun-2015 Makoto Onuki <omakoto@google.com> am 839eddd7: am 71f0747e: Fix upgrade steps

* commit '839eddd7ba394dad1d14a84fda49415335961372':
Fix upgrade steps
e090212bd2ff31a8f79a11e1e9b0980f7f6079fe 23-Jun-2015 Makoto Onuki <omakoto@google.com> Always atomically drop & create search index.

There was a chance the process or the device getting crashed right after the
DROP.
Bug 21925160

Change-Id: I25bfac0d8994644cc3ca39851f5cfcea6f541f37
ontactsDatabaseHelper.java
71f0747e4126c41aa30a5ffc431b8c70b3458445 23-Jun-2015 Makoto Onuki <omakoto@google.com> Fix upgrade steps

We accidentally reused version 1010.

Bug 21933746
Bug 21928867

Change-Id: Ic1aa05d264105f5794b2079ec1a8e5f9b54ed6e5
ontactsDatabaseHelper.java
43e057c1ae9201eabbcc05a330e85b66d0b16576 23-Jun-2015 Svet Ganov <svetoslavganov@google.com> Remove read/write social stream permissions

Change-Id: Ic51857dd196494168aebb66148a4dfe0533c6924
ontactsProvider2.java
30af467fac884acbe1083693e26618cf1755b5ed 20-Jun-2015 Zheng Fu <zhengfu@google.com> am 583e8a94: am f60c1934: am 876a6a92: code refactor in ContactAggregatorHelper

* commit '583e8a94be52c1ef0e5e887df11f555413e0a65d':
code refactor in ContactAggregatorHelper
583e8a94be52c1ef0e5e887df11f555413e0a65d 20-Jun-2015 Zheng Fu <zhengfu@google.com> am f60c1934: am 876a6a92: code refactor in ContactAggregatorHelper

* commit 'f60c193429d669a8d7ca13d431d6446b84267662':
code refactor in ContactAggregatorHelper
876a6a921e532b6c1ca653e4c52c1819a75ff3be 20-Jun-2015 Zheng Fu <zhengfu@google.com> code refactor in ContactAggregatorHelper

Bug:19908937
Change-Id: I554bae7a76173419717f9ce46aa778b8e5bc5807
ggregation/util/ContactAggregatorHelper.java
2b1a104a4b743011ea13338d072b6e03efdab0c6 17-Jun-2015 Makoto Onuki <omakoto@google.com> am 36553f1a: am 1efb4c21: am 3edc78c7: Guard against directory provider crash

* commit '36553f1adb17b97e4a6a8825394aa8b9a8731439':
Guard against directory provider crash
36553f1adb17b97e4a6a8825394aa8b9a8731439 16-Jun-2015 Makoto Onuki <omakoto@google.com> am 1efb4c21: am 3edc78c7: Guard against directory provider crash

* commit '1efb4c217ac50a3ed7b1246dac8f9b0a041b2593':
Guard against directory provider crash
3edc78c78ba277b116c28fde9b8759cb18f03e1e 16-Jun-2015 Makoto Onuki <omakoto@google.com> Guard against directory provider crash

Bug 21724632

Change-Id: I69765a4a4a416aeaa4563520526811ae019392a1
ontactsProvider2.java
eeec28907948b7461e467e9d62708dca2e45387a 11-Jun-2015 Zheng Fu <zhengfu@google.com> Re-create metadata_sync table.

Bug:20553119
Change-Id: I0fb89c284912b9c384f4e78dd364fba770e8c9e5
ontactsDatabaseHelper.java
3eaece5b333cf169d7f4d28b82fc0035c0e0f833 11-Jun-2015 Zheng Fu <zhengfu@google.com> am 007375d0: am 3ad4f2e7: Merge "Revert metadata_sync table and related code from M" into mnc-dev

* commit '007375d04b398a825e935f5ca4b86ff4853e6941':
Revert metadata_sync table and related code from M
3ad4f2e72b677e3f7936af17f831bf6cdd95aa69 11-Jun-2015 Zheng Fu <zhengfu@google.com> Merge "Revert metadata_sync table and related code from M" into mnc-dev
712533da14e5541b20097c8609905db1d52d0f10 10-Jun-2015 Zheng Fu <zhengfu@google.com> Revert metadata_sync table and related code from M

Bug:20553119
Change-Id: I89b48cc5a39a57ebeafe7821f07c410dac871258
ontactsDatabaseHelper.java
ontactsProvider2.java
etadataEntryParser.java
cb046a65f9e370c28a8535ee0c123ac0aeb2a3b3 09-Jun-2015 Zheng Fu <zhengfu@google.com> am 411cfcd3: am cf6adcbb: am 039259f7: Merge "Roll out new aggregator to limited dogfooders." into mnc-dev

* commit '411cfcd30431fae1a297b29bb8a45eb97045c65f':
Roll out new aggregator to limited dogfooders.
411cfcd30431fae1a297b29bb8a45eb97045c65f 09-Jun-2015 Zheng Fu <zhengfu@google.com> am cf6adcbb: am 039259f7: Merge "Roll out new aggregator to limited dogfooders." into mnc-dev

* commit 'cf6adcbba1739c8ac88aeca3411f7fa4853b9005':
Roll out new aggregator to limited dogfooders.
039259f7a3fa9cb11e891c878728b6cc0bc80f25 09-Jun-2015 Zheng Fu <zhengfu@google.com> Merge "Roll out new aggregator to limited dogfooders." into mnc-dev
a87f9f49c7f773d9ad0926de5017463d72938dab 09-Jun-2015 Zheng Fu <zhengfu@google.com> Roll out new aggregator to limited dogfooders.

Bug:19908937
Change-Id: I77e09aac3c60c60882f508a637225a4dc478a2ce
ontactsProvider2.java
d229296604ee02a5fcdb0f186f0c4b5bfe151450 09-Jun-2015 Makoto Onuki <omakoto@google.com> Merge "Actually make CARRIER_PRESENCE accessible (for master)"
18fa97da7c17ce342c492f22fcff064c05a52783 09-Jun-2015 Makoto Onuki <omakoto@google.com> Actually make CARRIER_PRESENCE accessible (for master)

Bug 20257870

Change-Id: If3996fe3ae1504897565111053848ceeb9a80c44
ontactsDatabaseHelper.java
ontactsProvider2.java
154a0429724aece4a0ded3d736bc2707099092e4 09-Jun-2015 Nancy Chen <nancychen@google.com> am 0128bb50: am 09865312: am 2139c6a3: Merge "Set Calls.NEW to 0 if the voicemail is read." into mnc-dev

* commit '0128bb50eb68d5f1371a1f99a6289e059db4b350':
Set Calls.NEW to 0 if the voicemail is read.
0128bb50eb68d5f1371a1f99a6289e059db4b350 09-Jun-2015 Nancy Chen <nancychen@google.com> am 09865312: am 2139c6a3: Merge "Set Calls.NEW to 0 if the voicemail is read." into mnc-dev

* commit '09865312b0e54395837302c3e2299cf14afbe155':
Set Calls.NEW to 0 if the voicemail is read.
2139c6a3d6d9e00ff03c3278ee3b84211d96b247 09-Jun-2015 Nancy Chen <nancychen@google.com> Merge "Set Calls.NEW to 0 if the voicemail is read." into mnc-dev
71fd9c74e8e3dc13b99625d4e37a569809c07463 09-Jun-2015 Makoto Onuki <omakoto@google.com> am 9b248f4c: am 1440fb9d: Actually make CARRIER_PRESENCE accessible

* commit '9b248f4cece271372a9c29f1ffd500ba254118fb':
Actually make CARRIER_PRESENCE accessible
1440fb9d8e4edefb57336532734f7cbab13a955f 08-Jun-2015 Makoto Onuki <omakoto@google.com> Actually make CARRIER_PRESENCE accessible

Bug 20257870

Change-Id: I5e7e12372dde1aeffaea1e953c16d86e341c3b66
ontactsDatabaseHelper.java
ontactsProvider2.java
5638e7fa091fa925b539a54bbf63abf94ea4c257 05-Jun-2015 Nancy Chen <nancychen@google.com> Set Calls.NEW to 0 if the voicemail is read.

Newly inserted read voicemails were notifying because the Calls.NEW flag was
set to true. Add logic to set it to false if the Voicemails.IS_READ flag
is set to true.

Bug: 21085233
Change-Id: Ibb969de54684578473b7617095b63dd04c953abc
oicemailContentTable.java
e8bc7fcc44530b3be966fd4dc62ac76cf9000907 05-Jun-2015 Yorke Lee <yorkelee@google.com> am ca403c3e: am 1db60a3b: am 47fc56dd: Fix broken CP2 unit tests and voicemail cleanup

* commit 'ca403c3eccd05a968fc7f54c12fdc08f78833794':
Fix broken CP2 unit tests and voicemail cleanup
ca403c3eccd05a968fc7f54c12fdc08f78833794 05-Jun-2015 Yorke Lee <yorkelee@google.com> am 1db60a3b: am 47fc56dd: Fix broken CP2 unit tests and voicemail cleanup

* commit '1db60a3bd598e6620d478cd637be90859bed7311':
Fix broken CP2 unit tests and voicemail cleanup
da88907f67135cfb61fd71a428b1fe0dc074860e 04-Jun-2015 Makoto Onuki <omakoto@google.com> am 24f658da: am de177d72: am cabd7cf8: Fix NPE in enterprise API & fix unit tests.

* commit '24f658da4b726adeaa803e4f4c36934e485811cb':
Fix NPE in enterprise API & fix unit tests.
24f658da4b726adeaa803e4f4c36934e485811cb 04-Jun-2015 Makoto Onuki <omakoto@google.com> am de177d72: am cabd7cf8: Fix NPE in enterprise API & fix unit tests.

* commit 'de177d72ec5464e4f8339e20d4bf24cc915403c1':
Fix NPE in enterprise API & fix unit tests.
47fc56dd40613fae565d0c4d630f5f0b5fc310ff 20-May-2015 Yorke Lee <yorkelee@google.com> Fix broken CP2 unit tests and voicemail cleanup

* Delete voicemails when VoicemailCleanupService runs by
checking whether delete is called internally.
* Delete unnecessary MockPackageManager class, and consolidate
all logic into ContactsMockPackageManager
* Separate permissions tests and delete logic tests in
VoicemailProviderTest
* Correct the number of exposed Call columns in CallLogProviderTest

Bug: 20669398
Change-Id: I695b82b639b93f3ce85bf6e20000279f19e4a14a
allLogProvider.java
bModifierWithNotification.java
cabd7cf832f5b160c30bff9c7b975bbf21a95d8e 04-Jun-2015 Makoto Onuki <omakoto@google.com> Fix NPE in enterprise API & fix unit tests.

Bug 21632829
Bug 21634841

Change-Id: Ic18f44e8de31fe48b1d3b7f3a49c355a4865aeca
ontactsProvider2.java
58c361bf637b48b20b4da45cc330ab50739c5f69 04-Jun-2015 Zheng Fu <zhengfu@google.com> am 98d3936f: am ae6342fd: am 650887fa: Merge "Performance tuning for contact aggregator2" into mnc-dev

* commit '98d3936f4f71fb0d4c00ccf14415f16470076e24':
Performance tuning for contact aggregator2
98d3936f4f71fb0d4c00ccf14415f16470076e24 03-Jun-2015 Zheng Fu <zhengfu@google.com> am ae6342fd: am 650887fa: Merge "Performance tuning for contact aggregator2" into mnc-dev

* commit 'ae6342fd598813726dae17b8972496af748f0043':
Performance tuning for contact aggregator2
650887faeb54b6c67c6628ea0b6da5554c58827c 03-Jun-2015 Zheng Fu <zhengfu@google.com> Merge "Performance tuning for contact aggregator2" into mnc-dev
d0d961e19f19704f7967dadf5be61fe6273a1d32 01-Jun-2015 Zheng Fu <zhengfu@google.com> Performance tuning for contact aggregator2

1. Skip already aggregated raw contacts during aggregation algorithm upgrade.
2. Remove case conversion during email comparion for better performance.
3. Fix bugs in the ContactAggregatorHelper to fix the flaky unit test.

Bug:21466686
Bug:19908937
Change-Id: I6f59894a4fdc605fe1b92ac82e2ac9e90561a158
ggregation/AbstractContactAggregator.java
ggregation/ContactAggregator.java
ggregation/ContactAggregator2.java
ggregation/util/ContactAggregatorHelper.java
a01b940125f91a96a2aa7b9711a9cd8f9ff4abbf 02-Jun-2015 Brian Attwell <brianattwell@google.com> am c1d81cd3: am 094a424d: am 95f4fd8b: Decouple ProviderStatus & internal provider state

* commit 'c1d81cd3a64eef9dcdf4de60dc903670152e7909':
Decouple ProviderStatus & internal provider state
c1d81cd3a64eef9dcdf4de60dc903670152e7909 02-Jun-2015 Brian Attwell <brianattwell@google.com> am 094a424d: am 95f4fd8b: Decouple ProviderStatus & internal provider state

* commit '094a424d37b976b64598c1175de545355ae37f5d':
Decouple ProviderStatus & internal provider state
95f4fd8bf381ed9319f139febc369ce70dcb022e 29-May-2015 Brian Attwell <brianattwell@google.com> Decouple ProviderStatus & internal provider state

Bug: 21090207
Change-Id: I7e93e36ad0c0d667ac56983c76acb1b97bd8755c
ontactsProvider2.java
earchIndexManager.java
f179c27ea68de60b970f34d7626846a02047a0ff 01-Jun-2015 Ricky Wai <rickywai@google.com> am 77321a67: am 887e7bb7: am d67c70c5: Merge "Fix enterprise path permission checking" into mnc-dev

* commit '77321a678b20898963b42d9ed6c36570d4a46e68':
Fix enterprise path permission checking
77321a678b20898963b42d9ed6c36570d4a46e68 01-Jun-2015 Ricky Wai <rickywai@google.com> am 887e7bb7: am d67c70c5: Merge "Fix enterprise path permission checking" into mnc-dev

* commit '887e7bb76379f8d49215e3bb310ff24f0d2478b0':
Fix enterprise path permission checking
d691c0ae1efccb33c383acc8749032d44adddb97 01-Jun-2015 Paul Duffin <paulduffin@google.com> am cbc0db8f: Merge "Switching to use try-with-resources"

* commit 'cbc0db8f9e1382f4bf60b4e707c5eb6bc20f2677':
Switching to use try-with-resources
4f787e2f890d8ce466148615ee4e2052600cdd1d 27-May-2015 Paul Duffin <paulduffin@google.com> Switching to use try-with-resources

The Closeables.closeQuietly(Closeable) method is no longer
present in v18. This change replaces usages with the
try-with-resource pattern.

This is part of the work to upgrade Guava to version 18.

Cherry-picked from commit dfff82913ea4201ecd983d40899e8459593f4495

BUG: 19672715
Change-Id: Id924d5db9e49c509e9a83c374411846305d23729
ebug/DataExporter.java
22f452cd02b95c601b8d58fcb6524d6cc66278aa 29-May-2015 Ricky Wai <rickywai@google.com> Fix enterprise path permission checking

Bug: 21489358
Change-Id: I5f655d5a41723f067533c2ae5c867dcbe3cc604d
ontactsProvider2.java
494d793abeb524321fc7192ead9e4ea22eb71573 28-May-2015 Brian Attwell <brianattwell@google.com> am c9d68371: am ce51d241: Merge "Stop enforcing {READ,WRITE}_PROFILE permissions" into mnc-dev

* commit 'c9d68371fd908b2bfb447de2487cbebb21f71ba7':
Stop enforcing {READ,WRITE}_PROFILE permissions
c9d68371fd908b2bfb447de2487cbebb21f71ba7 28-May-2015 Brian Attwell <brianattwell@google.com> am ce51d241: Merge "Stop enforcing {READ,WRITE}_PROFILE permissions" into mnc-dev

* commit 'ce51d2418ae766feed51f05ea69735753fbacb68':
Stop enforcing {READ,WRITE}_PROFILE permissions
ce51d2418ae766feed51f05ea69735753fbacb68 28-May-2015 Brian Attwell <brianattwell@google.com> Merge "Stop enforcing {READ,WRITE}_PROFILE permissions" into mnc-dev
e3afdce8647e144c2d0c81f48860138deb976cdf 28-May-2015 Brian Attwell <brianattwell@google.com> Stop enforcing {READ,WRITE}_PROFILE permissions

I should also remove all support for the Authorization
API from CP2 now that we've decided there is no need
for it. I'll leave cleaning this up for after I've
finished unbundling the Contacts app.

Bug: 21090207
Change-Id: I31e6ae7b0f49c3589071f6a95f8d69a9456c144d
ontactsProvider2.java
rofileProvider.java
2adee1b3012e1a2728fd9701419cc6214dd9fbac 27-May-2015 Makoto Onuki <omakoto@google.com> am 7c7da354: am 3a83f4c6: Fix invalidateAggregationExceptionCache().

* commit '7c7da354765fffe6859781df47fafd18fc2fff4d':
Fix invalidateAggregationExceptionCache().
7c7da354765fffe6859781df47fafd18fc2fff4d 27-May-2015 Makoto Onuki <omakoto@google.com> am 3a83f4c6: Fix invalidateAggregationExceptionCache().

* commit '3a83f4c60fbe7eb2ee31186d0675dcfbac3ee6b5':
Fix invalidateAggregationExceptionCache().
3a83f4c60fbe7eb2ee31186d0675dcfbac3ee6b5 27-May-2015 Makoto Onuki <omakoto@google.com> Fix invalidateAggregationExceptionCache().

Also clean up aggregator in preparation in preparation for b/19482664

Two tests in ContactAggregator2Test are failing, but it's irrelevant to this
change. (Bug filed for this.)

Change-Id: Id630812335fdaa2ab4955c240700b82fed84d1a8
ontactsProvider2.java
ggregation/AbstractContactAggregator.java
ggregation/ContactAggregator.java
ggregation/ContactAggregator2.java
dfff82913ea4201ecd983d40899e8459593f4495 27-May-2015 Paul Duffin <paulduffin@google.com> Switching to use try-with-resources

The Closeables.closeQuietly(Closeable) method is no longer
present in v18. This change replaces usages with the
try-with-resource pattern.

This is part of the work to upgrade Guava to version 18.

BUG: 19672715
Change-Id: I75f698ddf93987afbe84e08b2e4c8ccbef1e635f
ebug/DataExporter.java
c9ded23a262ba49803b164668d402b95833daf61 26-May-2015 Zheng Fu <zhengfu@google.com> am b3d7e887: am f60c48e2: Merge "Fix bugs in aggregator2." into mnc-dev

* commit 'b3d7e887c5d94f5cdfd86d9f9a12ff76406355a6':
Fix bugs in aggregator2.
b3d7e887c5d94f5cdfd86d9f9a12ff76406355a6 26-May-2015 Zheng Fu <zhengfu@google.com> am f60c48e2: Merge "Fix bugs in aggregator2." into mnc-dev

* commit 'f60c48e2125898602214b8abca43b9fdbc942e40':
Fix bugs in aggregator2.
f60c48e2125898602214b8abca43b9fdbc942e40 26-May-2015 Zheng Fu <zhengfu@google.com> Merge "Fix bugs in aggregator2." into mnc-dev
891e5b4c377258ff7d7259f2bab6cd6bff202aee 15-May-2015 Zheng Fu <zhengfu@google.com> Fix bugs in aggregator2.

0. Add unit test for aggregator2.
1. Only aggregate raw contacts in the default directory
2. Remove aggregation exception matches from the aggregation suggestion list
3. Fix the sqls to clear primary settings when merging
4. Make the scoring system consistent with current aggregator.
5. Don't aggregate raw contacts without name to any other raw contacts even
when data matching exist.

Bug: 19908937
Change-Id: Ie580def5ee9e3a291cd5bf112ccb29627f9b67cc
ontactsProvider2.java
ggregation/ContactAggregator2.java
ggregation/util/RawContactMatcher.java
3c06f53e3301c46fb4b30dda37e2f8d668e2631f 14-May-2015 Makoto Onuki <omakoto@google.com> Implement Data.CARRIER_PRESENCE (master cherry pick)

Also add a script to dump the DB schema.

Bug 20257870

Change-Id: If336f7dfbab4aca9be8f168d1e8e5a555a9fe649
ontactsDatabaseHelper.java
6172171da278a21bf14d02a8a7522082c6455c64 20-May-2015 Etan Cohen <etancohen@google.com> am d9300816: Merge "Implement Data.CARRIER_PRESENCE" into mnc-dev

* commit 'd93008163a8a2a4a877506eacdc4c4b1b2ad840e':
Implement Data.CARRIER_PRESENCE
d93008163a8a2a4a877506eacdc4c4b1b2ad840e 20-May-2015 Etan Cohen <etancohen@google.com> Merge "Implement Data.CARRIER_PRESENCE" into mnc-dev
3dc2352ed3ea1295b1badb97df9e961f3daccde8 15-May-2015 Makoto Onuki <omakoto@google.com> am 6ce17205: am 2d66b50b: Merge "Clean up permissions" into mnc-dev

* commit '6ce17205d1bc6da62b196fd08d5bfd1b0471557a':
Clean up permissions
6ce17205d1bc6da62b196fd08d5bfd1b0471557a 15-May-2015 Makoto Onuki <omakoto@google.com> am 2d66b50b: Merge "Clean up permissions" into mnc-dev

* commit '2d66b50b00603e1b54da45aa1129e6bc659fd46d':
Clean up permissions
2d66b50b00603e1b54da45aa1129e6bc659fd46d 15-May-2015 Makoto Onuki <omakoto@google.com> Merge "Clean up permissions" into mnc-dev
400e50c1efeb601f6162bd829fdf33e9dc5252f6 13-May-2015 Makoto Onuki <omakoto@google.com> Clean up permissions

- All permission checks now always pass if the caller is self.
- Remove uses-permissions that're enforced by self.

Bug 20927020

Change-Id: I985338495ed947d317f37e1a8d674a40c5e6bfe4
ontactsProvider2.java
rofileProvider.java
oicemailContentProvider.java
oicemailPermissions.java
til/ContactsPermissions.java
f615d9c682a5be33576f5e691532185810d169d2 15-May-2015 Yorke Lee <yorkelee@google.com> am 4f2b0708: am 64605820: Fix NPE in CallLogProviderWorker

* commit '4f2b0708448e477ecac9f657fc5cb910eb07f2de':
Fix NPE in CallLogProviderWorker
4f2b0708448e477ecac9f657fc5cb910eb07f2de 15-May-2015 Yorke Lee <yorkelee@google.com> am 64605820: Fix NPE in CallLogProviderWorker

* commit '64605820a3c27ca1d1bf2499aea8418bb80621d0':
Fix NPE in CallLogProviderWorker
64605820a3c27ca1d1bf2499aea8418bb80621d0 15-May-2015 Yorke Lee <yorkelee@google.com> Fix NPE in CallLogProviderWorker

Bug: 20979730
Change-Id: I8ccaa27613804891b958dd82ac2debeb0dad762b
allLogProvider.java
bdeea8a03680da2754df018b6a76e0e7fb99af84 14-May-2015 Makoto Onuki <omakoto@google.com> Implement Data.CARRIER_PRESENCE

Also add a script to dump the DB schema.

This CL needs ag/683503.

Bug 20257870

Change-Id: If336f7dfbab4aca9be8f168d1e8e5a555a9fe649
ontactsDatabaseHelper.java
51cb9cf6158b7e077110f3d5a704a3b3673795b1 11-May-2015 Tingting Wang <tingtingw@google.com> Fix a bug on update Data.hash_id column.

When updating a row for Data table, hash_id should not be updated
if there's no data1, data2, and data15 update.

BUG 20892843

Change-Id: I27c2aaa35d6d9714e83c8fd5ffcc714b4622207c
ataRowHandler.java
829975f64361a1585289c09e4a29a602cc979462 09-May-2015 Tingting Wang <tingtingw@google.com> Merge "Populate Data.hash_id for Data table."
b712e3c95a1add30937dee5dddab429ce5247269 08-May-2015 Tingting Wang <tingtingw@google.com> Populate Data.hash_id for Data table.

1) Using a hash method to generate hash_id string generated from
data1 + data2 for non-photo data, or from data15 for photo data.
2) Backfill data.hash_id for Data table if it's null.
3) Update hash_id when inserting a new Data.
4) Update hash_id when updating a new Data with changed data1 and data2
or changed data15.
5) Query data._id using hash_id and raw_contact_id.

BUG 20892843

Change-Id: Ieeab2f4ee6c4644fc1b4b1f57335b74530a7d91d
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandler.java
af398c323387653b347af2b9d4919ca82a3ccd36 08-May-2015 Zheng Fu <zhengfu@google.com> Override applyBatch() and bulkInsert() in ContactMetadataProvider

Bug:20537162
Change-Id: If605782ce3115de276790159b05dccc78e844799
ontactMetadataProvider.java
3a423092c2ead2a74f417b0a757d88e5b34a45f4 08-May-2015 Zheng Fu <zhengfu@google.com> Notify contact metadata change on raw contact deletion.

When a raw contact is deleted, mark metadata_sync.deleted as 1,
also notify this change to metadata network.

Bug:20893997
Change-Id: I87579d8451a3276df3b6dc4574f4b64004d07004
ontactsProvider2.java
ccab43fe2503a83623d791a34577d4fec804097d 07-May-2015 Zheng Fu <zhengfu@google.com> Merge "Notify contact metadata changes to contact metadata authority."
08fb8384ccb36de3d3d046e287fe5c43c1f85faf 07-May-2015 Zheng Fu <zhengfu@google.com> Notify contact metadata changes to contact metadata authority.

Need to notify metadata changes in the following senario:
1. raw contacts insert/update with column pinned,starred or send_to_voicemail
2. data usage stats update
3. aggregation exception update/insert
4. data delete, or insert/update with is_primary or is_super_primary column

Bug:20893997
Change-Id: I7ca6ae4c1a96baa9bb887ec11869d4194398ae64
ontactDirectoryManager.java
ontactsProvider2.java
ataRowHandler.java
ataRowHandlerForCommonDataKind.java
ataRowHandlerForEmail.java
ataRowHandlerForGroupMembership.java
ataRowHandlerForIdentity.java
ataRowHandlerForNickname.java
ataRowHandlerForOrganization.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForPhoto.java
ataRowHandlerForStructuredName.java
ataRowHandlerForStructuredPostal.java
rofileProvider.java
ransactionContext.java
c52172ed23c7e044f6a5f6c1903c2ab6a72098cd 07-May-2015 Zheng Fu <zhengfu@google.com> Wrap ContactMetadata insert/update/delete in transcation.

Bug:20537162
Change-Id: Ida25a6cdf5cd701c7ce87b4ff4c1702ddd500760
ontactMetadataProvider.java
6c1b57f54a79a4ff0556eaa7862f894d7471c29b 07-May-2015 Makoto Onuki <omakoto@google.com> am adbcd27e: am 6b379eed: Merge "Don\'t call notifyChange() until after the transaction have been commited."

* commit 'adbcd27ed3707343cf69ab4dd2011664eeb54e7a':
Don't call notifyChange() until after the transaction have been commited.
adbcd27ed3707343cf69ab4dd2011664eeb54e7a 07-May-2015 Makoto Onuki <omakoto@google.com> am 6b379eed: Merge "Don\'t call notifyChange() until after the transaction have been commited."

* commit '6b379eed0ed552bc59c41b179c0e54369c7713f9':
Don't call notifyChange() until after the transaction have been commited.
0027a1ab1b3c04e7f455020ffd252966f1d750d9 05-May-2015 Tingting Wang <tingtingw@google.com> Add metadata_dirty column to RawContacts table.

Add metadata_dirty column to RawContacts table, and raw contacts
related views, including view raw_contacts, view raw_entities, and
view entities.

BUG 20827851

Change-Id: I2a33656457bb56c4907edbacc5b5d47081c5250a
ontactsDatabaseHelper.java
ac86c67dc61b46e5dd13d78438deae22dc64cdbe 20-Mar-2015 Fedrik Ã…lund <fredrik.alund@mimer.com> Don't call notifyChange() until after the transaction have been commited.

If we call notifyChange() before the commit have been done clients that are listening for changes will start reloading before the transaction is finished and this will lead to unnecesarry waits.

Change-Id: I404bae39ace3d7557c4b48ccf4b757f3d986dbe7
Signed-off-by: Fedrik Ã…lund <fredrik.alund@mimer.com>
bstractContactsProvider.java
4309d6d78334fda8a4f16a90fcfb5f3d3e0e53ee 02-May-2015 Tingting Wang <tingtingw@google.com> Process Metadata on RawContact Insert and Delete.

On rawContact insert, read its metadata data column from MetadataSync
table for the new inserted rawContact, and parse it to update related tables.
On rawContact delete, update its metadata as DELETED in MetadataSync table.

BUG 20055460

Change-Id: I785cf7dd260b8ecf110d5724c017b1cdf85661cb
ontactsDatabaseHelper.java
ontactsProvider2.java
2c76de2c89979f19f9adab604e0375019efe5683 02-May-2015 Zheng Fu <zhengfu@google.com> Implement delete method for ContactMetadataProvider.

Bug:20537162
Change-Id: Ie2d18855b71112d1b56795fc79acb73852914e4d
ontactMetadataProvider.java
01e598c3f75beecaafbbe5ad5e0be9d21ed13754 01-May-2015 Tingting Wang <tingtingw@google.com> Implement insert and update method for ContactMetadataProvider.

Insert and update values to MetadataSync table, and also parse the data
column to MetadataEntry object, and then update other related tables
for the raw contact.

BUG 20055193

Change-Id: Ice7a6db308995704e7a5fb12b9594be03fa39cd1
ontactMetadataProvider.java
ontactsDatabaseHelper.java
58bc12653333c755c5bed5b05e7b9aaebe45ee2d 01-May-2015 Jay Shrauner <shrauner@google.com> am 61ec1816: Use transliterator for Simplified Chinese buckets

* commit '61ec18168fea70e5c10a28776fd5b9257d9961bc':
Use transliterator for Simplified Chinese buckets
384b448938b82c8ebf1628673d0aaee6972a5b69 30-Apr-2015 Zheng Fu <zhengfu@google.com> Add new ContactMatadataProvider.

Bug:20537162
Change-Id: I499efb7c6238957a65c518a1c938533d2fb8ac54
ontactMetadataProvider.java
ontactsDatabaseHelper.java
ontactsProvider2.java
61ec18168fea70e5c10a28776fd5b9257d9961bc 30-Apr-2015 Jay Shrauner <shrauner@google.com> Use transliterator for Simplified Chinese buckets

Use Pinyin name transliterator instead of AlphabeticIndex for bucketing
Simplified Chinese names.

Bug:19835686
Change-Id: I350a4375e2b5ba05320143581c7b532678f69120
ontactLocaleUtils.java
11d45334311f1b2ffa4f6697520939e6ce5b239e 29-Apr-2015 Makoto Onuki <omakoto@google.com> Fix SIP enterprise lookup

SIP lookup's _id is the data ID, not the contact ID unlike the non-SIP lookup.
Properly use the contact ID for photo URLs.

Bug 20522260
Bug 20518934

Change-Id: I52535968363c56af3b371197287743eb6e517731
ontactsProvider2.java
77b65aa3d1c2db02ce664c4b31e10370efe645cb 23-Apr-2015 Yorke Lee <yorkelee@google.com> Grant VoicemailContentProvider permissions to default or system dialers

Bug: 20333102
Change-Id: Icb54620cf9241b3999bcb3de1b73394c71becb2f
allLogProvider.java
oicemailContentProvider.java
oicemailPermissions.java
74e4f99cada94d6ca6be5d1bfee9abe7c4561253 25-Apr-2015 Zheng Fu <zhengfu@google.com> Fix some set concurrency issues in new aggregator.

Bug:19908937
Change-Id: Iade51905c1e5a1810b709d7b533984ceb6254939
ggregation/AbstractContactAggregator.java
ggregation/ContactAggregator2.java
57e16b057e5d1fbb2383ddbe7700f2e6c9bc0a33 23-Apr-2015 Tony Mak <tonymak@google.com> Merge "Add unit test for query against Phone.ENTERPRISE_CONTENT_URI"
b3c4b2641003c703365114712026d47cc7b13f8f 21-Apr-2015 Zheng Fu <zhengfu@google.com> Re-create metadata_sync table.

Drop foreign key constraint on account_id column;
Add deleted column;

Bug:20457617
Change-Id: I13b3c12aa57fa39fcf4ec1d4dfc52a4e9ad869b7
ontactsDatabaseHelper.java
e56d27b7774a9ce478372069a30f089e46ce855c 21-Apr-2015 Tony Mak <tonymak@google.com> Add unit test for query against Phone.ENTERPRISE_CONTENT_URI

Bug: 19551175

Change-Id: I69bdb672e64474a8daf12c3c38ea5fe262684aab
ontactsProvider2.java
006742f82d1cc3f34fd3c77ff2b23aa4c619affa 19-Apr-2015 Svet Ganov <svetoslavganov@google.com> Merge "Add OP_ADD_VOICEMAIL app op - contacts provider"
9019dfd748d0a5e39cc041269d8d42e8ee8eb3ef 18-Apr-2015 Tingting Wang <tingtingw@google.com> Merge "Update related tables from MetadataSync.data column."
794ef4db9d70441393b756ce6c4cc456b9143b11 15-Apr-2015 Tingting Wang <tingtingw@google.com> Update related tables from MetadataSync.data column.

MetadataSync.data column info is parsed to MetadataEntry object.
RawContact, Data, DataUsageStats, AggregationException tables need to
be updated or inserted for the given rawContactId from MetadataEntry.

BUG 20055193

Change-Id: I5bdfe2c44f9c9af8d4067dc136ceb62ab0b274af
ontactsProvider2.java
etadataEntryParser.java
33c4eba05b46e112f7de966d63a0459d75b33970 17-Apr-2015 Svet Ganov <svetoslavganov@google.com> Add OP_ADD_VOICEMAIL app op - contacts provider

Change-Id: I0dfce97bd1dc3df9118c3a3e7ec5f00c764abbb1
oicemailContentProvider.java
0e464bef9238f150a1a6d97200b49aae9dd33207 16-Apr-2015 Zheng Fu <zhengfu@google.com> Show which aggregator is used in bugreport.

Bug:20298625
Change-Id: I65b20cdbf6567eec2ccd7242359bf1d43b0bfe84
ontactsProvider2.java
aa18c233fdec3359c5231d4a5f61188446bf5d6f 16-Apr-2015 Zheng Fu <zhengfu@google.com> use new setting flag to switch between current and new aggregator.

In order for the switch, add AbstractContactAggregator for
ContactAggregator and ContactAggregator2.

Bug:20055573
Change-Id: I6f27d4df8017938b226f5c6371b15ba41fd18acd
ontactsProvider2.java
ataRowHandler.java
ataRowHandlerForCommonDataKind.java
ataRowHandlerForCustomMimetype.java
ataRowHandlerForEmail.java
ataRowHandlerForGroupMembership.java
ataRowHandlerForIdentity.java
ataRowHandlerForIm.java
ataRowHandlerForNickname.java
ataRowHandlerForNote.java
ataRowHandlerForOrganization.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForPhoto.java
ataRowHandlerForStructuredName.java
ataRowHandlerForStructuredPostal.java
ggregation/AbstractContactAggregator.java
ggregation/ContactAggregator.java
ggregation/ContactAggregator2.java
ggregation/util/ContactMatcher.java
ggregation/util/MatchScore.java
ggregation/util/RawContactMatcher.java
ggregation/util/RawContactMatchingCandidates.java
b94bfa502569ce869d443353c174d02754d42a82 16-Apr-2015 Zheng Fu <zhengfu@google.com> Fork ContactAggregator to AbstractContactAggregator to keep file hsitory.

Bug:20055573
Change-Id: I42c85df36f039b59707101660441243fb90baca2
ggregation/AbstractContactAggregator.java
97de7217ba52601af45750fe21d07e99f0314b93 15-Apr-2015 Tingting Wang <tingtingw@google.com> Merge "Parse metadata_sync.data to MetadataEntry Object."
d1f777e7b9003ac5d6bac0d9039acfd05a7bec69 08-Apr-2015 Tingting Wang <tingtingw@google.com> Parse metadata_sync.data to MetadataEntry Object.

metadata_sync.data is a text column contains the DeviceContactMetadata
Json string got from People API. Converting it to MetadataEntry object
is needed before using.

BUG 20055450

Change-Id: Ic82b07438fdf088563fcdcc99980b83df149734f
etadataEntryParser.java
94d605997c8cf36c5446bbc6379c7e397297d07e 14-Apr-2015 Ricky Wai <rickywai@google.com> Merge "Remove caller-id check in enterprise phone and raw contacts entities"
76f69956794e6ce36ffd2971455be5630becbd41 03-Apr-2015 Nancy Chen <nancychen@google.com> Merge "Add phone_account_* fields to voicemail content table allowed columns."
dca8f302db8e661f13f3585bc67c53a5adf36617 02-Apr-2015 Nancy Chen <nancychen@google.com> Add phone_account_* fields to voicemail content table allowed columns.

This allows updating and querying of voicemail entires for their
respective phone account columns.

Update tests to reflect this change:
- Increase number of voicemail columns to 18
- Add phone_account_* fields to update test

Bug: 19236241
Change-Id: I16b3c9d2a74bc7e169de4dd108b39b94acc98c4f
oicemailContentTable.java
6012b85f0eef8ebcfcb73b72216d17893804d4ea 02-Apr-2015 Zheng Fu <zhengfu@google.com> Add some new method implementations for new contact aggregator.

Also add a ContactAggregatorHelper class to hold some helper methods
to better falicitate unit testing

Bug:19908937
Change-Id: I2e2bcef2228e7a171e9c3259c27c3fa28bde646c
ggregation/ContactAggregator.java
ggregation/ContactAggregator2.java
ggregation/util/ContactAggregatorHelper.java
bb1bc1a5b107e282f974e2a9f43307d0c2144c62 31-Mar-2015 Makoto Onuki <omakoto@google.com> Merge "Enterprise quick contact 2/2"
42d5b79db882739368b163f4d5f61546d134cdbb 27-Mar-2015 Ricky Wai <rickywai@google.com> Remove caller-id check in enterprise phone and raw contacts entities

Bug: 19990833

Change-Id: Ibba3a0594262b975b3b4fdd4ebd1fcf1e40ff98a
ontactsProvider2.java
til/UserUtils.java
1076c4946c230612c8eb56dbcdf2e3ca22a624e3 19-Mar-2015 Makoto Onuki <omakoto@google.com> Enterprise quick contact 2/2

Now openQuickContact goes thorough DPM. When a lookup URI is build with
a lookup key returned by the enterprise lookup APIs for a corp contact, the
lookup key will have a special prefix. DPM checks it and launches QC on
the work profile, if the policy allows it.

Design doc: go/cp2-mnc-enterprise-dd

Bug 19546108

Change-Id: Iccba8254269180281af0154f4b9c20cbfff5c27d
ontactsProvider2.java
d6c0a1330d3e51706d70351a34631f1f4e8fb02f 26-Mar-2015 Zheng Fu <zhengfu@google.com> New contact aggregator (part 1)
Summary of the changes are:
1. In RawContactMatcher, add rawContactId and accountId to MatchScore
inner class, so that match score is on raw contacts level instead]
of accumulate to contact level
2. Add a wrapper RawContactMatchingCandidates to MatchScore to
facilitate the aggregation.
3. In ContactAggregator2, add findRawContactMatchingCandidates()
method to find the set of matching raw contacts for a given
raw_contact_id. This method will use the logic of
updateMatchScoresForSuggestionsBasedOnDataMatches() so that
it will give a set of raw contacts candidate with matching score
above threshold.
4. The second stage "Pair-wise comparison and find the
connected component of all the raw contacts in
RawContactMatchingCandidates" is done in new method
reAggregateRawContacts();
5. Some new methods still throw unSupportedOperationExceptions, and
they will be implemented in part2.
6. Tests will be implemented in follow-up cls.

Bug:19908937
Change-Id: I53483a29c24401e2f38a727168e7431cef86370a
ggregation/ContactAggregator2.java
ggregation/util/RawContactMatcher.java
ggregation/util/RawContactMatchingCandidates.java
889f3c72bf043fe0b289c9a5f4f445ebbb0aaf0e 30-Mar-2015 Makoto Onuki <omakoto@google.com> Merge "Revert "Enterprise quick contact 2/2""
5f20fb34e4d6ce4e00aece1a109685e5a0e78a8a 30-Mar-2015 Makoto Onuki <omakoto@google.com> Revert "Enterprise quick contact 2/2"

This reverts commit 9d5369ac6c1d788384d52b11da10f60571238405.

Change-Id: Ib442e2ac351146ad2d5129e39a999478b8ffe547
ontactsProvider2.java
fc237d0d3a2ac25e96adf1cc732d8b5563772747 30-Mar-2015 Makoto Onuki <omakoto@google.com> Merge "Enterprise quick contact 2/2"
9d5369ac6c1d788384d52b11da10f60571238405 19-Mar-2015 Makoto Onuki <omakoto@google.com> Enterprise quick contact 2/2

Now openQuickContact goes thorough DPM. When a lookup URI is build with
a lookup key returned by the enterprise lookup APIs for a corp contact, the
lookup key will have a special prefix. DPM checks it and launches QC on
the work profile, if the policy allows it.

Design doc: go/cp2-mnc-enterprise-dd

Bug 19546108

Change-Id: I30ffcc1f6f394144182f2cb2b6032568ea5b33eb
ontactsProvider2.java
2ded4cc7b214d7cddee9d3130744400fcb8cc1f0 23-Mar-2015 Jay Shrauner <shrauner@google.com> Merge "Protect against null lookup uri"
b593bf1894afe6f57dc9c0dde8bb9d7ac416fa7a 09-Mar-2015 Ricky Wai <rickywai@google.com> Add Email.ENTERPRISE_CONTENT_LOOKUP_URI

Like PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI
Apps in primary profile can have email lookup in managed profile

Bug: 19550046

Change-Id: I492909126faf4e1a2eb5c72f7f76f3a7a0656e6a
ontactsProvider2.java
3638597dbb90113a326bb5e9b0d3af47d1fd8d4c 19-Mar-2015 Ricky Wai <rickywai@google.com> Merge "Add RawContactsEntity.CORP_CONTENT_URI"
360dcb9df1b1119719fb1cdb98cab08161ba9033 18-Mar-2015 Zheng Fu <zhengfu@google.com> Merge " Fork ContactMatcher.java to RawContactMatcher.java"
1340c2f51a81789032e55a7805c1916dcd7f2277 18-Mar-2015 Zheng Fu <zhengfu@google.com> Fork ContactMatcher.java to RawContactMatcher.java

This is to copy the file history for new raw contact matcher.

Change-Id: I28f9e36d743268e2c17970175c09ba4d9aed86cd
ggregation/util/RawContactMatcher.java
30ec266bb7d0648c05606acc60a5be20a7a87686 07-Mar-2015 Ricky Wai <rickywai@google.com> Add RawContactsEntity.CORP_CONTENT_URI

Bug: 19551325
Change-Id: Ie0c31c951edab91b70b7587ab27b68db4e1f6fcd
ontactsProvider2.java
40bd4b813a06a151cff4eac5e0a68ae7889501a7 18-Mar-2015 Nancy Chen <nancychen@google.com> Add back upgrade actions that were lost from merging.

A merge from m-wireless-dev to master ended up merging two different
upgrade steps into one, which means that any devices that were upgraded
to version 1005 before the merge would not have undergone the upgrade
from m-wireless-dev. Add another upgrade step to ensure the necessary
upgrading happens.

Bug: 19796706
Change-Id: Ibc7af5f1ff923e338d57170c9b9c289f89c32838
ontactsDatabaseHelper.java
3a9b227565f9cf1eccb736b764d34dba6f20bdac 17-Mar-2015 Tingting <tingtingw@google.com> Make contacts backup schema change accessible.

raw_contacts.backup_id and data.hash_id have been added to schema.
To make them accessible, they need to be added to projection map.

BUG 19667203

Change-Id: I7d122843668d7ed31fc998a2c7f00dc909181fc8
ontactsDatabaseHelper.java
ontactsProvider2.java
fd8de127afaadccb3106609e203e9bf9f7c9deb9 16-Mar-2015 Vinit Deshpande <vinitd@google.com> Merge remote-tracking branch 'goog/mirror-m-wireless-internal-release'

Change-Id: I439330f8c022ce85005d84fd4286f4f1ffdced1c
09e08ac8c9352f42003d2cd3a510bea96244ae0a 13-Mar-2015 Jay Shrauner <shrauner@google.com> Protect against null lookup uri

Bug:19588470
Change-Id: Iadfed46a7de067513463f12fa72bdd658f5b07f8
lobalSearchSupport.java
410c29fe803c63342ee73168cd27f4bf7eda1c0e 10-Mar-2015 Ricky Wai <rickywai@google.com> Merge "Add private API to get merged primary and enterprise contacts"
b88a02f9551b991a8bc767867ae9ec1ccac75950 19-Feb-2015 Ricky Wai <rickywai@google.com> Add private API to get merged primary and enterprise contacts

Bug: 19550047
Change-Id: I5f2a5e5d54af50cd0b41dd3105e10a4676d17388
ontactsProvider2.java
693406016fa0b02b4af4188fd9668a3d74881652 09-Mar-2015 Makoto Onuki <omakoto@google.com> Cache photo URI too in calllog

Enterprise phone lookup returns special photo URLs for corp contacts, which
can't be obtained just with contact IDs. So we need to cache the URIs too and
otherwise pictures sometimes don't show up.

Bug 19546108

Change-Id: I48517da681c194b6ee4ca47dda57ccff81e76981
allLogProvider.java
ontactsDatabaseHelper.java
10fc5278a4633f5ef7d0a4b6cca40528e84294a9 07-Mar-2015 Santos Cordon <santoscordon@google.com> Merge "Remove CallLogBackupAgent."
f35365f25c85a3d72d78fedb1516fb94333af768 05-Mar-2015 Santos Cordon <santoscordon@google.com> Remove CallLogBackupAgent.

Moved to CallLogBackup.apk

Change-Id: I1aee3bb1dc4378bff0d346d424692bc60b3fdc40
allLogBackupAgent.java
bModifierWithNotification.java
a1b621ed5c1936d847c02161fa22ebe904464496 05-Mar-2015 Brian Attwell <brianattwell@google.com> Merge "Prioritize regular names over phonetic names. P2/2"
3cf9ac64046bfd65d419476c900d3d98d3eccfeb 05-Mar-2015 Brian Attwell <brianattwell@google.com> Prioritize regular names over phonetic names. P2/2

When choosing display names, prioritize StructuredNames that
have more than phonetic components.

I make no attempt to handle the case where a StructuredName
with only phonetic components is marked super primary. If
clients do this, the behavior is still undefined.

Bug: 19587274
Change-Id: I503c0fff6da30b9f1d6b6cbeaedfc4d9314f8a00
ontactsDatabaseHelper.java
f7076a627db99f9e845d406650d73be826091367 03-Mar-2015 Santos Cordon <santoscordon@google.com> Unhide call log entries by phone number.

If the phone account does not match any call log entries, then run the
unhiding query by the phone number instead of the specific phone
account. This addresses the cases where a user gets a new SIM card for
their existing phone number (e.g., switching service providers).

Change-Id: Ib0d5e5a36ad7445e95148470c45d8fdabd9125f7
allLogProvider.java
b39eeb4f07db680e542ccaf142136a42f9d305f8 27-Feb-2015 Santos Cordon <santoscordon@google.com> Hide unregistered phone account call log entries.

Change-Id: I238882e0dd3e63747a4eedcf3ff2af2c8d770dd4
allLogBackupAgent.java
allLogProvider.java
ontactsDatabaseHelper.java
honeAccountRegistrationReceiver.java
654914bbcb1948aa4f513845315563974203ec04 02-Mar-2015 Makoto Onuki <omakoto@google.com> Merge "Enterprise phone lookup should return consistent result..."
0f74e8600ad744f2e4ba9c6a4cdadf5da5a20e83 03-Feb-2015 Nancy Chen <nancychen@google.com> Upgrade voicemail_status and calls tables for visual voicemail.

Do a database upgrade for MNC in order to add multi-SIM fields to the
voicemail_status table and add "dirty" and "deleted" fields to
voicemails table. Add functionality in DbModifierWithNotification to
handle "dirty" and "deleted" appropriately. This new functionality is
tested in VoicemailProviderTest and CallLogProviderTest.

Bug:19236241
Change-Id: I25ebba0bdb5f720e48beaf17dbdd2846e494da74
ontactsDatabaseHelper.java
bModifierWithNotification.java
oicemailContentTable.java
468fc189050b234fa8df7f62af0f7987517ffc35 12-Feb-2015 Santos Cordon <santoscordon@google.com> Upgrade calllog DB to use ICC ID & source_phone_number.

To accomodate backup and restore of the call log, we have to convert the
existing sub-ID to an ICC ID. Also, add the source_phone_number to the
list of call log columns.

The ICC ID improves backup and restore because it is persistent across
different devices where a sub ID is not. If the user completely changes
their SIM card, the source_phone_number will be helpful in identifying
that scenario if the user kept their old phone.

Change-Id: Ib35e25216691e580b5ea539929ff16b2e3d30b88
allLogProvider.java
ontactsDatabaseHelper.java
2eb09524fc4b4afd061d30898dba30fab583545a 27-Feb-2015 Makoto Onuki <omakoto@google.com> Enterprise phone lookup should return consistent result...

regardless of requested projections.

In order to rewrite the cursor returned from the corp CP2, certain columns
are needed to compute other columns.
(e.g. PHOTO_URI requires _ID and PHOTO_FILE_ID).

This CL fixes that by always requesting all columns to the corp CP2.
Now rewriteCorpPhoneLookup() shrinks down the projection.

Bug 19545750

Change-Id: Id817d069554ebc89759303760effb557b152d58a
ontactsProvider2.java
ae8f8932b836437e548405387e080388c3686964 27-Feb-2015 Santos Cordon <santoscordon@google.com> Merge "More tests for CallLogBackupAgent"
52a1f4d4882c1e1db7a597f1bddb1cbeaf7af5de 27-Feb-2015 Santos Cordon <santoscordon@google.com> More tests for CallLogBackupAgent

Change-Id: I5f8ff641bbd3b9c186cb6e2e230ae70d02055fe4
allLogBackupAgent.java
3e2e34d46cca69ba09715b7d2e4c165d84d19ee5 27-Feb-2015 Zheng Fu <zhengfu@google.com> Fork ContactAggregator.java to ContactAggregator2.java

This is to copy the file history for new aggregator.

Change-Id: I57994a3c1ed0eaeaffa45bf921b2e17dbcf702d3
ggregation/ContactAggregator2.java
153281e5a15c9fa4db08dace265eb6556216066f 23-Feb-2015 Santos Cordon <santoscordon@google.com> Add simple backup/restore to Call Log.

With this change, call log should be a part of traditional android
backup. All call are backed up with this change. Subsequent changes will
filter down the call log entries which are actually backed up.

Change-Id: Id2e876003a2d0c020142eff7f65426d888fedfc1
allLogBackupAgent.java
415f5c0ebd5dcf2c54c4e8f8ca1a33708c075f67 22-Feb-2015 Santos Cordon <santoscordon@google.com> Add tests for CallLogBackupAgent.

Adds tests for writing and reading the state.

Change-Id: Ie00b3ec0c976195e32275a0a9d75b47ee245966e
allLogBackupAgent.java
fd6ef515b5c582c540b260c87cfb493bbd044643 13-Feb-2015 Santos Cordon <santoscordon@google.com> Simple Backup Agent for the call log.

Simple skeleton agent that reads the state of the call log. Does not
actually do any backup. It logs what calls it would backup and what
calls it would remove from backup. A subsequent CL will add the actual
backup/restore of calls.

Change-Id: Id8832c78a9a5aea71022b45c3cef79ca0b54f584
allLogBackupAgent.java
bModifierWithNotification.java
423f9bc8fed50e2caacd6f99f3160494f15c0a67 12-Feb-2015 Santos Cordon <santoscordon@google.com> Upgrade calllog DB to use ICC ID & source_phone_number.

To accomodate backup and restore of the call log, we have to convert the
existing sub-ID to an ICC ID. Also, add the source_phone_number to the
list of call log columns.

The ICC ID improves backup and restore because it is persistent across
different devices where a sub ID is not. If the user completely changes
their SIM card, the source_phone_number will be helpful in identifying
that scenario if the user kept their old phone.

Change-Id: Ib35e25216691e580b5ea539929ff16b2e3d30b88
allLogProvider.java
ontactsDatabaseHelper.java
ddd1e137585848bc58823e4f6e997ccf61b1b244 19-Feb-2015 Makoto Onuki <omakoto@google.com> am 6278612a: am a435c434: am 463d577c: am 6522ca93: Don\'t use queryContentProviders to avoid "transaction too large" exception

* commit '6278612a04f0e79a30fbb4f35befeb61e9190db3':
Don't use queryContentProviders to avoid "transaction too large" exception
148374fdbe3d723c7485e149afcfed314b2814e0 19-Feb-2015 Brian Attwell <brianattwell@google.com> Persist pre-authorized URIs

When exposing the Authority API, reviewers requested the
API be implemented properly instead of storing the pre-authorized
values in memory.

Bug: 18777272
Change-Id: I31e719b10803344f579bb89c8269f0a597a83c3c
ontactsDatabaseHelper.java
ontactsProvider2.java
6522ca932caf4a4921115a2a3d13068c2357084c 19-Feb-2015 Makoto Onuki <omakoto@google.com> Don't use queryContentProviders to avoid "transaction too large" exception

Instead, use getInstalledPackages, which knows how to circumvent the binder
transaction size limit.

Bug 18261831

Change-Id: I2725af045c60a47bfce6eab966a5c745b6c17870
ontactDirectoryManager.java
5d60a6d96cf144458505e8430bc7631c8420458e 09-Feb-2015 Zheng Fu <zhengfu@google.com> Add new metadata_sync table to facilitate android contacts backup.

This new metadata_sync table will cache the meta data on raw contacts
level from server before they are merged into other CP2 tables.
The data column is the blob column containing all the
backed up metadata for this raw_contact. This table should only be
used by metadata sync adapter.

Bug: 18930508
Change-Id: Iacafe812ed1fbb39b48331b6da56a35ac8f129dd
ontactsDatabaseHelper.java
0f6927a6946350dcb3031baa9ce1c7575f48307e 03-Feb-2015 Brian Attwell <brianattwell@google.com> Merge "Additional change to IS_SUPER_PRIMARY" into lmp-mr1-dev
ec22e2147d07c8a6de7fabeb0c45d22e844d0e6e 28-Jan-2015 Brian Attwell <brianattwell@google.com> Additional change to IS_SUPER_PRIMARY

UPDATE
-----------------
This is being committed a second time, with
two small changes from ag/619454:
1. This CL can be directly cherry-picked to MR1 because
of the simpler unit test
2. Don't run a pointless update() call

Original CL Comment
------------------

Noticed clearSuperPrimarySetting() sometimes clears all
mimetypes's is_super_primary flag values sometimes, even
mimetypes that aren't contained in both raw contacts.

This doesn't appear to have been the intended behavior.
Looks like a simple bug. Wrote a unit test and fixed
the bug. Added a new method to DataUtil used inside the
unit test. This method wasn't strictly necessary. But
it is very useful in later CLs.

(Part #2 or "Remove NAME_VERIFIED" series of CLs)

Bug: 5080996
Bug: 18777272
Change-Id: I7944aae2ad4acb4df6560c5cd086242b7582fbf5
ggregation/ContactAggregator.java
f256a7cf7f78d5ff2573358eb2eadd6f3a2ec9db 28-Jan-2015 Brian Attwell <brianattwell@google.com> Remove NAME_VERIFIED. Part3

Support use of IS_SUPER_PRIMARY instead of NAME_VERIFIED.
The contact aggregator now pays attention to
IS_SUPER_PRIMARY.

Remove all references to NAME_VERIFIED from CP2.

Bug: 18777272
Change-Id: I1579a3122b2d45b80de7106a2b9616e323855045
ontactsDatabaseHelper.java
ontactsProvider2.java
ggregation/ContactAggregator.java
aa7951f3147076cbcb70ec85bb4351600378806a 07-Jan-2015 Zheng Fu <zhengfu@google.com> Handle DB schema migration to facilitate android contacts backup

Add backup_id column to raw_contacts table
and hash_id column to data table.
Add unique index on backup_id and account_id of raw_contacts table.
Add index on hash_id of data table.
Update the raw_contacts and data view to add the new columns.

Bug: 18930508
Change-Id: I571c1115e7fb21e23b1956aaca8a80cf9d026e59
ontactsDatabaseHelper.java
7e0ac8313f2b1dd3a0786810b22a7c7711d39e17 30-Jan-2015 Dianne Hackborn <hackbod@google.com> Merge "No longer need to take care of pre boot msg."
98e8c76f401c7f4d56a9ef28e8f3521d69cdee58 30-Jan-2015 Dianne Hackborn <hackbod@google.com> No longer need to take care of pre boot msg.

Change-Id: Ie000ca609dfeb166451dee24f0cd15622f09c19a
ontactsUpgradeReceiver.java
8ddd7038fb59c1b346ee8baa8fcef57cc3eebf0c 28-Jan-2015 Brian Attwell <brianattwell@google.com> Additional change to IS_SUPER_PRIMARY

UPDATE
-----------------
This is being committed a second time, with
two small changes from ag/619454:
1. This CL can be directly cherry-picked to MR1 because
of the simpler unit test
2. Don't run a pointless update() call

Original CL Comment
------------------

Noticed clearSuperPrimarySetting() sometimes clears all
mimetypes's is_super_primary flag values sometimes, even
mimetypes that aren't contained in both raw contacts.

This doesn't appear to have been the intended behavior.
Looks like a simple bug. Wrote a unit test and fixed
the bug. Added a new method to DataUtil used inside the
unit test. This method wasn't strictly necessary. But
it is very useful in later CLs.

(Part #2 or "Remove NAME_VERIFIED" series of CLs)

Bug: 5080996
Bug: 18777272
Change-Id: I7944aae2ad4acb4df6560c5cd086242b7582fbf5
ggregation/ContactAggregator.java
2ffd05bbcf37129f2126b563e5185f429a9a9042 29-Jan-2015 Brian Attwell <brianattwell@google.com> Revert "Additional change to IS_SUPER_PRIMARY"

This reverts commit c44ee526c56d2f5e680cef24897cff3a922d6a2f.

Change-Id: I2d81fb028eb0672db9cc291ac187c2629435969d
ggregation/ContactAggregator.java
c44ee526c56d2f5e680cef24897cff3a922d6a2f 28-Jan-2015 Brian Attwell <brianattwell@google.com> Additional change to IS_SUPER_PRIMARY

Noticed clearSuperPrimarySetting() sometimes clears all
mimetypes's is_super_primary flag values sometimes, even
mimetypes that aren't contained in both raw contacts.

This doesn't appear to have been the intended behavior.
Looks like a simple bug. Wrote a unit test and fixed
the bug. Added a new method to DataUtil used inside the
unit test. This method wasn't strictly necessary. But
it is very useful in later CLs.

(Part #2 or "Remove NAME_VERIFIED" series of CLs)

Bug: 5080996
Bug: 18777272
Change-Id: I354ffe51ea64cc532387d7ba79fbb6d2389d662e
ggregation/ContactAggregator.java
75b452b88ad2841415a48e95706f538428ec200a 27-Jan-2015 Brian Attwell <brianattwell@google.com> Change IS_SUPER_PRIMARY reset logic

CHANGES
1) change is_super_primary reset as discussed in
go/proposed-change-to-resetting-super-primary-on-join
2) fix a bug in case #1 of testAggregation_clearSuperPrimary and
extended the case a bit. Previously, both data rows had
is_super_primary=false at setup instead of both true

REASON
This is mostly for the benefit of Lychee and future contact editor
changes.

This CL was also needed to make removing use of NAME_VERIFIED
from GoogleContacts possible. At the very least, IS_SUPER_PRIMARY's
behavior is now more consistent with NAME_VERIFIED.

Bug: 5080996
Bug: 18777272
Change-Id: Ic3c17fcb1757f5966a7c6a52cf489083d5b8e51a
ggregation/ContactAggregator.java
50f5cdd4a9c33896f2afadb0f8c4ebc09a75fa5a 26-Jan-2015 Kenny Guy <kennyguy@google.com> am c219a079: am b5e3a4c8: am abaa423f: Fix cross profile caller id to use manager profiles userid.

* commit 'c219a07962ad9cdaed157af9bd72232f4e5e6820':
Fix cross profile caller id to use manager profiles userid.
abaa423fa15f00b07b9c92c16ee186c909cac145 23-Jan-2015 Kenny Guy <kennyguy@google.com> Fix cross profile caller id to use manager profiles userid.

Cross profile caller id was checking myUserId when
deciding whether to allow caller id from manged profiles
where it should have used the managed profiles userid.

Bug: 19122752
Change-Id: I230fc933655cd9464d00b619a383ff0682660c12
til/UserUtils.java
c7ad9cf70433ea44746208ff56da910346f7e066 16-Jan-2015 Jay Shrauner <shrauner@google.com> Fix log TAG that was too long

Log tags >25 characters are dropped, so abbreviate

Bug: 19030945
Change-Id: I3a66ffcb41977db24e2e3ff16e6f22b530a78584
bModifierWithNotification.java
e05d1118d89cdbfc9bc0558d04af3ca3b2c6a508 08-Jan-2015 Brian Attwell <brianattwell@google.com> Ubundle from contacts contract Part 2/3

Remove ProviderStatus.DATA1

Discussion: go/contacts-contact-intent-ui

Bug: 18777272
Change-Id: I9c6125cc30710e4637b38f3785608abb9928d1a2
ontactsProvider2.java
becda5cc4e265ab2cc3fc958e39de08380abd6c3 10-Dec-2014 Zheng Fu <zhengfu@google.com> Merge "Skip aggregation if candidate contact contains too many raw contacts" into lmp-mr1-dev
085a7471448168069dac091eeb8a1c5e76138ffb 08-Dec-2014 Zheng Fu <zhengfu@google.com> Skip aggregation if candidate contact contains too many raw contacts

This is likely an error or a shared corporate data element
Bug:18641722

Change-Id: Icab78bcf621363a5b887095c043e2e1e3a2e1ca4
ggregation/ContactAggregator.java
eb10c527fcd100d485f2d27a8a1ffea585960802 04-Dec-2014 Jay Shrauner <shrauner@google.com> Fix package manager TransactionTooLargeException

Change resolvePhotoPriorityFromMetaData to use
PackageManager.queryIntentServices to avoid grabbing too much data back.

Bug:18607092
Change-Id: I32234d4906395b4940d28cc3661e49bb3de929e2
hotoPriorityResolver.java
098215569d35a130c883933ec76773e85356387e 21-Oct-2014 Zheng Fu <zhengfu@google.com> Modify the contact split logic to avoid over-split issue.

Details

If the best matching contact doesn't contain any raw contacts from the same
account as the given raw contact, join them together if no identity mismatch
between them on the same namespace, otherwise, keep them separate.

If the best matching contact contains raw contacts from the same account as
the given raw contact, join them together if they share at least one email
address, phone number, or identity; otherwise, re-aggregate raw contact and all
the raw contacts of best matching contact.

When re-aggregation is needed, re-aggregate all the raw contacts (given raw
contacts plus all the raw contacts of the best matching contact) based on the
pair-wise connectivity. Two raw contacts are considered connected if they share
at least one email address, phone number or identity.

Bug:18304324
Change-Id: Ic5a27a23c2f64f534f7a7eaf5f3fb474e877c207
ontactsProvider2.java
ggregation/ContactAggregator.java
df1e589415a68f4427219459ced28638d382132b 13-Nov-2014 Zheng Fu <zhengfu@google.com> Make the email comparison case-insensitive for contact aggregation.

Bug:18304324
Change-Id: If9e11022e392323b770c7560eba69617769ca080
ggregation/ContactAggregator.java
3a219cc3f5045bdebfcd975bf857c6ff26886a22 25-Oct-2014 Yorke Lee <yorkelee@google.com> Sync call log entries to secondary user on background thread

Add code (similar to CP2) to offload tasks onto a background thread. This
is a bit overkill for now but will be useful when we add stuff like call
log syncing.

Also add some new methods to MockUserManager needed to pass tests.

Bug: 18056687
Change-Id: If51f64895d16029ecca1d1c46573324891e1d4d0
allLogProvider.java
876e356dd86d0fc2a878faddcc04d861b06e65d4 08-Oct-2014 Yorke Lee <yorkelee@google.com> am 04707de5: am f624d76a: Use ContactsProvider context when sending broadcast

* commit '04707de5ab7364052a74df2b5261e0215d5db345':
Use ContactsProvider context when sending broadcast
f624d76a4ca27e4c80cd0f483500b0139e36c9c7 08-Oct-2014 Yorke Lee <yorkelee@google.com> Use ContactsProvider context when sending broadcast

Bug: 17879141
Change-Id: Iebc12962837ce4c7c026aa792762317d90097d9d
rofileProvider.java
5799f2bcbabe927ed91e3df4f71e54f8cb1f770c 16-Sep-2014 Zheng Fu <zhengfu@google.com> DO NOT MERGE synchronize photo storage creation for race conditions.

Several exceptions were reported regarding "Unable to create photo storage
directory /data/user/0/com.android.providers.contacts/files/photos".
It might caused by the fact that File.makeDirs() is not thread safe.
So make it syncrhonized to resolve this issue.

Bug:17505392
Bug:17449819
Change-Id: I494204424c024c2166340af609423a669e741761
(cherry picked from commit 240d10d677b4acfeda5aa6e66c2cdea9ae02769b)
hotoStore.java
240d10d677b4acfeda5aa6e66c2cdea9ae02769b 16-Sep-2014 Zheng Fu <zhengfu@google.com> synchronize photo storage creation for race conditions.

Several exceptions were reported regarding "Unable to create photo storage
directory /data/user/0/com.android.providers.contacts/files/photos".
It might caused by the fact that File.makeDirs() is not thread safe.
So make it syncrhonized to resolve this issue.

Bug:17505392
Bug:17449819
Change-Id: I494204424c024c2166340af609423a669e741761
hotoStore.java
84e66f5469168132e0ef8efc5e6f08f21608b383 05-Sep-2014 Zheng Fu <zhengfu@google.com> DO NOT MERGE Remove default settings during contacts aggregation.

Set is_super_primary to 0 for all the shared mime-types's data
between aggregated contacts.

Bug:5080996
Change-Id: Ie65259c11d719b343f234e5fccf883491e7992a7
(cherry picked from commit 96ddeddc52c85710a10cd8266c054ff1b1c5a52b)
ggregation/ContactAggregator.java
1c6905d2f799d81d5cb847c44fca7dc7d36fd684 05-Sep-2014 Yorke Lee <yorkelee@google.com> Follow ContactsContract API changes

Bug: 17390425
Change-Id: Ia88fb0235a56becc3ec5a770067856311769a68c
ontactsProvider2.java
a5d6539589c851152bbf6665c1addfc2c7292dba 02-Sep-2014 Yorke Lee <yorkelee@google.com> Delete stale calls in a managed profile's call log table

Bug: 17096027
Change-Id: Ia640ef8a8f88eb5f9ff9eddc096bcaf334bba3c9
ontactsDatabaseHelper.java
34ea500bee5828f1dbd0e19d31d91aa1e979382a 28-Aug-2014 Nancy Chen <nancychen@google.com> Merge "Handle db upgrade for non-Sprout devices to match Sprout devices." into lmp-dev
dcf33302ccef41224e40623d72943a295f211b02 28-Aug-2014 Nancy Chen <nancychen@google.com> Handle db upgrade for non-Sprout devices to match Sprout devices.

Sprout devices will have an extra sub_id column in the calls table,
add this column to non-Sprout devices, and copy data from sub_id column
to subscription_id column for sprout devices in calls table.

Bug: 14990572
Change-Id: Id334011c34833e44954d793947b65222183a0b09
ontactsDatabaseHelper.java
ec9680853b8526568a96805e38af77f3c6da175a 26-Aug-2014 Makoto Onuki <omakoto@google.com> Address API review comments:

- Rename isCorpContactId() to isEnterpriseContactId().

Bug 17253963

Change-Id: Ib89b491c52f2b1326a11c991574a117f75fc8bcd
ontactsProvider2.java
89c3c5706ca0b4b061b3f3a1a7ee27d9c0e43d60 16-Aug-2014 Yorke Lee <yorkelee@google.com> Add a maximum length check when inserting or updating phone numbers

Bug: 14307606
Change-Id: Id17a122cb9e86f9ae64232773869cb2108754ed0
ontactsProvider2.java
11d1e5f60f518e805c5f358f5376b87c08ef69d9 11-Aug-2014 Makoto Onuki <omakoto@google.com> Fix getMimeTypeId/getPackageId

In the old code we only put ids to the cache in the insert case, but the
select case. This means once the process restarts it'd never put anything in
the cache.

Also added the test for the conflict case.

Bug 16574964

Change-Id: I9979b61b6e1a3f04a81bcf2b78a678378f1a009c
ontactsDatabaseHelper.java
9c9432da4380689419c9b18fb8955eeaec8ca86d 11-Aug-2014 Yorke Lee <yorkelee@google.com> Merge "Block access to call logs from the corp profile" into lmp-dev
274d8ef297b883065bf108e4e26caaa9707ddf79 10-Aug-2014 Yorke Lee <yorkelee@google.com> Block access to call logs from the corp profile

Bug: 16812842
Change-Id: Ie4342b5efb2419097c35c0ddebd486a098cea523
allLogProvider.java
fe1156f671fadb4dc2302634793f5fbf18423ce7 09-Aug-2014 Yorke Lee <yorkelee@google.com> Add authority for ProfileProvider to fix CP2 NPE at startup

Bug: 16901202
Change-Id: Id47e979a8509fd5b9436970e5150e320390c7bd5
ontactsProvider2.java
9701936fadaf55ef773dd07015b35f99fd5f8a91 07-Aug-2014 Makoto Onuki <omakoto@google.com> Add unit tests for enterprise caller-id

Also fix a few issues:
- Fix projection map for phone_lookup/enterprise and add PHOTO_FILE_ID
- Null out custom ringtones from the corp CP2. Returning rintones in the corp
profile really doesn't make sense.
- Fix a log in queryPhoneLookupEnterprise().

Change-Id: If0617225228c526d4b7d87e9c95f6fbe090242a0
ontactsProvider2.java
ad847316fe64c958b65bc05eb736e704bc56b23f 07-Aug-2014 Makoto Onuki <omakoto@google.com> Fix "UNIQUE constraint failed: mimetypes.mimetype"

With the old code there was a chance of two threads trying to write the same
mimetype simultaneously, ending up getting "UNIQUE constraint failed".

One possible way to fix it is just to add locks, but doing so *might* cause
deadlocks due to implicit locks in SQLiteDatabase. So in this CL, we just retry
when we detect a conflict.

Unfortunately we can't use a transaction here because this method is called
from onCommitTransaction() too.

Also refactored the code to unify getPackageId() and getMimeTypeId().

Bug 16574964

Change-Id: I66274dfd080ae808795a4d59d30978b1ca1c06c0
ontactsDatabaseHelper.java
ontactsProvider2.java
334bb1c93b85b0b3e3feb7d7e1ebd7efabcc1f38 31-Jul-2014 Yorke Lee <yorkelee@google.com> Fix for incorrect PinnedPositions in RawContacts due to legacy pinnedpositions value

Bug: 16403306
Change-Id: I8d23b74b4ecf3e8d9f76bff130720bf7195ef8d0
ontactsDatabaseHelper.java
ontactsProvider2.java
4a47775ab4008165328ddab97f5151ddd94d9ab8 30-Jul-2014 Yorke Lee <yorkelee@google.com> Fix broken aggregation behavior for pinned contacts and tests

Update the value of some pre-defined constants in tests
Make sure that aggregation correctly sets pinned positions for
aggregated contacts - the lowest pinned position of all constituent
raw contacts, and 0 if none of them are pinned.

Bug: 16628573
Change-Id: I3e072baf7ff933a6eef861ed394f3fc817aee48b
ggregation/ContactAggregator.java
7f4ce37bd099d8dbad3177a2b9ebe341811a5ce2 30-Jul-2014 Yorke Lee <yorkelee@google.com> Follow ContactsContract API change

Bug: 16403306
Change-Id: I21d25ba836d9d9ab45a7ebdca0e2f24f8c678e43
ontactsProvider2.java
astScrollingIndexCache.java
8a8ddc3d1ceee9872ace06326ebe999ba171f70b 25-Jul-2014 Makoto Onuki <omakoto@google.com> Do not build NAME_LOOKUP from phonetic names

This prevents aggregation by phonetic name

Note: if a contact only has a phonetic name (i.e. without any non-phonetic name components), then
its display name is set from the phonetic name. This CL does *not* prevent phonetic-name-based
display names getting into NAME_LOOKUP, meaning if two contacts have no names but the same phonetic
name, then they *will* still be aggregated. But this shouldn't be an issue since what was an issue
was "aggregating two contacts with *different* names with the same phonetic name".

Bug 10957673

Change-Id: I6484128b1f7e4bbe1b08c57969a8a1ef147d5c7d
ontactsDatabaseHelper.java
ataRowHandlerForStructuredName.java
0fc2f46b80df2c4c14bec40055eb6b954c0c6523 25-Jul-2014 Yorke Lee <yorkelee@google.com> Merge "Update the value of PinnedPositions.UNPINNED to 0" into lmp-dev
96062013ec40d4b60dd162a6e4a7146690247a3e 21-Jul-2014 Yorke Lee <yorkelee@google.com> Update the value of PinnedPositions.UNPINNED to 0

Bug: 16403306
Change-Id: I86fcd1f2d1d145edf1ba3d4bd8ce21d14dcb94d0
ontactsDatabaseHelper.java
1d69b2f3576af29b1653ccb372142e04e3e158e9 24-Jul-2014 Yorke Lee <yorkelee@google.com> Add Calls.TRANSCRIPTION to CallLog (1/2)

Dialer needs access to the TRANSCRIPTION column via the CallLog to
show voicemail transcriptions inline.

Change-Id: Id1807923a07af9e9e34783e6be2e39485eee7795
allLogProvider.java
b0828df351e8b261ab36c8af37929bf3d9d6a4f9 17-Jul-2014 Makoto Onuki <omakoto@google.com> Check DPM.getCrossProfileCallerIdDisabled in caller-id

- Also add a test for UserUtils
- Also fix broken tests due to UserUtils.

Bug 16467654
Bug 15779911
Bug 16458399

Change-Id: I64a4526b512fce94590b75eae037a8bdcd874064
til/UserUtils.java
2ad39edbd856f3ea1177788aff7e653e593781eb 19-Jul-2014 Yorke Lee <yorkelee@google.com> Rename voicemail permissions

Rename READ_ALL_VOICEMAIL to READ_VOICEMAIL, and MANAGE_VOICEMAIL
to WRITE_VOICEMAIL
Bug: 16400686

Change-Id: I45d841b886c2bbe230c2f13fddbce41a729b6c61
allLogProvider.java
bModifierWithNotification.java
oicemailContentProvider.java
oicemailPermissions.java
3b34457a4cc0d2c55676f366ddc673091a198adb 17-Jul-2014 Yorke Lee <yorkelee@google.com> Sync call log entries from the primary user into the secondary user's call log

On startup of a secondary user's call log provider, sync any call log entries from
the primary user's call log that are:

1) Newer than the last sync time
2) Not a voicemail
3) Not a duplicate entry (identified by the number, and start time of the call)

Bug: 16298776
Change-Id: I843dfd8dd5c9433942e610cbbc2dfed95c29dd1c
allLogProvider.java
ontactsDatabaseHelper.java
til/UserUtils.java
a73b09bd8df85c93f1c95356efc1c41c103b11cc 17-Jul-2014 Yorke Lee <yorkelee@google.com> Fix broken tests in CP2

Change-Id: I1c198cbf086c7f267178a26d2a50123a8edaec12
til/UserUtils.java
d841fcb6aeb9fe7cb9454668bf641782f88f4382 16-Jul-2014 Makoto Onuki <omakoto@google.com> Address comments on commit 498944

Bug 15779911

Change-Id: I68ea7be682696efb40ff3bfc0ac615466402c8db
til/UserUtils.java
d372af60001602a8c6cccf6258b514360c69b513 14-Jul-2014 Yorke Lee <yorkelee@google.com> Add TRANSCRIPTION column to Calls table

Bug: 10928782
Change-Id: I8e0e53e3c746baa64dd868a0e1c57444e2050578
ontactsDatabaseHelper.java
oicemailContentTable.java
a6fa2dbe5da5a42e59e071c5d591f64aa9f28392 11-Jul-2014 Makoto Onuki <omakoto@google.com> Merge "Enterprise caller-id: Do not null out most fields."
3ffe262d93ca0f5669f838c08d5f8384c50eae0f 10-Jul-2014 Makoto Onuki <omakoto@google.com> Enterprise caller-id: Do not null out most fields.

This follows change I21ab20ad4147b303cd0d49d33b64a38275342dc5.

Bug 15779911

Change-Id: I62f0a7a17ec98e6e2fc650defa4843b9e04dbff2
ontactsProvider2.java
0e32b9e074465b24f491a0420110097b3c6fa08f 10-Jul-2014 Tyler Gunn <tgunn@google.com> Merge "Add features and data_usage columns to calls table."
a315de3cb1c62569f7de1f25ec5b4ad425ebdf07 10-Jul-2014 Tyler Gunn <tgunn@google.com> Add features and data_usage columns to calls table.

Bug: 16015261
Change-Id: I08d28a5af5b52cc8ca2e03e6db82f68807c1f69f
allLogProvider.java
ontactsDatabaseHelper.java
a2ca64be8750390170f151bd8368bd38699329a2 10-Jul-2014 Brian Attwell <brianattwell@google.com> Merge "Add the enterprise caller-id API"
5f9dbc1d2645f20ce883c11f6b2511503cecf8ce 09-Jul-2014 Makoto Onuki <omakoto@google.com> Add the enterprise caller-id API

Also Moved UserUtils to utils/

Bug 15779911

Change-Id: Ia4445772f12ebbc0f7832f3700c6fecf2ba13dd2
ontactsProvider2.java
serUtils.java
atabase/MoreDatabaseUtils.java
til/UserUtils.java
2ce22af86c7d6ea3c7d2944666609cbdbf9adc53 10-Jul-2014 Yorke Lee <yorkelee@google.com> Fix permission denial when cleaning up voicemail

Revert the change to use checkCallingPermission instead of
checkCallingOrSelfPermission when checking permissions.

Fixes a crash when CP2 runs its own voicemail cleanup service

Change-Id: I176ab9a3537bcfd37c76106750bc3be821fd615d
oicemailPermissions.java
2a836304091bf37a466c3a56e3b880222f518063 09-Jul-2014 Yorke Lee <yorkelee@google.com> Merge "Add manage voicemail permission (2/4)"
357a8cc44c59c5cf9528789ca949f6f0982e7ec7 09-Jul-2014 Yorke Lee <yorkelee@google.com> Merge "Update CP2 snippeting argument defaults (1/2)"
471923b8d71fb7f9632cad2de4f1583eeda61b62 08-Jul-2014 Yorke Lee <yorkelee@google.com> Update CP2 snippeting argument defaults (1/2)

The Contacts app was the only user of the snippeting functionality in
CP2, so update the default snippeting arguments to those in the Contacts
app.

Also fix some tests that had incorrect assumptions about outdated
functionality.

There is one remaining broken test in CP2 - testSearchByEmail. That has to do
with some special treatment with indexing email addresses and FTS search which
will take some more time to figure out.

Bug: 6948882
Change-Id: Id9af3ceb2dfa43a11ae528e3ab6b42371130a1f7
ontactsProvider2.java
6bcd74c4bc4a14d848a8407562b10a14876082df 08-Jul-2014 Makoto Onuki <omakoto@google.com> Enterprise: Add utility method to retrieve corp user handle.

Also show current user handle in verbose log.

Bug 15779911

Change-Id: If9dac500da44b351232ac8af53dc011be043d010
ontactsProvider2.java
serUtils.java
b078d625665a07e1349bcf7b3c6eff56400f9917 02-Jul-2014 Ihab Awad <ihab@google.com> Fix references to two constants

The names of two constants missed getting updated in a previous CL,
causing a build breakage.

Change-Id: I4853b8647c69bf2b12de43dc8a67fca75822fb14
allLogProvider.java
ontactsDatabaseHelper.java
e7c49d796e7e7043b3f2f8e3e7b274b3ba706756 01-Jul-2014 Ihab Awad <ihab@google.com> Rename Telecomm "Subscription" to "Account" (5/7)

Change-Id: If42f8c76ad0d347a3b387de4fa806148a0a2d780
allLogProvider.java
ontactsDatabaseHelper.java
aadbf3baac3fb4f0abf10157675ce8d45decb795 01-Jul-2014 Tyler Gunn <tgunn@google.com> Merge "Changing call log adapter to normalize phone number where possible."
54b97025256764a01f927792e64de8bf369e12f1 01-Jul-2014 Yorke Lee <yorkelee@google.com> Clean up SearchSnippetColumns API (2/3)

Bug: 6948882
Change-Id: I549321e5ecf789f55a67ad4fbf5b939400ff20b8
ontactsProvider2.java
lobalSearchSupport.java
778df2417da0c0186862b25519ce65ed633a9b6d 01-Jul-2014 Tyler Gunn <tgunn@google.com> Changing call log adapter to normalize phone number where possible.

Bug: 15616526
Change-Id: Id8fe981a622bdea786a48cbadf9ff08289ae3987
ontactsDatabaseHelper.java
efaultCallLogInsertionHelper.java
ab2ec1d4316770e2ce8dc47dd1ae71430cd70e36 25-Jun-2014 Yorke Lee <yorkelee@google.com> Add manage voicemail permission (2/4)

Update CallLogProvider and VoicemailProvider to provide read/write access to
voicemails based on their respective permissions.

Also update tests to reflect the new world.

Bug: 6948882

Change-Id: I26e960eae24dc1b8bd4a372420d4c42f242c88d3
allLogProvider.java
bModifierWithNotification.java
oicemailContentProvider.java
oicemailPermissions.java
6749114ea49788806973a7dea493a5ac52b00a8c 23-Jun-2014 Nancy Chen <nancychen@google.com> Update database schema for saving of subscription info in call log

Added fields "component_name" and "subscription_id" to call log table in
order to save information about the subscription responsible for placing
a call. Additionally made sure relevant tests pass.

Bug: 15473965

Change-Id: I0ed99452c3cdfdba31f1a71fb342406b0652e282
allLogProvider.java
ontactsDatabaseHelper.java
c0552e72e9329571176ae4357eafc07145c492b8 26-Jun-2014 Yorke Lee <yorkelee@google.com> Protect undemote method with permission check

Undemoting goes through a separate code path as the rest of the
CP2 queries/updates, so we need to do a permission check for the
WRITE_CONTACTS permission

Change-Id: I547270376c55f6ff311d5712eef8a6b0b923eee8
ontactsProvider2.java
ea74e9335e384b6abaf1daac9a7a534d5f3d7ff7 25-Jun-2014 Makoto Onuki <omakoto@google.com> Show caller PID in the verbose log.

Change-Id: I1d42a39eb8a27d65b4208dd2174f919929b0fb94
ontactsProvider2.java
ec25418988bb77d1f2482bc2f953cfd361c0f97e 20-Jun-2014 Yorke Lee <yorkelee@google.com> Update PinnedPositions API (1/2)

Follow the framework changes that deleted UPDATE_URI in
ContactsContract.PinnedPositions

Bug: 15593967

Change-Id: Ibf5b0d7fa7588b60742b324ba125075e28d9cc81
ontactsProvider2.java
dcffbdc062336c5403f9f5e1aadbba3f49db335f 18-Jun-2014 Yorke Lee <yorkelee@google.com> PinnedPositions API changes

Add UNDEMOTE_METHOD that is called to undemote a contact
Fix CP2 tests to use batch content provider operations instead of
PinnedPositions.UPDATE_API

Bug: 15593967
Change-Id: Id93c6ac0e214e59107725416b7865c56c9df32f3
ontactsProvider2.java
130dde5aed341af5be72ae7b97ab4485cf4e400e 20-Jun-2014 Paul Soulos <psoulos@google.com> Updates SQL alias in CP2

Change-Id: I73c0b8ee1833feefc60fa7024276222fcfb146c5
ontactsProvider2.java
9214ced257fea11a48d9ed0e2bbfd0da39cb4606 20-Jun-2014 Paul Soulos <psoulos@google.com> Added usage stats to Entity

Change-Id: Idf06de011d1c01ea7dda174189e676177f9c5847
ontactsProvider2.java
3ccaf5590a7ed2fca780f9b7fc46328d0f78a2ee 17-Jun-2014 fafaisland <fafaisland@google.com> Add READ_ALL_VOICEMAILS Permision to VoicemailPermissions, VoicemailContentProvider
and CallLogProvider

Bug:15695227

Change-Id: I244541c847c07450535a52d0bf38199b55387202
allLogProvider.java
oicemailContentProvider.java
oicemailPermissions.java
3ef26b5979ca194cc0a528825794be0386508ccf 23-May-2014 Jay Shrauner <shrauner@google.com> Fix aggregation merging of null display names

Fix aggregation merging if first raw contact lacks a display name.

Bug:15192402
Change-Id: Ibf125c1bbe7f5fc55302ea66ec405567930de300
ameNormalizer.java
9984dca0b705d0b8e1556c06f73ba3f05a85d517 23-May-2014 Jay Shrauner <shrauner@google.com> Merge "Catch 0 width/height scaled Bitmap sizes"
da5774624b1ecf2554d8492e174930d246ec94ee 23-May-2014 Jay Shrauner <shrauner@google.com> Catch 0 width/height scaled Bitmap sizes

Change getNormalizedBitmap to catch attempts to scale bitmap to 0 width
or height (which would throw an uncaught IllegalArgumentException) and
instead throw an IOException, which is caught and handled by the higher
level code.

Bug:15189759
Change-Id: Ifb23d0b0d4e1c2e8038b472840a464194fbfa800
hotoProcessor.java
a8cc5cd6a466a88aa410da6834b75c0210836632 22-May-2014 Santos Cordon <santoscordon@google.com> Merge "Add reserved upgrade version."
17f2d60a0fa76dec836b7bda60a029fe5c40356a 20-May-2014 Jay Shrauner <shrauner@google.com> Fix acore crash in DB upgrade

Remove unused getProperty() call in upgradeLocaledata() that created
a recursive call to getDatabase()

Bug:15091283
Change-Id: I372763aaff3daf47c3b191c3dc669d26a4b25a62
ontactsDatabaseHelper.java
d67388bb557c15f92c47c62214429c7c621d00cb 15-May-2014 Santos Cordon <santoscordon@google.com> Add reserved upgrade version.

Bug: 14990572
Change-Id: I0b5d4e305bc8104ec5ccc6c8fb692ba618ffff5f
ontactsDatabaseHelper.java
d4dbd063cf88e70b045607aa865b2fdb2329bf45 17-Oct-2013 Jay Shrauner <shrauner@google.com> Support secondary locales

Add support for tracking a secondary locale in addition to the current
primary locale for CP2. Switch to using parseable ICU language tag
(eg, "en-US") for locale tag written to DB. Secondary locale is set to
previous locale on locale change and persisted in CP2 DB and prefs.

Bug:8715226
Change-Id: Ia68397fd9118d89f3a45ac54f991f86bad42870e
ontactLocaleUtils.java
ontactsDatabaseHelper.java
ontactsProvider2.java
anziToPinyin.java
ocaleSet.java
03bc605b5c6f17deae7ad8efbd928abdc5d78854 07-Apr-2014 Ben Gilad <gilad@google.com> Replace the global mValues reference in ContactsProvider2.java
by local instances.

Change-Id: If520599d00dc51dc6e2c99bfedd2baa90e4eb28e
ontactsProvider2.java
a157bdc5a6bc0b4bdf889d0ed6475571bc547012 03-Apr-2014 Ben Gilad <gilad@google.com> One more cleanup CL before the change to remove/replace mValues.

Shouldn't include any functional changes, mostly focused on
dead-code removal, also removing unused/unnecessary code/logic,
tightening up access modifiers (e.g. using private vs. public) as
much as possible, using Java's built-in iteration when applicable,
grouping variables by static/non-static and access modifiers (e.g.
private members last, etc).

Change-Id: I4fa6af136b5da0ae6183eadce4798746b18813cb
ontactsDatabaseHelper.java
ontactsProvider2.java
53ab19d6d135d948620f3a648aeded79a8e7e761 03-Apr-2014 Makoto Onuki <omakoto@google.com> Merge "Partial revert of db1acfece867c4133e1749826f74f5b4e8eed1b2 (http://ag/383391)"
b118e62332952ad5ff4388736de08d0fa75117da 03-Apr-2014 Makoto Onuki <omakoto@google.com> Partial revert of db1acfece867c4133e1749826f74f5b4e8eed1b2
(http://ag/383391)

Do not use constants for initializing the UriMatcher --
it'll make it hard to glance supported URIs.

Bug 13302012

Change-Id: Ic24e535828cff6111bd0649519e24bcc1a9d2a3b
ontactsProvider2.java
ed01879a61a3687dad0bfba133733e4e379331ba 02-Apr-2014 Ben Gilad <gilad@google.com> Remove some dead/unused/boilerplate code.

Change-Id: I8f7a232cd2b2452a46444bb6b8f45df05f8e1e81
ontactsProvider2.java
3ea7c7eccfa269f88fb86659e1d28eaecf27fb0d 26-Mar-2014 Yorke Lee <yorkelee@google.com> Bump database version to rebuild search index

Bug: 11059351
Change-Id: I17e123859765d8194d463ec412e44e55f479cf73
ontactsDatabaseHelper.java
de853799fa95c596616e138f3ef2e66b1f9f95a6 26-Mar-2014 Yorke Lee <yorkelee@google.com> Correctly append contact IDs in SearchIndexManager

Bug: 11059351
Change-Id: I5d5193e37bf6cdbf059779f745cc73314c751962
earchIndexManager.java
1dc1cfb821c03a17c8b09265fdfd7260023e6767 11-Mar-2014 Yorke Lee <yorkelee@google.com> Update search index for entire contact when raw contact is modified

Bug: 11059351

Change-Id: I7c8989fd8505f888f5bc8605e68a2d73d0142b76
earchIndexManager.java
9273f0155a8dafa61527ef8a71f3e0eaff3e4b8a 05-Mar-2014 Brian Attwell <brianattwell@google.com> Add IN_DEFAULT_DIRECTORY to views and projections

Bug: 13173524
Change-Id: I6c0947d4978e204ce1268f65eab5e1cc66bda664
ontactsDatabaseHelper.java
ontactsProvider2.java
bf98e55afd5f39f72dc05c704409655b89a7fa25 27-Feb-2014 Brian Attwell <brianattwell@google.com> Do not ignore leading "*"s in phone lookups

After a phone lookup, "remove" entries from the cursor that
don't match the queried number w.r.t. to whether it has a leading
"*". "Removing" entries from a cursor involves making a partial
copy of the cursor.

This CL affects as little functionality as possible, so that it
can make it into MR2. Ie, we continue to ignore leading "*"s
in other CP2 queries.

MANUAL TESTS:
-Add a "*123" Emergency contact and "123" Voicemail contact
-Call "*123", then call "123". You should see two seperate
entries in your call log. In addition, the incall screens
should show Emergency and Voicemail respectively (although
the "123" call doesn't work properly inside the incall
UI right now. This is a seperate bug b/13195342).

Bug: 13195334
Change-Id: I7e1938ccb085630072611eb63148c5714b62fee8
ontactsProvider2.java
honeLookupWithStarPrefix.java
a51e58d4c7b081bff851e7200a8eae7d946b949e 27-Jan-2014 Yorke Lee <yorkelee@google.com> Respect user-defined selection in STREQUENTS query

The starred portion of the query in the starred+frequents
query does not respect the user's selection. This CL adds
the selection as an AND clause in the query.

Change-Id: Ie36931b0733e3aab05c3d7e2461843e5f3ec7f2d
ontactsProvider2.java
82d88d65f65a0e3eb816cd1ae9d81a0fd78d8a17 10-Jan-2014 Yorke Lee <yorkelee@google.com> Fix EMAIL_FILTER ranking for duplicate emails in different accounts

When there are there are two identical email data items, each belonging
to a different sync adapter account, the "SELECT DISTINCT" operator
causes the two emails to be incorrectly grouped before the account
prioritization sort order is applied.

This can cause the email address to be labelled with the wrong account,
causing it to be incorrectly ranked as an email address from another account.

To fix this, account name and type is added to the group by clause to
ensure that each email address is grouped correctly based on their account
before ranking them by account priority.

Bug: 12207447
Change-Id: Ib79f6c36ee6a83838bcaa82487f2f7fb9716bbf4
ontactsProvider2.java
843ab4932e7bd693c81b769f61e1a56be5b43662 23-Nov-2013 Chiao Cheng <chiaocheng@google.com> Fixes cases when a contact was deleted via the contacts app.

In this case, the contact id of the raw contact is nulled out. This has the
side effect of making the IN clause of sqlite never equal. Similar to:

SELECT 1 as id WHERE id NOT IN (SELECT null);

always returns 0 rows because the comparison to null is always false.

Protect against this case by eliminating null contact ids.

Bug: 11826565
Change-Id: Ide9b150bb7f94d03c210d43dbc8cdd5c42c21cf9
ontactsProvider2.java
5dcf56d7a35fb2ca2c08c6a3e8a3c60a8f32cdbc 08-Nov-2013 Chiao Cheng <chiaocheng@google.com> am 0c52af7a: am c4065090: am 25441f56: Merge "Fix broadcast of CONTACTS_DATABASE_CREATED intent." into klp-dev

* commit '0c52af7a3e137f131dcec1c45589291296911a87':
Fix broadcast of CONTACTS_DATABASE_CREATED intent.
ff3e7fb1c51dc695d4cdf64e25cb17f1364bcddc 07-Nov-2013 Chiao Cheng <chiaocheng@google.com> Fix broadcast of CONTACTS_DATABASE_CREATED intent.

The intent needs to be fired after database creation in case the user does
a clear data. This is needed in addition to the boot receiver to cover
all cases.

Bug: 11570016
Change-Id: Iaa3d952cc6db0a9c0e55e209f5fe41919ae7250a
ontactsDatabaseHelper.java
db1acfece867c4133e1749826f74f5b4e8eed1b2 01-Nov-2013 Chiao Cheng <chiaocheng@google.com> Use content_uri constants instead of locally defined string.

This makes it easier to trace URI to provider methods and visa versa.

Change-Id: I7961eeba3b88362f1323483ede14865dc7f56948
ontactsProvider2.java
rofileAwareUriMatcher.java
17f0e396eadf053c9f5bd25422015c15d7edab0e 10-Oct-2013 Jay Shrauner <shrauner@google.com> am 901b8c98: am 116f57fe: Catch potential NPE

* commit '901b8c98ecba095d53b8cc811a2c8c00ab0faad7':
Catch potential NPE
116f57fe659db05186ce85aa192bd65a974684e9 09-Oct-2013 Jay Shrauner <shrauner@google.com> Catch potential NPE

Catch case where country detector might return a null country

Bug:11139097
Change-Id: I5d4841a8f8d852e18cff1f9c359d5e005c7e58b8
ontactsDatabaseHelper.java
ontactsProvider2.java
a886d59650d3a1e50e2b6727e27a69a8cddefd46 03-Oct-2013 Jay Shrauner <shrauner@google.com> Merge "Fix Serbian address labels in non-Serbian locale"
d3b23d40bc15640abaeafa4041737b59f61ea557 02-Oct-2013 Jay Shrauner <shrauner@google.com> Fix Serbian address labels in non-Serbian locale

Add Serbian labels to default set (previously was only using Ukrainian
for Cyrillic languages when in a non-Cyrillic locale). This adds a net
of 3 new labels to the default label set. Added unit tests for Serbian
and Ukrainian unique characters.

Bug:11030904
Change-Id: Id35bf963ea10b89554aa0743d0f215c124b44c8d
ontactLocaleUtils.java
a16c2509fa398159988861a3fc8408b493fa445b 01-Oct-2013 Christine Chen <christinech@google.com> Filtes out legacy number in call logs

Bug: 10966248
Change-Id: I297925f336114d98c1109158e19546e81f03fe90
allLogProvider.java
efaultCallLogInsertionHelper.java
ec987e500405c067a13b66eeaed1516696790dc4 30-Sep-2013 Mathew Inwood <mathewi@google.com> Revert "Remove global search support."

The global search API is not being deprecated in this release, so we
want to keep the support for it.
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
f6de5a9d1418b0d7f4119d4204818ab3a0fe4fa2 24-Sep-2013 Yorke Lee <yorkelee@google.com> Add IS_SUPER_PRIMARY to default phone only strequents projection

Bug: 10888792
Change-Id: Id9fce5cfc66adfc1192ce752e8a3c2902de2e978
ontactsProvider2.java
e91e4eca5b255bcf46de31deca255d10c8f0b345 24-Sep-2013 Yorke Lee <yorkelee@google.com> Merge "Change CONTACTS_STREQUENTS for phone only queries" into klp-dev
a176ed4c42330e64d0246a10374507c862cec0de 24-Sep-2013 Yorke Lee <yorkelee@google.com> Change CONTACTS_STREQUENTS for phone only queries

This CL tweaks queries for CONTACTS_STREQUENTS to return phone numbers
belonging to starred contacts as well. Before this, the returned cursor
consisted of a mix of starred contacts (without their phone numbers), and
frequently contacted phone numbers.

Change-Id: If0ac847dd26f093d977403ca0100769f6c63be9b
ontactsProvider2.java
258f83d2ce17c5544c514d5b575b9df71b22155c 23-Sep-2013 Yorke Lee <yorkelee@google.com> Merge "Change frequents algorithm to return contacts in a different order" into klp-dev
d820edb03bd5caffc0dff19096552efa817dec59 21-Sep-2013 Yorke Lee <yorkelee@google.com> Change frequents algorithm to return contacts in a different order

Bucketing thresholds
- 3 days
- 7 days
- 14 days
- 30 days
- Any contacts older than this are not shown

Change-Id: I4940920c4eb8ad4f5d130adc0b2acd30a4d7aff6
ontactsProvider2.java
1af2c597003c0fbf181cf0e052ec2830aac87724 20-Sep-2013 Mathew Inwood <mathewi@google.com> Remove global search support.

The global search API is being deprecated. Remove the code from the
contacts provider that implements it, as nothing queries is anymore.

Bug: 10487397
Change-Id: I590e98964e5774dd47340df9b38d252b63a5b915
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
d639ddd61fc7b6f4a7879d583bfd2b595b066265 10-Sep-2013 Yorke Lee <yorkelee@google.com> Fix PHONE_FILTER and CALLABLES_FILTER search behavior

These two filters now only perform name lookups. The search index manager
indexes names, nicknames, and organization title and company name for
name lookups.

Bug: 10680335
Change-Id: I283c61af64a2f104b7482a2819ed4b8a238cba04
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForNickname.java
ataRowHandlerForOrganization.java
earchIndexManager.java
66d989c439fbb82a5b40a7efffa2f28208cf11d8 06-Sep-2013 Jeff Sharkey <jsharkey@android.com> Rename getCallingPackage() to avoid clash.

The framework now offers an authoritative getCallingPackage().

Bug: 10626527
Change-Id: I845ce60a092d944ea0351f10ee41dbf07b8dfecd
oicemailContentProvider.java
d9b90fa203d65d962650574662611e5d7425163f 29-Aug-2013 Yorke Lee <yorkelee@google.com> Don't crash in CP2 if country detector is null

Bug: 10539498
Change-Id: Ic094e472e5a567e1dc6be4cbd14c02938df1de47
ountryMonitor.java
bb267482ca936e8bf51a020f4f67bf71b0a01f14 20-Aug-2013 Yorke Lee <yorkelee@google.com> Fix bluetooth sharing

Revert https://us3-mirror-googleplex-android-review.googlesource.com/#/c/344550

Change-Id: I03628d48b58d20605206f88a6dbb803b3486f25f
ontactsProvider2.java
40edceb15f39cbcfdcff749433b60b9f01ad47ca 16-Aug-2013 Yorke Lee <yorkelee@google.com> Set UNKNOWN_LENGTH for assetFileDescriptor

This is needed so that ContentResolver.openFileDescriptor doesn't
throw an exception because it can't handle non-unknown file
lengths

Bug: 9864852
Change-Id: I4daeec09bf9f332000eafc3edb1f7ef6046f5048
ontactsProvider2.java
45b023e89d87b66e44c1b79c6e1444ec9db70a82 06-Aug-2013 Yorke Lee <yorkelee@google.com> Handle DEMOTE and UNDEMOTE in CP2

* If a contact is UNDEMOTED, if it was previously DEMOTED, it will
become UNPINNED. Otherwise, it will remain unchanged.

* When two raw contacts are aggregated, the parent contact should
inherit the lower pinned position of the two, not including negative
integers.

Change-Id: I74f41dfa327b8e5a79688b1e99eafbef7d9d58a0
ontactsProvider2.java
ggregation/ContactAggregator.java
a89aa7533a14b143b55bf4a29d284152ab9278a5 01-Aug-2013 Yorke Lee <yorkelee@google.com> Add Data.contact_id to phone strequents projection

This is needed so that operations on frequent contacts
swipe to hide, pin, etc can operate on data.contact_id instead
of data._id.
Change-Id: I66005ebcbf7608b2b96961a5637a6736c1076ab9
ontactsProvider2.java
96ade0922bec9e42c58ceeb1ee825e3d266e15a2 30-Jul-2013 Yorke Lee <yorkelee@google.com> Merge "Add pinning support in ContactsProvider"
81fea08280784b319b936a3506788d595c6ce2ad 18-Jul-2013 Yorke Lee <yorkelee@google.com> Add pinning support in ContactsProvider

Change-Id: I3c835c2fd0faf99f8fb176752cfcb12e011095a2
ontactsDatabaseHelper.java
ontactsProvider2.java
ggregation/ContactAggregator.java
c40e89125712d307f8cc0cc58d0227e96c251e23 23-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 84acbc81: am e2688b18: am 44c3d51b: am 13d744f2: am 466d8411: am 8d54a6e0: resolved conflicts for merge of b8fb609b to jb-mr1-dev

* commit '84acbc81b50e8d30df668b4ffd763b7c96e172a2':
Do not allow updates to the _data column.
84acbc81b50e8d30df668b4ffd763b7c96e172a2 23-Jul-2013 Chiao Cheng <chiaocheng@google.com> am e2688b18: am 44c3d51b: am 13d744f2: am 466d8411: am 8d54a6e0: resolved conflicts for merge of b8fb609b to jb-mr1-dev

* commit 'e2688b18df75eceb4895fecaaf4f0ebd42f23ef7':
Do not allow updates to the _data column.
e2688b18df75eceb4895fecaaf4f0ebd42f23ef7 23-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 44c3d51b: am 13d744f2: am 466d8411: am 8d54a6e0: resolved conflicts for merge of b8fb609b to jb-mr1-dev

* commit '44c3d51be8deee28d01e3e3f739a2f6b1fc608fa':
Do not allow updates to the _data column.
44c3d51be8deee28d01e3e3f739a2f6b1fc608fa 23-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 13d744f2: am 466d8411: am 8d54a6e0: resolved conflicts for merge of b8fb609b to jb-mr1-dev

* commit '13d744f2290a405bf99b1f8114da23668bd15274':
Do not allow updates to the _data column.
13d744f2290a405bf99b1f8114da23668bd15274 23-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 466d8411: am 8d54a6e0: resolved conflicts for merge of b8fb609b to jb-mr1-dev

* commit '466d84110ef8f03b91561dd7a778558570e32abb':
Do not allow updates to the _data column.
466d84110ef8f03b91561dd7a778558570e32abb 23-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 8d54a6e0: resolved conflicts for merge of b8fb609b to jb-mr1-dev

* commit '8d54a6e0fa9fb4bb0a2b3b2f36d0e9bf930d05c8':
Do not allow updates to the _data column.
8d54a6e0fa9fb4bb0a2b3b2f36d0e9bf930d05c8 23-Jul-2013 Chiao Cheng <chiaocheng@google.com> resolved conflicts for merge of b8fb609b to jb-mr1-dev

Change-Id: I336ee0b3f041f83a4b4e2c9973abb73852c2cc6f
b8fb609bb80b1fd16de46a0248188fff8ca722ea 22-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 284f7164: Do not allow updates to the _data column.

* commit '284f71646d1953f2d78b53e2cdb42cb93e1d9d6f':
Do not allow updates to the _data column.
859c719200467b6300d2148ee61258a35bd4b7ee 13-Jul-2013 Yorke Lee <yorkelee@google.com> Fix acore crash when upgrading to KLP

Bug 9811106

Change-Id: Iaf83808fe66886d4cdd66b991c3964972314c500
ontactsDatabaseHelper.java
284f71646d1953f2d78b53e2cdb42cb93e1d9d6f 11-Jul-2013 Chiao Cheng <chiaocheng@google.com> Do not allow updates to the _data column.

Fixes a security hole where applications can update the data location of
voicemail files to point to arbitrary file paths.

Voicemail provider stores the location of the data file in the _data column.
Applications can update this with an arbitrary file path as long as they
have the ADD_VOICEMAIL permission. Then they can subsequently read that
voicemail and obtain access to the file. This location is generated by the
provider and does not need to be updated by the applications.

Bug: 9674953
(cherry picked from commit ab2a24c126f35ae4aefb469f91094e5972abd8f0)

Change-Id: I6c795fe8e283f60f71ebc0e53606383c9fd22e71
oicemailContentTable.java
til/DbQueryUtils.java
ab2a24c126f35ae4aefb469f91094e5972abd8f0 11-Jul-2013 Chiao Cheng <chiaocheng@google.com> Do not allow updates to the _data column.

Fixes a security hole where applications can update the data location of
voicemail files to point to arbitrary file paths.

Voicemail provider stores the location of the data file in the _data column.
Applications can update this with an arbitrary file path as long as they
have the ADD_VOICEMAIL permission. Then they can subsequently read that
voicemail and obtain access to the file. This location is generated by the
provider and does not need to be updated by the applications.

Bug: 9674953
Change-Id: I9c8fc45071a06d627574a52bafbd9e6e172b4bf8
oicemailContentTable.java
til/DbQueryUtils.java
4214d57a4a87dbebc7c937275acc9b54fd718697 10-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 9c842fcf: White list file names and do not allow ".."

* commit '9c842fcf486ed5c70ca6db3106349aade27751bf':
White list file names and do not allow ".."
69b854cd1630d9c7ff1d8f9fcf02d60f79f70d6f 10-Jul-2013 Chiao Cheng <chiaocheng@google.com> am 4a1ade1e: White list file names and do not allow ".."

* commit '4a1ade1e8e86f8f8d2f47fce809e0b5e64735c2d':
White list file names and do not allow ".."
9c842fcf486ed5c70ca6db3106349aade27751bf 09-Jul-2013 Chiao Cheng <chiaocheng@google.com> White list file names and do not allow ".."

Fixes security vulnerability where application can pass in relative file paths
with ".." in the string to access files outside of the dumpedfiles directory.

Bug: 9607306
Change-Id: Iad219cb48fa560d837498c2dc75127294dcf401b
ebug/DataExporter.java
ebug/DumpFileProvider.java
4a1ade1e8e86f8f8d2f47fce809e0b5e64735c2d 09-Jul-2013 Chiao Cheng <chiaocheng@google.com> White list file names and do not allow ".."

Fixes security vulnerability where application can pass in relative file paths
with ".." in the string to access files outside of the dumpedfiles directory.

Bug: 9607306
Change-Id: Iad219cb48fa560d837498c2dc75127294dcf401b
ebug/DataExporter.java
ebug/DumpFileProvider.java
629f595e1e2324f7403465d96c4637375cc0c888 09-Jul-2013 Chiao Cheng <chiaocheng@google.com> Merge "White list file names and do not allow "..""
c43a8d4c928b0d362339cd418486e2aa91769b70 09-Jul-2013 Chiao Cheng <chiaocheng@google.com> White list file names and do not allow ".."

Fixes security vulnerability where application can pass in relative file paths
with ".." in the string to access files outside of the dumpedfiles directory.

Bug: 9607306
Change-Id: Iad219cb48fa560d837498c2dc75127294dcf401b
ebug/DataExporter.java
ebug/DumpFileProvider.java
8e31d4062aaa2081f9f515a7764e08abfd47c1e5 02-Jul-2013 Jay Shrauner <shrauner@google.com> am 5e0fa885: am 321d81dc: Merge "Change method to determine if the table is empty"

* commit '5e0fa885379a1919f9e7719ba3eb666ee2341084':
Change method to determine if the table is empty
5e0fa885379a1919f9e7719ba3eb666ee2341084 02-Jul-2013 Jay Shrauner <shrauner@google.com> am 321d81dc: Merge "Change method to determine if the table is empty"

* commit '321d81dcc008d4d7b3ad02272960a9972a141c90':
Change method to determine if the table is empty
979a2820d0011ecf53d275c50b86781ea778a29c 21-Jun-2013 Amith Yamasani <yamasani@google.com> Fix acore crash during Contacts database upgrade to 801

Make sure that the oldVersion is upgraded so that it doesn't throw
an exception after a successful upgrade step.

Change-Id: I29d4b85a2990a93abde340b4e1f60ddfc8698b3f
ontactsDatabaseHelper.java
e2663c31031acd574f590f845d3306ec847ecc91 17-Jun-2013 Chiao Cheng <chiaocheng@google.com> Ensure database create broadcast fires after boot complete.

Contacts database is created before boot completes by the
ContactsUpgradeReceiver. Any notifications fired before boot will not be
received by applications.

Bug: 9394450
Change-Id: I1c47308c7ec52b777f9f4ca8c19141634e4e0baa
ootCompletedReceiver.java
ontactsDatabaseHelper.java
d621a10ce45c1f9e4f6caddc7aef5b2370d595b8 19-Jun-2013 Jay Shrauner <shrauner@google.com> Merge "Add number presentation column to call log table"
ee00f99f752fbd7771b5a7b706ecf6f99060f127 10-May-2013 Christopher Tate <ctate@google.com> Contacts provider needs to be a privileged apk

Also fixes a sometimes-bug: the contacts database helper can be
invoked for upgrade prior to system boot, but it sends broadcasts.
Use FLAG_RECEIVER_REGISETRED_ONLY_BEFORE_BOOT flag to avoid problems.

Bug 8765951

Change-Id: I4ee4b4c3e17803e73c63e7a2e06e35088d1a611d
ontactsDatabaseHelper.java
e31bbc395fc04e9c5f841e8e76475d98c8332271 10-Jun-2013 Jay Shrauner <shrauner@google.com> Add number presentation column to call log table

Add number presentation column to call log table and convert older call logs
to use the new column.

Bug:6948882
Change-Id: I0e8f781d30600e3bfb08d8b89a1cade531e18c7f
allLogProvider.java
ontactsDatabaseHelper.java
0e55a38c8a2a94db45b65bbecd78c6d127b721a2 11-Jun-2013 Christine Chen <christinech@google.com> Merge "Add updates on usage data to Delta API."
1708e5af20ea2a109dfba2ab82c69e798e5df2e3 11-Jun-2013 Christine Chen <christinech@google.com> Add updates on usage data to Delta API.

- Updates the last_updated_timestamp of a contact when there is new
usage data available: last time contacted and times contacted.

Change-Id: I633d617681d56072a0d1f09d75a7fcba7e47b219
ontactsProvider2.java
b646ef018cff47aa5583b92b39bdb121b4bf45e5 04-Mar-2013 Hyoseong Kim <muzbit.kim@lge.com> Change method to determine if the table is empty

queryNumEntries API perform "COUNT(*)" query.
It is slower than New API that perform "EXISTS".
If the goal is to determine if the table is empty,
using new API is better.

[+] https://android-review.googlesource.com/52750

Change-Id: Idcc2633d0a5349c59f41e125cf34c9dc6622cdbe
ontactsProvider2.java
e7759bc574ebe2679386068b1b8fd7c17ca3134f 30-May-2013 Jay Shrauner <shrauner@google.com> Use ICU collator for display name ordering

Use ICU collator when ordering by DISPLAY_NAME to get locale aware ordering.

Bug:
Change-Id: I059761a311961a80998a628c67746b78ca3d14c7
ontactsProvider2.java
ee1267f05b98218d26f39875949cbc66a8a9b71d 21-May-2013 Jay Shrauner <shrauner@google.com> Clean up int data conversion calls

Catch various places we would crash if a data column didn't parse
as expected as an int or long.

Bug:9050606
Change-Id: I241e8a2b158eea89a2b86ca20d3b93379668084d
allLogProvider.java
ontactsProvider2.java
ataRowHandler.java
egacyApiSupport.java
d41514a0bf224fb3e45459e302ac108c1ff737c2 13-May-2013 Chiao Cheng <chiaocheng@google.com> am 3f88ff6b: Merge "Fix method not found errors for unit test." into jb-mr2-dev

* commit '3f88ff6b537fb53806f126b4aea3355686387717':
Fix method not found errors for unit test.
1f16c3ea6ef40f6ac5744b59c446c03eb2618e4f 10-May-2013 Jay Shrauner <shrauner@google.com> Fix unit tests when phone is in ja_JP locale

ContactsProvider2 uses method getLocale() to allow tests to override
default locale. This locale, however, was not being used for the
NameSplitter. Change the createNameSplitter method to take locale as an
input parameter so the SearchIndexManager tests will run with the right
search indexes.

Bug:7264326
Change-Id: I2535673032dcd628d8719b00eff6512cba9dc279
ontactsDatabaseHelper.java
ontactsProvider2.java
4a732664f285ebe3dcd495c5e94d4043ebd59dcb 10-May-2013 Chiao Cheng <chiaocheng@google.com> Fix method not found errors for unit test.

Two methods in MoreDatabaseUtils are no longer used after a recent bug
fix. But the tests for them are erroring out in userdebug builds because
proguard is stripping the methods.

Bug: 8894559
Change-Id: Idc2b4c9fd2fd6b58a3c44e5a40dec1b1c582cd2e
atabase/MoreDatabaseUtils.java
0c16259ed53295f17e785992d374dcac7d5c9885 25-Apr-2013 Jeff Sharkey <jsharkey@android.com> Close PFD after finished reading from pipe.

Avoids leak.

Change-Id: I2f5197d05e920b85062e5b88abb043a464bf17de
ontactsProvider2.java
da51adb4b99894666e7ea91fed0e8afc94162333 23-Apr-2013 Chiao Cheng <chiaocheng@google.com> Fixed issue where some contacts are not added to delete log.

Contacts with multiple raw contacts were not being inserted into the delete
log when accounts are removed. This was due to the raw contacts being removed
in batch instead of one at a time. The logic to determine whether a contact
can be deleted was determining whether other raw contacts exist. This does
not work when all raw contacts are removed in a single batch.

Added logic to pre-select contacts that will be deleted.

Bug: 8696462
Change-Id: I95adccf9e6756bbf6ca9dd7d144c1d9ee8905631
ontactsProvider2.java
atabase/ContactsTableUtil.java
0cc5d1504803de51f8b421442e04ece87728af43 22-Apr-2013 Chiao Cheng <chiaocheng@google.com> Fix sqlite error when too many bind variables.

Sqlite has a limit of 999 bind variables by default. Since there is no risk
of sql injection in this method, change to building sql by concatentation.

Bug: 8676489
Change-Id: I9bfea735bb14fd65c84eb4255825b7ad3f5fae71
atabase/ContactsTableUtil.java
a62622b31107f97be7da9a4b79393e465b64fd36 18-Apr-2013 Chiao Cheng <chiaocheng@google.com> Fixing delta api for account removal case.

Account removal uses a different code path from normal contact deletes. This
patch properly adds deleted contacts into the delete log when an account is
removed. Also updates contact last updated timestamp for the non-delete case
when a raw contact is removed from an aggregate contact.

Bug: 8654272
Change-Id: I05c3ef297e5ad2ca6713e06d0b40206876cf0b9e
ontactsProvider2.java
8ed367fdc0b086d54c489f68d555e2f0a4035f63 12-Mar-2013 Chiao Cheng <chiaocheng@google.com> Adding contacts delta api.

Updates and inserts can be detected through the use of a new timestamp
field in the contacts table.

Deletes can be detected by querying the new deleted_contacts table.

Bug: 8182147
Change-Id: I5c1e596f4e1aa58528afc29396f79cb4051e229c
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandler.java
ransactionContext.java
ggregation/ContactAggregator.java
atabase/ContactsTableUtil.java
atabase/DeletedContactsTableUtil.java
atabase/MoreDatabaseUtils.java
0c70f1701e264a0e79a14884f8396d2a2e4caacf 05-Apr-2013 Yorke Lee <yorkelee@google.com> Merge "Provider side changes for exposing data usage stats" into jb-mr2-dev
216c434537d05a691add4e22ba3a9d958c976c1e 29-Mar-2013 Yorke Lee <yorkelee@google.com> Provider side changes for exposing data usage stats

Use a uri query parameter to filter for a specific type of data usage,
otherwise the sum of all the data usage stats for that particular
data is returned.

Bug 8124079

Change-Id: Iee4c3accb46c9402f0a1659c9b8943c5a219a169
ontactsProvider2.java
0f4b7a9bfe4b2079a7c5bb22b4114b5672639b05 18-Mar-2013 Jay Shrauner <shrauner@google.com> Japanese and Chinese search key fixes

Change so Pinyin search keys are only generated when in a simplified
Chinese locale. Fix name style classification of phonetic names.
Generate Romaji search keys for Japanese phonetic names. Add
secondary locale labeling for a number of non-Western languages
(Japanese, Korean, Thai, Arabic, Hebrew, Greek, Cyrillic).

Bug:5356921
Change-Id: I8c3a6b67d59fbd6b7b16e4e9f69bc30d1d996a75
ontactLocaleUtils.java
ontactsDatabaseHelper.java
ataRowHandlerForStructuredName.java
anziToPinyin.java
ameLookupBuilder.java
8f8b122c7556350d94c2e349b3093024b0205d8d 08-Mar-2013 Yorke Lee <yorkelee@google.com> Add new apis to CP2

Add Data.Contactables.CONTENT_URI and CONTENT_FILTER_URI
Querying against these uris return email addresses and phone numbers
belonging to all contacts with email/address/names that match the filter
(if provided).
Add VISIBLE_CONTACTS_ONLY boolean parameters to Data

Bug: 8123918

Change-Id: I491cb2ff4c64c9d042d5e21cebc5f90d086c70ac
ontactsProvider2.java
1f8895bc9efd6c20adb02652bccb2c011ebca114 04-Mar-2013 Jay Shrauner <shrauner@google.com> Fix unit tests for ICU 51 patches

Fix unit tests to reflect fixes to AlphabeticIndex from backporting
ICU 51 fixes into current Android ICU drop. Add tests for new German
"Sch" and "St" labels.

Bug:
Change-Id: I9c4778bec24eebe6ed4228d541b6a6d95c6701aa
ontactLocaleUtils.java
70c9e28e8a37114b28638e1670d1f81586afd556 07-Mar-2013 Jay Shrauner <shrauner@google.com> Merge "Use ICU ImmutableIndex" into jb-mr2-dev
6fabfd02577c9c631cd371131c3e161122329777 07-Mar-2013 Jay Shrauner <shrauner@google.com> Fix FastScrollingIndexCache test

Make sure the FastScrollingIndexCache instance used for the unit tests
was created with the correct MockSharedPreferences

Bug:
Change-Id: I612638dadab394ea3ed8abbbe6f47de5f17601fe
astScrollingIndexCache.java
f335592cc008403f2b6e708b65017903ab83034b 07-Mar-2013 Jay Shrauner <shrauner@google.com> Use ICU ImmutableIndex

Switch to using ICU ImmutableIndex, which is thread-safe and theoretically
has faster lookups.

Bug:
Change-Id: Icd1f8b53c73f44fe71aeb99aefb9286405ea32d1
ontactLocaleUtils.java
9f675502e2ab04e37b043d29d82b1d19458cd1b2 05-Mar-2013 Jay Shrauner <shrauner@google.com> Merge "Auto-update ContactsDB on ICU version change" into jb-mr2-dev
2d2e22626b698b2484026ae18eca3c2c6340f2d1 27-Feb-2013 Jay Shrauner <shrauner@google.com> Auto-update ContactsDB on ICU version change

Save current ICU version into the ContactsDB and rebuild
locale specific data whenever the version changes.

Bug:
Change-Id: Id5fd3e178558dc903b522b2655c75e6aa353f6e5
ontactsDatabaseHelper.java
ontactsProvider2.java
ontactsUpgradeReceiver.java
astScrollingIndexCache.java
659016dd6a7ac6659d978c45d91400e4627afe6b 04-Mar-2013 Chiao Cheng <chiaocheng@google.com> Merge "Reverting is_primary sort order back to previous priority." into jb-mr2-dev
c6e28121e4c522c31c96e0ea97b66012cc571160 01-Mar-2013 Chiao Cheng <chiaocheng@google.com> Reverting is_primary sort order back to previous priority.

Bug: 8129961
Change-Id: If6dd3b5ebec19ef7c9fea493d90f0e8d88435f01
ontactsProvider2.java
21cfa6019b9fb82c23edf978d27904757207d9b0 27-Feb-2013 Jay Shrauner <shrauner@google.com> Fix unit tests for ICU 50

Fix tests to account for fixes made in ICU 50. Add some additional tests.

Bug:
Change-Id: I7d1fb0588f56b58da5c5177823ed5c16c4603e24
ontactLocaleUtils.java
a6a9fa802d1b56c206c670ca1d313bc64effcb5d 14-Feb-2013 Jay Shrauner <shrauner@google.com> Use ICU JNI wrappers for phonebook labels

Switch from using native code registered as sqlite callbacks to using
JNI wrappers for accessing ICU AlphabeticIndex. Stop using specialized
sort keys for Simplified Chinese because ICU code can correctly label
the characters directly.

Bug:
Change-Id: I0568b3a406495c147c7b9b3e72835d11d93f9d16
ontactLocaleUtils.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ameLookupBuilder.java
79b591543a37f256fcc93dc8b47017afc9c8dbca 18-Feb-2013 Jay Shrauner <shrauner@google.com> Call ICU lib for Pinyin transliteration

Switch from using hard coded tables copied from ICU to calling ICU
Transliterator directly for Pinyin transliteration.

Bug:
Change-Id: I87aae623dfe049a90cee213182275aa51a7dcd9c
anziToPinyin.java
49fb8375e9d3f7385d41b352d164a4e3e98c1528 08-Feb-2013 Dianne Hackborn <hackbod@google.com> Fix issue #8152662: Unable to share a contact via Email

When contacts provider internally recurses into itself, we need
to clear the binder calling identity before doing so, so that it
is consistent with the calling package name we will now be using.

Note that this also means that we won't be doing any further
permission checks against the original caller for these internal
provider calls... which is probably more correct anyway, because
we've already done the permission check on the original incoming
URI and we wouldn't want that to now fail due to some permission
strangeness on another URI it is using internally.

Change-Id: Icc3903287f91f35959a80168a6c107b1803f93a8
ontactsProvider2.java
3c05145763ad30eda83134411968942e1c11d06f 06-Feb-2013 Jay Shrauner <shrauner@google.com> Merge "Fix collation/indexing for i18n contacts"
c9626e7befd591923c6af859ad079abba8a84e41 15-Jan-2013 Dianne Hackborn <hackbod@google.com> Start tracking content provider app ops.

Change-Id: I899c3ae507a0e4feb95c8142b09b92e1fd87eefe
allLogProvider.java
ontactsProvider2.java
4d9895e902260670a96d0c3a9e792b3a6452577d 16-Jan-2013 Yorke Lee <yorkelee@google.com> Merge "Include name prefix in search index"
068e3ed308560cb92b985837b05a404da2060cbe 15-Jan-2013 Yorke Lee <yorkelee@google.com> Include name prefix in search index

Bug: 6987476
Change-Id: I99816c32938b5b3db5f79d816d91d814ab9dca6c
ameSplitter.java
7f51fad03f571e9f41ea7766b0f6231895c53d97 11-Jan-2013 Yorke Lee <yorkelee@google.com> Use phonetic name as display name if no other given name

Bug: 7942098
Change-Id: I0c43b6e78471631f6400d836311ec84658f063c9
ontactsDatabaseHelper.java
fda4395adc9266d0f8e0be8637d0effa7fd1e057 09-Jan-2013 Yorke Lee <yorkelee@google.com> Standardize search algorithm between People and Dialer

Bug: 5930716
Change-Id: Ic7cfffae5de878be683d27f92ccb5b034dc217c3
ontactsProvider2.java
255e7f1b8eebd0df68030289a22e9c3c4d6efa3d 03-Jan-2013 Jay Shrauner <shrauner@google.com> Fix collation/indexing for i18n contacts

Fix issue of contacts appearing under wrong label--sort contacts by
sort key, not by label.

Fix handling of labels that require more than the first character
(eg Czech 'CH') by using entire sortkey--not just the first letter--
to determine label.

Bug:7351596
Change-Id: Iaabc63041540f621220d0463df3e0850684caa94
ontactsProvider2.java
c231bb10ca1ae310568a0c7cb4f327e348ecde3b 22-Dec-2012 Chiao Cheng <chiaocheng@google.com> Fixing missing punctuation for punctuation search case.

Previous CL I9cbdf10d21c79f53bc621bacb7eeeb95a6a2435f fixed missing
punctuation at the start when searching without punctuation. (e.g.
{hello})

This CL fixes the case where leading punctuation is missing if you searched
with a leading punctuation. (e.g. {'hello}). The content provider
uses a different code path when it detects multi-words and snippeting
is actually done in sqlite using the FTS snippet method. The check for
multi-word was treating {'hello} as two words.

This means that multi-word searches will still have this issue as it still
uses the sqlite snippet method. Leaving this to a separate CL since it's
a riskier change.

Bug: 5929143
Change-Id: I4c2451b2e8eb47d5831e6ef6cfcca538ff3599b9
ontactsProvider2.java
4027677052d53822af586c13937f8f0cd27f50d6 13-Dec-2012 Yorke Lee <yorkelee@google.com> Provide helpful log message on attempt to downgrade SQL version

Bug: 7709971
Change-Id: I1a7eff95ff76e21b3b29535f09c95591469b707f
ontactsDatabaseHelper.java
e7fd96a61006c1be2e0713282a5a10531efc2ae5 26-Nov-2012 Chiao Cheng <chiaocheng@google.com> am 75a0a0b0: am dacd5de1: Change default sort order for email queries.

* commit '75a0a0b0ece29241b4712126af53841d5dcdb442':
Change default sort order for email queries.
75a0a0b0ece29241b4712126af53841d5dcdb442 26-Nov-2012 Chiao Cheng <chiaocheng@google.com> am dacd5de1: Change default sort order for email queries.

* commit 'dacd5de146b413de86d38b6f56a3fe0b2af4b155':
Change default sort order for email queries.
dacd5de146b413de86d38b6f56a3fe0b2af4b155 17-Nov-2012 Chiao Cheng <chiaocheng@google.com> Change default sort order for email queries.

- Prioritizing "default" emails over last used emails.
- Added ordering for same domain emails as last order by.

Bug: 7183241
Bug: 7346215
Change-Id: I6a8ba3cfe08792693eec4896f16853a88713bc3f
ontactsProvider2.java
til/DbQueryUtils.java
5d04f429708c3a7478a2b3b8a16298182237e78a 16-Nov-2012 Makoto Onuki <omakoto@google.com> am b036f674: am f5c0020b: Rebuild SQLITE_STAT1 table after drop operations.

* commit 'b036f6745c97e7bd654ee1b44122ceece917dd47':
Rebuild SQLITE_STAT1 table after drop operations.
b036f6745c97e7bd654ee1b44122ceece917dd47 16-Nov-2012 Makoto Onuki <omakoto@google.com> am f5c0020b: Rebuild SQLITE_STAT1 table after drop operations.

* commit 'f5c0020b87709f9c4c3de66a49c0893e2c2adebb':
Rebuild SQLITE_STAT1 table after drop operations.
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
ontactsDatabaseHelper.java
earchIndexManager.java
7d098d938e3414da40557ad6217d872282056b43 15-Nov-2012 Chiao Cheng <chiaocheng@google.com> Use Objects from guava library.

Switch com.android.internal.util.Objects to com.google.common.base.Objects.

Technically this change is not necessary for the provider but it nice to
use the same code everywhere. And since the provider already has a
dependency on guava anyways, this doesn't hurt.

Bug: 6948882
Change-Id: I565d65f00b1f25c4ae1bf3c8086c10ab2f31dfd5
ccountWithDataSet.java
874e0edc8875776588dd42dca29cdb0a10b76eb0 02-Oct-2012 Makoto Onuki <omakoto@google.com> am 94fc236d: am 0e014723: am 2a9d1fab: Merge "Make CONTACTS_AS_MULTI_VCARD locale safe"

* commit '94fc236d199460bddc390ce7f384b446c14df622':
Make CONTACTS_AS_MULTI_VCARD locale safe
94fc236d199460bddc390ce7f384b446c14df622 02-Oct-2012 Makoto Onuki <omakoto@google.com> am 0e014723: am 2a9d1fab: Merge "Make CONTACTS_AS_MULTI_VCARD locale safe"

* commit '0e014723e6d5d2acc3d59b78cee9a6d1fbfef1e9':
Make CONTACTS_AS_MULTI_VCARD locale safe
0e014723e6d5d2acc3d59b78cee9a6d1fbfef1e9 02-Oct-2012 Makoto Onuki <omakoto@google.com> am 2a9d1fab: Merge "Make CONTACTS_AS_MULTI_VCARD locale safe"

* commit '2a9d1fab1669d2962aa830872f063c1180fbea94':
Make CONTACTS_AS_MULTI_VCARD locale safe
bbdc6f0ca72a83c2a2ddd7bdc155c5b4a00cb7e8 02-Oct-2012 Piotr Jastrzebski <haaawk@google.com> Merge "Cancellation of queries for search suggestions."
0788053f47eb6bc66b99a8747351ece2db7c3871 02-Oct-2012 Johan Redestig <johan.redestig@sonymobile.com> Make CONTACTS_AS_MULTI_VCARD locale safe

SimpleDateFormat was used with the default locale to build
SQL statements; this is unsafe for some locales. Switched
to Locale.US.

Change-Id: I7307b12e1f3d796e1bb4a73d97918d0162ca971e
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ameNormalizer.java
earchIndexManager.java
bdf112f12eafe116bbf931a0c4158a6fb5713b3f 28-Sep-2012 Piotr Jastrzebski <haaawk@google.com> Cancellation of queries for search suggestions.

Passing CancellableSignal from ContactsProvider2.queryLocal to
GlobalSearchSupport.handleSearchSuggestionsQuery,
GlobalSearchSupport.addSearchSuggestionsBasedOnFilter and
SQLiteDatabase.rawQuery.

Search App needs this change to cancel queries for search suggestions which are
no longer valid due to some user action.

Change-Id: Ie019afff31bf49ba96a88899e829813075ab141e
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
9ff2587608416b4378767141ad396f51f23040a7 28-Sep-2012 Makoto Onuki <omakoto@google.com> Make sure to invalidate fast index cache when

aggregation changes.

Bug 7249008

Change-Id: I6022dca2e56a6a4cdfcde4d936289881a40d1012
ontactsProvider2.java
7b4a5d522df5282cd7dac655b4c673c06d1f449b 27-Sep-2012 Jeff Sharkey <jsharkey@android.com> Remove Secure setting usage.

Bug: 7232230
Change-Id: Ie40bda16e24df96530c80506a74747a4b2c16cb5
ontactsProvider2.java
2b7c28ce69dd596f986df0932aeb3bd00c52deb2 13-Sep-2012 Makoto Onuki <omakoto@google.com> Merge "Send a broadcast when profile changes" into jb-mr1-dev
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
ontactsDatabaseHelper.java
0bdbe752c3c0cbbef2acb4eca74642aec9195d88 12-Sep-2012 Makoto Onuki <omakoto@google.com> Send a broadcast when profile changes

Bug 7148705

Change-Id: I3df22b7fc18a106f221f022f222d8fee566a24af
rofileProvider.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
ontactsDatabaseHelper.java
ontactsProvider2.java
e31a15bcfe67f21320a71758411ba756f1d60f23 24-Aug-2012 Makoto Onuki <omakoto@google.com> am 3b1b1d5e: am 7d112d54: Merge "Update HanziToPinyin table and tests."

* commit '3b1b1d5e732728ea7d60b408ab03f42e5d9ace8f':
Update HanziToPinyin table and tests.
3b1b1d5e732728ea7d60b408ab03f42e5d9ace8f 24-Aug-2012 Makoto Onuki <omakoto@google.com> am 7d112d54: Merge "Update HanziToPinyin table and tests."

* commit '7d112d54a173e6d6172aeeff5fa7dfee4abc2d73':
Update HanziToPinyin table and tests.
0c49720fb3d58e346739c2ccd56ed2b739249e07 24-Aug-2012 Xiaotao Duan <xiaotao@google.com> Update HanziToPinyin table and tests.

Change-Id: I160208ede00a4f63b257a0b6cc59ff5ad153960d
anziToPinyin.java
a6ec38053a00fb399ca174931c149e3740c7420a 16-Aug-2012 Makoto Onuki <omakoto@google.com> Inprove database dump

- Use the best compression ratio.

- Report the correct file size via DumpFileProvider, so that Gmail
will be able to show an error if the file is too large. (gmail has ~25M limit.)

In case it's too large, we can ask the user to use Drive instead.

Change-Id: I625bf8913aa6fc2fce25130a219720b8d1a8896b
ebug/DataExporter.java
ebug/DumpFileProvider.java
c458f77ccd89757cf82b2e839715f467d87f901e 14-Aug-2012 Makoto Onuki <omakoto@google.com> Merge "Make "export contacts database" more secure" into jb-mr1-dev
623659ebf4875e63bf4fef1e0b00096e09121853 14-Aug-2012 Makoto Onuki <omakoto@google.com> Make "export contacts database" more secure

Don't put the dump file on the SD card. Instead, put it in the internal cache
directory which is protected by the filesystem permissions.

In order to make it attachable on gmail, create a shim content provider and
sends a content: URI for this provider.

The dump file can be read only from the apps that knows its name, which
we pass via the SEND intent. Each dump file has a unique 256-bit random name,
so it's virtually impossible to for other apps to read them.

Bug 6813842

Change-Id: I3ca081e696e4e432e2bf7eb701595c508cd19409
ebug/ContactsDumpActivity.java
ebug/DataExporter.java
ebug/DumpFileProvider.java
e530c0557f69d4758273ef22d7c4bbf48e1f3da7 14-Aug-2012 Chiao Cheng <chiaocheng@google.com> Merge "Adding limit and offset parameters to calllog provider." into jb-mr1-dev
e8956364a9cf4ec0f463768a6116fdcda8635b13 10-Aug-2012 Makoto Onuki <omakoto@google.com> Merge "Don't leave stale normalized number when updating..." into jb-mr1-dev
9bc20fb9de84effe8e88ccf9d526beafcea92ee9 10-Aug-2012 Jean-Baptiste Queru <jbq@google.com> resolved conflicts for merge of 3646b108 to jb-mr1-dev

Change-Id: I2ca60f4e861128143bbfe7eb688b255432423a9d
10840c6bcd8bf0ab2e5f846d345d14e5df9858a7 09-Aug-2012 Makoto Onuki <omakoto@google.com> Don't leave stale normalized number when updating...

with invalid number.

Also ContactsProvider2Test.testPhonesNormalizedNumber() should now work
in non-us countries too.

Bug 6960308

Change-Id: Ib15115f501ce67797dec8d05dc421f5931341b12
ataRowHandlerForPhoneNumber.java
3646b1085f422e5c7967af2c2ba30b76d80fa14f 10-Aug-2012 Jean-Baptiste Queru <jbq@google.com> am 28f87c6c: Merge "Sync HanziToPinyin tables with ICU 4.6."

* commit '28f87c6cb3aedeb92c8e870de22b580e3e634da2':
Sync HanziToPinyin tables with ICU 4.6.
28f87c6cb3aedeb92c8e870de22b580e3e634da2 10-Aug-2012 Jean-Baptiste Queru <jbq@google.com> Merge "Sync HanziToPinyin tables with ICU 4.6."
143bb522fcfb4a08c7f112876f3fac1cf47cf5ae 02-Aug-2012 Chiao Cheng <chiaocheng@google.com> Adding limit and offset parameters to calllog provider.

Allow client to pass in limit and offset parameters in uri.

Bug: 6849968

Change-Id: I535086449bfa76a5d8bc66567070141b76d19503
allLogProvider.java
84ae70d111070cc512790f0b2a573347fa9daca5 12-Jul-2012 Xiaotao Duan <xiaotao@google.com> Sync HanziToPinyin tables with ICU 4.6.

Change-Id: I6b6b144a460fbbf233222313559bbc546745d328
anziToPinyin.java
ed523dc48f24611582f0a1eebd7840a32bbc6b16 20-Jul-2012 Makoto Onuki <omakoto@google.com> Merge "Add debug activity to export all data files as a zip"
14a595d1d4b9e4616aa4f7a184f37b12e07049a2 20-Jul-2012 Makoto Onuki <omakoto@google.com> am d109b237: am ff91ec35: Tolerate crashes during re-aggregation.

* commit 'd109b23736e4171d23356642bd5dbe28743341da':
Tolerate crashes during re-aggregation.
8a6e02add7c70666cdb506310c134af7d91c323c 19-Jul-2012 Makoto Onuki <omakoto@google.com> Add debug activity to export all data files as a zip

This will allow us to collect contacts database files even from user build
devices where "adb root" is disabled.

This is simialr to what CalendarProvider does in CalendarDebugActivity. The
difference is it'll export all files under "/data/data/com.android.providers.contacts/",
including the profile db and highres photo files.

To launch the activity:
adb shell am start -a com.android.providers.contacts.DUMP_DATABASE

I'm planning to add somethig to the people app to fire off this intent, so that
users will be able to do it without adb.

The activity will show a warning message with "Start", "Delete" and "Cancel"
buttons.

- "Cancel" will close the dialog.

- "Start" will create a zip file. After that, it'll present the activity
chooser to let the user choose which app to use to send it with.

- "Delete" will delete the ZIP file. We need to make sure to ask the user to
do this once sending email is succeessfully finished (unfortunately there's
no way for us to detect it programmatically), as any apps with the "read
sdcard" parmission will be able to read it otherwise.

In the future, we may want to add options to, for example, exclude the profile
db or exclude highres pictures.

Bug 6813842

Change-Id: Id181efad65194ed39b0a0bc1226252da62b8927e
ebug/ContactsDumpActivity.java
ebug/DataExporter.java
d109b23736e4171d23356642bd5dbe28743341da 19-Jul-2012 Makoto Onuki <omakoto@google.com> am ff91ec35: Tolerate crashes during re-aggregation.

* commit 'ff91ec356f1b17dea095a880f61b8bc4ff333b1e':
Tolerate crashes during re-aggregation.
ff91ec356f1b17dea095a880f61b8bc4ff333b1e 18-Jul-2012 Makoto Onuki <omakoto@google.com> Tolerate crashes during re-aggregation.

This CL consists of two parts:
- Don't crash even if the name_lookup table contains malformed data. Just
treat it as name-unmatch.

- Don't crash even if an exception is thrown durign re-aggregation.
Re-aggregation is not *that* important anyway, so in that case just bump the
logic version and start the provider normally. (And even if we fail to bump
the version number, just go ahead and continue.)

Bug 6827136
Change-Id: Ifa3d4697c5d81f3480e0b8a9238b49312ac75e3b
ontactsProvider2.java
ggregation/util/ContactMatcher.java
til/Hex.java
539edaba4b64bd8c97bc92c1a75fc2fe90b5ce77 04-Jul-2012 Mathew Inwood <mathewi@google.com> am 5a2cfba2: am 084a9d5e: Don\'t sort contacts supplied to global search app.

* commit '5a2cfba2623b8606ec5eb1a8e443957da2495e84':
Don't sort contacts supplied to global search app.
5a2cfba2623b8606ec5eb1a8e443957da2495e84 04-Jul-2012 Mathew Inwood <mathewi@google.com> am 084a9d5e: Don\'t sort contacts supplied to global search app.

* commit '084a9d5ee564c758ff7709690ab404d6ac58e78d':
Don't sort contacts supplied to global search app.
084a9d5ee564c758ff7709690ab404d6ac58e78d 04-Jul-2012 Mathew Inwood <mathewi@google.com> Don't sort contacts supplied to global search app.

They are to be sorted by the global search app itself instead.

While we're at it, also remove 'create contact' and 'dial number'
suggestions since they're not used.

Change-Id: I0c56f638e347d101468e22d8fb2417552891eaa9
lobalSearchSupport.java
38210445730ee04c351c7cc1b3800cfe23e34325 27-Jun-2012 Makoto Onuki <omakoto@google.com> Reorganize import in contacts provider

Change-Id: If3afb134ea36bd93859efcd114885526e1592b91
ccountWithDataSet.java
allLogProvider.java
ontactDirectoryManager.java
ontactLocaleUtils.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ontactsTransaction.java
ataRowHandler.java
ataRowHandlerForCommonDataKind.java
ataRowHandlerForCustomMimetype.java
ataRowHandlerForEmail.java
ataRowHandlerForGroupMembership.java
ataRowHandlerForIdentity.java
ataRowHandlerForIm.java
ataRowHandlerForNickname.java
ataRowHandlerForNote.java
ataRowHandlerForOrganization.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForPhoto.java
ataRowHandlerForStructuredName.java
ataRowHandlerForStructuredPostal.java
bModifierWithNotification.java
efaultCallLogInsertionHelper.java
astScrollingIndexCache.java
egacyApiSupport.java
ameLookupBuilder.java
ameNormalizer.java
ameSplitter.java
hotoPriorityResolver.java
hotoStore.java
rofileAwareUriMatcher.java
rofileDatabaseHelper.java
earchIndexManager.java
oicemailCleanupService.java
oicemailContentProvider.java
oicemailContentTable.java
oicemailStatusTable.java
oicemailTable.java
ggregation/ContactAggregator.java
ggregation/ProfileAggregator.java
ggregation/util/CommonNicknameCache.java
a73e8547f050e299c60d4cc54b3f1055d61e269f 26-Jun-2012 Makoto Onuki <omakoto@google.com> Merge "Replace transparency with white for all pictures"
1422d81607669bdc2ebd51c1b71f6640293d85cd 24-May-2012 Makoto Onuki <omakoto@google.com> Replace transparency with white for all pictures

Bug 5261517

Change-Id: I6c16bb1f9897589beec222fc63ad899cd478b923
hotoProcessor.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
bstractContactsProvider.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ontactsTransaction.java
rofileProvider.java
fa078d353c83d7739d7e175af418a255e837fe92 18-Jun-2012 Makoto Onuki <omakoto@google.com> am 4c3a0457: Support new query parameters introduced in Iaab5c38a

* commit '4c3a04572ead6ad9f0cfc20a34db3252fdb31201':
Support new query parameters introduced in Iaab5c38a
4c3a04572ead6ad9f0cfc20a34db3252fdb31201 16-Jun-2012 Makoto Onuki <omakoto@google.com> Support new query parameters introduced in Iaab5c38a

The new query parameters controls which field hone.CONTENT_FILTER_URI should
search.

Bug 6662259

Change-Id: I6f4cb4439dc4414cb96cf6a9fc66d0758ddf9faa
ontactsProvider2.java
64ee95a3e48d6f83e338764650c53a915b778cdf 13-Jun-2012 Makoto Onuki <omakoto@google.com> am a499a2ad: Merge "Fix aggregation exception problem"

* commit 'a499a2adb856223de65d298cd93d70c85afe3d4d':
Fix aggregation exception problem
323c20f313689a71f716513f9ea772e992cbd59f 22-Mar-2011 Tomas Mandorf <tomas.mandorf@sonyericsson.com> Fix aggregation exception problem

This patch fixes a bug in the aggregation algorithm. When adding
aggregation exceptions sometimes when excluding a raw contact from
a Contact the contact information was not updated.

Change-Id: If527c0fe0bd51eec77a71e466492691375889037
ontactAggregator.java
76afa00cde0c8d407abf3597359280372fd85d41 15-May-2012 Makoto Onuki <omakoto@google.com> Don't wait for read access latch in provider.getType()

until really necessary.

Bug 6434853

Change-Id: I8f1d898f866b3b8016d720b80f8ffb8caac5048b
ontactsProvider2.java
11c3f85ab75cd21a1975025c6d8614e710161baa 08-May-2012 Jeff Brown <jeffbrown@google.com> Move CancellationSignal to android.os package.

Bug: 6427830
Change-Id: I9e856990512253fe2ca4cc2079d195a7fa991151
ontactsProvider2.java
rofileProvider.java
86f3922c73cc76a8b69b341dcd098517bb55837e 04-May-2012 Makoto Onuki <omakoto@google.com> Merge "Remove never used SocialProvider and activity table" into jb-dev
d2a4512095ec41ae4b67b65b9dd8986460ae8216 04-May-2012 Makoto Onuki <omakoto@google.com> Remove never used SocialProvider and activity table

Bug 6148750

Change-Id: If63219745973aa2629b95259ec692867f5197e79
ontactsDatabaseHelper.java
ocialProvider.java
2fe1f4f757a84cb76382c375ba3755a802c5e444 04-May-2012 Makoto Onuki <omakoto@google.com> More detailed verbose log from contacts provider

Change-Id: I4723c245d4dd93b130552e8257045c0419e0dc6b
ontactsProvider2.java
6b5e583877c12843dd12b16654ef1a02d874c6be 01-May-2012 Makoto Onuki <omakoto@google.com> Merge "Don't show the invisible in frequent" into jb-dev
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
ontactsDatabaseHelper.java
earchIndexManager.java
80628945e7e41bb9363c2fbbd2938890b9217792 30-Apr-2012 Makoto Onuki <omakoto@google.com> Don't show the invisible in frequent

Bug 6000492

Change-Id: I5959cad0e3c04476a1b133508c60cdb8037b16f7
ontactsProvider2.java
f76a0fe0629fb626d96081dc0f272433e4920ba3 26-Apr-2012 Makoto Onuki <omakoto@google.com> Merge "Don't suggest invisible for aggregation" into jb-dev
89f033e186043aeacaf16f73df44f2e0e6a106fa 26-Apr-2012 Makoto Onuki <omakoto@google.com> Don't suggest invisible for aggregation

Bug 6400450

Change-Id: I4b5ed4a331f6740c3954b232633076e60e1de140
ggregation/ContactAggregator.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
ontactsDatabaseHelper.java
9d9994ea8f6b02d2c1afb48a9d776c4c26d6c989 23-Apr-2012 Makoto Onuki <omakoto@google.com> Merge "New aggregation logic"
0992b9d4969ed0eee6e879db94292b635229e2b7 11-Apr-2012 Makoto Onuki <omakoto@google.com> New aggregation logic

Now a raw contact can be merged into a contact containing raw contacts from
the same account if there's at least one raw contact in those raw contacts
that shares at least one email address, phone number, or identity.

Now the aggregation logic version is 3.

Also:
- Make sure changes to the identity triggers aggregation.

- Stop re-using some HashMaps/HashSets, as they don't shirink the internal
table when clear()ed. During the aggregation update we may put a bunch of
stuff into those, and we want to make sure that we don't keep unnecessarily
bit internal tables after the upgrade. This should be okay with the modern
dalvik GC.

Change-Id: I855085d334679363cf9bffb918ca2ceb0cfe77f5
ontactsProvider2.java
ataRowHandlerForIdentity.java
ataRowHandlerForPhoneNumber.java
earchIndexManager.java
ransactionContext.java
ggregation/ContactAggregator.java
ggregation/util/ContactMatcher.java
63630bc7f962fd2b6f2c1bc41cbed45a8bc354ba 17-Apr-2012 Makoto Onuki <omakoto@google.com> Use 3 bucket sorting logic for frequent.

Bug 6343819

Change-Id: Id2a2827fca611e62a5a1406faa73026625feaede
ontactsProvider2.java
87426833d4c2c626e032f5d0b84a08b58024daf6 17-Apr-2012 Makoto Onuki <omakoto@google.com> Fix the last failing photo test

Also add some nice features to the asserts for complex data.
- assertImageRawData() now writes the expected and actual images to the
cache dir when failing.

- assertStoredValues() and its siblings now dump the cursor to logcat
when failing.

Bug 6280711

Change-Id: I77aff61b0494580d0b2ba24b35eb045a18cd48c8
ontactsProvider2.java
ataRowHandlerForPhoto.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
ontactsDatabaseHelper.java
dfab50ecd585e55769dea451cb3a47ff69b8b86d 14-Apr-2012 Makoto Onuki <omakoto@google.com> Fix and simplify data usage feedback

Now it correctly updates both raw_contacts and contacts too, with fewer
sqls and less memory.

Bug 6326418

Change-Id: I89f0f92bae5bad5505b218eca2a29ae56b51fe7f
ontactsProvider2.java
til/Clock.java
b6186821548995dce533ee502e82e9abf4c0aadc 13-Apr-2012 Makoto Onuki <omakoto@google.com> Use new URI for deleting usage stats

Bug 5475575

Change-Id: I11894ef80727e2dc22e73330a5afca41c189135b
ontactsProvider2.java
4e9806e2b347fdbd692d19aeb4fcfd117ebce36e 13-Apr-2012 Makoto Onuki <omakoto@google.com> Merge "New API to clear usage stats"
a780048d2caafbd922444b0c08adb81790db4635 13-Apr-2012 Makoto Onuki <omakoto@google.com> New API to clear usage stats

resolver.delete(DataUsageFeedback.FEEDBACK_URI, null, null);

Bug 5475575

Change-Id: I20adaea0350e95a8f8526507ddc1b2bdc8e8fe13
ontactsProvider2.java
d8f49acc7f64e71152a38cc92ecc2996a2e80670 13-Apr-2012 Makoto Onuki <omakoto@google.com> Merge "Fix most of photo tests"
c23a30e0510cf56d1dafddc79d1ab99ae9297a3f 12-Apr-2012 Makoto Onuki <omakoto@google.com> Fix most of photo tests

Adjusting existing unit tests for higher res photos turned out to be tricky,
because the size of the test images were selected for 256x256.
(e.g. cropping tests)

Also we don't want the display photo size to change depending on the running
device.

So let's just keep using 256x256 for all unit tests.

Added new asserts to EvenMoreAssert to compare image raw data, which prints
actual/expected dimensions when it fails.

Even with this CL, ContactsProvider2Test.testInputStreamForPhoto() still fails
with the following assert message. The image size seems to be correct, so I'm
not sure why. This may be because we've changed the compression rate, but
I didn't dig into it.

"Different data lengths: expected=1088 actual=1578,
expected dimentions=[96 x 96] actual dimentions=[96 x 96]"

Anyway, with this CL at least PhotoStoreTest will no longer crash, so let's
merge it now and take care of the failing test later.

Change-Id: I935f76acee3c2de99030c62e14f43de07074fb8a
ontactsProvider2.java
hotoProcessor.java
ggregation/ContactAggregator.java
321b8325f2adc4b017237b4fe010a7f0f2b017ad 11-Apr-2012 Makoto Onuki <omakoto@google.com> Fix " Cannot bind argument at index 1..." crash

Even when the specified account doesn't exist, we can't just replace
the entire selection with (1=2), because the orignal selection may have query
parameters. Let's just append "AND (1=2)" to the original query instead.

Bug 6295580

Change-Id: Ida13f17fe645329b1b1d5de76252abfb0fcbe282
ontactsProvider2.java
e5165be5b87b41e73d4c6e068c658ff1bfe3f0ac 12-Apr-2012 Makoto Onuki <omakoto@google.com> Merge "Dont show invisible contacts in frequent."
db0e85645ffe5a79500b31390149507ac432a2d9 12-Apr-2012 Makoto Onuki <omakoto@google.com> Dont show invisible contacts in frequent.

Bug 6000492

Change-Id: I0e316f294feca805038611e0449fddcbda0b2deb
ontactsProvider2.java
b7e305c1ad38f1e2058453f7412e51477adf8a24 10-Apr-2012 Makoto Onuki <omakoto@google.com> System prop to keep stale account data

If set to 1 (adb shell setprop debug.contacts.ksad 1) the provider
won't remvoe any data when accounts are removed.

This should be used sparingly; even though there are data still available,
the UI don't know anything about them, so they won't show up in the contact
filter screen, and the contact card/editor may get confused to see unknown
custom mimetypes.

Change-Id: Id036d7e0dd68b84bba953690a74648b25cf090b8
ontactsProvider2.java
18cb61aa592aa2c02c7f583f608ad0f8832f5742 07-Apr-2012 Daniel Lehmann <lehmannd@google.com> Merge "Allow access to the NORMALIZED_NUMBER, so that sync adapters can sync it"
65c62b9a3692410441475604e39f4957fe8a517c 03-Apr-2012 Daniel Lehmann <lehmannd@google.com> Addressed comments about previous CL

Bug:6202229
Change-Id: I8905f92bcea99848969a446b83d90c7cd077e547
hotoProcessor.java
eae25ef81bfe12946f50c72be9647447bb2a16b5 03-Apr-2012 Daniel Lehmann <lehmannd@google.com> Increase the photo size to 480x480 or 720x720, depending on device

Bug:6202229

Change-Id: I98b38023585d154eccad302578f796a2318fd5b2
ontactsProvider2.java
ataRowHandlerForPhoto.java
hotoProcessor.java
hotoStore.java
til/MemoryUtils.java
fb25f3a5a86ca15de8507baf02a357a63032af62 28-Mar-2012 Makoto Onuki <omakoto@google.com> Clear in-memory caches when rolling back transaction

Bug 6245089

Change-Id: I4fe92fbf190090b6e25a411c8c0e2f9885564952
ontactsDatabaseHelper.java
ontactsProvider2.java
rofileProvider.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
ontactsDatabaseHelper.java
ontactsProvider2.java
rofileProvider.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
ontactsDatabaseHelper.java
ontactsProvider2.java
rofileProvider.java
2b3fc5a7984d3d698a44640b18800ba788cbd704 27-Mar-2012 Daniel Lehmann <lehmannd@google.com> Merge "Don't upsize non-square pictures, even when cropping"
4311d471a6666c20809f740331f146957c61af48 27-Mar-2012 Makoto Onuki <omakoto@google.com> Merge "Add new package aggregation.util"
b0208fcd1c296f3eb2b8dfaa55e4fb4972b3d198 27-Mar-2012 Daniel Lehmann <lehmannd@google.com> Don't upsize non-square pictures, even when cropping

Bug:6202229
Change-Id: I88a9a9bb72921f7a3ed80aebe40935656a92eb3a
hotoProcessor.java
81567f4a0f7c9c338506bd82f4d33e83c2ccf159 23-Mar-2012 Makoto Onuki <omakoto@google.com> Add new package aggregation.util

Move aggregator related classes into it.

Change-Id: I712fe07ad2bab1e532e3822e3e2797a199329865
ommonNicknameCache.java
ontactMatcher.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ex.java
ameDistance.java
ameNormalizer.java
ggregation/ContactAggregator.java
ggregation/ProfileAggregator.java
ggregation/util/CommonNicknameCache.java
ggregation/util/ContactMatcher.java
ggregation/util/NameDistance.java
til/Hex.java
084fe28445cf74e3fa93522f8f8e5da6e065b8c3 23-Mar-2012 Makoto Onuki <omakoto@google.com> Make informational queries respect requested projection

Fixed:
- DisplayPhoto.CONTENT_MAX_DIMENSIONS_URI
- StreamItems.CONTENT_LIMIT_URI

Also now ProviderStatus now throws when a non-existent column is requested.

Change-Id: I03c82c31fe78a30d4929335dfb8efc3bff3bc76b
ontactsProvider2.java
904f4a2addf4fdf063cb40185cb73252ff0edefd 10-Mar-2012 Daniel Lehmann <lehmannd@google.com> Allow access to the NORMALIZED_NUMBER, so that sync adapters can sync it

Bug:6126736

Change-Id: Ia1c83c4c600e44f3a354aec7e206267341143ef4
ataRowHandlerForPhoneNumber.java
d3256d7ba4ee8376567f91c1c2dec444ad13d542 10-Mar-2012 Makoto Onuki <omakoto@google.com> am b591640f: am 7f2bbd3b: am 1cd70006: Merge "Adjust a variable type conversion."

* commit 'b591640f590b9ba133d1cae37aba038d1f9d4a86':
Adjust a variable type conversion.
7f2bbd3bbe2a7159854a8c037433b9ec4ad35ccb 10-Mar-2012 Makoto Onuki <omakoto@google.com> am 1cd70006: Merge "Adjust a variable type conversion."

* commit '1cd70006b3314ed7234f613092ccc5ac8f610dac':
Adjust a variable type conversion.
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
ontactDirectoryManager.java
ontactsDatabaseHelper.java
ontactsProvider2.java
earchIndexManager.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
ontactsDatabaseHelper.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
ontactsDatabaseHelper.java
ontactsUpgradeReceiver.java
rofileDatabaseHelper.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
ommonNicknameCache.java
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandler.java
ataRowHandlerForCommonDataKind.java
ataRowHandlerForCustomMimetype.java
ataRowHandlerForEmail.java
ataRowHandlerForGroupMembership.java
ataRowHandlerForIm.java
ataRowHandlerForNickname.java
ataRowHandlerForNote.java
ataRowHandlerForOrganization.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForPhoto.java
ataRowHandlerForStructuredName.java
ataRowHandlerForStructuredPostal.java
rofileAggregator.java
ggregation/ContactAggregator.java
ggregation/ProfileAggregator.java
47ad37083874664d5983627c3ecd8e1c9e86a6f8 01-Mar-2012 Makoto Onuki <omakoto@google.com> Add log to openAssetFile() and query()

(And remove from queryLocal)

To understand better what data is accessed.

Change-Id: Ib59de2336e291a1d19dc9c7b6bd6cb87f0d67f05
ontactsProvider2.java
73e87a8245896e1b38c4dc10c951d2b841c361d4 24-Feb-2012 Daniel Lehmann <lehmannd@google.com> Merge "Replaces HashMap by SparseArray"
dd1cc45e540b41e9a4b824410ca792dd8360b70e 24-Feb-2012 Daniel Lehmann <lehmannd@google.com> Replaces HashMap by SparseArray

Bug:6013599

Change-Id: If121860e3c272e504eba5e3ba094d463dae71d64
ontactLocaleUtils.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
ontactDirectoryManager.java
ontactsDatabaseHelper.java
674f943e22077ae399166d5fe8db96dd3d1f7259 18-Feb-2012 Makoto Onuki <omakoto@google.com> Remove in-memory account cache

Bug 6026073

Change-Id: Ic6057aa2347d1fa4c245ad2f6644ac4d5e8ae3cf
ontactsDatabaseHelper.java
ontactsProvider2.java
5acb3e091bc334d4e0f367a36f8d62a0add02b39 16-Feb-2012 Makoto Onuki <omakoto@google.com> Fix deadlock caused by the fast indexer cache

Also,
- Split up putAndGetBundle() into put() and buildExtraBundle().
The old design was to avoid taking a Bundle as a parameter, which
I generally don't like because it's not self-descrictive.
But splitting it up makes the structure of bundleFastScrollingIndexExtras
much cleaner -- the get() and put() calls are now in a single method,
bundleFastScrollingIndexExtras().

- Removed mFastScrollingIndexCacheLock. I don't really like synchronizing
on a non final member either, but mFastScrollingIndexCache is essentially
final, so I decided to be lazy.

Bug 6020589

Change-Id: If842e52e5334452a52cf8d19c460d52329fc81f4
ontactsProvider2.java
astScrollingIndexCache.java
5a515c25c5b43964c97941bfc13b125f9ff068f9 15-Feb-2012 Makoto Onuki <omakoto@google.com> Merge "Cache fast scrolling index."
35997f3fdee2984b6d5373326110eda26929001a 06-Feb-2012 Makoto Onuki <omakoto@google.com> Cache fast scrolling index.

The cache content is also stored in the shared preferences.

The cache is invalidated when:
- contacts (or profile), raw_contacs, or data is modifiled.
- accounts are changed. (Strictly speaking we have to do this only when
an account is being removed, but not when added. But let's just always do this
for just in case.)
- visible contacts are updated; i.e. when custom filter is udpated.
- the locale changes.

Change-Id: I70cfe7c88d3b1a0a0f820338acbe885c136b6e10
ontactsProvider2.java
astScrollingIndexCache.java
57e70bb3e70f9fe9b2916696fae45e686f567592 07-Feb-2012 Daniel Lehmann <lehmannd@google.com> Reset suggestion fields before reusing the object.

This avoids leaking data from one suggestion into the next for
option attributes.

Bug:5845926
Change-Id: I6c70cb042bf4b92c1e5fd80e8da96d625ef7f7db
lobalSearchSupport.java
1c3bf258545d2598daa23959d9a042d82d738af7 08-Feb-2012 luan hongjun <hongjun.luan@sonyericsson.com> Adjust a variable type conversion.

Integer division may assign 0.0 to a float variable in
NameDistance.java. So change int/int to int/float to realize
automatic type conversion.

Change-Id: I1721eb25a8796ee6b5affa9300c7de1cdd8a1061
ameDistance.java
85ff6534e410880d51b30a3ce362c0d3798375ca 07-Feb-2012 Daniel Lehmann <lehmannd@google.com> Merge "Fix broken sub-QueryBuilder. Instead of selecting only photos, this selected all kinds of data rows :-("
cde9e5e83f7c3a6bf341f9f2fa2359a1ed127f95 07-Feb-2012 Daniel Lehmann <lehmannd@google.com> Fix broken sub-QueryBuilder. Instead of selecting only photos, this
selected all kinds of data rows :-(

Change-Id: Iccfd5573d1f2661d6d5ba660ad4fef12cbc4adbd
ontactsProvider2.java
5f673b204620c4c241b3b39c6ac0ee063d22f13b 06-Feb-2012 Makoto Onuki <omakoto@google.com> Fix G+ crash during account switch

Make sure Raw_contacts / groups deletion works with account column selection.

Bug 5970976

Change-Id: If32f716576d6e4362f72f32289aebce012d19e2f
ontactsProvider2.java
74e8f30b3a67af4defd8f73c503e794785671fee 03-Feb-2012 Makoto Onuki <omakoto@google.com> Add debug logs to applyBatch

Change-Id: I646c7e091c2e778516e6287e3e91770e556ad71f
bstractContactsProvider.java
ontactsProvider2.java
7898a8e97722d5bf0db3c04107b2957b998c0332 03-Feb-2012 Jeff Brown <jeffbrown@google.com> Rename CancellationSignal using preferred spelling.

Bug: 5943637
Change-Id: I223a5e76627cdd604ebb147832f0fb086cb4a5f3
ontactsProvider2.java
rofileProvider.java
e5eefd3998ea1180bd550d2771bd9b83bb5ad6f4 01-Feb-2012 Makoto Onuki <omakoto@google.com> Merge "Fix proguard flags"
72d9e1789b03cc50779ed4ff6f647db1d1b0b175 01-Feb-2012 Makoto Onuki <omakoto@google.com> Merge "Remove the obsolete account columns from newly created db"
15826b1a7fd6d7a5be9223a61d49c0b532ccf01e 31-Jan-2012 Daniel Lehmann <lehmannd@google.com> Pass through the cancelation signal

Change-Id: I248c7817a50a257ec5c2001e529ec4453f7e11cc
ontactsProvider2.java
rofileProvider.java
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
ontactsDatabaseHelper.java
ontactsProvider2.java
1c9a5b6b11256f701c011db3a0ca4cee6c6fd531 27-Jan-2012 Makoto Onuki <omakoto@google.com> Merge "Fix for broken phone number snippet"
6b36358353c03943eec41ef9a8bea123a26782e4 26-Jan-2012 Andy McFadden <fadden@android.com> Tweak behavior of encodeHex

The Hex.encodeHex() function takes a "zeroTerminated" argument
that means, "when you see a zero byte, end the string". This is
being used on Collator keys, which are opaque binary blobs, and
not guaranteed to have a specific format.

This change makes the code work like the framework's DatabaseUtils
functions (getCollationKey/getKeyLen) which will remove the zero
termination if it exists, but otherwise retain the string in its
entirety. This still breaks encapsulation, but is incrementally
closer to correct behavior.

Because ICU happens to return collation keys that look like C strings,
this yields no actual change. All Contacts provider tests behave
as they did before the change, and the "nicknames" table (which
contains hexified collation keys) is unchanged.

Change-Id: Ibf5f31132f4d3119d416b8af7765f9c6eca5b841
ex.java
872cd1f5d04e9c5d4c4db2822c85cbda62b44b3f 25-Jan-2012 Makoto Onuki <omakoto@google.com> Remove the obsolete account columns from newly created db

Bug 5884869

Change-Id: I2cbec01766883a469fb5558306d6a9b7745845b8
ontactsDatabaseHelper.java
fba89ea92f519d77ec1d762724ed11bf4ebb7d20 24-Jan-2012 Makoto Onuki <omakoto@google.com> Fix for broken phone number snippet

Don't add snippet markers when snippetizing is deferrerd.

Bug 5904515

Change-Id: I7199e1d68659e06e2b183383b7ba4d8a089aec87
ontactsProvider2.java
7e086471c6317d059af21d292bee964b24613346 19-Jan-2012 Makoto Onuki <omakoto@google.com> Speed up search query update after each transaction

Contains two optimizations, which will greatly affect initial sync for
an account with a large number of contacts.

- When selecting from search_index, we used two columns from different tables:
'raw_contacts.contact_id IN (...) OR data.raw_contact_id IN (...)'.
But this is really equivalent to
'... OR raw_contacts._id IN (...)' as we inner join the two tables.

The latter is pretty much faster as both columns are in the same table and
each has an index.

Bug 5842620

- When we replace a search_index row, we first try UPDATE and if no rows are
affected then INSERT. But this UPDATE is pretty slow; on a test device it can
easily take >10ms, and with a 10K contacts database it took >80ms. (INSERT
is pretty fast; it's typically ~1ms.)

Let's first bulk DELETE all affected rows, then INSERT. The DELETE takes
roughly the same time as the previous UPDATE, but we only need 1 DELETE
per transaction, not per row contact.

Bug 5887648

Change-Id: I549ea2b47d7058bfba96a861236295f682d88c10
earchIndexManager.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
ontactsDatabaseHelper.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
ccountWithDataSet.java
ontactDirectoryManager.java
ontactsDatabaseHelper.java
ontactsProvider2.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
ccountWithDataSet.java
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForGroupMembership.java
egacyApiSupport.java
ransactionContext.java
9357fc5b4f8d4646df6477138071a3bd931bb86e 23-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.

Also ports in Makoto's fix to the phone lookup tests.

Bug: 5742389

Change-Id: Idda8474337bedaced59916c2b0af87b62b737d83
ontactsDatabaseHelper.java
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForPhoneNumber.java
1bc8603830a07b4ff641bf74227c654c99a8473b 13-Dec-2011 Dave Santoro <dsantoro@google.com> Cherry-pick Fix for GB upgrade issue with phone lookups.

This is a cherrypick from master for this CL
Iea81bc4163cb89169946f9a33f9e15b13e8868ad

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: Id61d5295272106a05af14d3c2ce1695eaf2dd372
ontactsDatabaseHelper.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
ontactsDatabaseHelper.java
47106a03cd4587123f4fa24f3620baf55fed15d9 13-Dec-2011 Dave Santoro <dsantoro@google.com> Moving ProjectionMap to frameworks/ex.

Change-Id: I3ccd0dd27ff0fe49ac54574449264c2e957d3a01
ontactsProvider2.java
rojectionMap.java
oicemailContentTable.java
oicemailStatusTable.java
4c4ea154ba08f2c772d645a092c3ffa4497295df 03-Dec-2011 Daisuke Miyakawa <dmiyakawa@google.com> Prefer usage stat to in_visible_group flag

Bug: 5524077
Change-Id: Ic5a5c541d2e59264f38c26ea991df5bee14b7884
ontactsProvider2.java
fa5cdd337d4d696d326db03c68bfae8645c83b14 21-Nov-2011 Mathew Inwood <mathewi@google.com> Unify and improve isPhoneNumber checks.

- Unify GlobalSearchSupport and ContactsProvider2 isPhoneNumber methods
- Improve phone number recognition for gloval search, using the detected
current country and the SIM country.
- Show 'Create contact' and 'Dial number' suggestion in global search
if there's a contact match too. Otherwise, you can't dial a number
that happens to be a substring of a contacts number.
- Move isVoiceCapable check from GlobalSearchSupport into ContactsProviders
to resolve some testing issues.
- Show 'Create contact' suggestions on tablets.

Bug: 5554109

Change-Id: Ie0afee2a97d7551a267482970f5e0615f1775c7d
ontactsProvider2.java
lobalSearchSupport.java
43825420ddcac27e58645962e02b19b6a8791042 29-Nov-2011 Dave Santoro <dsantoro@google.com> Merge "Fix cross-process cursor logic."
10178e5e0b9de566e04508b624a89860c61787d6 24-Nov-2011 Makoto Onuki <omakoto@google.com> Remove LegacyContactImporter

Contact data migration from donut is no longer supported.

Bug 5664971

Change-Id: I01c56752d93bb0f8e2a0e6ff81285f1971a7c893
ontactsProvider2.java
egacyContactImporter.java
ameSplitter.java
til/NeededForTesting.java
6bb8f22fe3bbcc00f6180a10173e12e7e58f7b5c 28-Nov-2011 Makoto Onuki <omakoto@google.com> Merge "Fix NPEs during ContactsProvider2Test"
887a804b03fcb37be1fde000945dcfd799b3c012 24-Nov-2011 Makoto Onuki <omakoto@google.com> Fix NPEs during ContactsProvider2Test

This happend if a raw_contact had null account name. Apparently some tests
will leave such records. Turned out streamItemPhotoIdToAccount wasn't actually
used, so I just removed it.

Also now ContactsProvider2.onCreate() doesn't supress exceptions if running
unittests.

Also removed ContactAggregatorPerformanceTest, which was failing to initialize
the provider as well. It was essentially disabled2 years ago anyway in
Id076a108.

Bug 5664700

Change-Id: I0b7fb0834965058886aa816a47629b93b86a6e13
ontactsProvider2.java
18b09495f5f37b38ff2e1c965e087dfde68c27fb 23-Nov-2011 Makoto Onuki <omakoto@google.com> Remove SUMMARY_GROUP_COUNT_PER_ACCOUNT support (for now)

This sub-query needs to be rewritten for the upcoming accounts
refactoring, but since it's @hide'ed and no one is using it, let's
just remove it for now.

I believe this count can be implemented efficiently using a join
(in a similar way we support SUMMARY_COUNT) rather than a subquery, but
this should be even easier after the refactoring.

Also when we re-implement this, we can just check if the projection
contains SUMMARY_GROUP_COUNT_PER_ACCOUNT, so we'll probably be able to
remove PARAM_RETURN_GROUP_COUNT_PER_ACCOUNT.

Change-Id: I3adc93cdf57280ab06b4a2cab77f834811178af8
ontactsProvider2.java
b6b22df3a64a80531d58f9cd60f2872fc2af92d1 02-Nov-2011 Dave Santoro <dsantoro@google.com> Fix cross-process cursor logic.

This fixes some issues with our cross-process cursor handling,
per Jeff Brown's recommendations.

Bug 5220669

Change-Id: If6599f0e7986cc4cc678b2123fcd694973b42034
ontactsProvider2.java
rossProcessCursorWrapper.java
nstrumentedCursorWrapper.java
emoryCursor.java
193f2da3b4c3e019cc3a85a7101478332b1869ec 22-Nov-2011 Makoto Onuki <omakoto@google.com> Minor cleanup for ContactsProvider2

- Add final when applicable
- Renamed some constants for consistency
- Use @VisibleForTesting
- Other minor clean-ups

Change-Id: I4dc835c8b099334ee51f8c8e9a5e7e5629b717d5
ontactsProvider2.java
2043d0e274e2fd11e0a43d89c2214ab2e6537619 19-Nov-2011 Makoto Onuki <omakoto@google.com> Merge "Remove hasColumn() and use isInProjection() instead."
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
ontactsDatabaseHelper.java
ontactsProvider2.java
e432023d408c461295e53c0593fabb2b4c17aeb3 23-Oct-2011 Daisuke Miyakawa <dmiyakawa@google.com> Add Callable URI support

This must be after I4729c87ecd11296599ed0313e8ad1f5aeabbd32b, which
introduces URIs this change depends on.

- CONTENT_URI will return a list containing both phone numbers and
sip addresses.
- CONTENT_FILTER_URI will return a list containing both, filtered
by a parameter. The URI will return addresses starting from
"sip:" too just for convenience. If a user type "johndoe",
sip addresses like "sip:johndoe@example.com" will also be returned.

Bug: 5039627
Change-Id: Ifbbfe9df3b9a560666d35ca78aeb07d513963195
ontactsProvider2.java
d0f0a9e6cb988cf354a812ddd18fc9163c2ac02c 17-Nov-2011 Makoto Onuki <omakoto@google.com> am 84af796b: Merge "Fix for arabic crash" into ics-mr1

* commit '84af796b8a6eaba851c6af2922500ad1bc49a34b':
Fix for arabic crash
0028e31e2fe6547177c72607256a83ede1f2566d 17-Nov-2011 Makoto Onuki <omakoto@google.com> am f5f038fa: Fix search for hyphenated names

* commit 'f5f038faf7f3ef460e1c11028d467954840e5f6f':
Fix search for hyphenated names
84af796b8a6eaba851c6af2922500ad1bc49a34b 16-Nov-2011 Makoto Onuki <omakoto@google.com> Merge "Fix for arabic crash" into ics-mr1
a99ffbd887e5120951845e5c60c32f459f71e9f2 16-Nov-2011 Makoto Onuki <omakoto@google.com> Fix for arabic crash

Make sure not to localize when using String.format to build SQL.

Bug 5619742

Change-Id: I66fd9c4a50dd6c083099a9def93840ff05aed5a6
ontactAggregator.java
ontactsProvider2.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
ontactsDatabaseHelper.java
earchIndexManager.java
c3b1e1c73146b6373f6666e7834aa767ea8ccfb6 15-Nov-2011 Daniel Lehmann <lehmannd@google.com> am 38f1fd23: Merge "Optimize STREQUENT queries and fix estimated table row counts" into ics-mr1

* commit '38f1fd23d523be9d8706b172c338d2a45d8f06ff':
Optimize STREQUENT queries and fix estimated table row counts
02b1a4637172d574512be0a5234f40cd45a723cc 15-Nov-2011 Daisuke Miyakawa <dmiyakawa@google.com> am 8ead0dc6: Allow the provider to conditionally remove duplicate entries

* commit '8ead0dc62d0031a22af0d14c7ed05893507893c9':
Allow the provider to conditionally remove duplicate entries
38f1fd23d523be9d8706b172c338d2a45d8f06ff 15-Nov-2011 Daniel Lehmann <lehmannd@google.com> Merge "Optimize STREQUENT queries and fix estimated table row counts" into ics-mr1
9978b26dd17bb2b20b91101f1e4682604336b5f6 15-Nov-2011 Flavio Lerda <flerda@google.com> Use integer constant when adding filtering clause.

Currently we are quoting an integer constant when generating the
filtering clause that excludes voicemails from the set of calls returned
to applications querying the default call log URI.

Pass the integer to the helper function, so that we can avoid quoting.

Change-Id: I1e460d2c8d3b04047cf4a1f4e1209b3e4ba5053b
allLogProvider.java
oicemailContentProvider.java
oicemailContentTable.java
til/DbQueryUtils.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
ontactsDatabaseHelper.java
ontactsProvider2.java
8ead0dc62d0031a22af0d14c7ed05893507893c9 11-Nov-2011 Daisuke Miyakawa <dmiyakawa@google.com> Allow the provider to conditionally remove duplicate entries

Must be after Ie88af0c3d21919ca201f4fcdd46ca09e9f8d94c0, which
introduced the new flag for duplication removal.

With this change the default behavior for Phone uri will be back
to the behavior before Ie21abb12736715358dd33bc690269f51ae1e0944
being introduced.

Bug: 5484956
Change-Id: I3b6ba3956449520f9e08653fc8beead763a5f8a1
ontactsProvider2.java
b5000cb82b8abd301e6e7b3b3f6d71e219b56f1c 08-Nov-2011 Daniel Lehmann <lehmannd@google.com> Merge "In Email-lookup query, prefer visible over invisible contacts" into ics-mr1
071d0e7bd3b2f3c9628dd655b09d147e668c3931 08-Nov-2011 Daniel Lehmann <lehmannd@google.com> In Email-lookup query, prefer visible over invisible contacts

Bug:5578303
Change-Id: I29beb8ce7ab0745b9f57b399fe017d60fbb96285
ontactsProvider2.java
5f9a2c3c9f1deefa1da88dcf580bf28859b44aa2 22-Oct-2011 Daniel Lehmann <lehmannd@google.com> Match contacts if identities match.

Bug:5237405
Change-Id: I5def748ecd5ce7d9c847b06b5111217d5d577492
ontactAggregator.java
ontactMatcher.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
ontactsDatabaseHelper.java
ontactsProvider2.java
b91899a113c499ef96fe5719398558b4cfd128c2 01-Nov-2011 Dave Santoro <dsantoro@google.com> Fix double-close of transactions if yields fail.

This was causing the exception that caused the failed yield to be
swallowed instead of propagated, as the second close was failing
due to lack of a DB lock on the thread.

Bug 5515111

Change-Id: Ic847801655b28301913b07b3929794b3ba16c5ae
bstractContactsProvider.java
ontactsTransaction.java
437d183d6ac71c9f5e0b75ee28f76956c3749ea7 01-Nov-2011 Daniel Lehmann <lehmannd@google.com> am 1322df8f: Fix extreme slowness in FTS search

* commit '1322df8f90d80587748ad10539516635326c01e8':
Fix extreme slowness in FTS search
1322df8f90d80587748ad10539516635326c01e8 31-Oct-2011 Daniel Lehmann <lehmannd@google.com> Fix extreme slowness in FTS search

Bug:5534735
Change-Id: I561bcf32d3c66b1a86b36a043d407a725325419d
ontactsProvider2.java
a2535f334849b4b16cef6dc55041a426ad57909a 28-Oct-2011 Makoto Onuki <omakoto@google.com> Merge "Speed up query for group tab" into ics-mr1
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
ontactsDatabaseHelper.java
ontactsProvider2.java
ac6f0b8a92fccb3611a7841d0f04e4ac24a58c91 20-Oct-2011 Makoto Onuki <omakoto@google.com> Don't use getInstalledPackages().

It's almost same as my previous CL 143783, except this time it uses
pm.queryContentProviders() to enumerate only packages that have a content
provider.

It still uses getPackageInfo(), but only on packages with a directory
provider and there aren't many directory providers around (there are only
two known ones: Exchange and the googlesync), so it should be okay.

(We could get rid of the getPackageInfo() call but that'd be too big a change
for MR1.)

Bug 5422702

Change-Id: I67f51f6a770bf1de6779b366017431c36b63815c
ontactDirectoryManager.java
679acd3308fb51ba24f247798a610da7e681a6c5 24-Oct-2011 Dave Santoro <dsantoro@google.com> am 5dccfb05: Fix deadlock case when removing accounts.

* commit '5dccfb059f5df0e9fdba026bcfbed677f44922cd':
Fix deadlock case when removing accounts.
5dccfb059f5df0e9fdba026bcfbed677f44922cd 22-Oct-2011 Dave Santoro <dsantoro@google.com> Fix deadlock case when removing accounts.

The account cleanup flow generally operates on one database (either
contacts DB or profile DB), bringing the account set up-to-date with
the accounts that remain in the system. However, the code was also
doing an update of the search index, which is bad in the profile case
because the search index is only associated with the contacts DB, and
threads must never ever open a profile transaction and then open a
contacts transaction (or deadlocks may occur).

This fixes the issue by skipping the pointless search index update if
in profile mode, but longer-term it would be good to get rid of code
that starts DB transactions outside of using ContactsTransaction.

Bug 5496295

Change-Id: Ieb4d42a21f85a85f18a4415463ea7c8dd3cc2477
ontactsProvider2.java
d1f800d2712c9050f350bd940e3333c35f558e83 18-Oct-2011 Daniel Lehmann <lehmannd@google.com> Code cleanup. Fixes most of the IDE warnings

Change-Id: Ibeff9a520563f6e1fea3f409ada6f934e98e4814
ontactAggregator.java
ontactMatcher.java
rofileAggregator.java
906cae61cada57539a87d25ca4fbe099836cf896 17-Oct-2011 Daniel Lehmann <lehmannd@google.com> Merge "Remove Live-Folders"
4004a43c7fbe48ba72de46cc88eb5567df184258 17-Oct-2011 Daniel Lehmann <lehmannd@google.com> Remove Live-Folders

Bug:5254892
Change-Id: I41cf5df369b887361e545d9e0acccef308824875
ontactsProvider2.java
9650d6727d11ce4665912da15cede15a578c5925 15-Oct-2011 Daniel Lehmann <lehmannd@google.com> Merge "Use hexadecimal collation key for name searches." into ics-mr0
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
ontactsDatabaseHelper.java
ontactsProvider2.java
earchIndexManager.java
d0eb93009559d095de0448907527aeb059801dc4 14-Oct-2011 Dave Santoro <dsantoro@google.com> Switch to using SecureRandom for tokens.

Bug 5462343

Change-Id: Ie54fc63eea215491f7e9d842a054996454765fb6
ontactsProvider2.java
73dab78ab7f87124b9500236e6c9b3ef240687d2 14-Oct-2011 Dave Santoro <dsantoro@google.com> Merge "Detect profile VCard URIs and support tokens." into ics-mr0
82792ae937085bfa1f7878166e89ca4ea84fd652 10-Oct-2011 Dave Santoro <dsantoro@google.com> Detect profile VCard URIs and support tokens.

This fixes the URI matcher to interpret VCard URIs for the profile
properly, and adds support in the provider side for pre-authorizing
URIs using temporary permission tokens.

Bug 5437453

Change-Id: I37bb6f759df833a3f007faef1eb35fb1434f7df2
ontactsProvider2.java
rofileAwareUriMatcher.java
rofileProvider.java
897e51661e0cb08c0f2d3e59136a1a6f8ceb2316 13-Oct-2011 Daisuke Miyakawa <dmiyakawa@google.com> Omit "other contacts" in contacts search again

Per bug 5336673 search_index now has index for "other contacts", which
isn't appropriate for People UI's contacts search. This change let
the contacts filter omit them using WHERE clause.

See also Ib77acdfa6968605a66561f0925d0aa81f4522bb9, which introduced
the search_index modification.

Bug: 5457264
Change-Id: Ia5dfc7ff33d503b9fe814ee0ec058e85cee0b9c8
ontactsProvider2.java
376917cea44aec4dfd68dec23522353b142535fd 06-Oct-2011 Dave Santoro <dsantoro@google.com> Allow multiple inserts in bulk between yields.

This should help to optimize these operations to avoid the overhead
of doing lots of individual inserts when the database is very active.

Bug 5353552

Change-Id: I5b3a06f41637452ec98297c66579fb7d4f81e2ec
bstractContactsProvider.java
d9125effce84804631c8e618ae88b2cfc69cf529 07-Oct-2011 Dave Santoro <dsantoro@google.com> Use internal APIs for cleaning up photos.

This avoids running into security exceptions when the cleanup
involves permission-protected data.

Bug 5422732

Change-Id: I5554d53ca76c5d513467c66782f7bf3ea61aa78b
ontactsProvider2.java
3a2043b8a68a800d4b1bedb88fbc0e1da8ce4d80 05-Oct-2011 Dave Santoro <dsantoro@google.com> am 36612112: Implement new social stream permissions.

* commit '36612112760df799ef89f7e324e5dfabd5ca0d2b':
Implement new social stream permissions.
36612112760df799ef89f7e324e5dfabd5ca0d2b 04-Oct-2011 Dave Santoro <dsantoro@google.com> Implement new social stream permissions.

Reading/writing social streams now requires READ_SOCIAL_STREAM or
WRITE_SOCIAL_STREAM permission. The special stream item insertion
that occurs on status update insertion is exempt from this
requirement.

Bug 5406886

Change-Id: I6a711d7f33b501e2c331c71684b2eb3a6bfd5ec5
ontactsProvider2.java
cb639a50b907b1dd1d7527ef97e6fa29ea693a29 04-Oct-2011 Flavio Lerda <flerda@google.com> Merge "Add new column for cached formatted number."
13ed28505ed1af4f0b4a6297c4c6840d91f10c8c 01-Oct-2011 Flavio Lerda <flerda@google.com> Add new column for cached formatted number.

Bug: 5316982
Change-Id: I2870778c8056468730d82794ddae90c74cab85fc
allLogProvider.java
ontactsDatabaseHelper.java
20e99644372a288beabe8d9d9481f34e2f4045d8 22-Aug-2011 Mark Brophy <mbrophy@google.com> Handle complex phone numbers in ContactsProvider.

Use i18n.phonenumber.PhoneNumberUtil to check whether the query is a
phone number.

Bug: 5396858
Change-Id: If389f6d996c6789630d91834d45778f420c6dde3
lobalSearchSupport.java
fcc7025b595564cff1bf211cd4089411e9b2f827 28-Sep-2011 Dave Santoro <dsantoro@google.com> am c990980a: Fix deadlock opportunity.

* commit 'c990980ab4beb7b81c3337526f1bdcd5d1a14730':
Fix deadlock opportunity.
c990980ab4beb7b81c3337526f1bdcd5d1a14730 27-Sep-2011 Dave Santoro <dsantoro@google.com> Fix deadlock opportunity.

The Profile provider was not synchronizing all transactions on the
contacts DB as it needed to. During commit, most transactions were
doing queries on the contacts DB. As a result, a profile op thread
could have a profile lock and then try to get a contact lock, and
contact op threads could have a contact lock and try to get a profile
lock while updating provider status.

Ensuring that all transactions first require a lock on the contacts
DB avoids the deadlock scenario.

Bug 5381085

Change-Id: I832e075ea37f0d650187b8ec067677ccee75a838
ontactsProvider2.java
3746d1277bfea1952d04e54ba1e0962be0cae259 26-Sep-2011 Mathew Inwood <mathewi@google.com> Merge "Don't return 'dial' suggesitons if we're not voice capable."
e57045a9b0034063e14ea34b6574b0b0f9fc8998 26-Sep-2011 Dave Santoro <dsantoro@google.com> DO NOT MERGE Port DB upgrades from master.

This brings the DB helper up-to-date with Master and fixes the
two bugs mentioned below on the factory ROM branch.

Bug 5118670
Bug 5336673

Change-Id: Ic3c68eeb96d08e74cfbd635baa61a8ce53bd9bf2
ontactsDatabaseHelper.java
earchIndexManager.java
6efb7db26598b105342d02207e0ca1c8725c10da 22-Sep-2011 Dave Santoro <dsantoro@google.com> Fixes and cleanup for transactions.

- Make the thread-local transaction shared between the contacts and
profile providers (as the implementation intended).
- Remove a bunch of extraneous variables from the contacts provider.
- Ensure that the profile provider switches the delegate into profile
mode before running onBegin() or onCommit().
- Port the fix for applying contact changes to the profile DB.
- Fix an issue with profile aggregation after the profile has been
deleted.
- Addressed a case in which we would create (and possibly hold onto)
a profile DB transaction erroneously.
- Ported fix for aggregation when raw contacts are deleted.

Bug 5320369

Change-Id: I1f36d4c87c6b655dfcb5e339f151d3bf1d37a437
bstractContactsProvider.java
ontactsProvider2.java
rofileAggregator.java
rofileProvider.java
873d6bed8f795a0f4b75560ecbe92feade516514 23-Sep-2011 Mathew Inwood <mathewi@google.com> Don't return 'dial' suggesitons if we're not voice capable.

Bug: 5317968
Change-Id: I52f9694de9781d0221e37078715398df69ae0354
lobalSearchSupport.java
4339e63032025be6ef61e60c6298dc7ab391c31b 22-Sep-2011 Daisuke Miyakawa <dmiyakawa@google.com> Merge "Make search aware of names in "all other contacts""
1744cae1895be1082404220667d1fecf7d148a71 22-Sep-2011 Dave Santoro <dsantoro@google.com> am ae94a710: Merge "Change Settings insert conflict to do an update." into ics-factoryrom

* commit 'ae94a710dbc0ea239277c25986e39ba53904c5fc':
Change Settings insert conflict to do an update.
a9995c98ba99bcdd101bc4734fdb3ff08e9efe8f 22-Sep-2011 Dave Santoro <dsantoro@google.com> Fixes and cleanup for transactions.

- Make the thread-local transaction shared between the contacts and
profile providers (as the implementation intended).
- Remove a bunch of extraneous variables from the contacts provider.
- Ensure that the profile provider switches the delegate into profile
mode before running onBegin() or onCommit().
- Port the fix for applying contact changes to the profile DB.
- Fix an issue with profile aggregation after the profile has been
deleted.
- Addressed a case in which we would create (and possibly hold onto)
a profile DB transaction erroneously.
- Ported fix for aggregation when raw contacts are deleted.

Bug 5320369

Change-Id: I1f36d4c87c6b655dfcb5e339f151d3bf1d37a437
bstractContactsProvider.java
ontactsProvider2.java
rofileAggregator.java
rofileProvider.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
ontactsDatabaseHelper.java
earchIndexManager.java
79168d502c62f205523a5f804c1df2864d193124 21-Sep-2011 Dave Santoro <dsantoro@google.com> resolved conflicts for merge of 078f588c to master

Change-Id: I17e4d57df3bb24388ca9ead92f9a40fc57bc0fd3
ae94a710dbc0ea239277c25986e39ba53904c5fc 21-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Change Settings insert conflict to do an update." into ics-factoryrom
0e21a867a572679d64d79041eb574d13665178d4 21-Sep-2011 Dave Santoro <dsantoro@google.com> Change Settings insert conflict to do an update.

This was the behavior the Settings table had before (when uniqueness
was enforced by the primary key), and it was assumed by external
apps, including Twitter.

Bug 5336876

Change-Id: Iab792df6a5d31c780a33ddebabdb26c7768f373b
ontactsProvider2.java
078f588cef389358adabc579de00747878f3c108 21-Sep-2011 Dave Santoro <dsantoro@google.com> Refactor transactions for contacts.

Rather than extending SQLiteContentProvider, the profile and contacts
providers now extend AbstractContactsProvider, which handles keeping
track of a thread-local transaction with awareness of what databases
have been enlisted in the transaction and whether it is being run in
the context of a batch operation.

This is intended to solve the issue of how the content provider can
manage transactions that operate across multiple databases without
risking deadlocks.

Bug 5320369

Change-Id: I08a7d518a3eae1b0bf438402d02f1f1d8e8df7b9
bstractContactsProvider.java
ontactsProvider2.java
ontactsTransaction.java
rofileProvider.java
85077339f2e0c6f21fd92fb8df335f3aae004fba 20-Sep-2011 Dave Santoro <dsantoro@google.com> Add support for profile/<photo> URIs.

The URIs profile/photo and profile/display_photo can be used to load
the thumbnail and display photo (respectively) for the user's profile
entry.

Also had to move ContactDirectoryManagerTest to MediumTests because
the LargeTests are starting to crash due to the SQL memory issue
again.

Bug 5226635

Change-Id: I7bf9787b06a49bf59c758421552dc969e6c6907d
ontactsProvider2.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
ontactsDatabaseHelper.java
78c48301b4135d02646a705d0de2e76abd904fde 17-Sep-2011 Dave Santoro <dsantoro@google.com> Revert new applyBatch method - it is harmful.

The primary problem is that the overridden method keeps track of
whether we're in a batch operation in the ContactsProvider2 scope,
leaving SQLiteContentProvider out of the loop. Meanwhile, the
SQLiteContentProvider insert/update/delete operations are checking
its own private flag for batch checking, and since that's always
false, they're creating and closing their own transactions
throughout the batch, which completely breaks transactionality
(and the functionality tied to it, like aggregation).

Bug 5320369

Change-Id: Ia7d00a770be179e5bef1226dffff3c2915c38e66
ontactsProvider2.java
2e5dda44de657f3fdf6d7241cdd318d2286c3cfb 16-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Do same photo processing for insert/update."
d022a80fababc650b4b4f3f5d25b877518aed266 16-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Fix deadlock in applyBatch."
edd81e0b038f478b857f384617ee29de0d0c894c 16-Sep-2011 Martijn Coenen <maco@google.com> Merge branch 'master' of ssh://android-git:29418/platform/packages/providers/ContactsProvider
1c0ff492c0b308fd88f2d19de9f1b3dc3a672460 15-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Re-aggregate all data on raw contact delete."
41f76a59a31946f6d784dacf9f13d9a4c0bbe203 15-Sep-2011 Dave Santoro <dsantoro@google.com> Re-aggregate all data on raw contact delete.

Previously it would just re-aggregate the display name, which would
miss things like display photo needing to change.

Bug 5324939

Change-Id: Ia06713c985d727efe117b3f1440af2f280874094
ontactsProvider2.java
3711af1a5799a7ae0c8e761e13a67a9fb5878cc8 13-Sep-2011 Martijn Coenen <maco@google.com> Set the VCardComposer raw contacts URI correctly for the profile.

Bug: 5300714
Change-Id: I87db1056498add7d4c29675fe75b07596242e8d7
ontactsProvider2.java
d0dba67000bfb73b6281a9ca6d476470f1ac41f2 15-Sep-2011 Dave Santoro <dsantoro@google.com> Do same photo processing for insert/update.

Specifically, we want to avoid inserting photos with empty byte
arrays.

Bug 5319468

Change-Id: I5c7fb18d76a15eaf202d8e81add189ce053156f2
ataRowHandlerForPhoto.java
36aa19fbab3722288b7f0917166ef6990ab7b52c 15-Sep-2011 Dave Santoro <dsantoro@google.com> Fix deadlock in applyBatch.

This is a simple attempt at a fix (as with most deadlocks, hard to
determine whether this really fixes the problem until the fix is
out in the wild for a time).

Bug 5320369

Change-Id: Ibc7634bc41c72303f05d26dc4250ed8ab7e859ec
ontactsProvider2.java
bd20dbedba706fdf2db7acb1c7d4391e57129d44 14-Sep-2011 Dave Santoro <dsantoro@google.com> Add lookup key support for photo URIs.

Bug 5235737

Change-Id: Iec2ef8ada5b70e22e35b6912ab62e6e680309dc6
ontactsProvider2.java
hotoStore.java
dc586a1fb85149e10e86f65eb532c8aa6f7ab0cc 14-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Do mimetype filtering based on ID."
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
ontactsDatabaseHelper.java
ontactsProvider2.java
91abbc9f691297594262d1f2d79acb744a66712c 13-Sep-2011 Dave Santoro <dsantoro@google.com> Fix a case that would trigger an account error.

Change-Id: I9e09d60a0a60a151c6c43842a499410b65e33693
ontactsProvider2.java
d9e353f4a13154dace037c99eb1054d85cce2521 09-Sep-2011 Dave Santoro <dsantoro@google.com> Fix URI support for profiles.

Many URIs that have essentially the same functionality for both
contacts and profiles have been collapsed into one case to save code,
and some profile-specific URIs that should have supported operations
have been added.

Also fixed an issue with detecting whether the provider is currently
operating in batch mode, and set up raw contacts to be fully deleted
if they have no associated account (i.e. they are local).

Bug 5284316

Change-Id: Ia6e129a4cdbd0e105be0c1a66c25e4955bdfbfae
ontactsProvider2.java
1a265df05176fb9213048a40bc1bff5900b027e2 09-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Add data_set for Settings."
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
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyApiSupport.java
b9be9c48e39c6fd940a65f4a7070d7f51c642ea0 08-Sep-2011 Isaac Katzenelson <isaack@android.com> Merge "Fix snippetizing cursor"
b7c083473a499d6d3ca48b48dcdb728dd5268cd4 08-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Add support for profile raw entities URI."
fabb89d3cead152f8bd768f62eeb5fc60406eab0 07-Sep-2011 Dave Santoro <dsantoro@google.com> Fix profile aggregation.

Bug 5248459

Change-Id: I6f09814d5f8b372173e8e82f7cf6dd5b98ba98a6
rofileAggregator.java
3202ae2de5c5fec9f5f61003a0e6b608283e1961 08-Sep-2011 Dave Santoro <dsantoro@google.com> Add support for profile raw entities URI.

Bug 5274218

Change-Id: Ic5b0b5ace48dfaea81190b8262c622179f20f617
ontactsProvider2.java
b3a1271feb57be104aabe8046846da0071a1f23e 02-Sep-2011 Isaac Katzenelson <isaack@android.com> Fix snippetizing cursor

Bug: 5217242 Email address with the found "snippet" highlighted should
be displayed on the second line below the contact name
Provider size fix:
Added support for deferred_snippeting parameter to URI.
Replaced the cursor wrapper with a code that inserts a bundle into the cursor
for client side snippeting

Change-Id: I1f411071d3d8552eab3c41303d1a99ab6fe0a801
ontactsProvider2.java
lobalSearchSupport.java
nippetizingCursorWrapper.java
13291f122c031a52bdb1116feb30a2b5f0893979 07-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Fix aggregation."
c88cc79e0e19b8299a2a356c7d70b48f70b4a93e 07-Sep-2011 Dave Santoro <dsantoro@google.com> Clean up stream items on account removal.

Bug 5239627

Change-Id: I0c45baeaf6e3a1730760f49696e1f489ef22490f
ontactsProvider2.java
6b556103afd9aa1bdfba8164c462093ef0822f31 07-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Fix issue with cleaning up stream item photos."
0a3ba72748faa8e3909ee7d5294fc07eb1c4de92 07-Sep-2011 Dave Santoro <dsantoro@google.com> Fix aggregation.

Last week's change to handle the profile lookup key broke the way
that aggregation assembles the lookup key for regular contacts.

Change-Id: I56bc9cdfee129789dd260ed27b62e476db970ff8
ontactAggregator.java
rofileAggregator.java
d2ee1503a0de87863c21153c723442328ad79bb7 07-Sep-2011 Flavio Lerda <flerda@google.com> Merge "Fix status message in contact updates."
43e5c84252ff510a3536e34ce39ff046882a294f 07-Sep-2011 Flavio Lerda <flerda@google.com> Merge "Fix voicemail tests."
c2714bbd397b09a20da476c89560e1caecdcce58 07-Sep-2011 Dave Santoro <dsantoro@google.com> Fix issue with cleaning up stream item photos.

Bug 5250048

Change-Id: Ibb0daef7a089ec851a9201cfd4163173f713f839
ontactsProvider2.java
82780691f1a3b4d8784e29a961b1140cd07bc9a8 07-Sep-2011 Dave Santoro <dsantoro@google.com> Clean up stream items when raw contact is deleted.

Also added support for raw_contact/#/stream_items/# URIs, which we
were returning on stream item inserts for a raw contact.

Bug 5239627

Change-Id: I32116b32f1ebd28f7c86d6dc7567fca8f7c7ff07
ontactsProvider2.java
5fc972e270197c08ac6d26b4b5f672cddb669f70 06-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Prevent stream item photos from being nuked."
6bd4c1b9d4d05e96dee1233614dc7a0265ea608a 06-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Fix lookup key generation for inserted profiles."
f402aaf776fee29d8044d97979b16695f24086dd 05-Sep-2011 Flavio Lerda <flerda@google.com> Fix voicemail tests.

The problem is that we run this query locally (within the same process)
in the tests and this means that the content values passed in were
modified and later re-used (assuming it would not contain the extra,
generated columns). The solution is to always make a copy of the content
values before modifying them in the provider (which is the safest way
anyway).

Bug: 5226211
Change-Id: I972111821a4af1e1d3df2dc47189d664a7303683
allLogProvider.java
oicemailContentTable.java
5d9fcbaaa0007134564d63272470296f5d23b62a 03-Sep-2011 Dave Santoro <dsantoro@google.com> Prevent stream item photos from being nuked.

Bug 5250382

Change-Id: Ie121858a4a2c7584f04432e7830bdbeb6cd52bf7
ontactsProvider2.java
a5542f6ec9ef1ee2f54ce85f26d826bd88e4a5b1 03-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Another fix for the bulk insert problem."
c5fdfb79564e8b46d6aae213a312d4e1560f3a3c 03-Sep-2011 Dave Santoro <dsantoro@google.com> Fix lookup key generation for inserted profiles.

We were properly updating the lookup key to "profile" on updates,
but the initial insert would still have a regular lookup key, which
would prevent us from identifying it as a profile URI, and in turn
meant that stream items wouldn't show up for the profile.

Bug 5245109

Change-Id: I7c01d051a167214be77bd962901af6cdb6100787
ontactAggregator.java
ontactLookupKey.java
rofileAggregator.java
14fa8096cb8d2bc59cace60248f7d08316b3df72 03-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Add support for I/U/D on profile/data URI."
8d55bbc171bea632e960e0e5a88557cef5e66d92 03-Sep-2011 Dave Santoro <dsantoro@google.com> Another fix for the bulk insert problem.

The insert depends on mDb being set, which our totally-overridden
bulkInsert method didn't do.

Bug 5239086

Change-Id: Id86eee9e5f6a9076dfa29f985d83387ba1ec4f8d
ontactsProvider2.java
0c5812a467378c57c2d2715ee4f0a9f541c64809 03-Sep-2011 Dave Santoro <dsantoro@google.com> Add support for I/U/D on profile/data URI.

Also make sure that deletes of data use the appropriate URI when
querying for the rows to delete if in profile mode.

Bug 5249062
Bug 5201592

Change-Id: I206fb8653bdc111c4cab1e703346fc56502fce65
ontactsProvider2.java
9d4236390716603995c7bdc787ec1c423df8e5db 02-Sep-2011 Makoto Onuki <omakoto@google.com> Merge "Fix alphabetical headers for phone-all contacts"
2ebc62b692be3aaaeafa01d658ae3cdfb25b728a 02-Sep-2011 Makoto Onuki <omakoto@google.com> Fix alphabetical headers for phone-all contacts

- On phone, we dedupe phone numbers using "group by", but we don't
do that in bundleLetterCountExtras, so there'll be mismatch if a contact
has dup numbers.

- The proper fix would be to make bundleLetterCountExtras() respect group by,
but we'd have to use a subquery to do this, and this method is quite tricky
to tweak without risking regression or negative impact on performance.
(I know because I tried to optimize it...)

- So instead, just use count(distinct CONTACT_ID, PHONE NUMBER) instead of
count(*) to count records in this case. But count() takes one argument,
so concatinate these two columns instead, i.e.
count(distinct CONTACT_ID || ',' || PHONE NUMBER)

This change is pretty low-risk, and not as slow as it may look. It only slows
down the query by 14% with 10,000 contacts (1.4sec v.s. 1.6sec).

- We also use group-by for the followin queries, but I don't think they'll
ever be used with addressbook indexer?
CONTACTS_FREQUENT, PHONES_FILTER, EMAILS_FILTER and GROUPS_SUMMARY

Bug 5249927

Change-Id: Ib6f307efafb0a402cbfed74f09e7d28fdd246823
ontactsProvider2.java
072079319b9bd2998b06a2cab0e9b4af6eb05c33 02-Sep-2011 Dave Santoro <dsantoro@google.com> Make all modification operations serialized.

Prior to this change, it was possible for a profile operation and a
contacts operation to both be run simultaneously, since each DB
maintained a separate transaction lock.

With this change, ALL operations start a transaction on the contacts
DB, so modifications to either DB will be serialized. This should
address the root cause of the jumbled mValues bugs, since only one
operation should be executing at any given time.

Bug 5248637

Change-Id: I4cdefddcb7b84f120d009300f45b772f439be88d
ontactsProvider2.java
ae660f448c485f20dc051f6268759469d394277e 02-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Fix photo updates when no photo is specified."
cfc422b077c30f3e70c8506952de02d526d71a04 01-Sep-2011 Dave Santoro <dsantoro@google.com> Fix photo updates when no photo is specified.

If no photo key is present, we will not attempt to do any photo
processing on the row. The existing photo and photo file, if any,
will be unaffected.

If a photo key is present but the value is null or an empty byte
array, we will clear out the photo BLOB and photo file fields when
updating.

Bug 5247668

Change-Id: Ice8508060ab272bedfb42d105df55e972357e843
ataRowHandlerForPhoto.java
e72fee30ee40a3c8dd22af43c6257d93bc25b477 01-Sep-2011 Makoto Onuki <omakoto@google.com> Merge "Use new api AbstractCursor.setExtras() to return index info"
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
ontactsDatabaseHelper.java
63f81c9140195d0deb91996e5a416b646597a30c 01-Sep-2011 Dave Santoro <dsantoro@google.com> Merge "Handle profile/contact split for bulk insert."
ce39517fb7b9a3e5d8e02a1f68b14f3e09f13542 01-Sep-2011 Dave Santoro <dsantoro@google.com> Cleanup variable referring to removed column.

Bug 5242084

Change-Id: I7c8d00701a5a20c97556bf523faf4c4b9fb8a49a
ontactsDatabaseHelper.java
720277eff4ffa6344ce2efc1fc39f9ced8af0b6b 31-Aug-2011 Dave Santoro <dsantoro@google.com> Handle profile/contact split for bulk insert.

Unlike applyBatch, in the bulk insert case we have all the info we
need to make a conclusive contacts vs. profile determination, so I
pulled in the logic from the superclass and augmented it to handle
opening and closing contacts/profile DBs and transactions in a
cleaner manner.

I was unable to reproduce Daisuke's bug, but this change would at
least ensure that a database helper is set before attempting to do
an insert in bulk.

Bug 5239086

Change-Id: I8cdbb41c9a8a0f24af99c554942649af1333b627
ontactsProvider2.java
7b0d7b04db42e7a8fd6a511b15da6bcd13f15a3c 31-Aug-2011 Attila Bodis <attila@google.com> Merge "Enable contact matching for incoming calls which only contain local number."
409605a187683155d9c6dbc2626b6419e3dd384e 31-Aug-2011 Makoto Onuki <omakoto@google.com> Use new api AbstractCursor.setExtras() to return index info

Avoid CursorWrapper, which has performance penalty on cross-process queries.

Bug 5220669

Change-Id: I630fffaaaa2b28846c715ae0d2d536da01b701a8
ontactsProvider2.java
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
ontactsDatabaseHelper.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
ontactAggregator.java
ontactLookupKey.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ontactsUpgradeReceiver.java
lobalSearchSupport.java
rofileAggregator.java
rofileAwareUriMatcher.java
rofileDatabaseHelper.java
rofileProvider.java
ransactionContext.java
28355c60acbdca85733528150b75b812595d7d0a 30-Aug-2011 Makoto Onuki <omakoto@google.com> Merge "Lazily-initialize PhoneNumberOfflineGeocoder/PhoneNumberUtil"
c4144727cd740079f47e74ae5078d1613874f72a 29-Aug-2011 Makoto Onuki <omakoto@google.com> Lazily-initialize PhoneNumberOfflineGeocoder/PhoneNumberUtil

- They were indirectly created in VoicemailContentProvider.onCreate and
CallLogProvider.onCreate, and were slow. It was taking ~300ms on my
measurement on a nexus-s. Also it touched the filesystem, so it can
be much slower on worn-out flash or when flash is busy.

- Doing it in a provider's onCreate means it affects auto-complete
performance if acore is not started. Also it'll affect app-startup
when we merge processes.

- But they were actually only used when inserting a call log, so we don't
have to initialize them at startup.

- Inserting a call-log should be done in a worker thread, so lazy-
initialization shouldn't cause laggy UI.

(Alternatively, we could initialize them in a worker thread at startup,
but I don't think it's worth it.)

- Also, now CallLogProvider and VoicemailContentProvider share the
same instance of DefaultCallLogInsertionHelper.
(They used to have their own)
same instance of DefaultCallLogInsertionHelper doesn't have any
instance specific state, so this should be safe.

Bug 5220669

Change-Id: Ibcd664ed683507c5dcac88bec736e4903a4a7032
allLogProvider.java
efaultCallLogInsertionHelper.java
oicemailContentProvider.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
ontactsDatabaseHelper.java
ontactsProvider2.java
663b8b8ce7a29fb2796dc6431f2cd5992934f315 28-Aug-2011 Makoto Onuki <omakoto@google.com> Add log to measure startup performance

Use this to enable log:

adb shell setprop log.tag.ContactsPerf VERBOSE

Bug 5195464

Change-Id: I8348dffb050c562e708ab81405d556625794fdf3
allLogProvider.java
onstants.java
ontactsProvider2.java
oicemailContentProvider.java
4747809486541f7a3d342d3e1dd48fb5ea255ad6 28-Aug-2011 Flavio Lerda <flerda@google.com> Fix status message in contact updates.

This fixes a problem with a status message being added to a contact's
update stream. The text contains an extra <p> tag, which leads to extra
newlines being rendered.

Bug: 5176548
Change-Id: I28854bf053508e63ac0345556129e82c9e7984cb
ontactsProvider2.java
e291c7c5222ccdfc8c0832d7c3bd7f989030dfb1 27-Aug-2011 Daniel Lehmann <lehmannd@google.com> Merge "Fix the creation of the search_index table when the aggregation mode changes"
0fa55000b5c92dd26828178ed4e3d1013c80721a 26-Aug-2011 Makoto Onuki <omakoto@google.com> Merge "Return proper mime-types for stream items"
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
allLogProvider.java
ontactsDatabaseHelper.java
dac99257ff2cca8028afd471699fbcea44c09a1b 26-Aug-2011 Flavio Lerda <flerda@google.com> Merge "Fixes convertion to HTML of status updates."
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
ontactsDatabaseHelper.java
d263c073c3697aa3e58a8ef73096b8ff7012f8ea 25-Aug-2011 Daisuke Miyakawa <dmiyakawa@google.com> Merge "Group rows with a same phone number and a contact id."
cf55cbe8932f620484a3634d13ecc116c32fdc99 25-Aug-2011 Daisuke Miyakawa <dmiyakawa@google.com> Group rows with a same phone number and a contact id.

Bug: 5201809
Change-Id: Ie21abb12736715358dd33bc690269f51ae1e0944
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
fe6c9b5240b1b26a72358dbb80bdda9c3f5c080d 25-Aug-2011 Flavio Lerda <flerda@google.com> Fixes convertion to HTML of status updates.

The code was stripping one extract character. This is only a problem
whem something is appending after it, as in the case of the Updates
header.

Bug: 5212740
Change-Id: I5b82168d83ee41a20256118003bb3d1bce182990
ontactsProvider2.java
518eb86edafbd4d8cd69a9452461baddc2a4aaae 23-Aug-2011 Daniel Lehmann <lehmannd@google.com> Merge "Remove the java-synchronization and completely rely on DB transactions"
af43bfb95070c234ae7090f6041f6fc62366313a 23-Aug-2011 Makoto Onuki <omakoto@google.com> Return proper mime-types for stream items

Bug 5196154
Bug 5198078

Change-Id: I6da42907e900d348294b42d2bc556090c2639ab5
ontactsProvider2.java
fa4db3db4146a26f154ef2e89352ad70a5415b8e 22-Aug-2011 Daniel Lehmann <lehmannd@google.com> Remove the java-synchronization and completely rely on DB transactions

Bug:5134056
Change-Id: Ied50a93fbcd1121ca978cbb8fdcd8556020cb28f
ontactsProvider2.java
hotoStore.java
fb667e943650a431bc132c4c50d772ed37d0c245 22-Aug-2011 Dianne Hackborn <hackbod@google.com> Add boot message when upgrading database.

Change-Id: I3f17aed690066ed4d2ab645a059c66a1bdd7a1f1
ontactsUpgradeReceiver.java
e3a10e4fcdb8b5e619f02a26fd1a26cef3b149a3 21-Aug-2011 Flavio Lerda <flerda@google.com> Remove extra new line from status updates.

When status updates are added to the stream items, they need to be
converted to HTML. In the process, an extra new line was added at the
end of each of them.

This commit removed this trailing new line, so that the updates are
shown correctly in the UI.

Bug: 5193689
Change-Id: I223070eeb1439a8ffacbfb61d6e86355b14c68db
ontactsProvider2.java
24109deca5aa84e52dfddf0bdeda23bcbc8d484f 17-Aug-2011 Daisuke Miyakawa <dmiyakawa@google.com> Merge "Use phone number for grouping when normalized number is null"
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
ontactsDatabaseHelper.java
58567abca253f1efa2db5c39e17e42dca589e916 16-Aug-2011 Daisuke Miyakawa <dmiyakawa@google.com> Use phone number for grouping when normalized number is null

NORMALIZED_NUMBER may become null when the number isn't able to be
parsed by the library (e.g. pager address). Current implementation
groups multiple numbers with null normalized values into one
result, which confuses users.

Bug: 5040732
Change-Id: I1ad7dfb72dbc5d239aa95a913d35c2d8dfe3167c
ontactsProvider2.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
ontactsDatabaseHelper.java
a473a987518f696c3480b022f5e1d13e3cbff5d2 16-Aug-2011 Isaac Katzenelson <isaack@android.com> Merge "Fix provider empty state status"
3e6cd1fbafd09bf9b6ec35a19a55b48a271727df 15-Aug-2011 Isaac Katzenelson <isaack@android.com> Fix provider empty state status

Bug: 5074806

The provider was setting the empty state (no account and no contacts)
when the account count was zero and the contacts count was zero.
This is no longer true when you have a profile, so a check was added
to set the status to empty if there is one contact and it is a profile

Change-Id: I9771dc99af1573e5c0ff2ac62ed5e5ca433fd738
ontactsProvider2.java
73ea28535cb77f9a874eefcc1b009e59881d4be0 15-Aug-2011 Daniel Lehmann <lehmannd@google.com> Merge "Renaming com.google.i18n.phonenumbers to com.android.i18n.phonenumbers to avoid name collision."
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
ontactsDatabaseHelper.java
ontactsProvider2.java
0e272967c6c6662d8a6eed80650dad0369aac085 13-Aug-2011 Dave Santoro <dsantoro@google.com> Merge "Fix openAssetFile method of inserting photos."
3f9ee8aaba20b358ca63f4b57523c960d82b5cc9 13-Aug-2011 Isaac Katzenelson <isaack@android.com> Fix crash in GoogleVoice when getting contact info

Bug: 5155743 Google voice is in crash loop (stack goes through Contacts)

GoogleVoice is queries for contact data using the PHONE_LOOKUP query.
If the phone number is part of the user's profile, the returned contact
is the profile and further queries (to get the contact's photo) fail
the security check and an exception is thrown.

The fix restrict the PHONE_LOOKUP query to non-profile contacts.
This is a temporary fix until dave's major change for profile
handling is submitted.

Change-Id: I65e42156f1fab5e5cded77f288e3ef69c3f6ecac
ontactsProvider2.java
c6eab5080340824edd2c6676c4e6b96e142f87e4 12-Aug-2011 Dave Santoro <dsantoro@google.com> Fix openAssetFile method of inserting photos.

For reference, the issue was occurring because the file descriptor
passed back to the caller is parceled immediately, which closes the
file descriptor on the provider side before it even gets to the
caller. The solution was to stop fiddling around with temp files
and just pass back a pipe instead - the provider then can simply
read the image content from the pipe and process it.

Bug 5156644

Change-Id: Ie210f65b5b8681524fed12a53df0c852fc951e5a
ontactsProvider2.java
hotoStore.java
32f5e00ffc769059731056a47aadf183ec948d1a 12-Aug-2011 Shaopeng Jia <shaopengjia@google.com> Renaming com.google.i18n.phonenumbers to com.android.i18n.phonenumbers
to avoid name collision.

Bug: 5157607
Change-Id: If7db52ae5eba1696d20e9897860d757021477002
efaultCallLogInsertionHelper.java
43e6f3b14e00a7bab4876d288d77adfa6787d622 12-Aug-2011 Flavio Lerda <flerda@google.com> Merge "Convert status updates to HTML."
3ae32e20bc3f7a278471475efa300b6544b1112e 11-Aug-2011 Debashish Chatterjee <debashishc@google.com> Voicemail provider: Don't automatically set HAS_CONTENT field.

It is best to let the content owner set this field when it is finished
writing the content into the file.

Another change will modify the voicemailproviderdemo app to set this
field in the app.

Bug: 5147190
Change-Id: I93e4b467acdefe339fa70dd751ea05f195c32e71
oicemailContentTable.java
2e757d904e62dbf5bc0b028626fa9319ccc38c45 09-Aug-2011 Debashish Chatterjee <debashishc@google.com> Notify callog uri if a change is made through voicemail provider.

DbModifierWithVmNotification till now only notified to voicemail uri
content observers for change made through call log provider. We need the
otherway round as well so that any change made to a voicemail entry
through the voicemail provider should be notified to listeners of
calllog uri. This is needed to make call log auto refresh work when a new
voicemail is inserted.

DbModifierWithVmNotification is now renamed to DbModifierWithNotification
and suports both ways notification. Notifications generated by call log
provider as well is now routed through this class.

Bug: 5055868
Change-Id: I2de8c9867445bcb86ce94a8600acc726266c8008
allLogProvider.java
bModifierWithNotification.java
bModifierWithVmNotification.java
oicemailContentTable.java
oicemailStatusTable.java
d5ef5903570e533a501abe6a8e3d533fdb5318fc 10-Aug-2011 Flavio Lerda <flerda@google.com> Convert status updates to HTML.

Since stream items text is HTML but status updates are text only,
convert the text to HTML when inserting a status update into the stream
items.

Bug: 5122642
Change-Id: I61e3d9802e527c6977e7d29660ffd137ae899dae
ontactsProvider2.java
13a121b7252020fb9226ce3d2bfe4973e2c682cd 10-Aug-2011 Flavio Lerda <flerda@google.com> Merge "Automatically add a geocoded location to entries in the call log."
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
allLogInsertionHelper.java
allLogProvider.java
ontactsDatabaseHelper.java
efaultCallLogInsertionHelper.java
oicemailContentProvider.java
oicemailContentTable.java
oicemailTable.java
9245089f788c01597913b1e998be86a626ae6244 10-Aug-2011 Daisuke Miyakawa <dmiyakawa@google.com> Exclude profile from email filter

Bug: 5131203
Change-Id: I735fc33d00c5d7dde67e3b759365cb8812f69b20
ontactsProvider2.java
eaa7d851000e368a18be24bc816046ad9cf49d6e 08-Aug-2011 Debashish Chatterjee <debashishc@google.com> Modified VoicemailContentProvider to set Calls.NEW

Calls.NEW is now an internal field for the voicemail interface and so
the content provider must set it to '1' for new voicemail insertions.
Contacts app now depends on this field to show notifications.

Bug: 5055868

Change-Id: Ic76501fa3a4361f1fce278247295d0bbe2f1f4c8
oicemailContentTable.java
5a423d58bcb8bcc617546f918a550ab11d5bef60 05-Aug-2011 Debashish Chatterjee <debashishc@google.com> Merge "Allow read-only sharing of Uri in voicemail content provider."
cce1c9cf029f40b62955f4b545f94c993daefbd2 04-Aug-2011 Dave Santoro <dsantoro@google.com> Add support for updating profile raw contacts.

Bug 5122027

Change-Id: I4c0c4dc3b8b9eedbca347929fe16893aa1630005
ontactsProvider2.java
83aeb09dd56546eca32cc51e638270f8598a0203 04-Aug-2011 Dave Santoro <dsantoro@google.com> Merge "Fix data set handling for groups."
3593682b8d9213fde576a0cff54458ad50563980 04-Aug-2011 Dave Santoro <dsantoro@google.com> Fix data set handling for groups.

Bug 5121818

Change-Id: I5bd0c6b0678aed2b708057774d7041b822bf3ed9
ontactsProvider2.java
eeffa7edb048e785ebc665c830dc84d87f174b07 04-Aug-2011 Debashish Chatterjee <debashishc@google.com> Allow read-only sharing of Uri in voicemail content provider.

Since we perform our own permission check, uri permission check
done by the content resolver is not sufficient. Our implementation of
the content provider should also explicitly check for uri level permission.

This is needed to allow sharing of voicemail uri from the contacts app.

In a follow up change we will allow sharing of URIs only to those apps that has
ALL permission. Right now the provider definition does not allow sharing
of uri.

Bug: 4961053
Change-Id: I5af53ee76ea10fa5f45c8cdcb95c773cc7ad138e
oicemailContentProvider.java
708cf7d14509a32cdd4091e5e3b03a74adad1e38 04-Aug-2011 Debashish Chatterjee <debashishc@google.com> Merge "Fixed a strict mode violation in voicemail/calllog provider."
1c8e5fcdd6199f5959aaa6eab47e806b401efdd9 04-Aug-2011 Hugo Hudson <hugohudson@google.com> Don't crash deleting a voiceamil with no file.

- The file constructor wasn't happy with null.
- Instead log a warning and carry on.

Bug: 5120418
Change-Id: I6d83c34dbea828b560674c065b45a1eb04b07ee6
oicemailContentTable.java
13cb841466fefcd041cd86b7877d000dfe73e8ec 04-Aug-2011 Debashish Chatterjee <debashishc@google.com> Fixed a strict mode violation in voicemail/calllog provider.

DbModifiervmNotification did not close the Cursor after making the
query to determine affected packages.

Change-Id: I2b8723a8b903117b28e8c905f68b3cfc039afc79
bModifierWithVmNotification.java
859d213c456e3c46c7f7485f6f72242d9524e2c9 04-Aug-2011 Debashish Chatterjee <debashishc@google.com> Merge "Renamed permission READ_WRITE_OWN_VOICEMAIL to ADD_VOICEMAIL"
8049e12f9a9a6dd19155fdce2352d437ca27a14c 03-Aug-2011 Dave Santoro <dsantoro@google.com> Merge "Fix photo-related tests for Proguard builds."
524913c66ce75ca8dec127ac88e3bc2249c246d9 03-Aug-2011 Dave Santoro <dsantoro@google.com> Fix photo-related tests for Proguard builds.

Bug 5112593

Change-Id: I4b559911a100fdbe466bc79057d22000800e08be
ontactsProvider2.java
98a77ec8057c5fe0ff487ca7d0910312693e5689 03-Aug-2011 Debashish Chatterjee <debashishc@google.com> Renamed permission READ_WRITE_OWN_VOICEMAIL to ADD_VOICEMAIL

The framework changes to add new permission ADD_VOICEMAIL went in
change-Id: I515e7967bdb0e8498a60a32983f9122ce10dcc4a.
And the contacts app to start using the new permission went in
change-id: I188a109b69228e58a2c9b1d9a234a270df60555a

Bug: 5098551
bModifierWithVmNotification.java
oicemailContentProvider.java
oicemailPermissions.java
61db4f74315f0a9cef695b1af37a3c8a2fa9d970 03-Aug-2011 Debashish Chatterjee <debashishc@google.com> Merge "Delete voicemail data when source package is uninstalled."
deb58243ee82a0b0c9a3b03c0d68635d4b5e5d36 02-Aug-2011 Hugo Hudson <hugohudson@google.com> Merge "Add synthetic columns to voicemail table."
1e6310fcc55c8549c98018fc427b54e1619320a4 30-Jul-2011 Hugo Hudson <hugohudson@google.com> Add synthetic columns to voicemail table.

- Since our voicemail table supports getInputStream and getOutputStream
we should also support the columns for DISPLAY_NAME and SIZE, since
these are expected to exist for helping other apps share files -
attaching to an email in GMail for example.
- Uses an SQL hack to combine a suitably localized string with the
number column for the display name.

Bug: 5066115
Change-Id: I48a08ade2a3a2a28a1d3e3415ec27dd956056d44
oicemailContentTable.java
a71dc460ca951c7aca591f3f470c160cde70a1e3 01-Aug-2011 Dave Santoro <dsantoro@google.com> Populate data_set in values from the URI.

Change-Id: I332596515fc55d9c28ed7b79128650328112da6c
ontactsProvider2.java
dd13a37943dbe4cd2c0a055a1e79811d818b8da7 01-Aug-2011 Dave Santoro <dsantoro@google.com> Merge "Create account record if needed on profile insert."
a09d7527b132ec82f98cde1564b0262fd85768c2 01-Aug-2011 Dave Santoro <dsantoro@google.com> Create account record if needed on profile insert.

For accounts without a data set, this should be handled automatically
when the account is added. But with data sets, we need to handle it
specially so that the profile raw contact ID reference has a row to
hang off of.

Other raw contacts or groups with a data set will have the account
record created in the background when the provider is initialized.

Change-Id: I24ea0c389c3bc839aee295f1297e2236c473d66f
ontactAggregator.java
c6eb4fe44502116f834fadcc54214b3fa93ff564 28-Jul-2011 Debashish Chatterjee <debashishc@google.com> Delete voicemail data when source package is uninstalled.

The deletion of voicemail data for the uninstalled package is done
through a service. The PackageIntentReceiver just forwards the package
removal intent to the service after sanity check that the intent is
really for an uninstalled package.

The logic to check whether the intent should trigger a clean up is
repeated in VoicemailCleanupService as well. This provides an extra
safety net and and also lets the unit test cover this functionality.

Bug: 5056159
Change-Id: Id7315a1318d510b50878f26c2e0d380c1920ee4e
ackageIntentReceiver.java
oicemailCleanupService.java
3606209fe0f5bac0e7d312f0c1576b7ee5cf8ee7 01-Aug-2011 Debashish Chatterjee <debashishc@google.com> Merge "No more use audio mime type for voicemail uris."
d558ccc921460ac382850a8e6e2e668f3a2b9b26 29-Jul-2011 Debashish Chatterjee <debashishc@google.com> No more use audio mime type for voicemail uris.

This makes the uri handling simpler, as we voicemail uris can now only
be of item or dir and does not depend on the content.

This also avoids strict mode violation when getType is called from UI
thread.

There is no change needed in the contacts app because the URI mime type
is right now used by the app.

Bug: 5090052
Change-Id: Ie2e502f9b09465dc343e873d43e206aaad8b6076
oicemailContentTable.java
5517770250b3afa4fd88b6869c3244680821d222 29-Jul-2011 Dave Santoro <dsantoro@google.com> Added query instrumentation when verbose logging.

Change-Id: Id55596034b11f819e4f1d367f648be4bb0e73a33
ontactsProvider2.java
rossProcessCursorWrapper.java
nstrumentedCursorWrapper.java
nippetizingCursorWrapper.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
ontactsDatabaseHelper.java
ontactsProvider2.java
24bc499d6756e7b2bd95b2eabb64a6d9d13435ba 28-Jul-2011 Dave Santoro <dsantoro@google.com> Initialize PhotoStore in background thread.

Bug 5031708

Change-Id: I6a621ca81281c3a146846f89650779f2a73888cc
ontactsProvider2.java
a4b8d716eae19f2236ecbc13dc3b31ac4d7cd19e 28-Jul-2011 Daisuke Miyakawa <dmiyakawa@google.com> Merge "Return starred with phone number when phone-only"
8d5a094810ce8c60b83e534d903a0d662e621252 28-Jul-2011 Debashish Chatterjee <debashishc@google.com> Do not send the provider_changed event to pkgs that have not changed.

The earlier code sent provider changed notification with permission
READ_WRITE_ALL_VOICEMAIL if the candidate package is not affected by the
change. This guaranteed that the change is not notified to the package
if it does not have ALL permission, but it generated an error log with
"permission denied" message. This is not desirable.

This change checks for ALL permission explicitly and do not even fire
the notification if the candidate package is not affected and does not
have ALL permission.

Change-Id: I20982572d7f9a08ce98b03b23c9d2d8aa60efc9f
bModifierWithVmNotification.java
9dbfd650ccf93714f3266e80f9fbdbcb526ae7b3 28-Jul-2011 Daisuke Miyakawa <dmiyakawa@google.com> Return starred with phone number when phone-only

Bug: 5087645
Change-Id: Ib60353fd44c23566ae0d2cbaa695f5bbdfd26eb0
ontactsProvider2.java
a9828e23ea823db06e5e885d4855ffbc1eba8165 28-Jul-2011 Dave Santoro <dsantoro@google.com> Merge "Provider and DB changes to support data_set field."
6c7e506750e0d1348bec9497f053f582c601bcd8 28-Jul-2011 Makoto Onuki <omakoto@google.com> Merge "Query speed up with "raw_contact_is_user_profile" check"
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
ccountWithDataSet.java
ontactAggregator.java
ontactDirectoryManager.java
ontactLookupKey.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForGroupMembership.java
ransactionContext.java
4b64b6e8f448938434cb1e022a4e7dfaae8f9c8c 28-Jul-2011 Makoto Onuki <omakoto@google.com> Query speed up with "raw_contact_is_user_profile" check

Put the raw_contact_is_user_profile after user'selection, not before.

This check is slow but most of the rows would just pass the check, it's better
to do this check after user's selection.

This change will make the group member list query more than twice as fast.

Bug 5087853

Change-Id: I07e7ecb3324601d0c38b5c1aba82d8bdb2501438
ontactsProvider2.java
51d1da962292ecef21abdf7e41abfdb7f1d72fcd 27-Jul-2011 Debashish Chatterjee <debashishc@google.com> Merge "Improvements in voicemail broadcast notifications."
94cc8c65bc46f60b912091d3037376e15b74da0f 26-Jul-2011 Flavio Lerda <flerda@google.com> Do not expose the NEW column in the Voicemail provider.

We added the IS_READ column, so that we can distinguish between items
that are new and items that have not been read (or heard, for
voicemail).

However, there is no reason to expose the NEW status of voicemail, since
that is about whether the user should be notified and it is handled
entirely by the content provider and Contacts application.

This is part of the changes needed to fix notifications for voicemails.

Bug: 5036195
Change-Id: I74d760a73d5ffbbb6eb26f2dbe7c7ca2a92ad2d6
oicemailContentTable.java
929a04e2830e30718930d96335dfb0a729b6ab91 23-Jul-2011 Debashish Chatterjee <debashishc@google.com> Improvements in voicemail broadcast notifications.

This change fixes two primary issues:
1) If a voicemail record is modified through call log provider, a
voicemail provider notification is now generated.
2) voicemail notifications are now sent with permission ALL if the
receiving component packages is not the owner of the modified record.
This ensures that a voicemail source (having OWN permission) gets notified
only of changes for records that it owns. But a package that has ALL
permissions get notified of everything,

A new interface DatabaseModifier is now used by both voicemail as well as
calllog provider to perform any operations that can modify the
underlying table. DbModifierWithVmNotification implementation of this
interface fires relevant notifications under the hoods.
All logic related to sending notifications is now moved from
VoicemailContentProvider to this new class.

bulkInsert has no special treatment anymore. We now fall back to the framework's
default implementation. It was complicated to optimize for provider_changed events
for bulk insert when using the DatabaseModifier interface.

TODO: I am yet to write unit tests for broadcast intents. I have done
manual testing to make sure that they work. Also the existing unit tests pass,
proving that none of the existing content provider operations are broken by
using the DatabaseModifier wrapper.

Bug: 5060354
Bug: 4974222

Change-Id: I0935105f146a71abeffbde634d79f8806b8e0ed2
allLogProvider.java
atabaseModifier.java
bModifierWithVmNotification.java
oicemailContentProvider.java
oicemailContentTable.java
oicemailStatusTable.java
oicemailTable.java
363bdaba2994539e1a3a2342a9fcf223604d69ea 25-Jul-2011 Daisuke Miyakawa <dmiyakawa@google.com> Make frequent uri work correctly

Also add unit test for it

Bug: 5073384
Change-Id: I7fa41f50883e14a84ef95d2b098379b1d6b47bae
ontactsProvider2.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
allLogProvider.java
ontactsDatabaseHelper.java
oicemailContentTable.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
ontactsDatabaseHelper.java
ontactsProvider2.java
45ae7eaf0e2c9459ccbeeb5eb5977f055c4ed8ec 21-Jul-2011 Daisuke Miyakawa <dmiyakawa@google.com> Add support for frequent uri

Must be after Ia670229e4d3e793446b0a0dce2590e20709ee18c

Bug: 5050315
Change-Id: I0ad08f65659987aefda20cd1f9fdfb0d375660f0
ontactsProvider2.java
4928b8c8c7a49ec088884cd9d330eeecc811dca9 20-Jul-2011 Daisuke Miyakawa <dmiyakawa@google.com> Make strequent-phone-only returns what we want

- in starred section, just starred persons should be listed.
One person should not appear more than once.
- in freuqent section, we should be able to obtain phone numbers
One person can appear multiple times with different numbers.

To achieve it, we need to tweak results further. Instead of
allowing users to have Contacts columns, we have to allow part of
Data columns (DATA1, DATA2, DATA3). Those Data-columns will be NULL
in the starred section right now.

In order to have those additional columns in Contacts Uri (this is
for Contacts.CONTENT_STREQUENT_URI, not Data), this change has
one restriction: with phone_only flag, users cannot have
IS_USER_PROFILE any more. That's not so critical as phone_only
is not part of public API.

Modify unit test for phone-only results (SMS feedback shouldn't
affect phone-only results). Also introduce comvenient function
for testing feedback stuff in general.

FUTURE TODO:
- We should also be able to obtain a phone number relevant to
the starred person while this change doesn't support it.
- We may need to group numbers by contact instead of showing
them apart (bug: 5059874)

Bug: 5050181
Change-Id: I47f532e5b7bb3f8bfd77215c61abb31a09d7fd51
ontactsProvider2.java
72836d9ba83ef4d78168a408feaebdd225666f5c 21-Jul-2011 Debashish Chatterjee <debashishc@google.com> Merge "Get rid of voicemail permissions from contacts content provider."
1dfa964f2e1756e27b36f99421bd403c84ea0a5f 20-Jul-2011 Dave Santoro <dsantoro@google.com> Tweak to StreamItemPhotos to include metadata.

This joins in the PhotoFiles table to get width, height, and filesize
info from that table when selecting stream item photos.

It also adds an option to the photo processor to force cropping the
image to a square centered on the original's rect - this is how the
social stream photos are to be displayed in the designs.

Change-Id: I596a4a0be94db0df39d29bc06e1a1684a057a202
ontactsProvider2.java
hotoProcessor.java
791a25b9f228bed8d8bb2febadbd883452555d89 20-Jul-2011 Debashish Chatterjee <debashishc@google.com> Get rid of voicemail permissions from contacts content provider.

They are now defined in framework/base. submitted in
https://android-git.corp.google.com/g/119573

Bug: 5049309
Change-Id: I9927efe575b3a8b098599154c213840564023dfd
oicemailContentProvider.java
oicemailPermissions.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
ontactsDatabaseHelper.java
ontactsProvider2.java
hotoStore.java
1fafab3782590ab080dab07651df5aed0768e154 20-Jul-2011 Debashish Chatterjee <debashishc@google.com> Include EXTRA_SELF_CHANGE only for PROVIDER_CHANGED event.

Voicemail content provider should include the extra EXTRA_SELF_CHANGED
only for the PROVIDER_CHANGED and not for NEW_VOICEMAIL event.

Bug: 5052915
Change-Id: Idd976ced2a3eaed878847e43488eb5202b677338
oicemailContentProvider.java
f9648a03e88e2d1a91c616a20d903e4c9a2468e5 18-Jul-2011 Daisuke Miyakawa <dmiyakawa@google.com> Fix malfunctioning bucketization logic

I82052953d5dad42ac171df29248ed25e9b4a2434 dropped the
logic so we need to re-introduce it correctly

As we don't have public API for updating LAST_TIME_USED
columns outside the provider, we need to let the unit test
call a method in ContactsProvider2 directly instead of
calling DataUsageStat API.

- fix the query
- make update logic package-private
- add a unit test for it
- introduce guava to include @VisibleForTesting

Bug: 4998821
Change-Id: I0b699bffffd42a13ab00ac335796687052efb67a
ontactsProvider2.java
87614d7d293b1519dc1f0f403fd59c8bf4d8a347 15-Jul-2011 Dave Santoro <dsantoro@google.com> Photo aggregation logic update.

In the new logic, we'll pick the largest photo (in pixels, using file
size as a tiebreaker for display photos) to determine photo priority
if no super-primary is defined.

If this logic doesn't pick a winner, we fall back to the old photo
priority based on the account.

Change-Id: I9cf58b86a6c22bcf671a4852606a4534fa0fa7da
ontactAggregator.java
ontactsProvider2.java
afc8e7ad6e5208db6c87b8500ecc1246ad966d62 15-Jul-2011 Dave Santoro <dsantoro@google.com> Update profile enforcement checks to require a DB.

In most cases, mDb would be set by the time a profile check was first
made, but if the first check is a query, it won't be set. So pass in
the database for initialization on all enforcement calls.

Bug 5032229

Change-Id: I5bde0d9ac54522483a09fb174f22b06a4582b3a5
ontactsProvider2.java
6ae89770d8047852b6a1f6fb3cbac812910aa476 14-Jul-2011 Dave Santoro <dsantoro@google.com> Fix issue with profile checks during updateData().

We were doing a query with profiles included to determine the set of
items to update, but that triggers a permission error if the calling
app doesn't have READ_PROFILE permission (even if the rows being
updated don't affect the profile).

Bug 5028891

Change-Id: Id16d31d5d9d62dea2e62709c6ac03c1562a64438
ontactsProvider2.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForPhoto.java
hotoProcessor.java
hotoStore.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ed6bfd922fd84db21de08c1d12e93c501b86560d 11-Jul-2011 Daniel Lehmann <lehmannd@google.com> Remove restricted white-listing

Bug:4974334
Change-Id: I4dd95089774373d2b67d7e14dc6b7fc40a92d094
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
204ab9d4c4380ed056b8eb0ae5fb1d60b9fc5eee 08-Jul-2011 Debashish Chatterjee <debashishc@google.com> Merge "VoicemailStatus content provider implementation."
9cf06e7bcb0be759f1c930412fd2e41eba4f5f03 06-Jul-2011 Debashish Chatterjee <debashishc@google.com> VoicemailStatus content provider implementation.

- New Voicemail.Delegate implementation for voicemail_status table.
- modified openFile() interface to simplify the interaction.
- UridData now has a getWhereClause() method that can be used by both
the tables to set selection clause based on the uriData.
- Imrpoved permission checks for ContentValues for
update/insert/bulkinsert operations.

Bug:4968719

Change-Id: I6a6173c58d9929ef952c7d7e95afb8bc5ff4157b
oicemailContentProvider.java
oicemailContentTable.java
oicemailStatusTable.java
oicemailTable.java
oicemailUriType.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
ontactsDatabaseHelper.java
ontactsProvider2.java
e47118b8739b42c0abdee11629360e633aa426c6 07-Jul-2011 Mark Brophy <mbrophy@google.com> Merge "Set the new last-access time global search column."
83a60d38646265694ab9cfa88b9601c201edb303 06-Jul-2011 Debashish Chatterjee <debashishc@google.com> Merge "Refactored VoicemailContentProvider to simplify using multiple tables."
4b571ba0de4fac4ff9d2a4277032b8c6548fdbfa 05-Jul-2011 Debashish Chatterjee <debashishc@google.com> Refactored VoicemailContentProvider to simplify using multiple tables.

This is needed to simplify the voicemail provider to be able to serve
operations on the voicemail_status table as well.

The idea is to retain all common functionality related to voicemail
permission check etc in the main VoicemailContentProvider class. And
delegate database level operations to another class that only deals with
functionality speficic to the underlying table.

In the favor of code reuse the interaction between voicemail_content_provider
and voicemail_table_implementations is both ways. VoicemailTable
interface defines the operations exposed by both sides.

I have also added a couple of new test cases to cover getType() and
source_package check in the uri. Old test cases continue to pass to
prove that the refactoring did not break any functionality.

Change-Id: I4cb031234c2f5746084c51557e2ba0edbaf3d6de
oicemailContentProvider.java
oicemailContentTable.java
oicemailTable.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
ontactsDatabaseHelper.java
6fbb4b739c288395bd80343400d3455b0292a0fd 04-Jul-2011 Debashish Chatterjee <debashishc@google.com> Stop using deprecated field VoicemailContract.CONTENT_URI.

Instead use VoicemailContract.Voicemail.CONTENT_URI.

Change-Id: I2a5b8afd15d472ace254de429f37d1ae51e372cd
oicemailContentProvider.java
e36e13b9e92759bb861a10ff22195853359c267d 04-Jul-2011 Debashish Chatterjee <debashishc@google.com> Modified voicemail provider to accept source_package as a param.

Voicemail provider now no more supports /source/ path. Also stopped
using deprecated fields of VoicemailContract.

Change-Id: Ieab08781bca6ec571f29c56ca55d84a8fd18547b
oicemailContentProvider.java
oicemailUriType.java
89f718673f71c71951ded3723b35a0c82d8dda34 01-Jul-2011 Mark Brophy <mbrophy@google.com> Set the new last-access time global search column.

QSB will sort results by last-access time. Set the new column
with this information for QSB.

Change-Id: Ie8871aeec4ed2a30a672bc6c064a9a32c82d2372
lobalSearchSupport.java
06f995b614e0ebe59ff75f170e20ca96c9b17f0c 01-Jul-2011 Debashish Chatterjee <debashishc@google.com> Send broadcast intents to specific component instead of package.

This avoids sending duplicate notification to the same package if it has
more than components registered for the same broadcast.

Change-Id: I93744aebc9a4800c5ce1fd60fb1468382f55934e
oicemailContentProvider.java
b0664c37411783238fd92f8a027b5820992cf899 01-Jul-2011 Debashish Chatterjee <debashishc@google.com> Merge "Fixed VoicemailProviderTest."
975d52af754e6f05089fcd9f7066df05c290c3b7 01-Jul-2011 Debashish Chatterjee <debashishc@google.com> Fixed VoicemailProviderTest.

A recent change in voicemail content provider used the package manager
queryBroadcastReceivers() to query the receiving packages of the broadcast intent.
However, mock package manager used in the test env does not support this
operation and throws an exception.
The fix is to wrap this method within the content provider
implementation and stub the wrapper method in the test.

Change-Id: Ief4887f1379614466ea6471cf7b132ef873550ba
oicemailContentProvider.java
38eed6e2849f3e4fcfb00054f13dd19f7525a199 01-Jul-2011 Flavio Lerda <flerda@google.com> Change the way voicemail permissions are enforced.

Contacts and ContactsProvider share the same process, therefore calls
by the Contacts app to the content provider for voicemail are not
considered to be IPCs and therefore the current permission checks would
fail for it.

Change-Id: I3fd8ea7fa86bf2454d117cbb155fbb8a522b39e2
oicemailPermissions.java
92d97071e56110e0df7f25e6ebc92ff4ebf74a88 29-Jun-2011 Flavio Lerda <flerda@google.com> Use shared constants for call log with voicemails.

Use the shared constants for accessing voicemails in the call log.
Remove the local copies in the content provider.

Change-Id: I1c026ab604201b73e4f6a057a8b725479c72c796
allLogProvider.java
7d7d0e95636344c01eb4e4d034791c199bee98e9 28-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> use System.arraycopy

Change-Id: I8f9525659ce5bead62f3693f79ce70771d87e384
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
42e8dddb940a502e97151a08f16b87aed7b30de5 27-Jun-2011 Debashish Chatterjee <debashishc@google.com> Modified VoicemailContentProvider to set 'SELF_CHANGE' in notifications.

VoicemailContentProvider now sets the new boolean extra 'SELF_CHANGE'
instead of 'CHANGED_BY' in its broadcast intents. This is more secure as
we do not reveal the details of the application that caused the change.

see bug https://b/4773134

Change-Id: I9ff1c782d9924da628b00cd9e712ab3dba9ab9d2
oicemailContentProvider.java
aafbe295d67686870c64c74a59e589d1dfb506fa 20-Jun-2011 Debashish Chatterjee <debashishc@google.com> Introduced query param 'include_voicemails' for call_log uri.

- by default only call entries (i.e. no voicemails) are returned.
- if include_voicemails is set to true then also include voicemail
records, but only if the caller has full voicemail permission.
- voicemail record can only be inserted through call_log provider if
include_voicemails is set.

Change-Id: I98f6778ace64fa752dc0525c5ce4e5eb83b2e689
allLogProvider.java
oicemailContentProvider.java
oicemailPermissions.java
til/DbQueryUtils.java
til/SelectionBuilder.java
377850d2dfd28eaf1b22273a50cfe066f6667ab9 24-Jun-2011 Dave Santoro <dsantoro@google.com> Renamed INCLUDE_PROFILE param to ALLOW_PROFILE.

Bug: 4777097

Change-Id: Ib254569f2595ae90e5ef72c1c4abcc7a5e45215b
ontactsProvider2.java
fdd04bc3a972cd72dfe7bf925e1624d656b34cf7 21-Jun-2011 Martijn Coenen <maco@google.com> Implement openAssetFile() for profile vcard.

Also passes the query Uri directly to the vcard composer
for the different vcard modes.

Change-Id: Ie562e92b3ce54092b8a0cdf87db55b612768573b
ontactsProvider2.java
c591cc2ffecdd0038f787a133606752752294c13 18-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> Prefer primary data to others.

Bug: 4723377
Change-Id: Iaeb74924a8567d049adcd91dfa03814a63abf088
ontactsProvider2.java
6494f8d9faae80aca15d4da17d41c89349b55e8a 17-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> Merge "Fix test breakage introduced in ICU upgrade."
00e7c94b70f4b477653534dbe559d1759d796157 16-Jun-2011 Debashish Chatterjee <debashishc@google.com> Added checks in voicemail provider to not expose call_log fields.

- Voicemail provider now has check to ensure that no field outside of its
projection is accesible.
- Moved functionality to check ContentValues against a projection map to
DbQueryUtils.
- Associated test cases.

Change-Id: I23033c96f74f0ab981152f70e585c69ba5284602
allLogProvider.java
oicemailContentProvider.java
til/DbQueryUtils.java
71340347b4862d4b1368a5d69d1667e2245952e4 17-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> Fix test breakage introduced in ICU upgrade.

- Move HanziToPinyin.java to ContactsProvider package.
- Update tables in the file.

HanziToPinyin.java (in framework) has had collation table for
effectively searching Pinyin-s for Chinese Hanzi-s. The table
is based on previous ICU (4.4, or before).

With I695558055cc139b42b71da9138f61d19bcbd9758, ICU 4.6 is now
available, which has tons of improvements in zh collation, while
HanziToPinyin.java still has a table based on previous ICU. This
caused several test breakages and caused a real problem in Chinese
name sorting.

Also HanziToPinyin.java is only used by ContactsProvider, so there's
no strong reason for us to have it in framework (even though hidden).
It would rather convenient to have it in the provider package to
track issues around the file.

Bug: 4645142
Change-Id: If786dd286dab47ca1b2ccab38c5fa43ae390c0f7
ontactLocaleUtils.java
ontactsProvider2.java
anziToPinyin.java
1975b56a3368b4b7684429ffa79e7b9dbc35b475 16-Jun-2011 Debashish Chatterjee <debashishc@google.com> Unit tests for voicemail provider.

These tests cover basic functionality of the provider including
permission checks and media content input/output.

The key functionality that is yet to be tested is provider
change broadcast intents. This requires us to use a mocking framework,
and we are yet to finalize on which one we will use.

Change-Id: I2304309c4fc109cc1e0b969ede33d8268a4d4194
oicemailContentProvider.java
07b66b78439296cd27e1ca7c156bc9eeeae85131 16-Jun-2011 Debashish Chatterjee <debashishc@google.com> Merge "Voicemail provider implementation within ContactsProvider."
2262f0ccc800b93a9d1e63c55654ca3aaf5e7d1c 15-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> Prioritize IN_VISIBLE_GROUP in auto-complete.

Previously it was ok to show data not in any group, as
we had just shown display_name and email addresses.

Now with chips we show photos, while a lot of data not in any group
usually don't have photos.

Bug: 4371572
Change-Id: I501ddba5d26302ab734ead783a5ddbf36a581010
ontactsProvider2.java
988b96fb9d7e007adb470caeb66f77f16a899a54 15-Jun-2011 Martijn Coenen <maco@google.com> Merge "Support for streaming vcards without photo."
dfa6d58328345c7c91f2467d29189a57b96bfe2a 15-Jun-2011 Martijn Coenen <maco@google.com> Support for streaming vcards without photo.

Change-Id: I4c119156584f2290c2081412b206351274230fd4
ontactsProvider2.java
52e8d24f8492116f0b49b147576ce13a5f913aa2 13-Jun-2011 Debashish Chatterjee <debashishc@google.com> Voicemail provider implementation within ContactsProvider.

- New voicemail provider class
- all voicemail operations restricted to only 'voicemail' call type.
- new voicemail permissions (currently defined in the manifest file
itself)

Change-Id: I32b916c5b4a53e93bafbecf7df7bee3f5e27fee6
rojectionMap.java
oicemailContentProvider.java
oicemailUriType.java
til/CloseUtils.java
til/DbQueryUtils.java
til/TypedUriMatcher.java
til/TypedUriMatcherImpl.java
til/UriType.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
allLogProvider.java
ontactsDatabaseHelper.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
ontactsDatabaseHelper.java
ontactsProvider2.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ransactionContext.java
6bf90e1bfe7d9e487ff5b35f7e48e6b8ccc346c2 04-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> am 37f0bdbb: Remove stale rows in directory table.

* commit '37f0bdbb0a99b12abcc319f49a2caa5ab648add0':
Remove stale rows in directory table.
37f0bdbb0a99b12abcc319f49a2caa5ab648add0 02-Jun-2011 Daisuke Miyakawa <dmiyakawa@google.com> Remove stale rows in directory table.

When upgrading from mr0 to mr2, we encounter some crashes on
email compose. It is because BaseEmailAddressAdapter uses directory
API, and the API has wrong resouce id in it. We need to remove
rows which don't correspond to any directory provider.

Bug: 4479240
Change-Id: Ife87a4a2ccad5d2a784eb5bd6ca56061a22c1787
ontactDirectoryManager.java
09e69522745551522c55dff27424496f255def46 02-Jun-2011 Daniel Lehmann <lehmannd@google.com> Enable selection strict mode and sql injection tests

Bug:4368912
Change-Id: I3f854a54e402f366be9bc6712a6188b4537b990b
ontactsProvider2.java
5bd028407806015c91d863ee2bbffbaaf1c200d8 06-May-2011 Dave Santoro <dsantoro@google.com> Fix search support tests.

Bug: 4382711

Change-Id: I48faaadeafa4e265fc8d72382a0e91b071b9215e
lobalSearchSupport.java
5fdc17bae46504edebe7285c3dbc7691ef3fbeb9 07-Apr-2011 Daisuke Miyakawa <dmiyakawa@google.com> Fix wrong handling in getQueryParameter()

ContactsProvider2#getQueryParameter() wrongly
interprets long parameter name as shorter one which is
substring of the original.
(e.g. "longer_param=value" is also treated as "param=value")

Bug: 4260119
Change-Id: Ide096589106984a5d99e70f754830d7943a7ac5c
ontactsProvider2.java
2ab9366bd96d5b6c0e6f1d03918a57f4b7e80876 05-May-2011 Dave Santoro <dsantoro@google.com> Merge "Fix issues with Contacts sync."
547c5eddcc79f680dc128b3851bf6cc03b0d0ebf 05-May-2011 Dave Santoro <dsantoro@google.com> Fix issues with Contacts sync.

We were wrapping cursors on Contacts queries too aggressively - the only cases
we should be wrapping with a snippetizing cursor are when the query actually
contains a snippet column.

Bug: 4382294
Bug: 4378350
Change-Id: I0bd007afde0bb850e88f5953f5efcfddbda0e2e4
ontactsProvider2.java
25110bb5ff8463a3047c29f535618a682d7cbfb6 03-May-2011 Mathew Inwood <mathewi@google.com> Handle zero-query case for global search.

When a request for no query is received, return recently contacted
contects. This is used to show recently contacted contacts in QSB
when it is first launched.

Bug: 4306122
Change-Id: Ic7b492c400d80be9661afc32a539c9317d7f73ef
lobalSearchSupport.java
3716f1447ceb21180d1301790eabd8b9453f486d 27-Apr-2011 Dave Santoro <dsantoro@google.com> Move snippet logic from DB to a cursor wrapper.

This results in a huge performance boost when doing searches and filters across
large Contacts DBs, since the expensive snippet() function (and associated
joins necessary for its logic) no longer need to be run for each record
returned; instead, the snippetization is only done as each entry is retrieved
from the cursor.

If the query string entered by the user consists of multiple tokens, the DB
snippet() function will still be used.

Bug: 4021462

Change-Id: I60ce69b4506bc7f770f139c127f859689b05f2d3
ontactsProvider2.java
lobalSearchSupport.java
nippetizingCursorWrapper.java
04f7fc0bddad198108d2f45cb730b9506e81dedb 26-Apr-2011 Daniel Lehmann <lehmannd@google.com> Rewrite subquery to make better use of indexes

Bug:4021462

Change-Id: If14d2c6b2e3a57c27bf16387295d45d23df52465
ontactsProvider2.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
ontactsDatabaseHelper.java
7d82ae92714f2132e3a0971d844ae8cdf10d76e7 05-Apr-2011 Daisuke Miyakawa <dmiyakawa@google.com> Add "primary account" support.

Two query params "PRIMARY_ACCOUNT_NAME" and
"PRIMARY_ACCOUNT_TYPE" allow users to supply
a primary account associated with the query, which
enables contacts provider to optimize query results.

For example, in an email composition screen, users may
want to promote email addresses related to an account
selected as a "from" field. This change allows the
client to let the contacts provider know the account.

Must be with I2a22be56822226e3ea6b6f2ef23bb77816d0345a

Bug: 3510087
Change-Id: Ibce363d336cb3e3a1fca10bddbd912ec96e4b059
ontactsProvider2.java
108f1be6b0e855f1b335bc591755a9e5f488175a 17-Mar-2011 Daisuke Miyakawa <dmiyakawa@google.com> Use new interface for vCard export

Bug: 4066223
Change-Id: Ie21c8966b0bb5b73b3afd18bfe7c142b523413c4
ontactsProvider2.java
7df711d8b184abb8ec97516de2553c470264293f 10-Mar-2011 Daisuke Miyakawa <dmiyakawa@google.com> Use old version of vCard composition method

Must be after I91b65f881e1712ecf82c2e119a92bc70c43c623c

Bug: 4066223
Change-Id: I2667a91d90b1ce985a354a5a37de75bb8156cff8
ontactsProvider2.java
17a22fae02931ae536f35293ca13a8de53439f72 26-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Preserving dot in name prefixes like "Mr." and "Prof."

Change-Id: Ife9324d8429961468a6ef3074feb374a63b989f0
ameSplitter.java
55e5cbf566edd89fc55f4a7f0ef2847084da9b16 25-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Displaying name prefix in the list and detail panel

Bug: 3488074
Change-Id: Ieb13337edbec01dcbd9581500420f47213f972e5
ontactsDatabaseHelper.java
ataRowHandlerForStructuredName.java
egacyContactImporter.java
ameSplitter.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandler.java
egacyContactImporter.java
dadaeebb6ff4845c5cad1c294fca669e7ac446ee 23-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Trim parts of the contact name before joining.

This fixes sorting of names that start with a space.

Bug: 3395927
Change-Id: I6d8d8d5047526e64081a33bd008cfb531c3f7328
ameSplitter.java
383d8aa53aa2f74a4b71642de7df2e4b9f2242c8 22-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Fix tests broken by proguard

Bug: 3466915
Change-Id: If506bba3142c7b8fd8ef3a8033693925f51da2ca
ontactsDatabaseHelper.java
2352cf62c46e1caaad64c7b3dbcc601951018eb3 12-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Masking the 'malformed MATCH expression' error

This is a temporary fix.

Bug: 3445187
Change-Id: Ib7325c8a3977ab9a17173aefe5a70abab7160540
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForStructuredName.java
egacyApiSupport.java
ameLookupBuilder.java
earchIndexManager.java
92ddc5cdc4d89ee2c6e861ae7b3a3a913ffa0100 12-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: Asian language support

Bug: 2078420
Change-Id: I1a99ad05bb6e30b539134d60f669134b87dbf180
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForStructuredName.java
lobalSearchSupport.java
ameLookupBuilder.java
174f7d319b987aa2aeeb6f2563f4b939acb8d791 11-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: QSB support

Bug: 2078420
Change-Id: I767ccecc856c0ae9ad74aafb3dac0de39b657e3c
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
earchIndexManager.java
30cc766756461da8d53933f88ea01dd2272a90eb 11-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: minor bug fixes and test clean-up.

Please note that at this stage QSB cannot search by
organization - that index has been removed. Thus
a couple of tests will be failing until QSB support
is restored.

Bug: 2078420
Change-Id: Icb5d4636b18c3fa3e26eca4ed386492cb28db62d
ontactsProvider2.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForStructuredName.java
7ba290f5de7f116ec0eaac30980ffef2878d2b64 11-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: optimizing index use

Bug: 2078420
Change-Id: Ibf4ebdd03934d68402d123bb39c6a061c609e3e9
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandlerForOrganization.java
earchIndexManager.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandler.java
ataRowHandlerForEmail.java
ataRowHandlerForGroupMembership.java
ataRowHandlerForNickname.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForStructuredName.java
earchIndexManager.java
ransactionContext.java
f482a4e25759d2c144eb41a3de56a342bd473435 10-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: no snippet when searching by name

Bug: 2078420
Change-Id: Icdd38c9963accec117ce134ef5a13e08e5f07f05
ontactsProvider2.java
ataRowHandlerForStructuredName.java
earchIndexManager.java
3d0f0e0a1325ae306842b3ad1487d3507df0821d 10-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: special snippet for phone number search

Bug: 2078420
Change-Id: I0771c46b516009df7d11471dfee87fac5a2925bf
ontactsProvider2.java
5e70c0772ef2b975c95787112ac0f15047a4ff0c 10-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: special snippet for email address search

Bug: 2078420
Change-Id: Ic8f49e91fbc039ce1f167bf58c8393019102b71a
ontactsProvider2.java
03197a00e17386aa9b1971bde3cda034bc17e0c3 09-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: updating filtering logic

This is half-done for now. A bunch of code is still protected
by if (false).

Tests temporarily do not run.

Bug: 2078420
Change-Id: Ie9b5a286426557c85c235413176090915bd6d9c2
ontactsProvider2.java
05e50fbf9809bf04eceec3d2a2753630dc4f9315 09-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: building full index for all contacts

Bug: 2078420
Change-Id: Ief6db4f4ecc0b6e5adb37a0654a72383099dc138
ontactsDatabaseHelper.java
ontactsProvider2.java
earchIndexManager.java
6d9702cec82fd27a1c3093c64df9dcc22744899a 09-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: adding remaining built-in data types

Bug: 2078420
Change-Id: Ifbd67f5ed65c44c2521a4b4d48d90aab8d0c86d1
ontactsProvider2.java
ataRowHandler.java
ataRowHandlerForCommonDataKind.java
ataRowHandlerForCustomMimetype.java
ataRowHandlerForEmail.java
ataRowHandlerForGroupMembership.java
ataRowHandlerForIm.java
ataRowHandlerForNickname.java
ataRowHandlerForNote.java
ataRowHandlerForOrganization.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForPhoto.java
ataRowHandlerForStructuredName.java
ataRowHandlerForStructuredPostal.java
earchIndexManager.java
eeeed5669d98897501bf2b18c88579c7effd0955 08-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Full text search: adding common data types

Bug: 2078420
Change-Id: I0c48e1fef3473415d01280274599f0be5cc69b08
ataRowHandlerForEmail.java
ataRowHandlerForNickname.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForStructuredName.java
ataRowHandlerForStructuredPostal.java
earchIndexManager.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ataRowHandler.java
ataRowHandlerForCommonDataKind.java
ataRowHandlerForOrganization.java
earchIndexManager.java
ransactionContext.java
6ca827312e6c69bdd88b48e485debee9fe5d16ba 05-Feb-2011 Dmitri Plotnikov <dplotnikov@google.com> Fixing inappropriate use of implementation detail

Bug: 3426389
Change-Id: I67051b37ab73abff7201ec3e0e7a25425e91d1ad
ontactsProvider2.java
ec73c9927a67e4afdd35c1b030254ed7f528655f 27-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Fixing deadlock in contacts provider

Bug: 3396429
Change-Id: I6c84c46b9605ba645e1a70c83db615a620b60200
ontactsDatabaseHelper.java
7b330a64cdf77ddb1c3e7259a7f069e99b025b51 25-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE during bulk insert in ContactsProvider2

If the first bulk insert is received before the provider
is fully initialized, you get this NPE. The provider
needs to wait for write access before doing the insert.

Bug: 3385546
Change-Id: I58b14c1824d738ef4dd1447dbf11fa678aa8f5a5
ontactsProvider2.java
9a6be1610fdf40c2f7f04cfe4b66fde3a35940dc 20-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Making QSB query not return "Dial 777" when on a no-telephony device

Also, adding support for QSB search by phone number and
email address.

Bug: 3349545
Change-Id: Ib30cc05f1894a0a74c5dcd349affb367d82603fd
ontactsProvider2.java
lobalSearchSupport.java
c1619ab08116aa6f5192a6108959b493dafdb0b6 18-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Fixing a concurrency issue in aggregation suggestion query

The code runs two consecutive queries assuming that the
data would not change between them. Adding a explicit
transaction boundaries to ensure data consistency.

Bug: 3364441
Change-Id: Ib447595496d69ebfc1f01740081a73c8116a642f
ontactAggregator.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
ontactsDatabaseHelper.java
ontactsProvider2.java
36d7a981711dc856da815fbc8739ee88c0236a15 17-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Synchronizing assignment of mimetype IDs and similar static data

Bug: 3355307
Change-Id: I259cd808a1079f37577ee355f3ee69ff8d1a4a9c
ontactsDatabaseHelper.java
5f1f4a062ac34d75d2dbf586702cbeb121cf09ca 14-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Removing legacy compatibility with the notion of a "hosted account"

Bug: 3349346
Change-Id: Ib33f9697142a2419f29d5a43d8276504f42cbcc8
ontactsProvider2.java
038893e70e8f7d0beafbb26c47586bc05191f1ce 13-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Preventing dialable letters from matching phone numbers

In simple contact search that mixes search by name
as well as email and phone number, it is incorrect
to match "ABCDEF" to phone number "222333". We only
want to use the phone number matching if the filter
looks like a dialable phone number.

Change-Id: Ida7a12ba815a4127b482452fe11d5ac7b784f363
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
415ba9ec45dc1be35d3921b28e1dae23e150fb25 11-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Fixing crash in ContactProvider2.getType when accessed too early

Unlike query() and other methods, getType() did not wait
for the provider to get initialized and would raise an NPE
during booting of the device.

Same would apply to the openAssetFile method, though it was
not actually called during boot time.

Change-Id: I502554b28ea908ff87c018c9330d6b55b1ac52bf
ontactsProvider2.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
ontactsDatabaseHelper.java
egacyApiSupport.java
e2adda196b19047bc5243d2bffe9e5650e17e39d 05-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Making address book cursor cross-process

Bug: 3324678
Change-Id: Ic071fa034d8926930e70807b1b45b696446e58df
ontactsProvider2.java
d9ec58265ae59a549880ef63cdfb5d0d977cdaba 04-Jan-2011 Dmitri Plotnikov <dplotnikov@google.com> Moving SQLiteContentProvider to /common/ex

Change-Id: I482f3d54041efef6348f53f06abfac3d21e0f28a
ontactsProvider2.java
QLiteContentProvider.java
fd2a6a5b7ecbbec6298182daee3b252896f82ea4 23-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing a database contention during locale change

Bug: 3304345

Change-Id: I4b89d15d067df83b24a760fe1dd67605d2ad2f28
ontactsProvider2.java
d97464c056e8f247e1b33dce0ea2f77eb7f6c009 21-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding an index to aide aggregation on phone numbers

Bug: 3282731
Change-Id: Ief3f7110d75b032b24c5ab9d0dcdaa0846e7c65c
ontactsDatabaseHelper.java
f266e8c568905337960b1fec5379841585af92a7 09-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Excluding invisible contacts from aggregation

Bug: 3184559
Change-Id: If4b75548477cc296107d233fb6678c266fb0ca94
ontactAggregator.java
ontactMatcher.java
ontactsDatabaseHelper.java
ataRowHandlerForGroupMembership.java
15c6e903b6d66e20e7cb1ebe7ff8c713e0a3386b 08-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing strict mode violation in ContactsProvider2.

Bug: 3250314
Change-Id: Iab0f1bf98132260bb51e99613572f0db5044095b
ontactsProvider2.java
37c85b89cc989308749ea22b1ce29c59a47158ac 08-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing strict mode violation in CallLogProvider.

Bug: 3253978
Change-Id: I30ffcf1ffba47b2b6aa1e1df6c15728b84508803
allLogProvider.java
ed78fd6df5e9f3a2d572162e5d374d1f4a625bdd 03-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken tests (proguard issue)

Bug: 3244266
Change-Id: Id64d6609a3223ada664e87f134e368c429b4fde6
ontactsProvider2.java
bf732767b4d4d7104e4723bda7d3b0eb0f909997 02-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Moving initialization and callbacks to background

Bug: 3228684
Change-Id: I7fab53092dbf55ebb502bc5d4d2012c88842c8b8
ontactDirectoryManager.java
ontactsProvider2.java
2ac23b3017b6799c017512b545a23f6366a58ae0 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE caused by contact sync

Change-Id: I9b2ec41b163b44f8848610e86e9d406302e71d35
QLiteContentProvider.java
ed089fd34d7b3baf29709eb4f2bc14fa35117660 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken build

Change-Id: I3761b94f2801e005babd70f02ca5852a4c0d5d9f
ontactsProvider2.java
ataRowHandlerForCommonDataKind.java
f6d4922f664127d0455b45b1f7444c4553581282 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Extracting DataRowHandler classes to the top level

Change-Id: Ica84da28a01a9c1b3c19967ab8cb154d796812c2
ontactsProvider2.java
ataRowHandler.java
ataRowHandlerForCommonDataKind.java
ataRowHandlerForCustomMimetype.java
ataRowHandlerForEmail.java
ataRowHandlerForGroupMembership.java
ataRowHandlerForNickname.java
ataRowHandlerForOrganization.java
ataRowHandlerForPhoneNumber.java
ataRowHandlerForPhoto.java
ataRowHandlerForStructuredName.java
ataRowHandlerForStructuredPostal.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
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyContactImporter.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyContactImporter.java
7e2635fa663312adb2bc9d04f50a6bb54c6cc5f4 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Moving a method from ContactsProvider to ContactAggregator

This is another step in preparation for turining
DataRowHandlers into top-level classes.

Change-Id: I74611a64e4601fdbbcc4fa99521026f0c95e3d2f
ontactAggregator.java
ontactsProvider2.java
d364d74ce9cc677c10362b8686d7c33fafe78beb 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Introducing a TransactionContext object to hold state for a single TX

This is another step in preparation for turining
DataRowHandlers into top-level classes.

Change-Id: I43cfad5cebcebd5e3c51000d1732e778f400d238
ontactsProvider2.java
ransactionContext.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
ontactsDatabaseHelper.java
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
49d48c0a709c1efa8593acadadd31350bfc75d9a 01-Dec-2010 Dmitri Plotnikov <dplotnikov@google.com> Ensuring that cached db connection is only used in transactions

The mDb field should not be used outside transactions,
because the database may have been closed between transactions.

Also, fixing a race condition described in

Bug: 3106464

Change-Id: I002a107f3b8aafa1a58dfdab2980978b00fc5ec1
ontactsProvider2.java
egacyApiSupport.java
QLiteContentProvider.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
ontactsDatabaseHelper.java
ontactsProvider2.java
89b7c2b6e0003b17d08002f02d6aeec9f9788c8d 30-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing LegacyContactImporterTest

Bug: 3240203
Change-Id: Ib733141a31c648437fa5d7171e0bfd22a4911c0f
allLogProvider.java
ontactsProvider2.java
ountryMonitor.java
fdcf0d5bef479819f9715c0bc750d1e8fa0dcd3e 24-Nov-2010 Daniel Lehmann <lehmannd@google.com> Merge "Allow zeroing the primary/super-primary flag"
6dd371aea88e09cbe56b8c483021f3bf61527331 24-Nov-2010 Daniel Lehmann <lehmannd@google.com> Allow zeroing the primary/super-primary flag

Bug:3212270

Change-Id: Iee664d6a13f66f0f38ed5829488e42b57448dad4
ontactsProvider2.java
359c52a6988dd3e2db2327ec36e5870906fbf359 24-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing empty IN clause in aggregation suggestion query.

Bug: 3221774
Change-Id: I56cf52ea7d56c83e502de52727417bc4a858873f
ontactAggregator.java
3ea7932a47027c8629d3a301e1a16e7d2c8a298d 23-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing GB->HC upgrade path.

Bug: 3219199
Change-Id: Icd6d7dee77b28547e6fac57d300ea81d0a40b56a
ontactsDatabaseHelper.java
c039cfb78c40730483fd71178df63ada5826a315 20-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for the new column: Groups.GROUP_IS_READ_ONLY

Change-Id: I9dc91a03d7732544cedf439e0c940c035cbfdb39
ontactsDatabaseHelper.java
ontactsProvider2.java
3826a44d8de41e9c148dd6a967392ea5af478085 18-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for a new ProviderStatus

Change-Id: I76da184b794ea7727b9109e693fbf8834c9450b6
ontactsProvider2.java
6b759a2b977a29c3c4abe1eb6d2ba242f937a923 12-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Excluding non-alphanumeric chars from contact search

Bug: 3172506
Change-Id: I3811b01e8893e4e292671fc2ac4a43771e7505e9
ontactsProvider2.java
f4015ab9ab7c26b766b5331fbf6655b8c54877ea 11-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing an issue with social status updates after a contact split

Bug: 3172848

Change-Id: Iea102c2751d48f6d0f0d78474ad664a24dc46602
ontactAggregator.java
ontactsProvider2.java
a85745ab25f9ab8fd6fd29e174bf2fac5492e448 03-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Printing an error message instead of throwing an exception.

When we get a query containing an invalid directory,
just return null. This could be a stale URI, shortcut
etc. No reason to blow up the client app.

Bug: 3119769
Change-Id: Ic798b59341a3dec360e62eb9b43671f17e483169
ontactsProvider2.java
1e9ff1153509503935d9ed32bf7e360ea788adb5 02-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Upgrading QSB Contacts query"
23061012b777c607100ce30250c3542b4fc8c1c8 02-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing QSB contact search that includes special chars

Bug: 3141773
Change-Id: I16fdb41baa8d3cde5aa38333c551916ba7bfc7a4
ontactsProvider2.java
4cb5cd47d9c3378e22050011152c88f2bc666514 02-Nov-2010 Dmitri Plotnikov <dplotnikov@google.com> Upgrading QSB Contacts query

Bug: 3125118
Change-Id: I3ed594d49647e01167f2db86d5ef07b206d85cfb
lobalSearchSupport.java
f87d3f35a3759d5b95a403c2539859e1b3ee429f 02-Nov-2010 Bjorn Bringert <bringert@android.com> Include length in vcard file descriptors

Bug: 3042385
Change-Id: I01d023e9e9777d4ced3add931faea59fcba6a934
ontactsProvider2.java
08ee3fb4e82900b52d02627ed54907431f4f5ade 27-Oct-2010 Mathew Inwood <mathewi@google.com> Throw FileNotFoundException when contact photo not found.

Bug: 3065064
Change-Id: I209ead53eae1e3e44fb6e3298885f66b9aca455b
ontactsProvider2.java
56f2638b49e6bca97f6aa7b0768a8f1fe6e7b72e 22-Jul-2010 Sang-il, Lee <gendoh@google.com> Support searching with given names for Korean names

Change-Id: Ifd5c8ebf265e7d3f4738dc0f378532f612ba9ef6
ontactsDatabaseHelper.java
ameLookupBuilder.java
ameSplitter.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
ontactDirectoryManager.java
ontactsDatabaseHelper.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
994c32a995a85937faf59e37a9fc88b526470d7d 19-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Including PHOTO_SUPPORT in directory management

Change-Id: I340ade4c173b1d5dd8eb7b0e80f4c4601e654955
ontactDirectoryManager.java
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
ontactsDatabaseHelper.java
8295d4dd0fa0530c095c8cc9fd0791e6be1b53ce 16-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> resolved conflicts for merge of 117166d0 to master

Change-Id: Icc51fb6eff0431fe5f73f2d4dfa7810fa1c8885b
75497890701732816c70c4b0d80738ff1837d630 16-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> am afcfc000: Fixing ContactAggregator breakage revealed by an automated test

Merge commit 'afcfc0005f7c93d46c28cdd8e18f956287ca0d18'

* commit 'afcfc0005f7c93d46c28cdd8e18f956287ca0d18':
Fixing ContactAggregator breakage revealed by an automated test
0ffb2de31ccd89ec56355417adc4c4c7bacd80eb 15-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> am 72c76677: Making aggregation exceptions override the not-from-same-account rule

Merge commit '72c7667755dfabba69a2afa479185a3ab458e948'

* commit '72c7667755dfabba69a2afa479185a3ab458e948':
Making aggregation exceptions override the not-from-same-account rule
117166d023b9d9405f18cc5222b18fd16a13660c 15-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Fixing the trigger for aggregated presence." into gingerbread
1dac83b8fa58944acfd00f44e717a7dddc659d2d 14-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing crash when email lookup query is missing an email

Bug: 3061109
Change-Id: If1030c7c4a825b137f745823dcd88bea6cf7ac42
ontactsProvider2.java
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
ontactsDatabaseHelper.java
afcfc0005f7c93d46c28cdd8e18f956287ca0d18 14-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing ContactAggregator breakage revealed by an automated test

If you have an automatic aggregate of three or more
raw contacts and you confirm the aggregation by adding
an explicit manual override between two of the raw contacts,
the third raw contact falls out of the aggregate.

This CL fixes the problem.

Bug: 3097139
Change-Id: I96b717eeb03e1a49a45b28ee395924f9d61c3e99
ontactAggregator.java
72c7667755dfabba69a2afa479185a3ab458e948 14-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Making aggregation exceptions override the not-from-same-account rule

We now have a rule that we won't let contacts
from the same account to get aggregated. This
rule should NOT apply to manual aggregation.

Bug: 3095300
Change-Id: Idb6bdf54214cec46c72bf681e6f980ac0d293386
ontactAggregator.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
ontactAggregator.java
ontactsDatabaseHelper.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
ontactAggregator.java
ontactsDatabaseHelper.java
d98a2d76849bcdec668e6a639f5b738edffd0e27 13-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge commit '0dce6bf7a' into manualmerge

Conflicts:
src/com/android/providers/contacts/ContactsProvider2.java

Change-Id: I9f62ee8ba755224f4fef8fb9354c4e68969971a5
e34b6c291ea04cb88ff124455b6b1943e04d425c 13-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge commit '8638e1e9' into manualmerge

Conflicts:
src/com/android/providers/contacts/ContactsProvider2.java

Change-Id: I2585cef1f1ae37b8ed028b8e58b8b5b431f460c6
53214b3ed12b0ff9cb589b6559311f2ac142f2e3 08-Oct-2010 Bjorn Bringert <bringert@android.com> Move SyncStateContentProviderHelper to frameworks/ex

Change-Id: Ib776d018678120e962ca1e28f5d14ea7d3b23471
ontactsDatabaseHelper.java
ontactsProvider2.java
2f3dea5e7ad22182915c5576b561622496afa574 12-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge commit '2a0d5f9c' into manualmerge

Conflicts:
src/com/android/providers/contacts/ContactsProvider2.java

Change-Id: I809b6ac511c43d6e60cb749b7811786e7ec08bdb
0dce6bf7a86a78d3073327419f17395c3a2d2688 12-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Changing contact aggregation to not join from same account

Second attempt, now w/o an infinite loop.

The change addresses several requirements:

1. If "Michelle Lee" and "Michelle Lee" are two contacts
in the same account, we won't aggregate them.
2. If "Michelle Lee" and "Michelle Lee" are two contacts
from different accounts, they do get aggregated, but
if a third "Michelle Lee" shows up in one of those two
accounts - we bust the original aggregate.
3. If "Michelle Lee" and "Michelle Lee" are not aggregated
and a third "Michelle Lee shows up, it does not get
aggregated with either of the first two regardless of
the account.
4. Any manual joining overrides the above behavior.
5. The OTA with this change will bust all aggregates that
contain raw contacts from the same account.

Bug: 2650610
Change-Id: I413231af4cfa620f8d266a758c22bfc879aeae07
ontactAggregator.java
ontactMatcher.java
ontactsProvider2.java
8638e1e999596ddfe12cbb529e58ca2345185af4 11-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Revert "Changing contact aggregation to not join from same account"

This reverts commit 2a0d5f9c628e723261bc5198e0fd606076b76b74.

Bug: 3086301

Change-Id: I7f05eb14122687950ca7d22d591fc172c463045e
ontactAggregator.java
ontactMatcher.java
ontactsProvider2.java
2a0d5f9c628e723261bc5198e0fd606076b76b74 11-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Changing contact aggregation to not join from same account

The change addresses several requirements:

1. If "Michelle Lee" and "Michelle Lee" are two contacts
in the same account, we won't aggregate them.
2. If "Michelle Lee" and "Michelle Lee" are two contacts
from different accounts, they do get aggregated, but
if a third "Michelle Lee" shows up in one of those two
accounts - we bust the original aggregate.
3. If "Michelle Lee" and "Michelle Lee" are not aggregated
and a third "Michelle Lee shows up, it does not get
aggregated with either of the first two regardless of
the account.
4. Any manual joining overrides the above behavior.
5. The OTA with this change will bust all aggregates that
contain raw contacts from the same account.

Bug: 2650610

Change-Id: Idfba4dd330a4842310f3fed85e6ae0a3a634e95c
ontactAggregator.java
ontactMatcher.java
ontactsProvider2.java
014c46e39ad19aaa64e23e714bdafa358775a0d1 07-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Redefining "All contacts" as members of any group."
d6ef718d85724dc482dc88f8c8a87b356e63c0f6 07-Oct-2010 Dmitri Plotnikov <dplotnikov@google.com> Redefining "All contacts" as members of any group.

Change-Id: I3f55af4aba1994d0f639ab8fbbdfd01434237804
ontactsDatabaseHelper.java
d8272f91a5354b855f5d99db9e1ca4478c93479d 05-Oct-2010 Elliott Hughes <enh@google.com> Fix NameNormalizer to only use public API.

Bug: 2417080
Change-Id: I2b055355eb4c293a91634f659e58c7592c60e38b
ameNormalizer.java
90f51664389e302cd3d498e8fcef04ec26f28de5 30-Sep-2010 David Brown <dab@google.com> am f481f22a: Handle DATA in ContactsProvider2.getType().

Merge commit 'f481f22a9323fe338672f99b88b26c5f0725cd42'

* commit 'f481f22a9323fe338672f99b88b26c5f0725cd42':
Handle DATA in ContactsProvider2.getType().
f481f22a9323fe338672f99b88b26c5f0725cd42 29-Sep-2010 David Brown <dab@google.com> Handle DATA in ContactsProvider2.getType().

(I noticed this was missing because I saw IllegalArgumentExceptions in the
logs when doing caller-id lookups for SIP addresses, which happen directly
on the Data table.)

It is valid to call getType on a DATA uri, though, so we now return
Data.CONTENT_TYPE.

Bug: 3004127
Change-Id: I14538cd8671e2f47acedddd79c18bd2ce4709a8f
ontactsProvider2.java
168d5437461d59535cda2b9ccf1ce9a8a5bc8688 26-Sep-2010 Elliott Hughes <enh@google.com> Fix a trivial TODO, cleaning up an import.

Bug: 2417080
Change-Id: Iff73324d0f8f9d86e4e95998e4ab71d883fe8d0c
ameNormalizer.java
2b07b826e208e464bbd85d4679aab956bef0bafc 24-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Changing Contact PHOTO_URI to NULL when PHOTO_ID is NULL

Change-Id: I6a1778438752785adfd3bc64bd12ac2595bbf8c0
ontactsDatabaseHelper.java
778d92d4dce5f76c649e2aca9d00d3f214cd7643 23-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding PHOTO_SUPPORT and SHORTCUT_SUPPORT to projection maps

Change-Id: I268debfdfaa635b7564cfa67a98e71800575d367
ontactsProvider2.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
ontactsDatabaseHelper.java
3d67ff829e8acb0f650f155c3c0d377c0f46507a 23-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for PHOTO_URI and PHOTO_THUMBNAIL_URI

Change-Id: I080c3227164eba6804095a4f0cbd82bb5093e161
ontactDirectoryManager.java
ontactsDatabaseHelper.java
ontactsProvider2.java
385182830ff0ed84edce9aba2424d2afe99453ce 22-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding a table for Directories.DEFAULT contents

Change-Id: I9d1c15e6df24fbec84e436923abdae75b88c6eac
ontactsDatabaseHelper.java
ontactsProvider2.java
d015a8321fb9dcbfa96becb909145dfcce3da608 20-Sep-2010 Bai Tao <michaelbai@google.com> Fix the failed unit test

Change-Id: I27a7918608ed854c8ed9108a9d2d4d5fc5b24ec8
ontactsProvider2.java
f4e7ae68ba58d82b16bc2101db8d0f358c1d9297 15-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Making "distinct" applied automatically for Data queries

The code ensures that "distinct" is NOT applied
when projection contains columns unique to the Data
projection map (as compared to the Distinct Data
projection map).

Change-Id: I87f8492357be92c4105d15deca3bb9a3eb07edae
ontactsProvider2.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
ontactDirectoryManager.java
ontactsDatabaseHelper.java
ontactsProvider2.java
1b2a89588e9593756c2627ce1683539f4ffa1e51 11-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing the rescan of packages for contact directories

Change-Id: Ic2eb69595b0bd439d1cd4a000eb509eee9be06b3
ontactDirectoryManager.java
ontactsProvider2.java
afb84050536a4472c13efc0e996d31132d254605 10-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE in ContactsProvider initialization.

Change-Id: I062db8216ab8336ec3a0e6166eef26730c01766f
ontactDirectoryManager.java
ontactsProvider2.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
ontactsDatabaseHelper.java
66e3c421a517bf704a6e2ccf8c47c65ae2fc677d 01-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Reverting CL I3ec109a9

Change-Id: I5fed8b5fdfae1dbebeb53a376456705a6f0f8df9
ontactsProvider2.java
6255d756615cfa89fb3411d1840dbe08e1375ffe 01-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Rescanning all packages for directory providers

Now automatically scanning all packages to see
if they come with directory providers whenever
an account is added/changed.

Change-Id: I1ec1851f923aeba47c4c3dc751534c562885f0f0
ontactDirectoryManager.java
ontactsProvider2.java
c918b0d3ab17a45a392748f43956b927c83eb402 01-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Improved ordering of email address autocomplete suggestions

Change-Id: Id59c2f40400eb7b3394ea6774ce48036859ecc86
ontactsProvider2.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
allLogProvider.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ountryMonitor.java
2e40e351a80ff608045bc9f55b48bd1a3d16926b 01-Sep-2010 Dmitri Plotnikov <dplotnikov@google.com> Passing the "limit" parameter to directory providers

Change-Id: Iad41e6a63c69d4f8a00b14f99e8d425a8cff1947
ontactsProvider2.java
6206cd7e15b1fe63b72cc9ba32a4d84c764963ce 31-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Temporary patch to allow people to sync contacts

The contact sync crashes

Bug: 2965003
Change-Id: I3ec109a9de7ed227d9d702ccbe327a26d25c7c4e
ontactsProvider2.java
3d83de8caa2a62925e242f32ccfdd3f5179b16f1 31-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> am 9516b6ee: Use new SharedPreferences.apply() instead of commit().

Merge commit '9516b6eef76b3504913f5efcadf603969946a3d0'

* commit '9516b6eef76b3504913f5efcadf603969946a3d0':
Use new SharedPreferences$Editor.apply() instead of commit().
9516b6eef76b3504913f5efcadf603969946a3d0 27-Aug-2010 Brad Fitzpatrick <bradfitz@android.com> Use new SharedPreferences$Editor.apply() instead of commit().

apply() starts an async disk write and doesn't have a return value but
is otherwise identical in observable effects.

Change-Id: Icd6065e9ef650f80a93e1397bfd6300edc2670c0
ontactsProvider2.java
ontactsUpgradeReceiver.java
332321f2832d52f50b9f8fc1f4006459000a4b21 26-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Unwrapping transitive cursors.

When we get a cursor from a Directory it will likely
be wrapped into a CursorWrapper. CursorWrappers are
not CrossProcessCursors and cannot be returned over
the binder, so we need to unwrap them.

Change-Id: I2148d0cf72d8cce299019f3d24b8f4e269a762a3
ontactsProvider2.java
4458d63ef3384832fd2ad82130d4ad042cce2de6 21-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Resolving a concurrency issue with directory registration

Change-Id: I9b31d04e87d90db45d16cfdaa7f586b7d0441c20
ontactsProvider2.java
7a3c645fa7db38449d34eb04d4e032fd079c3244 19-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> New ContactsProvider query: complete_name

We want to allow the UI to switch freely
between a single field name and multi-field name.
For that we need to expose the name parsing/concatenation
machinery we have in the contacts provider.

Change-Id: I51586e309e11a90c719d747862b646de7fb8f326
ontactsProvider2.java
ac13ddd04d665442de846b59234bdc936a6699b4 14-Apr-2010 Bjorn Bringert <bringert@android.com> Use new public API for memory-backed file descriptors

Bug http://b/issue?id=2595601

Change-Id: Ia274e4c5d7098054bec189e28f2172fb864e6e8c
ontactsProvider2.java
53fac8f99f3884c372c907a76766d27fa9e1d95f 17-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Switching to a more narrow configuration change notification

Change-Id: I7d8610e6e92331793b768dd951b746753e1be8b6
ontactsProvider2.java
ocaleChangeReceiver.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
ontactsDatabaseHelper.java
ontactsProvider2.java
8727a729d5c0e875538025f0a85b3ac64c3a7745 13-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixes following some breakage caused by CL 60952

Change-Id: Ia9fe3a477ab3e4e141773432a969d67168fd6155
ontactAggregator.java
ontactsProvider2.java
76dfa406e2cde19c824983c37fc92c1c5bf63eec 13-Aug-2010 Daniel Lehmann <lehmannd@google.com> Fix the build

Change-Id: I750f1c6b4c3d05d93bb07ee306f11486bfd9ce40
ontactAggregator.java
ontactsProvider2.java
5b3634b24d3c21618f96860e969fd5c9ba7d9ca8 12-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for query-based aggregation suggestions.

For now exact name match is required.
Will add other types of search later.

Change-Id: Ibc7bca3a7f418da349b318e0e31861268af5f827
ontactAggregator.java
ontactsProvider2.java
09ae48b82b17e24016b14a1ab64706222ab1071f 11-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Supplying a default projection to Directories

Change-Id: Ie0de59b99624252e4688113fcc6ff52ec75ac8e4
ontactsProvider2.java
f06a42ca707b8c74d0ac9070db5f9767f4fe74dd 10-Aug-2010 Dmitri Plotnikov <dplotnikov@google.com> Syntax sugar for projection map creation

This is in preparation for supplying a projection
to Directories even in the absence of projection
in the original query.

Change-Id: I3c3aa928d02308548349a9407502de943e84a166
ontactsProvider2.java
rojectionMap.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
ontactDirectoryManager.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ackageIntentReceiver.java
ackageUninstallReceiver.java
02123b7cc8336ec5481f20c12ce5c7f2b9f044d4 05-Aug-2010 Brian Carlstrom <bdc@google.com> Tracking merge of dalvik-dev to gingerbread

git cherry-pick --no-commit 633d446a

Change-Id: I0f96f14dfffd9fa8e3bd2480c3de0518818616e7
ameNormalizer.java
a549eb3c9627862a3e45d910d5c981191086a949 30-Jul-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for all-encompassing contact/entities URI.

Change-Id: I65821cf0abe2c8a94abd9168e80a0a098c1e2a1f
ontactsDatabaseHelper.java
ontactsProvider2.java
dd300fe5f5a1071b1c135af7c76e3ae149edda4d 29-Jul-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing two issues with CHAT_CAPABILITY

Also, adding tests for all projection maps.

Change-Id: Iadf6b534905ad09fc15d799837d60dc8b1e91c3d
ontactsProvider2.java
4fbe050dad387000d36caf07cff1a3fcbf12661f 22-Jul-2010 Marc Blank <mblank@google.com> Don't treat package replacement as a deletion

* Currently, we delete the directory information from removed packages
* Before doing this, check EXTRA_REPLACING in the Intent; if it's
true, we ignore the broadcast.

Change-Id: I3e7a0c5066ee1c9fc917b2a33c0873c050974d2c
ackageUninstallReceiver.java
632248ae0053fa99b1f5b4cfaab3e55b7453fcb1 19-Jul-2010 Vasu Nori <vnori@google.com> fix broken gtalk & contacts in master

Change-Id: I6e2dbe2fe6fd7fd1d74e80d66065ad613ec03222
ontactsDatabaseHelper.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
ontactsDatabaseHelper.java
ontactsProvider2.java
aabcd1d34a71ad06ee0a9395331540484f1ceb17 15-Jul-2010 Vasu Nori <vnori@google.com> add chat_mode to presence_db tables: presence, aggregate_presence

Change-Id: I62fc49669217a6136e31164713dc25a5296721ef
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
5bfdcad228817e2edd2cdbfc69a9b16d411b1533 24-Jun-2010 Dmitri Plotnikov <dplotnikov@google.com> am 4f20a360: Avoiding a race condition caused by configuration change during FroYo upgrade

Merge commit '4f20a360a2f0a7a83900c28fc7728542b38d8939'

* commit '4f20a360a2f0a7a83900c28fc7728542b38d8939':
Avoiding a race condition caused by configuration change during FroYo upgrade
4f20a360a2f0a7a83900c28fc7728542b38d8939 24-Jun-2010 Dmitri Plotnikov <dplotnikov@google.com> Avoiding a race condition caused by configuration change during FroYo upgrade

Bug: 2789091
Change-Id: I8515521eeea83e11c9b14eface70e3f86bf51974
ontactsProvider2.java
d829c82236bb636c816c25b384a28b4d99f0ed0f 23-Jun-2010 Dmitri Plotnikov <dplotnikov@google.com> am 80952e03: Resolving a race condition in upgrade to Froyo

Merge commit '80952e03e425a04ea2fd77e3ff44a8453ffdefe1'

* commit '80952e03e425a04ea2fd77e3ff44a8453ffdefe1':
Resolving a race condition in upgrade to Froyo
80952e03e425a04ea2fd77e3ff44a8453ffdefe1 23-Jun-2010 Dmitri Plotnikov <dplotnikov@google.com> Resolving a race condition in upgrade to Froyo

Bug: 2789091
Change-Id: I4adb18ca019d50215129c2c7ec088b49438d053f
ontactsProvider2.java
d3d812af96f7d77e13dc60652626b39f25907147 07-Jun-2010 Dmitri Plotnikov <dplotnikov@google.com> Initial implementation of the directory API

Change-Id: If8cb0a1fc32dba0ac47502d9f86b43e0e0add8b8
ontactsDatabaseHelper.java
ontactsProvider2.java
ackageUninstallReceiver.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
ontactsDatabaseHelper.java
ontactsProvider2.java
1a40dbed84a2a2f397d52c64099469ed3557aabe 18-May-2010 Vasu Nori <vnori@google.com> add API to Cursor to get column value type

Change-Id: I373c3d09ca4aaa16c282a41a6ed80dc9d6391bca
eorderingCursorWrapper.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
ontactsDatabaseHelper.java
ontactsUpgradeReceiver.java
ventLogTags.logtags
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
ontactsDatabaseHelper.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
ontactsDatabaseHelper.java
219c2a98c2b79da6cfcf2ba05fe985c5534b87ac 18-May-2010 Daisuke Miyakawa <dmiyakawa@google.com> Make ContactsProvider use a static version of vCard library.

Bug: 2689523
Change-Id: If012a8aa061c6b3874e494779edb73c9e8e106b6
ontactsProvider2.java
35da06eb902047d8f3eb1698450d7bfdc41f22d4 19-May-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding garbage collection for the visible_contacts table.

Change-Id: Ied1f328f93149c4e448fe8636f61062f3cc6d28d
ontactsDatabaseHelper.java
e3e79030101447da07547647bad225686eb9b8df 19-May-2010 Dmitri Plotnikov <dplotnikov@google.com> Preventing unnecessary update of contact visibility at boot time

Bug: 2511409
Change-Id: I5191cc424adbaa97648db9cedee6573a16b0232c
ontactsProvider2.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
lobalSearchSupport.java
egacyContactImporter.java
2149ab82f021c204618d0d3644e261fd7a8d8490 05-May-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for contact/lookup/*/#/data URIs

Change-Id: I941b6e9c7c47a30bbd975881ba755ba0c5862401
ontactsProvider2.java
c9e6d75562621a3dee26a99c2b082e2fd9b0c8b3 04-May-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing filtering with an empty filter

Change-Id: Ieb1257573cae88e83abf3217a31a4e1ff187eca6
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
633d446a21eaceecc0948893769f82163f1cb1e5 24-Apr-2010 Elliott Hughes <enh@google.com> Start weaning NameNormalizer off icu4jni implementation details.

Minor reshuffling necessary to keep building with the Java 6 API changes
post-froyo. This is compatible with the Java 5 API, and needs only an import
change to be compatible with the Java 6 API.

Ideally, this class should only be using public API, but I don't think
anyone has time for that right now.

Bug: 2417080
Change-Id: I40ac70a62ccf0a096a5635cc0499699b8bb69498
ameNormalizer.java
80d7871ca31d604cbfd857661d5300bb090076db 16-Apr-2010 Daniel Lehmann <lehmannd@google.com> Add NAME_RAW_CONTACT_ID to view_contacts

Change-Id: Ib889d1cc43e4551b9f7887bf3c808140f2bf16a3
ontactsDatabaseHelper.java
ontactsProvider2.java
7f786e5cbde9975b9632beb9b6d19eeef8a64cf1 15-Apr-2010 Dmitri Plotnikov <dplotnikov@google.com> Using strict projection map

Change-Id: I36e42e5277e94da754e1c2c0e33d59a4c4018ef3
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ameSplitter.java
45d8626bf586b5c7111fa86324a7201ae8073607 07-Apr-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing phone number picker in search mode.

The phone number picker crashes if you
try to search by something that is neither
a name nor a phone number, e.g. "&(./"

This is a relatively rare use case for people,
but very common for monkeys. The main reason to
fix it now is to allow monkeys to continue running
and discovering other problems.

Bug: 2473955
Change-Id: Ib48e324b4d3ced262cc90a67471a35765742eff1
ontactsProvider2.java
35ebc8d4a0a96b8fbe155e0c2ee6e72a994e6e8c 06-Apr-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing handling of null sync ID in legacy import. Part II

There was an issue with the original "fix". I actually ran
tests against Master and thus did not notice the breakage.

Bug: 2498528
Change-Id: Ic3d288a5d1d39f1ff9a9bb5a3a048c813f665fbc
egacyContactImporter.java
2aa932da79a22b69d55e862966941afe4377532e 05-Apr-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing handling of null sync ID in legacy import.

Bug: 2498528
Change-Id: I0c0f84ab39258ce068a8013cb0e704e8cdf23e80
egacyContactImporter.java
c64e0fb0655d8e81c22db555b55c953b5b787b01 01-Apr-2010 Fred Quintana <fredq@google.com> revert the stripping of System Group:
from the names of google system groups

Change-Id: I6c132b27a124f4d1d60d791d28419b520523bfb5
http://b/issue?id=2558197
ontactsProvider2.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
6dddb9abd6f738e43b41a4687c318533085ff0c7 26-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Removing broken SQL

Bug: 2548819
Change-Id: I81a754d93ddda2e484e7d5276a6263c491baa066
ontactsProvider2.java
7ceafd016eb07d2de808d18cd5a9463efaee781d 26-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Reflecting name/phonetic name change in name lookup

Bug: 2152608
Change-Id: I56130e9a2ea0a3e7fc62490caf02040591ce6b19
ontactsProvider2.java
f8536aaa7a52b9a7a353bc54e158becdbe79ec87 25-Mar-2010 Bai Tao <michaelbai@google.com> Put the contacts on the phone into My Contacts group.

Change-Id: I71964d3bcb026ea2c3d09438bcbcf0ed474c1886
ontactsProvider2.java
5ecb42daaef10e8790f9ed7683fae93cf7bed988 26-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Deprioritizing twitter pictures in contact aggregation"
767e109d6f08749b9ed202c0b71f3459eaae2115 26-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Deprioritizing twitter pictures in contact aggregation

Discussed the solution with Tim Sullivan, got a Dr.No approval
for fixing the issue in FroYo and for the solution itself.

In two separate CLs we will set picture priorities for
Facebook (5) and Twitter (3)

Bug: 2535693
Change-Id: I3d90474d92b58db2845a43658845176260c24812
ontactAggregator.java
ontactsProvider2.java
hotoPriorityResolver.java
198e4e86729fca4472f1ddda514d7f674bd368d6 25-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Making contact visibility update null-tolerant"
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
ontactsDatabaseHelper.java
f604d0340a8578a0d4b34e5d6e0e7e212136af32 24-Mar-2010 Bai Tao <michaelbai@google.com> Remove the fake ContentChanged notification

Change-Id: Ia1f996415f1a46ae60144eb166d531a99778e49c
allLogProvider.java
afbf2a3343d0f8e7ae7cbfbbec60004ed37caf3f 24-Mar-2010 Daniel Lehmann <lehmannd@google.com> Publish NameRawContactId in ContactData-Query
Bug:2534647

Change-Id: I9b063282b0ec430bd7ce64a946ec2699b0406781
ontactsDatabaseHelper.java
ontactsProvider2.java
992edb8d6ec6382fc64e6106cff8a8a121a30b7e 24-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing an issue with legacy contact import.

The issue is that the importer set the is_primary flag, but
not the is_superprimary flag.

Bug: 2535177
Change-Id: I32e11d1bb9c1068781d1a734256a223f75543e7f
egacyContactImporter.java
3b10d3a1ed1052dcdf529da370cb71b74164b158 23-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding phonetic given name to contact name lookup

Bug: 2536325

Change-Id: I66c03e118cef1ccf9449010752dd6ee76b9305cc
ontactsProvider2.java
d5a176cfe6d8701ae8b7882596711e5fc2746be1 19-Mar-2010 Daniel Lehmann <lehmannd@google.com> Construct a SQL string instead of using parameters to not run into param-count limits
Bug:2528389

Change-Id: I6bce9eb299d1686fd11445196285ec4b7e5e1492
ontactsProvider2.java
bc487a312a84972f03776cdc5784cc132a57f8fd 20-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE in isWritableAccount

Change-Id: I56410fd4846231bd574c89c04c51f6cb779a5945
ontactsProvider2.java
e8d2c8276d6331843410c97751e46fc50b257379 20-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Support for Data.CONTENT_URI URI for photos

Bug: 2530676
Change-Id: Ibad58c047713fe4e9e13fb0d0ce660f3e852f0a8
ontactsProvider2.java
d4d73e2df19f8304f9eb9426319b182931a25a9e 19-Mar-2010 Daniel Lehmann <lehmannd@google.com> Handle account==null instead of throwing NullPointerException
Bug:2528419

Change-Id: I30bbdc5fcc8d1259c36bfe04badf32e3e034d1f3
ontactAggregator.java
73f1f396c155b247b903d8f4111db17d3e13dc4d 19-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Favoring editable contact name over read-only

Bug: 2528277
Change-Id: Ic67fa43eeb9dd215874450f1a78f16846b598d94
ontactAggregator.java
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
44e4e1a871a5e958495978086300814775e87637 19-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing a delay in contact deletion.

Bug: 2522890
Change-Id: I1ce5e2ee685ae8b035d143d8b52838f1c965ce5f
ontactAggregator.java
743eac356404195f236ad44379fe9d180beb5bf2 19-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Optimizing the "all accounts" query in ContactsProvider2.

Change-Id: Ia6f8d36956397757c7c246585e37462d09c20337
ontactsDatabaseHelper.java
ontactsProvider2.java
8ebd00a718bb868818b8dfaab10d66481a49d730 19-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Storing legacy contact status in the database."
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
ontactsDatabaseHelper.java
ontactsProvider2.java
e709da26d02cc55c553f14e20233ddddd408936b 18-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing SUSPENDED contact aggregation mode

Change-Id: I50aaf86a653d0b3e147937edad3e7a634b86d9e7
ontactAggregator.java
1391e03254ce442022e05e473f1a5e322411150c 18-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Avoiding unneccessary aggregation passes"
813fd5712e0ad264ff6907c85d68a01fb1255d28 18-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Avoiding unneccessary aggregation passes

No longer triggering contact re-aggregation if the data
is changed to its current value.

Also, skipping aggregation when all that's changing
is sync adapter technical data.

Change-Id: I6494c998f5e9b336b45dc04787d0b6f5a1851f6e
ontactsProvider2.java
18cba80a41494e82464aaf8c6ab1ac3f608492bc 17-Mar-2010 Daniel Lehmann <lehmannd@google.com> Fixed visibility of contacts, display-names and lookup-keys after Donut->Froyo update. Reworked Tests.
Bug:2517163
Bug:2521116

Change-Id: I8e33650acf9a59b52719289e37257c1b3c55a7a9
egacyContactImporter.java
f5a847e8c93db02f3334dbc276debd90bdea5658 16-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing handling of aggregation mode

Aggregation mode was handled properly when each change
was in a separate transaction. This CL makes it
work the same when multiple changes are made
within a single transaction.

Change-Id: I39b3c6378f02b2468e559e9d5227809ab463aa2d
ontactAggregator.java
ontactsProvider2.java
bd578a748ab5bd74aa63511cce8769d5882f4651 13-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Implementing legacy contact upgrade under low storage conditions

Bug: 2498528
Change-Id: Ibd7aa458f665fea71192ce7ff1743f064acb3858
ontactsProvider2.java
egacyContactImporter.java
51698db0c97b20e95421bc42b243e4ea315137be 16-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken build

Change-Id: I1a16eacf94003b3c85a9843eed4a3e8f74969286
ontactLookupKey.java
e0bbba6a6026b2577e62097ea8f8f7ebe48da8f5 16-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Allowing "-" to occur in contact lookup key

Change-Id: I3402f0ec6ae6196615d428395d27f454fe026fd6
ontactLookupKey.java
42aff67de3f0f4b8664a74fe6ff63ae191aa51bf 12-Mar-2010 Daniel Lehmann <lehmannd@google.com> Ability to create VCards containing several contacts
Bug:2501468

Change-Id: Ie28f1617d8ca02539eaf7bff90cc9decfa4e4ac6
ontactsProvider2.java
609cc5b4c96a6981f675a70ff743ecfec2b448e6 11-Mar-2010 Daniel Lehmann <lehmannd@google.com> Update visibility after accounts have changed
Bug: 2268520

Change-Id: Ibd55a44ca626c52b57375fb88b3401678f50c7fd
ontactsProvider2.java
48786768751cdd9868fb3cf3c82d63f277a54b6f 11-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Enabling search by phonetic name

This will not apply to existing contacts yet. I will do
a database upgrade in a following CL.

Bug: 2443866

Change-Id: Iee844df16e7cd8b0c0bc8cd19c9a13532589cf38
ontactsProvider2.java
egacyContactImporter.java
65ce381c2bb7ddcc3e7d3b8f5f7095831be97603 10-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing call ordering during ContactsProvider2 initialization.

The cached mime type IDs were being used before they were initialized.

Bug: 2504223
Change-Id: Ic3f18aebeabf7f16abdab9f034502cfd4e4600e4
ontactsProvider2.java
f0da835940ab6ae1aa37e0ba2ddd29c3117eb212 10-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing contact list breakage caused by rapid switching between locales

Bug: 2504328

Change-Id: Ibd956e35b3bb9eaead8b9253bd2becbd4a5ab326
ontactsProvider2.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
cdd03b2ba03718a7fa85663a2438136284a1557c 08-Mar-2010 Bai Tao <michaelbai@google.com> Filter English contacts by initial char in Chinese Locale
Filter Chinese and CJK contacts by initial char in neither Japanese nor Korean locale.

Change-Id: Ie20b081a96421c56f1713cb676946743704549f3
ontactLocaleUtils.java
ontactsProvider2.java
ameLookupBuilder.java
ameSplitter.java
89f1f71495aedc58252b3f58a46a036986c319d2 09-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixed SQL syntax error broken by change 42758 (take II)


Change-Id: Ibc1dabb85b38247c00c252a35b1ac61688deec6f
ontactsProvider2.java
90507ed329506c5de6206e9eebc6c44a7abfdb7d 09-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixed SQL syntax error broken by change 42758

Change-Id: I294c3a532c79473e79eb615e91bc4b673c6b6525
ontactsProvider2.java
51f41be3b905c63ccffcdc82ec58cf5f7ded2c34 09-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Rebuilding contacts sort and lookup keys on locale change.

Bug: 2476633
Change-Id: I25ba9521e7247907d4fa8c0148091d9d67e4e389
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyContactImporter.java
09c6613dd14cb1911da5d62e39a4e54eb8f4666f 09-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding basic support for the new ContactsProvider status URI

Bug: 2498528
Change-Id: I3f27ef0c1cc2efaaef4045f0d03271ae92879ed5
ontactsProvider2.java
5086b63bf3de5f26f495b640e85259c0ebf5ca47 09-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing ArrayIndexOutOfBoundsException in contact sync

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

Change-Id: I7d60da3300c61571b293e2bda5a3440a8a35d16c
ontactsDatabaseHelper.java
ontactsProvider2.java
ameLookupBuilder.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
ontactsDatabaseHelper.java
ontactsProvider2.java
92fcdfb24194e8527ef59c0af0731825ee46fa45 05-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding a format of contact lookup key that works better for unnamed unsynced contacts.

Bug: 2385103
Change-Id: I79d7e4d62077a5ebc0231c24ffa07ea05ba9c77f
ontactAggregator.java
ontactLookupKey.java
ontactsProvider2.java
0265a180cf027d149f11f8750652ac67ea08ca24 05-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Explicitly closing cursors and databases in ContactsProvider2 and related tests.

Change-Id: I70549b9517f38ae53fb59f60851f831768b87615
egacyContactImporter.java
2526f94e532ac973c846db0099f94b375a23be93 05-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Switching from string builder to "?" notation for status update statements in ContactsProvider

Bug: 2378148
Change-Id: I0e909042767d4056157bd1c8b3140aa57d630aea
ontactsProvider2.java
f6c1658fa38b4a94ceab295767938388ec735240 05-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Properly updating TIMES_CONTACTED when invoked via legacy Contacts API

Bug: 2483809
Change-Id: I03511e710d48a02f35eba2cf54b0d0909ea1a9e2
egacyApiSupport.java
9005e312949b4624aae6953dbdab2eaee1650835 05-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding a mime type for the phone lookup URI.

Bug: 2486764
Change-Id: Ie94456ff9125d6b981b8dac8f8d160c976db2a94
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyContactImporter.java
ameLookupBuilder.java
fa4a38c9d54f3e3aad4674867bb1250f450c0b95 04-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Making exceptions more verbose in ContactsProvider2

Change-Id: I32f7d5d4a4bbd8468ac174d5c0cb4f6521806272
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyApiSupport.java
9fcf109b56cec0aad05322a3b4594228ea06d859 04-Mar-2010 Daniel Lehmann <lehmannd@google.com> Lookup of contacts with known ID and LOOKUP fixed. Used to be a problem for contacts without names
Bug: 2179909

Change-Id: I33bb9e5174d7db81b5502c5bb8f38f861720a104
ontactsProvider2.java
34d90e08d19d142b50fdfe62e6abbdbbaa77780e 03-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Merge "Switching to the new SQLite extension function, GET_PHONEBOOK_INDEX"
bfd59cb11248659d12a379394774da8ff6f36cef 03-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Switching to the new SQLite extension function, GET_PHONEBOOK_INDEX

Bug: 2407129
Change-Id: If8ff2ddee9a222de061ea84b043d19a8e8503944
ontactsProvider2.java
7c007126ce15037d1521d6860f17b7b054aaf161 03-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE in Contact Aggregator

Bug: 2451315
Change-Id: I93913d39a2a326632f79dafc41b24c77803f3e46
ontactAggregator.java
ae7733451f6ddf3246efcd7fd4fc6882eefa6657 03-Mar-2010 Dmitri Plotnikov <dplotnikov@google.com> Retrofitting Eclair/Froyo changes into the legacy contact conversion script.

Bug: 2461372
Change-Id: I587a8654c0d14d7145230238fe44585a65803698
ontactsProvider2.java
egacyContactImporter.java
ameSplitter.java
96b7618a3996f2f356cb33553e76877d23a996f2 02-Mar-2010 Doug Zongker <dougz@android.com> reuse SQL statements with different selection args, correctly this time

Change-Id: I9b7fb16b4bcd9c90537134ac333b252fe80b9e69
ontactsProvider2.java
0ea545354bb1c43d117c2eca28df078fe63af3c7 02-Mar-2010 Doug Zongker <dougz@android.com> Revert "reuse SQL statements with different selection args"

This reverts commit 7cac580efadfcbfeedc15802a436f774f9d134ce, which
breaks the unit tests.

Change-Id: I3d9cb75992eaecbf7acc5fb01d3b8d7513f88d38
ontactsProvider2.java
7cac580efadfcbfeedc15802a436f774f9d134ce 02-Mar-2010 Doug Zongker <dougz@android.com> reuse SQL statements with different selection args

Change-Id: I70f7088a4c401145c2e6b7fa3fa6a5fd97db9606
ontactsProvider2.java
04b7ce026c73077d9d982742bc662ea4b3ac74e7 27-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Rebuilding contact name lookup during an upgrade from Eclair.

Bug: 2476275
Change-Id: Icda3e0d57ba053978fc0bc8c7e961db2b8b5a69c
ommonNicknameCache.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ameLookupBuilder.java
d0569511c4b9eb961d5a73be16edb9767fa9c2eb 27-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Refactoring common nickname cache into a separate class.

Change-Id: I88529053ea3643b35d34cb6acadf6f0d8327479b
ommonNicknameCache.java
ontactsProvider2.java
ameLookupBuilder.java
b06484032125877d1a89785a1a912ca58c12d448 26-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing contact lookup by email or nickname

Bug: 2472887
Change-Id: I7010292dd1f189ae0fc18340ebc263664e1f15f8
ontactsDatabaseHelper.java
ontactsProvider2.java
9c6ef008d92017108e3d10dcd8e2146eded9e148 26-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Reflecting the rename of contact search snippet fields.

Change-Id: I0dec0d2b32c099f39f5f74239c9ba397a6fc414f
ontactsProvider2.java
9d9673d6a93926c337e23b7e2dcfb9aebc43e9ab 25-Feb-2010 Fred Quintana <fredq@google.com> make the ContactsProvider2 abort the request by throwing an exception if the sync state to update no longer exists
ontactsProvider2.java
916f2d7104bfba857412a66b40ed60fea6546222 25-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Adding support for contact search snippets

Bug: 2447965

Change-Id: Id531ca694173751392961510e1207215113b323d
ontactsDatabaseHelper.java
ontactsProvider2.java
734dd93a5a1bba5da3d105af2e2ededdc8ddea77 23-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Removing db intialization code from SocialProvider.

Bug: 2439739
Change-Id: Ide207a5ab8a963304b1750b81cdb12257e907222
ocialProvider.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
ontactsDatabaseHelper.java
f3f4a385d8d1d6788ba79ca353d02235de1d9b33 18-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE in the A-Z contacts list.

Change-Id: Ib67cbcf603e5efa6f24c0a60dc59e5cd2fe0367a
ontactsProvider2.java
ba2c85b4700fbb3ecaf75e1101735f60b5483527 17-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Implementing the "count contacts grouped by first letter of sort key" URI.

Bug: 2407129
Change-Id: I42a2977650c167cb55a363830503b69feb7ebdb3
ontactsProvider2.java
7a2a564e9a72969999821142c821eb1b912f0d95 15-Feb-2010 Daisuke Miyakawa <dmiyakawa@google.com> Use ContentProvider2 use VCARD_TYPE_DEFAULT in VCardConfig instead of using invalid String "default".

Bug: 2377678
ontactsProvider2.java
2b7a632bba423357ae5641f94da6a2f71afc523b 08-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing lookup key update for unsynced contacts.

Bug: 2377667
Change-Id: I3d4ba2fed436d2f322285740b66563f1b0e4e864
ontactAggregator.java
ontactsProvider2.java
34469970fb04b9b188b5430f592b0c956a6ea2aa 06-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing contacts.db version.

Change-Id: Ice638d7b66f673db4c9200bf5d2299aa1ab79c21
ontactsDatabaseHelper.java
31168f49a3da9b9a9d5346f3d6a8098b76179c9c 06-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing contact lookup by company name and title

Bug: 1360100
Change-Id: Ic897ee1cb9e1c11c858b85b4c0c1d364fabccaad
ontactsDatabaseHelper.java
ontactsProvider2.java
bc4f473094597b9c40c7c99ea8c9fdf74187eca8 02-Feb-2010 Dmitri Plotnikov <dplotnikov@google.com> Fixing ClassCastException in contact search.

Bug: 2410640
Change-Id: I1c07f24381da292478dd013d1e4536dbf45d65a0
lobalSearchSupport.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.
ontactLocaleUtils.java
ontactsDatabaseHelper.java
ontactsProvider2.java
ameSplitter.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
ontactsDatabaseHelper.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.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
ontactsDatabaseHelper.java
d698a841901cd1c42cbe1bfa8fff3cdee5f19a7b 14-Jan-2010 Vasu Nori <vnori@google.com> Merge "don't set max cachesize anylonger. it is managed by SQLiteDatabase."
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.
ontactsDatabaseHelper.java
5b6f7fbb003a085088b2ae4e61b07774d61f8565 13-Jan-2010 Daisuke Miyakawa <dmiyakawa@google.com> Make PostalSplitter support Japanese name-splitting algorithm and add unit tests for them.
This change is originally from Change I8f7aaf13.

Bug: 2275764
ostalSplitter.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
ontactsDatabaseHelper.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
ontactsDatabaseHelper.java
ba355248c255551bc65d8023b968513cbe9bcdf3 25-Dec-2009 Jeff Sharkey <jsharkey@android.com> Correctly report unknown vCard size for OpenableColumns.

Fixes http://b/2332466
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
e246689441b2ff39cb97de277d6caeec95358863 13-Nov-2009 Jeff Sharkey <jsharkey@android.com> Require both or neither ACCOUNT_NAME and _TYPE.

In places where Accounts are used, this change enforces that
both or neither of name and type are provided. It changes
behavior of resolveAccount() to throw instead of returning
boolean.

Fixes http://b/2258771
ontactsProvider2.java
88de448cde437853b7e2eebcc1c99d4e76f70a2d 22-Dec-2009 Tom Taylor <tomtaylor@google.com> am db69a883: am 28caf262: Update imports to android-common

Merge commit 'db69a88303ca121359321c3f8b965f0c98c13a12'

* commit 'db69a88303ca121359321c3f8b965f0c98c13a12':
Update imports to android-common
28caf262cf4f5724ff372a1d97f5130299e3a368 21-Dec-2009 Tom Taylor <tomtaylor@google.com> Update imports to android-common

Several files were moved to android-common. Update all the references
to import those files from the new location.
lobalSearchSupport.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ameSplitter.java
f5bda8d8994a50c60e5d39fb66990040b1bb5622 21-Dec-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change I502d43d5

* changes:
Fixing broken build
06e4b0e38617b9b16ef1caf67efd75563c79dff8 21-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken build

Change-Id: I502d43d55f91ef2d6513cdcc377cd8aa31fbc1f8
ontactAggregator.java
bca1c8b44f99528fc123d5547723e44771e8e934 21-Dec-2009 Mike Lockwood <lockwood@android.com> Revert "Merge change Ief95261a"

This reverts commit 003009d47e893df100d4020c708296b23c03d28f, reversing
changes made to 5b3b3ec368625c07a2c94d2199a75099d4d9b8a9.
ontactsDatabaseHelper.java
ontactsProvider2.java
ameSplitter.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
ontactsDatabaseHelper.java
ontactsProvider2.java
ameSplitter.java
635a11c53a532d9b5aba5fd7c51a8d47dcb0aaf2 16-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding Name Splitter functionality that works for CJK names.

- automatic recognition of name language

- the "last name first" full name notation

- automatic recognition of phonetic name alphabet

- handling of the "Last, First Middle" format

- now including middle name and suffix in the full name, e.g. "John K. Smith, Jr."

- preserving dot after the suffix

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

This CL was reviewed as change Id2f042a8 on the eclair-mr2 branch (abandoned).

Change-Id: I9e63c70a0aa815319bcb28cc6b753acdcf850245
ameSplitter.java
038a60f1920d798bc391a376e81980921a75cc34 11-Dec-2009 Fred Quintana <fredq@google.com> moved the hidden sync helpers out of the framework
removed the old ContactsProvider
ontactsProvider.java
6e38acbd1e72c62a6f8917297aed97e35c0c4697 11-Dec-2009 Vasu Nori <vnori@google.com> Update times_contacted manually since triggers to do that are gone.

This is fallout from CL # 35440. this change seems to effect only the unittests
ontactsProvider2.java
egacyApiSupport.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.
ontactsDatabaseHelper.java
ontactsProvider2.java
62318e1ea8306142a10526534b7d83560ecf5b3a 07-Dec-2009 Fred Quintana <fredq@google.com> changed to use the new EntityIterator interface
ontactsProvider2.java
31ee50d0d9618117b7f09d2720e6e0e05ca8fce2 03-Dec-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change I5f14b939 into eclair-mr2

* changes:
Getting rid of some dead code
4a318ba1f6aff725e99b4a141fd4c3dc8a112b7a 03-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Getting rid of some dead code

Change-Id: I5f14b939976d4385a2410e8b01ed05bdba271e1c
ontactsDatabaseHelper.java
7318f9e11bdac5ea1ff5e6a8143b90c4e5c497f6 03-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> Removing unnecessary limit on name lookups in global search support for contacts

Having a limit on the number of name lookups was a bad idea
to begin with: you may be looking for one visible contact and
name lookup would yield 500 matches of which 499 are invisible,
so you would consistenly miss the one contact you were looking
for.

I have confirmed that removing this limit does not affect
the performance of the query too severely. With a set of 5000
contacts all starting with the letter "D" I still got the
one contact I was looking for in less than a second on Sholes.


See bug http://b/2298674

Change-Id: Id4219dea1be2f9ac885ef5ddda5e8376c3e050ee
ontactsProvider2.java
lobalSearchSupport.java
1b6c85b96f5cccae94d8bad6ea727accacfb7a0f 02-Dec-2009 Dmitri Plotnikov <dplotnikov@google.com> DO NOT MERGE cherry-pick of CL I0ff20aa2 from eclair-mr2

Optimizing the email filter query.

In order to make the query perform, I had
to break out two separate nested queries:
one for the email lookup and one for name lookup,
and build the UNION of found _ids before
retrieving suggestions from the Data table.

Performance of the query is improved by orders of
magnitude.

All tests pass.

Bug: http://b/2286776
Change-Id: I61707fe263cbe58a0e96e83d6b291a869fceba78
ontactsProvider2.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
egacyContactImporter.java
ocialProvider.java
f2a293b58b3b19a1b3f93ca2e34f596c7cdea4dd 30-Nov-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change I7f61664c into eclair-mr2

* changes:
change BEFORE triggers to AFTER triggers - to make them work with sqlite 3.6.20 & beyond
07ce1624de652aa8494630a071b051a1670c4e3d 26-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Optimizing the email filter query.

In order to make the query perform, I had
to break out two separate nested queries:
one for the email lookup and one for name lookup,
and build the UNION of found _ids before
retrieving suggestions from the Data table.

Performance of the query is improved by orders of
magnitude.

All tests pass.

Bug: http://b/2286776

Change-Id: I0ff20aa2bd3bcfc765831390a36274c01e0e16e3
ontactsProvider2.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
ontactsDatabaseHelper.java
62cb40bb634b00ab9d8f22b18afed4c44413e9eb 26-Nov-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change Icaed50ed into eclair-mr2

* changes:
Optimizing global search for contacts.
9e7bf1b00c1bac90510cef7776224e0fd3d8908a 21-Nov-2009 Vasu Nori <vnori@google.com> Setup ContactsProvider with compiled-sql statement cache.
ontactsDatabaseHelper.java
dc947a9d03279eab0fb7c3b9d8ffbb492c1e2062 25-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Optimizing global search for contacts.

Enabling some indexes, disabling some other indexes creates
the effect of a nice optimizations.

Bug: http://b/2139526
Change-Id: Icaed50ed35310d104dbba338daf757395b3792d1
ontactsProvider2.java
lobalSearchSupport.java
36ae696fec100780667ed2770faeac7a031aef99 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Limiting number of ContentProviderOperations per yield point.

This helps prevent an ANR caused by a rogue sync adapter

Bug: http://b/2235205
Change-Id: Idd63dc530b7a15a08b2e4774bda012c1334304ee
QLiteContentProvider.java
6ddfaa70c41909595f1e738c54227ab4f6a8c3f9 06-Nov-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change Ia34f0ca9 into eclair-mr2

* changes:
Fixing database versioning broken for a brief time in CL 32247
71037c010a0b7c882284fc1ed8584a378d926b83 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing database versioning broken for a brief time in CL 32247

Change-Id: Ia34f0ca9dbc9ae25f7a817031cdf01b5ec6a109d
ontactsDatabaseHelper.java
04d535c37a0ea66f5cf2d95f9df7b5b96ef3a5f5 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> am ea029fd7: Making it possible to place and take calls in low storage situations.

Merge commit 'ea029fd79225640e49be82457b83b6b3a0279fd0' into eclair-mr2

* commit 'ea029fd79225640e49be82457b83b6b3a0279fd0':
Making it possible to place and take calls in low storage situations.
3410a80f4aafe5685da61c217808d2bf21d55dfc 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> resolved conflicts for merge of 1c8e40c1 to eclair-mr2

Change-Id: I5c8e9e76c79a5c70d214bc0b28360c41c07e7b85
ea029fd79225640e49be82457b83b6b3a0279fd0 06-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Making it possible to place and take calls in low storage situations.

Bug: http://b/2182531
Change-Id: I5c88a3024ff1c5a06b5756b29a2d903f8f6a2531
ontactsProvider2.java
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
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyApiSupport.java
047763296d2c98bd4121252486cc0df87b25bc31 05-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> am d810b894: Fixing breakage in Legacy Contacts API support uncovered in CTS tests.

Merge commit 'd810b894f0a677d7f6db0dfd9e2d7e4c9987e21c' into eclair-mr2

* commit 'd810b894f0a677d7f6db0dfd9e2d7e4c9987e21c':
Fixing breakage in Legacy Contacts API support uncovered in CTS tests.
d810b894f0a677d7f6db0dfd9e2d7e4c9987e21c 05-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing breakage in Legacy Contacts API support uncovered in CTS tests.

Bug: http://b/2136124

Change-Id: I4196ebaaa27899b5a0239f2d773d9a0dc3d832a2
egacyApiSupport.java
4da1b8ded4435a3392bac3511c67182015e0953f 05-Nov-2009 Dmitri Plotnikov <dplotnikov@google.com> Replacing argument concatenation with selection args arrays.

This takes advantage of the new SQLite caching mechanism introduced
in CL https://android-git.corp.google.com/g/#change,30704

Reduces the number of queries in SQLite cache
from 1200 to 200 for an 800-contact sync.

Change-Id: Id36664f2687b7612c2f38c760437b633b01bb467
ontactAggregator.java
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
b4e61e064b59e8076df81b061add9fb358fd2ed9 31-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> resolved conflicts for merge of 62715245 to eclair-mr2
627152453c692915ac79191acd1d2d2a4dd6fb0d 30-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Making the first account "adopt" contacts created on the phone before any accounts

Bug: http://b/2222360
Change-Id: If55205305e0673ab3e22f8da5086a772f9990c22
ontactsProvider2.java
98ebd4d5faab51d5f1dd7aaa1613004dddb65774 30-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> am e0f854c1: Allowing on-the-phone only contacts to be seen through legacy compatibility APIs.

Merge commit 'e0f854c10f7a3aeebc9a7be9fb2bb101d70c01e4' into eclair-mr2

* commit 'e0f854c10f7a3aeebc9a7be9fb2bb101d70c01e4':
Allowing on-the-phone only contacts to be seen through legacy compatibility APIs.
e0f854c10f7a3aeebc9a7be9fb2bb101d70c01e4 30-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Allowing on-the-phone only contacts to be seen through legacy compatibility APIs.

Bug http://b/2226458

Change-Id: Ib02f4e31b5127bcb5943f0d115c61973167b3e9a
egacyApiSupport.java
f7f747a00f4fa7a9e564507693419a5a8db0eb8f 23-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2 optimization: two hot spots: parsing query parameters and allocation of Account objects

Stats:
Baseline: 830 yield points, 72 ms per yp, objects: 964 per yp
Optimized: 830 yield points, 72 ms per yp, objects: 772 per yp

Change-Id: I467ba6de114bb73bd0725c3c1fb534db0c1425d1
ontactsProvider2.java
1129311abb3db9bf6eb5731da054276164e0b8d1 22-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2 optimization: end-of-tx contact insert - switching to compiled statements and reusing buffers.

Stats:
Baseline: 889 yield points, 75 ms per yp, objects: 1047 per yp
Optimized: 889 yield points, 72 ms per yp, objects: 964 per yp

Bug: http://b/2208650

Change-Id: Iec3596a18e5a0cc614a16a9aab016a02ad4e55e6
ontactAggregator.java
ontactsProvider2.java
d076a108d58b30591f197e1b90fa8de60999c499 23-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Removing contact aggregation scheduler. The aggregation is no longer running in a separate thread.
ontactAggregationScheduler.java
ontactAggregator.java
ontactsProvider2.java
a48ddb6e3a888c72765bf83a5705c544995f5340 22-Oct-2009 Evan Millar <emillar@google.com> am 5e28b3a5: Fix favorite ordering bug (http://b/issue?id=2197247)

Merge commit '5e28b3a5e44bf4f2c0980c50a2ab35350fc5f230' into eclair-mr2

* commit '5e28b3a5e44bf4f2c0980c50a2ab35350fc5f230':
Fix favorite ordering bug (http://b/issue?id=2197247)
5e28b3a5e44bf4f2c0980c50a2ab35350fc5f230 21-Oct-2009 Evan Millar <emillar@google.com> Fix favorite ordering bug (http://b/issue?id=2197247)
ontactsProvider2.java
19fdfba1ea717362c05ed9ee5655829c0cf42d6b 22-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> am bf000932: Fixing the handling of Contact Join Suggestions URI.

Merge commit 'bf00093267bb0d455e736dd2f1dea7236649c7cd' into eclair-mr2

* commit 'bf00093267bb0d455e736dd2f1dea7236649c7cd':
Fixing the handling of Contact Join Suggestions URI.
a8d8b1cb48a6e94645dbce836193b40c7481356c 16-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2 optimization: accumulating setDirty(true) per transaction

Also reducing allocation of StringBuilders.

Stats:

Baseline:
877 yield points, 97 ms per yp, objects: 1265 per yp

Optimized:
877 yield points, 89 ms per yp, objects: 1256 per yp

Bug: http://b/2148608

Change-Id: Ic3fd7d8fe5c8174a158266d56b8cbf008a073db1
ontactAggregator.java
ontactsProvider2.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
ontactAggregator.java
ontactsDatabaseHelper.java
ontactsProvider2.java
egacyContactImporter.java
08e42c9c153a60bf2e7c71dd40bf84bb5fc93555 20-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken build

Change-Id: I4dbc7db9bff950779a4f6ef5a28de4d79d1c479a
ontactsProvider2.java
ab91a8babdbda516d4e5088fedf3fdebf9cf88ad 20-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Optimizing ContactsProvide2: reducing the number of group lookups during contact insert.

The "get version" query is coming from the sync adapter. The other two group-related
queries are being eliminated by this CL.

Bug: http://b/2198859
Change-Id: Ie385aabf965d32d29696aacd56548ebb15ff3a0e
ontactsProvider2.java
d0f63551e3147babcebde5326b31285d7bdf6739 20-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Optimizing ContactsProvide2: reducing the number of "data" queries during contact insert.

Stats:
Baseline: 851 yield points, 97 ms per yp, objects: 1265 per yp
Optimized: 851 yield points, 79 ms per yp, objects: 1132 per yp

Bug: http://b/2198728

Change-Id: I6bc4b59f391ec653db7bd6ceb3e6332b3b2cf928
ontactAggregator.java
ontactsProvider2.java
3684089aba82df3f7a0c111e7c96ed8b0380e57a 19-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2 optimization: Performing name and email lookup entirely in the database

Instead of loading name lookup rows into memory and constructing a query to
find matches, do the whole thing with a single query.

Stats:
Baseline: 880 yield points, 97 ms per yp, objects: 1265 per yp
Optimized: 880 yield points, 88 ms per yp, objects: 1196 per yp

Bugs: http://b/2148604, http://b/2148605

Change-Id: I444e5739e555bb7a6fdd144ac7a5f37930bffed0
ontactAggregator.java
ontactsProvider2.java
315dd702d006aedf2f867d3fe49e31e05e4f9a16 15-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2 optimization: using a Bloom filter for lookup of known nicknames

This saved just under one query per name or 2.35 queries per contact
on the test dataset.

Stats:

Baseline:
877 yield points, 97 ms per yp, objects: 1265 per yp

Optimized:
877 yield points, 86 ms per yp, objects: 1245 per yp

Bug: http://b/2148639

Change-Id: I139252ef153ae13cee0f16c4bce6beedbf319945
ontactsProvider2.java
3389f7c7df6c90e48fcb0c27832bc322e5b20bf6 15-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2 optimization: caching raw contact IDs involved in aggregation exceptions

This saves one query per contact.

Number or object per contact (~1700) and time per contact (~125ms on Sholes)
does not seem to be significantly affected by this optimization.
Should probably submit this anyway and see its effect on really
large accounts (e.g. 5000 contacts)

Bug: http://b/2148645

Change-Id: I57457201017463e519ed55dddda75a0d802f0d9a
ontactAggregator.java
ontactsProvider2.java
bf00093267bb0d455e736dd2f1dea7236649c7cd 21-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing the handling of Contact Join Suggestions URI.

Bug description:
If the join suggestions URI came from a source without restricted data
access and the suggestions included a restricted contact, we would get
an exception from ReorderingCursorWrapper, basically saying: I expected
N suggestions, but I only got N-K (where K is the number of restricted
suggestions).

The fix makes sure the restricted suggestions are excluded early enough
to keep the reordering cursor wrapper happy.

Bug: http://b/2179486
Change-Id: I5d1268e063cdd7b15d74aff0c8556d4614eddfdb
ontactAggregator.java
9705f5bcb04c4b3012a762fb3ba8620b518587cc 13-Oct-2009 Vasu Nori <vnori@google.com> add support to update/delete data in status_updates table. update tests.
ontactsProvider2.java
47ab23770b9f010a5e5277cda68267fe0613a1cc 13-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2185274] Optimizing queries used by Google Voice

Change-Id: If9a8aee57f3d344f98ddc1462c34113b2194241f
ontactsDatabaseHelper.java
egacyApiSupport.java
27f039b535f98c1cb1a31207047003235ddaed15 13-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2183891] Plugging a security hole in ContactsProvider2: callers will not be able to unrestrict RawContacts

Change-Id: I9e43f77e8dfee886695377602ddface2fe03c200
ontactsProvider2.java
fda634f3eeff6aed8e8dddca92fc07aa44befedd 13-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2183494] Deleting status updates when a contacts account is removed

Change-Id: Ia9e86786ed11b3fca60b274edc6495b77838bc46
ontactsDatabaseHelper.java
c03e723e7b07434a3e60454606bc18e2df4ee06b 09-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2168777] Favoring visible contacts on insert of presence/status updates.

Change-Id: If581fb64017ca4dc74c5c3f1805fa96f722fa6cd
ontactsProvider2.java
6581e1d13b9f310c2d7def2d2645f25158814107 09-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2176922] Raising aggregation suggestion threshold for email addresses from 0.82 to 0.95

This still does not require an exact match, but the difference should not exceed one or two characters.

Also, fixing the LegacyContactImporterTest (only the way test result is asserted is changing - not the test or the tested code)

Change-Id: I8d8e27f65a2e6ecaf73d50ded08b823090b31f02
ontactMatcher.java
732961a5b936d316482f9ded6bfc5fe1c99a65c8 08-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2163519] Making ContactsProvider2 honor the super-primary flag on a photo

Change-Id: I92d49bcd95922d0393eee48fc9f81f8e288247f6
ontactAggregator.java
67c9ed1cefa5c084d3f373d7f1ecb7122983ff15 07-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2171774] Fixing the fixStructuredNameComponents() method

This is effectively a revert of change dd0e0f44fe403ff201d46d5534f7f1148e5ad729
followed by a proper fix for:
[Issue 2160728] Fixing full name update when parts of structured name are deleted

Change-Id: I96e990820938ee79a87411eb926d774c951fa768
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.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
ontactsDatabaseHelper.java
ontactsProvider2.java
e2a3fb8c60d68aaef5f20587e5c9cb3f6f3ffa22 06-Oct-2009 Megha Joshi <mjoshi@google.com> Fix lookup query throwing exception for null displayNames.

Bug: 2133257
Dr No: TS
ontactLookupKey.java
dd0e0f44fe403ff201d46d5534f7f1148e5ad729 05-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2160728] Fixing full name update when parts of structured name are deleted

Change-Id: I3a206a4cfb09be590bf96476d128791129263742
ontactsProvider2.java
f8b937f62fb80445bf59b2e504d765bcab746557 05-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2157431] Optimizing the Status Update insert into the contacts database.

Actually the part that is being optimized is the lookup of the data row to link the new status update to.

Change-Id: I883cc8969ed47a2c1832f65d4a8b1973d1c64d35
ontactsProvider2.java
5b4b305b9698526c6e82e0e01448b0a5642dd505 03-Oct-2009 Fred Quintana <fredq@google.com> account manager api review changes
ontactsProvider2.java
14b8a1243ab5c043b35e47527ca1c962064f3771 02-Oct-2009 Daisuke Miyakawa <dmiyakawa@google.com> Change selection argument so that it complies with the current view
given from ContactsProvider2.

Root cause: VCardComposer changed the table to look over, from
RawContacts to Contacts, which is with valid ratinale
(Contacts shows aggregated view, while RawContacts does not).

Unfortunately, the change made ContactsProvider2 corrupted, which has
assumed the table VCardComposer is looking at is RawContacts.

Now, after discussing with Contacts team, this change is concluded to
"correct" change.

I changed from RawContacts._ID to Contacts._ID after jsharkey's approval,
but the actual string is the same "_id", so the essential is the same.
The difference is that readers would not be confused with seeing "RawContacts"
in the wrong context.

Internal issue id: 2162658
ontactsProvider2.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
ontactsDatabaseHelper.java
6ce24dc1d53f1ed2760a06cd60c705ebdf666f43 01-Oct-2009 Megha Joshi <mjoshi@google.com> Force sync to happen if Groups.SHOULD_SYNC is set.

Bug # 2093578
Dr. NO: TS
ontactsProvider2.java
3296d3469bce0041a6cefc44d0486a2a7d0c9f82 30-Sep-2009 Jeff Sharkey <jsharkey@android.com> Offer separate social projection when requesting data rows.

Part of fixing http://b/2126683
ontactsDatabaseHelper.java
ontactsProvider2.java
20938cd6df602bf08c232b32fc047592c1561347 01-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2159148] Restricting email filtering to not show other email for the suggested person

Change-Id: Ic1692de29912f8875e09ed392d48c48558c3b307
ontactsProvider2.java
0f5116227592cb8e724542c598daffa383964679 01-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> Making contacts provider tests run again

Change-Id: Ie85b0dd312368bf04e2343471265c51437dea6f1
ontactsDatabaseHelper.java
c9bcbd7f788d71c14076d1c2fb8e8d4ad359a261 01-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2139526] Prioritizing phone number over email address in contacts search suggestions

Change-Id: I3799b81fde799b18c4e431f1662f1f5d47fe0308
lobalSearchSupport.java
21736ffd1e795edd6ea64955bafbd245dc8ba355 01-Oct-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change If80d9ab9 into eclair

* changes:
use Events for birthdays
f80d9ab92d69e579edce069406f2c1b3280e58d3 01-Oct-2009 Fred Quintana <fredq@google.com> use Events for birthdays
ontactsDatabaseHelper.java
4e8ced99f8bbb01abd610a6ca60afcabb6ffe737 01-Oct-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2156901] Fixing update of the "starred" flag on raw contacts

Change-Id: I737a6e1a428edaa16c108bbbf5d4a461035560d4
ontactAggregator.java
d91272b48f97243533c6580981e12a4847b5783f 30-Sep-2009 Jeff Hamilton <jham@android.com> Read the unrestricted pacakages list from XML.

Change-Id: I9af814b8bb1b95051a0371d1e3d3769c052ffd95
ontactsDatabaseHelper.java
ontactsProvider2.java
339603c831c0f0440312c40bee7008bef93dac95 30-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2147424] Making sure that a contact can be filtered/looked up by any word in the name

Which is not to say that it can be aggregated on any word in the name - that limit is still 4.

Change-Id: I61821af3d8103e3ec58b42df10f96171667c5eca
ameLookupBuilder.java
3b2770e909f82c90218aee49d6f9f107aa4b7feb 30-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2084032] Adding support for non-public legacy contacts uri "groups/system_id/*/members"

Change-Id: I20a3dc40c24200fb39d01c71ea52bc7ab844c9a2
egacyApiSupport.java
e06751fce696a31fcba173821dbe78b08bae20be 30-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2084032] Adding support for legacy contacts uris "people/#/organizations" and "people/#/organizations/#"

Change-Id: I4336d5099492eeee27d128f92d93299c0da7cdd0
egacyApiSupport.java
c76cdd0723b99f478c9ba5329d14a971cd8dfb3d 30-Sep-2009 Costin Manolache <costin@google.com> Remove GAIA string
ontactsProvider.java
ontactsProvider2.java
egacyContactImporter.java
c10787a94ab8d0163480b6f33bd4367d142164d4 30-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2155084] Favoring first name, not last name, in contact name splitter

Change-Id: I599963b2be83824a3a446655db1eb7cee5ec5b40
ameSplitter.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
ontactsDatabaseHelper.java
ontactsProvider2.java
b38ed2c5ffeb20efc677b4a9229db4a00603aa8d 29-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Renaming OpenHelper to ContactsDatabaseHelper

Change-Id: Iccdf1ebcd8a3ab430941c957f712bb9e7dd2706c
allLogProvider.java
ontactAggregator.java
ontactMatcher.java
ontactsDatabaseHelper.java
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
egacyContactImporter.java
ameLookupBuilder.java
penHelper.java
QLiteContentProvider.java
ocialProvider.java
bae94ada3546ed32182f50303a733752d5ef7178 29-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2153617] Increasing contact aggregation suggestion cap and constraining lookup types.

Change-Id: I27664191830865e300ba3f943f1067c8e48c4be7
ontactAggregator.java
6a809c1d28c1ba36203d9e54709a08667478d9d7 29-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Updating contacts DB version

Change-Id: I345efe03c6d9da8f9c3f9adea1731934ad5c23d2
penHelper.java
f9aeb84d61c01a473819e9173f8311ca5d678a8d 28-Sep-2009 Jeff Sharkey <jsharkey@android.com> Use separate API for vCards through openAssetFile().

This change fixes http://b/2138790 by providing a separate
Uri when providing vCard-formatted Contacts.
ontactsProvider2.java
penHelper.java
0a185cdcb65d1beb2a295fffbe2ae11a6a2c097f 28-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding support to ContactsProvider2 for status update attribution

Change-Id: Ib98a5fc203a9ce5efb4707b9ce015bd497b8ef10
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
ba965ceeb86dd9404d43f418daae357bc4afbdcd 29-Sep-2009 Jeff Hamilton <jham@android.com> Fix handling of times_contacted.

Change-Id: I1fc10736cf4848acdba657fdefabf00a711fd56b
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
d237c80845d8e13164d34278d3c20e31f8d80b4d 28-Sep-2009 Daisuke Miyakawa <dmiyakawa@google.com> Make ContactsProvider2 check FOR_EXPORT_ONLY query parameter and restrict
data access even when the application has appropriate priviledge.

This feature is required by vCard exporter/composer, which has to remove
un-exportable data from available ones, but the current provider does not
make such kind of flag ("is_restricted") public.
ontactsProvider2.java
penHelper.java
0cc388933e698760d4985a7d7be1325f9c8305e9 28-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing legacy contacts API support after the latest change in the status update APIs.

Change-Id: I0d9bb5bdc3217cfdd70131cd7aa361f5db9ad1a5
egacyApiSupport.java
82bd858c9911dfbd8dca52dc276333768b0a429e 28-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding columns to support attribution of status updates. Also renaming some columns to better describe their purpose.

Change-Id: I2018079e540dedb2be1b61671742bbe99e92619c
ontactAggregator.java
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
penHelper.java
737858a04a157a0afad9ec81372c75d14bf68788 28-Sep-2009 Jeff Hamilton <jham@android.com> Tweak an index so the contacts list can take advantage of it.

Change-Id: I3b3c510182c9cbe5918dc30916e40da4db3303aa
penHelper.java
19cf97e1f8a569ad782756183419b7ba45ce15a0 24-Sep-2009 Tadashi G. Takaoka <takaoka@google.com> Added undo delete handling in update.

Internal Bug: 2138733
ontactsProvider2.java
1a21fa6383449df4bf0d46138a23aa02dfa235a0 26-Sep-2009 Jeff Sharkey <jsharkey@android.com> Replace delayed query parameters with transaction flags.

Callers should instead use applyBatch(), which now delays
any visible updates until the transation finishes. This
partially fixes http://b/2075275

This change also fixes a bug where aggregated visibility
wasn't being updated correctly. Wrote new unit tests to
verify correct behavior.
ontactsProvider2.java
penHelper.java
d4b57da3f07bc530db69015d363c61a768a4713a 26-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2148075] Legacy contacts API: Adding missing columns to the groupmembership projection map

Change-Id: I08c7f9d0ac67c237d5d59ecad066cc1922786ecb
egacyApiSupport.java
71e051c79a57af70ec7b095074c3e7faf9507b52 26-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2148072] Adding support for non-public legacy API content://contacts/groups/name/*/members

Change-Id: Ia5128b55bb393fde186e95da086c32508374c035
ontactsProvider2.java
egacyApiSupport.java
dea2b6389abf1ae0448ae047b4b0a9e423381d77 25-Sep-2009 Jeff Hamilton <jham@android.com> When a Presence.DATA_ID is provided explicitly associate the presence with the provided data row.

Change-Id: I2e9b2125093ce948e46c667430a0e543c6c5c2f2
ontactsProvider2.java
d60cf9ba1d039f1a22375f56c18356e0d4f8ca14 25-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> As we are now searching for contacts by organization, adding support for search by email as well.

Change-Id: I0856f5a6391bc7f11f8e7063e0bb2cc908ce5348
ontactsProvider2.java
a3bd0246ca3741877488bca7aadd91c79b2fd8d2 25-Sep-2009 Fred Quintana <fredq@google.com> request a sync when the database is created
penHelper.java
bba785deb78d0c75e83492dc8aa9e2ff6165b227 25-Sep-2009 Fred Quintana <fredq@google.com> rename misc to birthday
penHelper.java
8fddc066662d58e8d6a436decb8dafbf28ce652e 24-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2138752] Improving performance of sync and contacts UI by fixing stats in the sqlite3.db

The main problem was that an index name was only updated in one place by my
CL https://android-git.corp.google.com/g/#change,26082
penHelper.java
a23cd5b6f478f6c9dda54173e84bd0098b9f3364 24-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Storing social status updates in a persistent table.

Change-Id: Ic6be86385a4e456ae164499aeec40900294fb118
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
7d9fdcf8346f789436148eff1f00e8f49b370ef0 21-Sep-2009 Neel Parekh <neel@google.com> Allow updating via raw_contacts/#/data
ontactsProvider2.java
5aec18c7ba70a011ffff949cfa3faaffce0a79c7 24-Sep-2009 Jeff Sharkey <jsharkey@android.com> Offer to delay visibility updates until caller forces.

We now watch for query parameters on insert, update, and
delete for Settings and Groups, which we use to delay
updating of IN_VISIBLE_GROUP at the callers request, which
is going to be used to help avoid ANRs. Also wrote unit
test to verify it works. Part of fixing http://b/2075275
ontactsProvider2.java
5ac5c70d1165309302ebcc931f51723e37d31e0b 18-Sep-2009 Jeff Sharkey <jsharkey@android.com> Limit to account when updating RawContacts.

Fixes http://b/2102133
ontactsProvider2.java
bffeabdf3dcf58f963ad1bb4d3e6e51f3ac16cfd 23-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2110703] Using triggers to update aggregate contact presence status

Change-Id: Ib1f55ddb926ebafd43c7776cad1db10217fc1bfc
ontactAggregator.java
ontactsProvider2.java
penHelper.java
a5d05d90333a70d471d78e82caeb5cfa2e4d4c59 21-Sep-2009 Tadashi G. Takaoka <takaoka@google.com> ContactProvider: Make nickname, company and title searchable.

If contact entry doesn't have a name, then nickname, company and title
are used as display name in order of preference.

Internal Bug: 1360100
ontactsProvider2.java
penHelper.java
70c314fb9b2ef3d47340b93816d46200aba9f5ec 23-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2133126] Fixing presence update/insert to do a proper replace.

Change-Id: I4211484b516cfbc5278dc2116fb97ab0daf817f1
ontactsProvider2.java
23c48e7953e2f854eeef6d8e3d3c1b901fc571ed 22-Sep-2009 Fred Quintana <fredq@google.com> fix entity query when querying by id
ontactsProvider2.java
2d89933b87a15ae5ed5d6b6ec4220ac085695ada 22-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2097207] Adding support for filtering of contact aggregation suggestions

Change-Id: Iabfe6758d4d916bddd88cbc47a133e5bdfd1d722
ontactAggregator.java
ontactMatcher.java
ontactsProvider2.java
c91ffc49403818f280c382f01bbfd5cd9a9bca6b 22-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing OOM exception in ContactsProvider2 caused by names that look like this: "A B C D E F G H I"

Since we are computing all possible permutation of names, a name with 10 words would
cause us to create 7,257,600 rows in the name_lookup table.

Limiting that to just 4 words, 48 rows max. Choosing the 4 longest words to
improve reliability of matching.

Change-Id: I83b1424cc14a291d8d8b615a356d6ec4f9e00aad
ameLookupBuilder.java
0be993f8ef0078b9825a5ffe6add08a6786d8dac 21-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2133143] Updating contact visibility as group membership changes

Change-Id: I289bb688958c04f2dd6e89cd0096ece9ed279257
ontactsProvider2.java
f23764675b35b5262a39c79aad8e9842460274b2 21-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> No longer relying on the components of structured name for aggregation.

Now parsing display name into tokens and allowing permutations of those.

Bug IDs: 2132657, 2132636, 2089893

Change-Id: Idea256bbec3b82fb229199c6bd6e9d7b145ab075
ontactAggregator.java
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
egacyContactImporter.java
ameLookupBuilder.java
ameNormalizer.java
ameSplitter.java
penHelper.java
d15a13a9b1dfe59dcf7196c6d5d55afe7f25d2a2 20-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 25940 into eclair

* changes:
Use strict phone number comparation algorithm if the config tells the package to do so.
3a6a49cfb06272e3e25f3c390a9cf4002da6e34d 20-Sep-2009 Daisuke Miyakawa <dmiyakawa@google.com> Use strict phone number comparation algorithm if the config tells the package to do so.

This change must come after the change 25941.

Internal issue id: 1892808
allLogProvider.java
ontactsProvider.java
penHelper.java
48828f54daafda2edb122258c4c6a7d2ca704128 19-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding support for contacts/data/phones/#, contacts/data/emails/# and contacts/data/postals/#

Change-Id: I6f22e419d29b08b9d9e136d700cc4bd8f35a2397
ontactsProvider2.java
9b43551f1ce33b79141772737a262ce609bd0ceb 18-Sep-2009 Megha Joshi <mjoshi@google.com> Changes sortorder for LIST_STEQUENT.

Fixes bug 1401384.
ontactsProvider2.java
abeef28436a5c93cc0f227df389a295919529bcc 18-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 25781 into eclair

* changes:
[Issue 2084032] Adding support for remaining legacy contacts API update and delete calls.
47065b759d2b23c2bd87bdbbc10ad3ad086008fc 18-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken legacy contact importer test

Change-Id: I62458a2db6dfda823e72c35522339b96cd96926c
egacyContactImporter.java
044685c79fb8fb6e15479d0e68d60f8630f6be43 18-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2084032] Adding support for remaining legacy contacts API update and delete calls.

Change-Id: I9fe1d40683e7df7da93c2df80cd7d1d61c53c059
egacyApiSupport.java
ee56e80dcab0ca58f81dc5318db8d0c453d75903 18-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2123926] Adding support for some non-public legacy contact APIs

Change-Id: Ia9644088561939b39fc20343a522fc0a1be53df4
egacyApiSupport.java
penHelper.java
3de6754a90e3682f2f52b99621d0fded060b99ae 18-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Making contact name filtering more restrictive: ignoring name variants and email-based nicknames.

I discovered this issue while trying to reproduce http://b/2123390
I typed "h" and saw Erica among the filtered contacts. The reason is that the nickname cluster
id for Erica matched the hex representation of letter h. The fix is to be more specific about
what types of name lookup we are interested in.

Change-Id: If367424052ee8e93757c98ce1dbb435522d8ba2e
ontactsProvider2.java
8f1631f8a610e7278526916ce73ac1e422a5c9b8 18-Sep-2009 Jeff Sharkey <jsharkey@android.com> Add LOOKUP_KEY to distinct data projection.
ontactsProvider2.java
48e6471eca7b9204fa09a70216cba26038245076 18-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 25673 into eclair

* changes:
fix some places where we did not clean all data for removed accounts
5f9e610be459bd1332e182c41cf7510265d5f7cc 18-Sep-2009 Fred Quintana <fredq@google.com> fix some places where we did not clean all data for removed accounts
ontactsProvider2.java
f2f14a3dfb4b53a056e000c0aa17fbae13bd445e 18-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing database upgrade logic for upgrade 87->90

Change-Id: I40082b85162deab0bc701c916049ae4d53141165
penHelper.java
1ea29714ef8fdd62b71f265f27391c22f4a50340 17-Sep-2009 Fred Quintana <fredq@google.com> clear the aggregation state at transaction start time
ontactAggregator.java
ontactsProvider2.java
fc4e892529eccdfa42121f0304ec7d0dbb42d6c9 17-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken build

Change-Id: I649e79ebf19ccfcc3e4e8969e0fb0268e57ec45c
ontactsProvider2.java
0e8520cf7f15576ce4d66202203770086fd26a71 15-Sep-2009 Ken Shirriff <kens@google.com> Add system property to control contact aggregation.

Boolean property sync.contacts.aggregate will enable or disable contact
aggragation.
ontactsProvider2.java
43880c9228332d0ea1426341fcf712d302b2c55b 17-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Waking up sync adapters when sync settings change.

Change-Id: I115ea79816808628da3e36dd9d04e06f07aef60d
ontactsProvider2.java
bae1149721f27eae3afa1e7da775af47dfb0e066 17-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 25506 into eclair

* changes:
[Issue 2123481] Adding notifications to CallLogProvider
89c626eb655440c86a2e5df076e83708c1b32c17 17-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2125440] Checking account query parameters for all relevant queries

Change-Id: Idf0deeacb556b79ef94774a2cb65b7415b1dea5d
ontactsProvider2.java
penHelper.java
6f157d1cfb219f80d375c1357bfbdc5bf599d91a 17-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2123481] Adding notifications to CallLogProvider

Change-Id: Ie459eba74349b264fb5379079078e7a005f5ec71
allLogProvider.java
a4090f6698f92f07408a89cac54401226dac9d5b 17-Sep-2009 Michael Chan <mchan@android.com> Fix build breakage. Remove junk from file.
penHelper.java
2b6b4cdd4e715029f3e8d9e78a6a24abd5b78ba2 17-Sep-2009 Fred Quintana <fredq@google.com> change the contact_entities_view to join to the raw_contacts table
to allow it to return a row for raw_contacts that have no data and to
use the raw_contacts indicies when querying
penHelper.java
1b03c2d019966fba89dad3678dd9f04e4e5f4802 17-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2112473] Speeding up aggregation by changing LEFT OUTER JOIN to JOIN and adding LIMIT to some queries

Amazingly, these minor changes dramatically improve some frequently used
query plans and prevent odd data sets with lots of matches from having too much
of a negative affect on performance.

Change-Id: I13b3e0df0f1d4f37c04f60907ff201797096d0e3
ontactAggregator.java
penHelper.java
bb89f2bba743012377739f2e0b3977ae26b2d3bf 17-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 25437 into eclair

* changes:
Fixing breakage of legacy contacts API support broken by an earlier CL
dee54bb86f3608730f0b9f37d8982a7f6b280a85 17-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing breakage of legacy contacts API support broken by an earlier CL

The gist of the issue is that SQLiteDatabase supports one nested transaction, but only one.
The code was executing two nested transactions (not two levels of nesting, just two sequential
transactions) and that was causing the outer transaction to roll back. We really should fix
this in SQLiteDatabase.

So the provider will now call the aggregator before, not after transaction commit, and
the aggregator will not open a nested transaction.

Change-Id: I9fa09d36ea43a62ba4f2fd5e5e1816cc439d225b
ontactAggregator.java
ontactsProvider2.java
dc0c2842c9502f40073d1b614389d70ec8cd8e68 17-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 25384 into eclair

* changes:
Make bulkInsert yield if contented, s.t. other processes can access the contacts db if needed. This is a temp. fix until we figure out what is going on with the bulkInsert of presence - i.e., why are they taking so long.
f60d509ce937754379029e7ab9deb44ccbb475d3 17-Sep-2009 Cynthia Wong <cynthiaw@google.com> Make bulkInsert yield if contented, s.t. other processes can access the contacts db if needed. This is a temp. fix until we figure out what is going on with the bulkInsert of presence - i.e., why are they taking so long.
QLiteContentProvider.java
1443b159afd6149659383ff5fd7b7958d6c077cc 17-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2112473] Speeding up aggregation by running it on the main thread

This is an experimental change. I don't want to rip all scheduling code out
until we have confirmed that this change is safe.

Change-Id: I38f1b19de1048c4287c99fd53d313d23b06dbdb8
ontactsProvider2.java
21ed031a016f57c573de154d4b204cca033feb9f 16-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 25200 into eclair

* changes:
[Issue 2112473] Another round of optimizations in Contact Aggregator.
e1b656d725445663e443679af3fbedb5f4db3996 16-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2112473] Another round of optimizations in Contact Aggregator.

Pushing per-contact aggregation performance to about 20 ms.

Change-Id: I2f734feede5b5b1e5a762dcf44a9516822a4ae53
ontactAggregator.java
ontactMatcher.java
341e4621f2ee7614c66bc25dd3da70eaaa866b46 16-Sep-2009 Jeff Sharkey <jsharkey@android.com> Add logic to expose new Settings.ANY_UNSYNCED flag.

Part of fixing http://b/2084771
ontactsProvider2.java
penHelper.java
56d2bd40ebb238c2990bc239f68c7e61c7d5b02c 15-Sep-2009 Evan Millar <emillar@google.com> Add lookup_key to 2 projection maps.

Change-Id: I98950f909601da6c32595fb3ed1c4f07b8943023
ontactsProvider2.java
f79538095a1af16dcd6e641448b627f60f197802 15-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2112473] Optimizing contact aggregation by enforcing use of indexes

Also reducing size of some indexes that don't have a performance effect.

Change-Id: I67572ffa9f5eaf8d3b1adb3d9c38722e1fcf73c5
penHelper.java
f6be85f72615168c836b05c03ab5fc80d4794a82 15-Sep-2009 Fred Quintana <fredq@google.com> change to use the new CALLER_IS_SYNCADAPTER flag
ontactsProvider2.java
bce6ee29f2d971ceae2bfce85a06bb3ecec6537a 14-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2084032] Adding support for legacy URI: contacts/contact_methods/email

Change-Id: I9c2c62952b7d24d4e87db8b2c7037f49674276aa
ontactsProvider2.java
egacyApiSupport.java
8c4f838f899daadb6f46f8c27ab7636023e39c38 12-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2: optimizing structured name update

Also implementing a (safe and correct) bulk update of Contacts.

Change-Id: I2bc1badccfbccf53a9630503e104d11bec0e6396
ontactsProvider2.java
67b73a3e6bc186aa83915275bde6eeeeea5e97cf 12-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2083923] Preventing contacts from crashing Google Voice

Change-Id: I50eb16bbc3fac20b402a45e31d9530740fdbaf58
egacyApiSupport.java
52aa678e4d221f37fda29d0621f864c6777e916b 12-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 24820 into eclair

* changes:
[Issue 2116081] Removing account's data from _sync_state when account is deleted
7f4257706ffa60244b704a64568813b229ee221d 12-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing contact name lookup delete (it was inserting instead of deleting)

Change-Id: I7d3c52e5d33b41db4f5a0280570df3e2c4ca6cbc
penHelper.java
4637c20c6b6d3b6f6671e6a44ed57f1e5b9c4484 12-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2116081] Removing account's data from _sync_state when account is deleted

Change-Id: Ib7139a2bfaf5ea039da88f0c209f230f14b41717
ontactsProvider2.java
81d6a78dffd57f24f9aaecb6cd54e4084c3c9846 11-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Reducing unnecessary triggering of sync adapters by ContactsProvider2

Change-Id: I280cd6d96a76e8df151ddb43b0f1b783501c4373
ontactAggregator.java
ontactsProvider2.java
QLiteContentProvider.java
cac7746068de91dc656f4e1f0e01e536eb16016b 12-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Removing unnecessary (and very harmful) aggregation trigger

Change-Id: Iadedbf3fc83f267984c94c2c1d2ae7dfe0dd91fd
ontactsProvider2.java
1e530df9f7e496dc47f77d4323c89bd413b79b64 11-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2111706] Fixing email filter, which was stopping after an "@"

Change-Id: I4b3a00cc79cc6cc3d1351b5a301a36f6a950d688
ontactsProvider2.java
2e990cc352353b2e4d83f1eeecff137b94b84266 11-Sep-2009 Jeff Sharkey <jsharkey@android.com> Handle lookup Uris for delete and update cases.

This helps support atomic operations, like delete and
starred from the UI. Fixes http://b/2102632
ontactsProvider2.java
51bf5ea9531b9da72caff607dbdf35fd6f61cbe2 11-Sep-2009 Jeff Sharkey <jsharkey@android.com> Correct to use RawContacts._ID instead of CONTACT_ID.
ontactsProvider2.java
7581213e160c460671aebdb054b8afd2f138d99e 10-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2112637] Adding support for Presence to the Aggregation Suggestions.

Change-Id: I40007a7a4fa5fa7eed4c3f98936200024cfcc2cd
ontactAggregator.java
ontactsProvider2.java
da165c972c51aa0dd1a39aa135ebc8bf0dad7580 10-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2112162] Fixing the issue causing incomplete contact aggregation passes.

Change-Id: I85999d87d1b0b420ed546205b3c225126fad7b8a
ontactAggregator.java
c1778ef6fa53b6bf08fd715b3ad70c052c5f1ce9 10-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2102836] Fixing the false positive aggregating on multiple secondary matches
ontactMatcher.java
ontactsProvider2.java
d173ca0f279d89030cc7e3f1aadd18755a2e8766 10-Sep-2009 Jeff Sharkey <jsharkey@android.com> Add support to open contacts as vCard asset files.

Similar to how photos are handled, when someone opens a
contact as an asset file, we build the details into a vCard
format and pass back as a MemoryFile.

Also slight refactoring and removal of deprecated API use.
ontactsProvider2.java
dea3ee5e7f84be2abfe35837a460cbe779d319db 10-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2097210] Fixing incorrect aggregate contact update when splitting a three-way joined contact
ontactAggregator.java
ontactsProvider2.java
cb144e1429596701603c016f4a078f6331e6481d 10-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2108974] Deletion of an aggregate contact will now be synched to the server.

Confirmed expected behavior with a unit test and a manual test.
ontactsProvider2.java
03b8c9da49c1b60d4a374b50cd079ad8aa81200b 10-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 24451 into eclair

* changes:
Fixing transactionality of contact aggregation by bailing after yielding the transaction
cf9b3dd2a81b86d17776580fcc9d7a1fd22b8841 10-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing transactionality of contact aggregation by bailing after yielding the transaction

Change-Id: Ia62c55a48b82689aecc7f6a8eee8d73cc2208f67
ontactAggregator.java
df9db5e99572ce9760eb265683134c1f3293928f 09-Sep-2009 Fred Quintana <fredq@google.com> clear mUpdatedSyncStates in clearTransactionalChanges()
ontactsProvider2.java
6bc46c9f22aaa9e68f344b171426fc686d3b536a 10-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing broken tests in ContactsProvider2
ontactAggregator.java
ontactsProvider2.java
4529f06d48c8ad3cc573a9b7b8f2f952b1e20dcd 09-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Addressing data security issues in ContactsProvider2
ontactAggregator.java
ontactsProvider2.java
ad8e419c780c57e8e7f5f5b6d064ba328ba4a695 09-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 24292 into eclair

* changes:
Making automatic contact aggregation even more conservative.
c100221f706afc08409e8317a27d6850b11c54d3 09-Sep-2009 Omari Stephens <xsdg@android.com> Fix typo: IMMEDITATE -> IMMEDIATE
ontactsProvider2.java
28245e1690abbab18b3224e4164a738f6e64d6c0 09-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Making automatic contact aggregation even more conservative.

Also bringing back Jaro-Winkler distance calculator, which was emasculated by CL 22788
The Jaro-Winkler distance is actually very useful for generating
manual join suggestions. It will not be used for automatic aggregation.

Change-Id: I7844efbcc1e0f9265f9fc8c56af8772282879f5f
ontactAggregator.java
ontactMatcher.java
ameDistance.java
b5a4add17815167d20a90645779df34cdf45280d 03-Sep-2009 Fred Quintana <fredq@google.com> batch up some changes, like the version update, until the end of the transaction
ontactsProvider2.java
penHelper.java
QLiteContentProvider.java
01911fa9cfa21f198fd767eedde072acbb879f28 09-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 1789740] Ensuring that organization is used as a contact display name if name itself is unspecified
ontactsProvider2.java
3ee1a2b657a5a807912dc944172e850c487ddb70 08-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 24076 into eclair

* changes:
Fix a race condition that could break legacy APIs.
5e99505757457d11d9388f6d04960e97fc776a59 06-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Introducing a more advanced email filter, which will do a proper name lookup

Also updating the phone filter to allow the use of a phone number itself
for lookup, including the use of keypad letters.

It uses the normalized name and avoids returning duplicate results.
ontactsProvider2.java
b61f0d658092919aa2bb201787cf3fcbe1d3d048 05-Sep-2009 Jeff Hamilton <jham@android.com> Fix a race condition that could break legacy APIs.

The delegate was only being registered in the
contacts provider, but the social provider also
uses the open helper and could sometimes be
the first provider to be created, causing the
legacy API support delete to not be registered
when the database was created.

Bug: 2102666
Change-Id: I95cd187fc2fd2f4a1a3e1fde7e8926518342f558
egacyApiSupport.java
penHelper.java
0c0adda32be5de3acf392ab715cff468b6b340f8 05-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing contact aggregation exception API.
ontactAggregator.java
ontactsProvider2.java
penHelper.java
352a5f616ba5fc544689c235afab1174151748a6 04-Sep-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 23526 into eclair

* changes:
Add an onAccountsUpdated handler, to delete contacts if an account is deleted.
70d2ff8c87961703351b223ce8b15342fe795a0b 02-Sep-2009 Cynthia Wong <cynthiaw@google.com> Add an onAccountsUpdated handler, to delete contacts if an account is deleted.
ontactsProvider2.java
588891a7dece4769938895a5046582b3f5f569ec 04-Sep-2009 Ken Shirriff <kens@google.com> Add contacts aggregator event logging.
ontactAggregator.java
a5bfaf55790262eea97de432d9e7f313c219c066 03-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding a trigger to implement the "removeContactIfSingleton" functionality.

Also clearing out name lookup and aggregation exception tables upon deletion of a raw contact.
ontactsProvider2.java
penHelper.java
f8a5056d346d41f16e9bca3e98321f3de8012595 03-Sep-2009 Evan Millar <emillar@google.com> Bump db version, since I forgot to in 23713.

Change-Id: I6f9f530ea90013ae3f2f8550139ef1dbb4186234
penHelper.java
622e0a2f00b3de248926ec9e89b11a6425919819 02-Sep-2009 Jeff Sharkey <jsharkey@android.com> Relaxed type and label checking, structured consistency.

For CommonDataKinds rows, we strictly require that TYPE be
set when LABEL appears. Previously we had enforced that
LABEL could only exist under TYPE_CUSTOM, but this doesn't
hold true for providers that want to allow additional TYPE
values to have labels. This fixes http://b/2089080 and
http://b/2065904

This change also helps maintain consistency between
structured and unstructured fields for StructuredPostal and
StructuredName. That is, when an update updates one without
also updating the other, we provide the additional values
required to keep them consistent. If the client specifies
both sets, we let them pass through. Fixes http://b/2087358

Also adds unit tests, including fixing broken ones.
ontactsProvider2.java
egacyApiSupport.java
ameSplitter.java
ostalSplitter.java
b3ce7aaa2390698c9424d17df4d2979dcd902cfd 03-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Contacts: Cleaning up golden test files after the change of data mime types.
penHelper.java
3cb415e7b97c3e318d7a16aaf7cc5c6b825d349a 03-Sep-2009 Evan Millar <emillar@google.com> Add IS_SUPER_PRIMARY to Entity query projection.

Change-Id: I3a329a15acfc3f1ecc93d0a4e42f1927e1a99db2
ontactsProvider2.java
penHelper.java
285b771bc955305fa6d49ca23f808cecc8a13d5e 03-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2092543] Making manually created contacts show in the list immediately.
ontactAggregator.java
ontactLookupKey.java
ontactsProvider2.java
penHelper.java
QLiteContentProvider.java
25abcf949c0dd826a770b437489b83de48975cea 02-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2084618] Making the contact aggregator favor better display names.
ontactAggregator.java
ontactsProvider2.java
penHelper.java
1261c4296fd26973f696b67ea982835f035246e0 02-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Bump db version to force re-sync after mimetype name changes.
penHelper.java
433a3a08a4726952c080e22e3969ac6c4f28e8df 01-Sep-2009 Jeff Sharkey <jsharkey@android.com> Re-aggregate RawContacts when STARRED touched.
ontactAggregator.java
ontactsProvider2.java
be84be1519fe0b73f47c2b2fe9badb8a3e833b28 02-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing getType, which I broke in CL 23525
ontactsProvider2.java
b4cfef6f658ecade496351107f6ed2a4818f3e3a 02-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Returning the correct content type for CONTENT_LOOKUP_URI
ontactsProvider2.java
a6733943584294492aa0118fc32bf4e58dabb028 01-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Avoiding reaggregation when the only thing that changes is the photo.

Updating contact photo ID only.
ontactAggregationScheduler.java
ontactAggregator.java
ontactsProvider2.java
927b9dc7681a56a79ea927449877fde1bef54fb9 01-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Breaking up contact aggregation into smaller transactions.
ontactAggregator.java
cdbd854decda3f493b395c8867f2cd131d95d09f 01-Sep-2009 Dmitri Plotnikov <dplotnikov@google.com> Making aggregation optional during Donut->Eclair contact import.

The importer will create contacts just like the aggregator would,
but without actually aggregating duplicates. All raw contacts
are still marked for reaggregation, so the dupes are still discovered
in the subsequent aggregation pass.

The user experience is that all contacts show up very quickly (on sholes
we should expect to see 700 contacts within 15-17 seconds). Then a bit
later duplicates start disappearing.
ontactAggregator.java
ontactsProvider2.java
egacyContactImporter.java
penHelper.java
QLiteContentProvider.java
1b7a7947242bb3b8caaed871775e62d486144c9f 31-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Implementing live folders in ContactsProvider2
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
cf80ca3101d80a431809c3bec834bc329416ae99 31-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE that occurs in contact lookup key when both name and source ID are null.
ontactLookupKey.java
5870f2dcc2ac7715b2c078a886ee346622e7887e 31-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding soft identity to Contacts
ontactAggregator.java
ontactLookupKey.java
ontactsProvider2.java
penHelper.java
4e0850dcd27600b57c1ba9c1466e729b4a0fd5b1 29-Aug-2009 Fred Quintana <fredq@google.com> allow delaying after yielding
QLiteContentProvider.java
944abb09aa47fc08db668be8909fc4045a681117 29-Aug-2009 Cynthia Wong <cynthiaw@google.com> Take the account into account too when we are deleting and updating DATA.
ontactsProvider2.java
e2579e029472f76b2dfda141444d775c67da0ec8 28-Aug-2009 Cynthia Wong <cynthiaw@google.com> Use the account name and type when we are doing update and deletes on contacts in the provider. Added a test for the delete case.
ontactsProvider2.java
5f515d93c04729e6cdc9b704d18579162d71d5f2 28-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding indexes to raw contacts and groups to facilitate sync.
penHelper.java
c76d0a78fe2d3471195cfa555bab016eec154f07 28-Aug-2009 Jeff Sharkey <jsharkey@android.com> Include STARRED in Entity, trigger dirty when touched.

Include RawContacts.STARRED column in Entity projection and
set DIRTY flag when starred is changed. We otherwise don't
trigger dirty, since the other fields aren't important to
sync--for example, TIMES_CONTACTED.

Helps fix http://b/2079148
ontactsProvider2.java
penHelper.java
023b9437a3644e59309b8cfd12c6d84b98433f95 28-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Avoiding more unneccessary calls to markForAggregation
ontactAggregator.java
ontactsProvider2.java
db52621f83bfbc4b0bb74bcdc10006ee054c0ac7 28-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Building larger transactions by yielding for longer periods of time.
ontactAggregator.java
421782cb554e5050cf62a86b98df6520038dcd15 28-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Avoiding unneccessary calls to markForAggregation
ontactAggregator.java
ontactsProvider2.java
94743330ca80ad334340bef51b2a093242721bb0 28-Aug-2009 Jeff Hamilton <jham@android.com> Add legacy API support for inserting into URIs like content://contacts/people/1/phones.

Bug: 2083923
Change-Id: I948ff3f8a87a7594aa890b6c7cf45c11f862008d
egacyApiSupport.java
ff2de103f7e3eeeff4665ef63f07460fef053d6d 27-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Removing "summary"-style URIs.

We will determine whether to include Presence by looking at the requested projection.
ontactsProvider2.java
penHelper.java
cabac02a2416b495e030654accffcbb5ae526678 27-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Solving aggregation of dissimilar names by parsing them explicitly.
ontactMatcher.java
ontactsProvider2.java
3fe48cf2c81f6e89b78e919661e2b0b828a2144e 27-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing the notification URI for legacy API
egacyApiSupport.java
0b30cac29514b3978896731ba1df6a54fc94e9e4 27-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing a bug where changing/adding a phone number on the web would not be reflected on the phone.
ontactsProvider2.java
5dec8cf5a992bac38c0e81d744fc77d748e926aa 26-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2070421] Providing legacy table names as aliases, so you can use people._id in queries.
egacyApiSupport.java
a276d23a70bdb8fdc7c8340a12a64e90696da115 26-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Making name matching in aggregation much less lenient.

We are no longer using the Jaro-Winkler algorithm.
The new algorithm simply counts differences: character mismatches and transpositions
and aggressively caps the former and the total separately.
ontactMatcher.java
aroWinklerDistance.java
ameDistance.java
8e45e5f2142db78941b095f7418cc05b71668094 26-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Several changes in Contact Aggregation logic:

- The first request to aggregate will run immediately. The accumulation will only begin if
the following request shows up within 1/2 sec
- Reaggregation will no longer remove and reinsert Contacts. Once created, it will keep
the aggregate contact record. The only situations when it will be deleted is a join or
removal of all constituent raw contacts.
- Data updates and deletes will now trigger Contact update to keep names, photos etc
in sync with the constituent data.
ontactAggregationScheduler.java
ontactAggregator.java
ontactsProvider2.java
penHelper.java
abb46d4eaffb41f2984cb8a432fbbb8520e92514 25-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing NPE that occurs during contact sync when an email record has no email
penHelper.java
9848688e22402c7f1995a928dac1519c7b793b01 25-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Follow-up to change 22554. Should have upped the database version.
penHelper.java
61efab87c2c8166b3cd69ed1a908d1c0d7271d0b 25-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2074490] Adding legacy support for getType
ontactsProvider2.java
egacyApiSupport.java
b3f909fee75cb384fc381ec5ce70dd001669f945 24-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Support for Global Search Shortcut refresh and contact images.
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
14bba94bbe0f2e215ad7b3b9417754a1ba0d95bf 25-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2072020] Updating name lookup tables when structured name, email, nickname are updated.

This is also an optimization: we will no longer be rebuilding
name lookup structures over and over again as a contact gets updated
and aggregated.
ontactAggregator.java
ontactsProvider2.java
egacyContactImporter.java
penHelper.java
68936cefd4caa779169ea00ffd1adc399e634c9b 25-Aug-2009 Jeff Sharkey <jsharkey@android.com> Correct counts for ungrouped contacts.

Was joining and counting all ungrouped RawContacts instead
of counting aggregated Contacts instead.
ontactsProvider2.java
penHelper.java
ac004680e3cc127b6ebf32b78d2813654b9c56fb 25-Aug-2009 Jeff Sharkey <jsharkey@android.com> Trigger update of IN_VISIBLE_GROUP when inserting Group.

Also fix minor bug where we didn't persist dirty flag set
in updatedValues.
ontactsProvider2.java
468c18fe543f1bf81411204f6996b3626cde175e 24-Aug-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 22483 into eclair

* changes:
make the data version trigger happen before the update
c2543da57fb6c90de4fa2de90db2df7f539f0483 24-Aug-2009 Fred Quintana <fredq@google.com> make the data version trigger happen before the update
penHelper.java
653f73c9417ee0d2cf90e9aacd32848016747cf7 22-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2065658] Editing a phone number now updates phone lookup table

... and some optimizations
ontactsProvider2.java
e84f2475ec53a588c8c3461d28d3d8654ee74010 23-Aug-2009 Jeff Sharkey <jsharkey@android.com> Don't include a column that doesn't exist.
ontactsProvider2.java
e07913c61c320b0cc2036db3b714e39534d8cd7a 21-Aug-2009 Jeff Sharkey <jsharkey@android.com> Add support for visibility of ungrouped contacts.

Built a tricky UPDATE query to determine the visibility of
any Contact by using any GroupMembership entries, otherwise
fall back to Settings.UNGROUPED_VISIBLE.
ontactsProvider2.java
penHelper.java
97f9a162b7632481988bf8639b83f37dcb42b586 22-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Syntax: just moved a constants out of method bodies.

@jham: I understood the meaning of your comment in the previous CL
only after I submitted it.
egacyApiSupport.java
0126458fabecb6514bf6d368ae6a066a78856a91 22-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Legacy compatibility for Im and Presence.

We will not support inserting Presence, but we need to continue joining with it.
egacyApiSupport.java
4dcd106ccc27dbbfaae86baf0cd57beb42c27ccc 21-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Cleaning up Presence API
ontactsProvider2.java
penHelper.java
3653cf1fa8fb36a96a7e4a6ebd615438877c3183 21-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding a "Photo" directory under Contacts.
ontactsProvider2.java
e46667e641cd1c60998e1ccab4b60531d5b12ef7 21-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Introducing AGGREGATED_PRESENCE - thanks to JSharkey for the idea.

This new DB table is maintained in memory and summarizes the presence
status and custom status for each (aggregate) contact. With the help
of this table, we avoid having to do GROUP BY and MAX(status) when
running contacts summary queries. An added benefit is that
we can now get the latest custom status update as part of the
summary query.
ontactAggregator.java
ontactsProvider2.java
penHelper.java
038c3db1b54dd9313c10c212025d37ca8a9e660f 21-Aug-2009 Fred Quintana <fredq@google.com> add the reset() method to EntityIterator
ontactsProvider2.java
a6def2055f5d12cb6ee5cc3dc1adaf39f2b7c97c 21-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Support for data_with_presence URI
ontactsProvider2.java
203b55f4b5edf72b6b81f852d365803d23b046f2 21-Aug-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 22158 into eclair

* changes:
Accounts aren't allow to have empty names.
28153f2e3dda944e983f6dd0ab80aca63631ddfa 21-Aug-2009 Jeff Hamilton <jham@android.com> Accounts aren't allow to have empty names.
egacyApiSupport.java
19a0962e62c13a5e5f8e5b4eed5e30d3477894b4 21-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Support for phones_with_presence URI
ontactsProvider2.java
6f7446a25ecb55ee213eaa7702837cdf32e68777 20-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Contacts: "non-existent account type".

Providing a "non-existent account type" instead of
an exception when there is no default account on the phone.
ontactsProvider2.java
egacyApiSupport.java
6c4c491741802ab5bbd003c5c5d795143f520437 20-Aug-2009 Jeff Hamilton <jham@android.com> Fix the package name.
penHelper.java
ea547d55f864133861b2db44221ae0c2ac6c1a68 19-Aug-2009 Fred Quintana <fredq@google.com> change should_sync to have a default value of 1
penHelper.java
e3eb7ef438010c893c429f3031dcc7298171865d 19-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Completing implementation of phone lookup API.
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
2971716e6a68660721d45be97bf3bd2dfad1c5ef 19-Aug-2009 Fred Quintana <fredq@google.com> add support for deleting groups and rawcontacts by a selection string
ontactsProvider2.java
eb9ffdccfa19f5b2f22e688f733fd77e39605f9e 17-Aug-2009 Jeff Sharkey <jsharkey@android.com> Bring back per-Account Contact-specific settings.

These are used for two purposes: a flag indicating the
default sync state for Groups to inherit, and a flag that
marks when Contacts that don't belong to any specific group
should be visible in UI.
ontactsProvider2.java
penHelper.java
fb362d1a5df250a49fad06db323b0d41fe0e3757 18-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing legacy API support for phone lookup.
egacyApiSupport.java
penHelper.java
410a3791d80d256638a991690d24bdad6e24635c 17-Aug-2009 Fred Quintana <fredq@google.com> stop using deprecated startSync call
ontactsProvider.java
54d6316486a810f45abade9d985dbb52b6cb17e2 18-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding indexes to optimize common contact list requests.
penHelper.java
9155470a5d8e7834ca742f66ede487e4f6e391ea 18-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Providing projection mappings for _id fields in Contacts legacy support.
egacyApiSupport.java
df9fd6b239de5829b04cb413e4dfa3e6da649c38 17-Aug-2009 Fred Quintana <fredq@google.com> fixup after merge from master
ontactsProvider.java
ontactsProvider2.java
egacyApiSupport.java
25125bae2a6c263588331de8af2f5b377ba2fd10 17-Aug-2009 Jeff Sharkey <jsharkey@android.com> Increment version to trigger upgrade.
penHelper.java
38446bf47c5ee2080df69f5fc8a33ad2fa3e61b5 17-Aug-2009 Jeff Sharkey <jsharkey@android.com> Bring back SHOULD_SYNC flag, expose CONTACT_ID in entities.

The frist allows sync groups to be edited, and the second
is used when editing contacts to know which aggregate ID to
strongly bind the new RawContact to.
ontactsProvider2.java
penHelper.java
ff065d085b794a0bf4be4cf6e87a67bf060e0319 15-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Using a latch instead of semaphores.
ontactsProvider2.java
568904d1cc9acfabac78b6fcbf8a7d5115688174 14-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> do not merge: cherry-picked d326974ca339cef284cc045c61d340ddb60d08da from master branch
ontactsProvider2.java
egacyContactImporter.java
249027f2470a2e9a802124012dffb1f821998913 15-Aug-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 21367 into eclair

* changes:
Simplified and fixed aggregation on structured name.
5c54b6d39e0b1cf220f2becc22d488405340d2fc 15-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing sync ids in legacy contact import.
egacyContactImporter.java
2a03d9c2bf627795963561a0f9406b23dc93fec5 15-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Simplified and fixed aggregation on structured name.

Removed all of the over-engineered treatment of first name only,
last name only and similar use cases.

Now there are just three types of name matches:

1. Exact match
2. Variant match: first/last name flipped, Jeff/Jeffrey
3. Collation key match: this can be used for approximate matching
ontactAggregator.java
ontactMatcher.java
penHelper.java
c19e02a37399c55b852d6570f73553e859b0139a 15-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing the "Liza Ma" use case. This name was parsed as Liza (first name), M.A. (suffix).

Should really be Liza (first name), Ma (last name)
ameSplitter.java
b58058243bcd4405ad5ba5c3a465c46a35182ff7 14-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Merge from master (21282 and 21283)
egacyContactImporter.java
013a0d6b3d392fb49d4618f2527b2ed3fec7d34f 13-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Contact import optimization: using direct inserts into the database.
ontactsProvider2.java
egacyContactImporter.java
11944a13b31aa7c98f1079697f24b3a1999ca571 13-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Aggregation optimization: email lookup, name lookup, phone lookup
ontactAggregator.java
ontactsProvider2.java
penHelper.java
2482dd0309794d57233d0af37a7c12fc647e7bf9 12-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Aggregation optimization: updating all Contacts attributes with a single pass over raw contacts.
ontactAggregator.java
a8a24aceaa7826c7b16f02d0079e23da8fbfb509 12-Aug-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 20935

* changes:
Fixing the bug where the aggregator would get repeatedly interrupted.
6c85aa28319092c2e70092cd46a26e447ed32275 12-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing the bug where the aggregator would get repeatedly interrupted.

Fixing the bug where the aggregator would get repeatedly interrupted
and never accomplish anything. Also, increasing the aggregation batch
size by increasing the standard aggregation delay from 1/2 sec to 1 sec
and max delay from 5 sec to 10 sec.
ontactAggregationScheduler.java
88e5f4d32aa9cd3af0ac9654de479f1b8113f712 12-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing Data deletion logic
ontactsProvider2.java
f992bfab334b760d36a053fc0b439382dcfb51ad 12-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Removing handling of primary phone/email on Contact.

Adding code to compute HAS_PHONE_NUMBER on a Contact.
ontactAggregator.java
ontactsProvider2.java
penHelper.java
de955f25491cdc0e826ea5c7d4cd0e93cb970fb7 11-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Proper transaction handling in ContactsProvider2
ontactAggregator.java
ontactsProvider2.java
QLiteContentProvider.java
caa1cf4ef062f163ac5e370cebc0e47b5ae7460e 11-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing several issues of legacy support:

1. Security constraints fully enforced.
2. Default account is used for all operations.
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
73776ffd5c00e94db987ee30864e9c7a8396d22d 11-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> DIRTY flag on Contacts will no longer be set if the query has the ?mark_as_dirty=true parameter.

Sync adapters should be able to set their own data on the Data row without
triggering another round of syncing.
ontactsProvider2.java
penHelper.java
94021b213e4db367f60b30fcbfe9019e28571784 10-Aug-2009 Fred Quintana <fredq@google.com> add the deleted flag to the groups table
ontactsProvider2.java
penHelper.java
d659078547c329b58f90d8809910a845d913dbc6 10-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Using LIMIT instead of MAX_SUGGESTIONS
ontactsProvider2.java
42129745337d0e27945ad2c013c5df3e10d42d68 10-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Minor bug fix: NPE on missing phone number, email or nickname
ontactAggregator.java
99a9b5ec879f6cd6876f7f6b680b82d8304e6b92 08-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing an exception produced by the Display Groups UI.
ontactsProvider2.java
9a181df62cc9ca83c5ac1d8952f270d225b13961 08-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing an issue caused by non-exitence of the legacy contacts db.
egacyContactImporter.java
4a023070dab9a069be4cac5f5ba5554b66238484 08-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Hiding security constraints in SQL VIEWS - first cut.

This CL serves two purposes:
1. We hide the restriction checking inside SQL VIEWs, which will prevent security attacks like passing ") OR(1" for selection
2. We gain the ability to use unqualified column names in selections - all columns on a VIEW have unique names.
ontactAggregator.java
ontactsProvider2.java
penHelper.java
5d0fa81285aea6cc545686a9d32736933b446482 07-Aug-2009 Jeff Sharkey <jsharkey@android.com> Fix presence query to match contract class for legacy API.
egacyApiSupport.java
8a185960d5648eaa08033fe902fff0c9cb0c06b7 07-Aug-2009 Jeff Sharkey <jsharkey@android.com> Fix presence query to match contract class.
penHelper.java
7a4550f2afb24b2112b6c937f416c6f46ece35f4 06-Aug-2009 Fred Quintana <fredq@google.com> - add some missing columns to some projections and views
- return IllegalArgumentException instead of a RuntimeException
ontactsProvider2.java
penHelper.java
7906f55e82ab84356e56d10d0336079145e04a38 06-Aug-2009 Jeff Sharkey <jsharkey@android.com> Fix social projection that had ambiguous column name.
ocialProvider.java
00ec508630251d6c6e3746469c9428f5a8cd5996 05-Aug-2009 Jeff Sharkey <jsharkey@android.com> Fix column map naming, empty projection behavior.

The "MAX(mode)" projection needed to be named as the
expected column to be useful. The default behavior of
assertContained when asking for no specific columns
(projection=null) should be to /not/ limit to just that
single column. And finally, fix up one place where the
protection clause was being appended wrong.
ontactsProvider2.java
lobalSearchSupport.java
3d8b043c3341a5b6c2e781b7eba9767d5cd13267 05-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Contact conversion script, initial cut
ontactAggregator.java
ontactsProvider.java
ontactsProvider2.java
egacyContactImporter.java
penHelper.java
eorderingCursorWrapper.java
c345fa41d140d1b89b4636dca6ac1d305f7c8e6a 05-Aug-2009 Mike Lockwood <lockwood@android.com> Ignore duplicate column exceptions during database upgrade

Some columns were accidentally removed and readded, so in some upgrade
cases, the column might already exist.

Signed-off-by: Mike Lockwood <lockwood@android.com>
ontactsProvider.java
e7c19a079df0ba9be2fbba494ba6efd838658f78 04-Aug-2009 Fred Quintana <fredq@google.com> add back a column I mistakenly removed
penHelper.java
321afd997c985f150a13e0a5538e2a12b755b217 28-Jul-2009 Fred Quintana <fredq@google.com> - test that query entities works
- add a view for the contacts entities query to hide the internal column names from user-provided where clauses
- fix a bug that keeps updates of a data row by id from working
ontactsProvider2.java
penHelper.java
f0dda4a4c357f604ca6553d905b0efd526757c31 04-Aug-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 9671

* changes:
Fixing db versioning which got messed up a bit between donut and master.
29275a6472528635b3c323c9d25ef9af464b6c75 04-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing db versioning which got messed up a bit between donut and master.

The current ContactsProvider and its database are being deprecated, so this change is made just to get from here to ContactsProvider2.
ontactsProvider.java
3cfe8d532d509fbbe605454e3a32b2361b7e1501 04-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding columns SYNC1-4 and fixing tests.
ontactsProvider2.java
penHelper.java
a908fb5f39aa2021662a6cc317cc7e4db2d8bfb0 04-Aug-2009 Dmitri Plotnikov <dplotnikov@google.com> Breaking global search support into a separate class and limiting search results to visible contacts only.
ontactsProvider2.java
lobalSearchSupport.java
egacyApiSupport.java
0c83a3c4b6a9c8a0dfa0b3aa2af91b74d8e3304f 03-Aug-2009 Evan Millar <emillar@google.com> Fix some missed naming conversions
ontactsProvider2.java
b79160e642fca12222ca2bd2b8936a73f83d5e12 02-Aug-2009 Jeff Sharkey <jsharkey@android.com> Remove COUNT(*) from projection, was breaking tests.
ontactsProvider2.java
penHelper.java
a01e50cb1a5dd21293f8a8fe43f3fe0bf6349164 31-Jul-2009 Jeff Sharkey <jsharkey@android.com> Fix IM constants to match framework change.
ontactsProvider2.java
c70dc0e38ff82c6e6d6b7458637c54fbdf446aac 31-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Reimplementing global search integration in ContactsProvider2.

Also fixing bugs in the area of logical deletion of raw contacts and their exclusion from further aggregation.
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
2815f58f72f109790585931f601a63ddc02536a5 30-Jul-2009 Evan Millar <emillar@google.com> Adds URI for querying Contacts joined with RawContacts.
ontactsProvider2.java
penHelper.java
f1ce2d5008e490f447d6f5ff04a784c8ae066e9d 30-Jul-2009 Jeff Sharkey <jsharkey@android.com> Added COUNT(*) to support ContentProviderOperation.

Also added field to the Entity view, and correctly drop the
view during database upgrade.
ontactsProvider2.java
penHelper.java
e99988b266dd1263162583e81e2b408e7329b1c8 29-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Extracting call log implementation out of the legacy contacts provider.
allLogProvider.java
penHelper.java
226c3dc6e93ca76a84c99100caa31045cba06cf6 28-Jul-2009 Fred Quintana <fredq@google.com> - test that query entities works
- add a view for the contacts entities query to hide the internal column names from user-provided where clauses
ontactsProvider2.java
penHelper.java
61d61cb4d13a33c5581765fb4c0f1b3c0b2cdf4c 28-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> [Issue 2017273] Contacts Aggregator doesn't maintain state of dirty bit...
penHelper.java
d3fde755e73cd3912a488e7cb7d412d3c5f6ca94 28-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2: Renaming Aggregates to Contacts
ontactAggregator.java
ontactMatcher.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
ocialProvider.java
373f7d2adc36680c31ff33e9ee12be865af6b5fb 28-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Implementing Presence query.
ontactsProvider2.java
17392c6de42c9617117eb16ee2d937064a447a2c 28-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing a merge issue
penHelper.java
5ef0401c311c62e53bde415b99cbb0ff83b0a9a2 28-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> ContactsProvider2: Renaming CONTACT_ID to RAW_CONTACT_ID
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
ocialProvider.java
1fd9b53d9e5d8ea87b69a51fb084c6f0d9f7c93e 27-Jul-2009 Fred Quintana <fredq@google.com> add unit tests for the contacts dirty and version trigger and fix any bugs found
penHelper.java
33b41fdb8d7c3c654cb070799c9d6e2b4ab16078 27-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Implementing Raw Contact deletion.
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
6cffee46a1334d2b3ed19f436b27638451541044 27-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Changing Contacts to RawContacts.

The renaming will be done in baby steps and in the
order of priorities.

Step 1: Contacts->RawContacts and deprecate Contacts
Step 2: Once all is converted, remove Contacts
Step 3: Aggregates->Contacts, including comments in the API
Step 4: Tables and fields
Step 5: Comments in the implementation code

Intermediate steps will be pretty ugly, but the result will be glamorous. I hope you are all still ok with "RawContacts"
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
ocialProvider.java
6b27a9710317bfc5a5217b90f70862a17248449b 27-Jul-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 8576

* changes:
Implementing compatibility mode for contact filtering
b0160a0bcf6d59eaa43fd501e124b95f873e0157 27-Jul-2009 Marc Blank <mblank@google.com> Fix trigger so that dirty is set for contacts when its data items are changed
penHelper.java
445ca81effbb0d61c7bc0033acf2d3dfd228fd4e 25-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Implementing compatibility mode for contact filtering
ontactsProvider2.java
egacyApiSupport.java
70b5ee6864cb3368d24a9e876fb93008997b12df 25-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Compatibility support for Presence
ontactsProvider2.java
egacyApiSupport.java
c6ad6f6c5690a28bacb9fa0f4357ea8c8a91e3ba 25-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding compatibility support for contact photos.
egacyApiSupport.java
20a94c86ede7380c8dd8df2f6a72b3c00ac1bed8 24-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Fixing bulk update and delete of contacts data.
ontactsProvider2.java
c62855331805c2744a097ef6ea625652197bfb87 24-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Associating Presence with Contact as opposed to Aggregate.
ontactsProvider2.java
penHelper.java
d51a83ac4f8032b62d9a23b90a8f43d6b7eb2dbb 23-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding SQL VIEWs to support backwards compatible WHERE clauses.
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
0f8f3b3e4a6ad18c5868d0215cc137845a2ddc74 23-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding compatibility support for Contact Extensions and groups.
egacyApiSupport.java
penHelper.java
67dde51ab932dc84d95a203b113989b13437f13d 21-Jul-2009 Jeff Sharkey <jsharkey@android.com> Hard-coded IS_RESTRICTED exceptions, move to RES_PACKAGE.

The current RestrictionException API wasn't final enough to
reveal in the next platform release, and is only being used
by a single party. In addition, the original approach
required the sync adapter to assert any granted exceptions
during each update pass. There was also additional overhead
of watching for PACKAGE_ADDED and PACKAGE_REMOVED broadcasts
for clearing any applicable exceptions.

Finally, since this is a critical security element, we
really wanted to avoid storing the exceptions in another
SQL table that may be altered through an unknown SQL
attack vector. For now, the packages granted IS_RESTRICTED
access should be manually entered in sAllowedPackages.

This change also cleans up some projection mappings, and
minor fixed to prepare for a pending framework change.
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
ocialProvider.java
e80e514a6175ad2ee03ea6eff6201e0e47d5a710 21-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Adding compatibility support for ContactMethods and phone numbers.
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
3cebbf7141252768d3e272e049e9c5b0cb9d710e 17-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Work in progress: introducing DataRowHandlers in ContactsProvider2.

1. Introducing DataRowHandlers
2. Adding DISPLAY_NAME to Contact for maintaining
a backwards compatible behavior
3. Implementing compatible DISPLAY_NAME behavior
4. Fixing handling of null display name
5. Implementing primary Organization
6. Implementing compatibility mode for Organization
7. Adding "delete" to compatibility support
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
9261b2141aa90a4fed632fd6da03026d4c216280 14-Jul-2009 Fred Quintana <fredq@google.com> - add the DIRTY and VERSION columns to the ContactsProvider2 Groups contract
- make the CP2 allow adding group membership rows with only a sourceid
in which case it will lookup the group row id, creating a group row
if necessary
- added test cases
ontactAggregator.java
ontactsProvider2.java
penHelper.java
f4e1358f1c8f5fe5e9e7689e36e04c57c2385169 15-Jul-2009 Dmitri Plotnikov <dplotnikov@google.com> Removing ContactOptions table.

1. Moving ContactOptions fields to Contacts.
2. Introducing AGGREGATION_MODE
3. Introducing Legacy API support
4. Implementing "last time contacted" update - for now just legacy requests.
ontactAggregator.java
ontactsProvider2.java
egacyApiSupport.java
penHelper.java
111b2c267f6d78ce39a83209cafaf649307f45e5 15-Jul-2009 Android (Google) Code Review <android-gerrit@google.com> Merge change 7411

* changes:
Add Uri for filtering the aggregate summary on group name.
b67163a1088f09c59f324350662eb18772fac6b6 15-Jul-2009 Evan Millar <emillar@google.com> Add Uri for filtering the aggregate summary on group name.

New Uri is:

content://com.android.contacts/aggregates_summary/group/*

Where * should be replaced by the group name.
ontactsProvider2.java
0a5bd36c3c9e21dac4e62222e893c59a46f43578 15-Jul-2009 Fred Quintana <fredq@google.com> rev the version number
penHelper.java
ae6ca1f34cf5458d79ec803411d4308879a91e92 13-Jul-2009 Evan Millar <emillar@google.com> Chooses one photo to represent the aggregate.

This implementation simply chooses a random* photo from the first
account when sorted by account_name. We may want to make this more
intelligent before release.
ontactAggregator.java
ontactsProvider2.java
28b3769e3fcecae56c3fc70cbcb0f95282b9640e 14-Jul-2009 Fred Quintana <fredq@google.com> fix a build breakage
penHelper.java
35ed95769096bb5dd406ad7d1fcaa49a0e35a307 11-Jul-2009 Fred Quintana <fredq@google.com> make ContactsProvider2 create a syncstate table for use by sync adapters
ontactsProvider2.java
penHelper.java
035b4cc204be2641079a0b04e9ee9791a8f8248b 09-Jul-2009 Fred Quintana <fredq@google.com> remove the accounts table from the ContactsProvider2
ontactsProvider2.java
penHelper.java
28f8857b1b46bde18b85c6d3c2a63ac44c3c2e1c 08-Jul-2009 Evan Millar <emillar@google.com> Merge commit 'goog/eclair-dev' into merge3

Merged the new contacts content provider into goog/master. The old and
new content providers now live side by side under separate authorities.

Conflicts:
Android.mk
AndroidManifest.xml
res/values/strings.xml
47a99760251f02a63b1c5bb8a51c7457ee4c2626 18-Jun-2009 Mike LeBeau <mlebeau@google.com> am a8a4bb9c: Use better icons for call contact and create contact search suggestions, just added to the framework.

Merge commit 'a8a4bb9cfccbea8dd71295e018189f5043fec1ad'

* commit 'a8a4bb9cfccbea8dd71295e018189f5043fec1ad':
Use better icons for call contact and create contact search suggestions,
a8a4bb9cfccbea8dd71295e018189f5043fec1ad 18-Jun-2009 Mike LeBeau <mlebeau@google.com> Use better icons for call contact and create contact search suggestions,
just added to the framework.
ontactsProvider.java
49779557e2ac7c105353adf179d182b3255e190b 10-Jun-2009 Bjorn Bringert <bringert@android.com> am 01ff5402: Remove obsolete TODO from Contactsprovider.

Merge commit '01ff54021878fe6fb03a630802ab52eb14d29422'

* commit '01ff54021878fe6fb03a630802ab52eb14d29422':
Remove obsolete TODO from Contactsprovider.
01ff54021878fe6fb03a630802ab52eb14d29422 09-Jun-2009 Bjorn Bringert <bringert@android.com> Remove obsolete TODO from Contactsprovider.

I originally put a TODO in about finding out what format
contact photo blobs are stored in. It turns out that
my original guess of image/png was correct, so I'm removing
the TODO.
ontactsProvider.java
d0b9dd4e088110aaf122f99df205ab296d642d96 04-Jun-2009 Bjorn Bringert <bringert@android.com> Another attempt at fixing the merge.
ontactsProvider.java
4dd50161fd013a1341f010d558973c590bfbdd9c 04-Jun-2009 The Android Open Source Project <initial-contribution@android.com> fix problem with previous merge
ontactsProvider.java
53294bbe817b5ddff3d085c934948af81ecf57a6 04-Jun-2009 The Android Open Source Project <initial-contribution@android.com> effectively undo previous merge
ontactsProvider.java
37f4204592393df36a19851a6d2043fc6ff8420d 04-Jun-2009 The Android Open Source Project <initial-contribution@android.com> resolve conflicts w/bc4056
bc40569c27089788eead5b0f0373d7ff11cbb6c9 01-Jun-2009 Bjorn Bringert <bringert@android.com> Use openAssetFile() for contact photos in search suggestions.

This avoids including blobs in the Cursor, which may contain thousands
of rows. Since all the data is copied out of the database as soon
as the cursor is used, including contact photo blobs adds
significant overhead.

Fixes http://b/issue?id=1862417
ontactsProvider.java
709243725e9d80fb2406f8693801d0c1c7281e83 29-May-2009 Bjorn Bringert <bringert@android.com> am 5a539745: Support ?limit=N query parameter for contacts provider.

Merge commit '5a539745bb9ad9a58f548d26d07620b2d513aafb'

* commit '5a539745bb9ad9a58f548d26d07620b2d513aafb':
Support ?limit=N query parameter for contacts provider.
5a539745bb9ad9a58f548d26d07620b2d513aafb 22-May-2009 Bjorn Bringert <bringert@android.com> Support ?limit=N query parameter for contacts provider.

This lets callers limit the number of results returned
from the contacts provider. When there are thousands
of contacts, just filling the cursor window
can take several seconds. This results in severe
user-visible latency.

The limit argument can reduce the latency for
applications that do not need all matching contacts,
e.g. global search.
ontactsProvider.java
74999033b43c16114e8a52b72660fb8d95e4ded9 22-May-2009 Daisuke Miyakawa <dmiyakawa@google.com> Hand merge from cupcake_dcm from donut, part 5.1
This is same as 1930. I did some mistake around git, so created this commit again...
ontactsProvider.java
0022985fe85d761e698207a8622bd3fd2d832ca2 19-May-2009 Mike LeBeau <mlebeau@google.com> am e6962d3c: Make "Create contact" suggestions from the contacts provider never get stored as shortcuts (because that\'s just weird).

Merge commit 'e6962d3c84586f986cff239ddfcbccf56f964144'

* commit 'e6962d3c84586f986cff239ddfcbccf56f964144':
Make "Create contact" suggestions from the contacts provider never
e6962d3c84586f986cff239ddfcbccf56f964144 19-May-2009 Mike LeBeau <mlebeau@google.com> Make "Create contact" suggestions from the contacts provider never
get stored as shortcuts (because that's just weird).
ontactsProvider.java
0ff0a6d5b11aa17ae29708584d3f40b154acc347 18-May-2009 The Android Open Source Project <initial-contribution@android.com> merge bf7de1787bc6fef9ceb459a88114cf640301cc27 w/conflicts
bf7de1787bc6fef9ceb459a88114cf640301cc27 13-May-2009 Bjorn Bringert <bringert@android.com> ContactsProvder: Use new _TOKENIZE column token_index

The _TOKENIZE function now uses an extra column, token_index.
This commit changes ContactsProvider to add and
populate the new column.
token_index is not yet used in any query, but it will soon
be used for ordering of seach suggestions, see
http://b/issue?id=1847321

I haven't run the ContactsProvider testsuite, since I can't
get it to run at all:

adb shell am instrument -w com.android.providers.contactstests/android.test.InstrumentationTestRunner
INSTRUMENTATION_RESULT: shortMsg=com.android.providers.contacts.ContactsSyncAdapterTest
INSTRUMENTATION_RESULT: longMsg=java.lang.VerifyError: com.android.providers.contacts.ContactsSyncAdapterTest
INSTRUMENTATION_CODE: 0

log:

E/dalvikvm( 484): Could not find method com.android.providers.contacts.ContactsSyncAdapter.getCanonicalGroupsFeedForAccount, referenced from method com.android.providers.contacts.ContactsSyncAdapterTest.addGroupMembership
W/dalvikvm( 484): VFY: unable to resolve static method 48: Lcom/android/providers/contacts/ContactsSyncAdapter;.getCanonicalGroupsFeedForAccount (Ljava/lang/String;)Ljava/lang/String;
W/dalvikvm( 484): VFY: rejecting opcode 0x71 at 0x000a
W/dalvikvm( 484): VFY: rejected Lcom/android/providers/contacts/ContactsSyncAdapterTest;.addGroupMembership (Lcom/google/wireless/gdata/contacts/data/ContactEntry;Ljava/lang/String;Ljava/lang/String;)V
W/dalvikvm( 484): Verifier rejected class Lcom/android/providers/contacts/ContactsSyncAdapterTest;
ontactsProvider.java
77d61decd26fda5e2dd1d602adcf6f202e5cfcfb 12-May-2009 Bjorn Bringert <bringert@android.com> am f07385e: Richer info in contacts search suggestions.

Merge commit 'f07385e614cf88079e3e7767ea4b0507839ae1b6'

* commit 'f07385e614cf88079e3e7767ea4b0507839ae1b6':
Richer info in contacts search suggestions.
f07385e614cf88079e3e7767ea4b0507839ae1b6 06-May-2009 Bjorn Bringert <bringert@android.com> Richer info in contacts search suggestions.

Before, the search suggestions returned by the ContactsProvider only
showed a single line, with the contact name, organization, phone number
or e-mail. Global search had it's own version of contacts suggestions,
adding contact photos, a second text line, and IM presence.

This patch moves the richer information to the suggestions returned
by Contactsprovider. Advantages of this:
- The search suggestions in the Contacts app will now be richer.
- In global search, contacts suggestions will now look the same
when selecting the Contacts source as they do in the blended
suggestion list.
- The contacts-specific code can be removed from GlobalSearch.
ontactsProvider.java
9bce5b0908748238a31a1788cf66af98dcb75f4b 09-May-2009 Karl Rosaen <krosaen@google.com> am be7b7a9: Return MIME types for search suggestion URIs.

Merge commit 'be7b7a906dc628a7c019c212ad000ad71052b333'

* commit 'be7b7a906dc628a7c019c212ad000ad71052b333':
Return MIME types for search suggestion URIs.
be7b7a906dc628a7c019c212ad000ad71052b333 08-May-2009 Karl Rosaen <krosaen@google.com> Return MIME types for search suggestion URIs.
ontactsProvider.java
73fe87ef7ea7b6868f1ae2ddaae7699c2f830540 08-May-2009 Karl Rosaen <krosaen@google.com> am 0025580: Implement shortcut validation in the contacts provider by re

Merge commit '0025580d46c690c97d754807c1506617f6a23d47'

* commit '0025580d46c690c97d754807c1506617f6a23d47':
Implement shortcut validation in the contacts provider by returning a shortcut id, and
0025580d46c690c97d754807c1506617f6a23d47 06-May-2009 Karl Rosaen <krosaen@google.com> Implement shortcut validation in the contacts provider by returning a shortcut id, and
responding to the validate shortcut URI.
ontactsProvider.java
ec90f41aff415826f583e71fa9a4b23ca95615d2 30-Apr-2009 The Android Open Source Project <initial-contribution@android.com> am 52a0d2c: Merge branch \'readonly-p4-donut\' into donut
6fd8b0bb6fb7be5156304b1b2aaf2995b5572504 24-Apr-2009 Karl Rosaen <> AI 147564: Merge back from search branch to donut. Notes:
- all public apis and framework changes have been reviewed by relevant folks in our branch (e.g romainguy)
- all new public apis are @hidden; they will still get reviewed by api council once we're in git
- other than that, it's mostly GlobalSearch and search dialog stuff, a new apps provider, and some tweaks
to the contacts provider that was reviewed by jham

Automated import of CL 147564
ontactsProvider.java
0a1e92b047a87ac207b1991aff5c18b979ad9cc9 23-Apr-2009 Fred Quintana <fredq@google.com> change the sync framework and users to understand Account
ontactsProvider.java
d38f10fb35257f564b0299f5cadf7534a596d3c5 28-Mar-2009 Jeffrey Sharkey <> AI 143308: am: CL 143159 am: CL 142855 Fix SHOW_OR_CREATE intent to correctly handle duplicate E-mail or IM entries for a person.
Added a new WITH_EMAIL_OR_IM_FILTER_URI to find people with a given string as either an E-mail or IM address. This cleans up the original code, and lets us handle duplicates when there are multiple ContactMethod matches for a single person. (We don't get GROUP BY through the ContentProvider interface.)
In ContactsListActivity we don't show possibly-incorrect labels when in MODE_QUERY_PICK_TO_VIEW, as any labels and values would be identical. (The people appearing in that list are there because their ContactMethod matches the query.)
Original author: jsharkey
Merged from: //branches/cupcake/...
Original author: android-build
Merged from: //branches/donutburger/...

Automated import of CL 143308
ontactsProvider.java
1ff594292ceff88b7dbccff928b05282b43802fc 27-Mar-2009 Jeffrey Sharkey <> AI 143159: am: CL 142855 Fix SHOW_OR_CREATE intent to correctly handle duplicate E-mail or IM entries for a person.
Added a new WITH_EMAIL_OR_IM_FILTER_URI to find people with a given string as either an E-mail or IM address. This cleans up the original code, and lets us handle duplicates when there are multiple ContactMethod matches for a single person. (We don't get GROUP BY through the ContentProvider interface.)
In ContactsListActivity we don't show possibly-incorrect labels when in MODE_QUERY_PICK_TO_VIEW, as any labels and values would be identical. (The people appearing in that list are there because their ContactMethod matches the query.)
Original author: jsharkey
Merged from: //branches/cupcake/...

Automated import of CL 143159
ontactsProvider.java
055285653761ff3a086d56ffce1c14f087361bf9 25-Mar-2009 Romain Guy <> Automated import from //branches/master/...@141566,141566
ontactsProvider.java
63b5d908c0b7816dc75ac9840b65819362dc9e7d 25-Mar-2009 Romain Guy <> Automated import from //branches/donutburger/...@141563,141563
ontactsProvider.java
67e55b92586cec2510ac4324ee4162e8b5f4a61d 25-Mar-2009 Eric Fischer <> Automated import from //branches/master/...@141530,141530
ontactsProvider.java
64e90751ad0dce854263ba04eaf4c5d41390212f 25-Mar-2009 Eric Fischer <> Automated import from //branches/donutburger/...@141529,141529
ontactsProvider.java
35f92790f22971044b787ee7c6f774f72e8463d9 25-Mar-2009 Jeffrey Sharkey <> Automated import from //branches/donutburger/...@141029,141029
ontactsProvider.java
27d6e7f480570aa99124fddda7355d1eca1f7656 25-Mar-2009 Jeffrey Sharkey <> Automated import from //branches/master/...@141031,141031
ontactsProvider.java
79d2f10eb9822eeee9511e11c6b52f18d4f59e8a 25-Mar-2009 Evan Millar <> Automated import from //branches/master/...@141025,141025
ontactsProvider.java
2bc4701fc07e38ed5748c59a825bb76c01a49899 25-Mar-2009 Evan Millar <> Automated import from //branches/donutburger/...@141022,141022
ontactsProvider.java
bf22eb48f17911965daae1679a972d3a4edf2c0b 13-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake_rel/...@138607
ontactsProvider.java
7d2e8218a56ab5403bfbd83821fef13dd8f2fc22 09-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@137197
ontactsProvider.java
843921b7cde004adab16b8949788d20901006f62 05-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@136594
ontactsProvider.java
c731b0cf6e7e2c1c4da8a3562ae16341bd659bc6 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
ontactsProvider.java
17c931bd5d2a72c4de95a41b8ca2d00a0d72a53e 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
ontactsProvider.java
6df44e921af2de2474922f6e3e2a8db73e424b97 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@132589
ontactsProvider.java
cfea08ba43be72e812deb3d5cffa48221027e5b8 03-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@137055
ontactsProvider.java
2d6410af060452cf2544f25627f392ac34e8947b 11-Feb-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@130745
ontactsProvider.java
833c0c445b37dd55785189dc2d6d304ea1a85784 16-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@126645
ontactsProvider.java
b0f94c82189fdbe30037fbda532576043cbb067e 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
ontactsProvider.java
b9c68743c83b00ab02d98a6df87f5d87a8b38ba3 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
ontactsProvider.java
0f58cfe01bb0f491330f7dcf85d54d0081459b57 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
ontactsProvider.java