Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

facebook contacts sync #1

Closed
wants to merge 567 commits into from

5 participants

@samuaz

part of the support for synchronizing facebook contacts

Daniel Lehmann and others added some commits
Daniel Lehmann 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
3b505de
Debashish Chatterjee 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
9cf06e7
Debashish Chatterjee Merge "VoicemailStatus content provider implementation." 204ab9d
Daniel Lehmann Remove restricted white-listing
Bug:4974334
Change-Id: I4dd95089774373d2b67d7e14dc6b7fc40a92d094
ed6bfd9
Daniel Lehmann Allow a sync adapter to provide an OPEN action for a group
Bug:4413120
Change-Id: I798b586acd200f0713c59f75b2815ce22e8a9c86
1cdfc9d
Dave Santoro 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
f547fd5
Daniel Lehmann Fix the tests
Bug:4413120
Change-Id: I796dc50d8e3e978098869fcb7fccd597a84c2e4a
77c0766
Dave Santoro Merge "Large photo storage." 26491aa
Dave Santoro 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
6ae8977
Dave Santoro 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
afc8e7a
Dave Santoro 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
87614d7
Daisuke Miyakawa 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
f9648a0
Debashish Chatterjee 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
1fafab3
Dave Santoro 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
6802030
Debashish Chatterjee 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
791a25b
Dave Santoro 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
1dfa964
Debashish Chatterjee Merge "Get rid of voicemail permissions from contacts content provider." 72836d9
Daisuke Miyakawa 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
4928b8c
Daisuke Miyakawa Add support for frequent uri
Must be after Ia670229e4d3e793446b0a0dce2590e20709ee18c

Bug: 5050315
Change-Id: I0ad08f65659987aefda20cd1f9fdfb0d375660f0
45ae7ea
Daisuke Miyakawa 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
f1efadb
@flerda flerda 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
b2197b2
Daisuke Miyakawa Make frequent uri work correctly
Also add unit test for it

Bug: 5073384
Change-Id: I7fa41f50883e14a84ef95d2b098379b1d6b47bae
363bdab
Debashish Chatterjee 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
929a04e
Debashish Chatterjee Fixed VoicemailProviderTest.
A recent change added a new 'IS_READ' field into the content provider but
this test was missed to be updated for the number of columns expected
out of the content provider.

Change-Id: I03885e2b2ac827fe04e06e528e9ffd51823004ee
9a5dfea
@flerda flerda 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
94cc8c6
Eric Fischer Import revised translations.
Change-Id: I7a76451008d3ae29155e9bc62a8223b05a249e69
7cc353f
Eric Fischer Merge "Import revised translations." 010b2f3
Debashish Chatterjee Merge "Improvements in voicemail broadcast notifications." 51d1da9
Makoto Onuki 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
4b64b6e
Dave Santoro 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
43368a3
Makoto Onuki Merge "Query speed up with "raw_contact_is_user_profile" check" 6c7e506
Dave Santoro Merge "Provider and DB changes to support data_set field." a9828e2
Daisuke Miyakawa Return starred with phone number when phone-only
Bug: 5087645
Change-Id: Ib60353fd44c23566ae0d2cbaa695f5bbdfd26eb0
9dbfd65
Debashish Chatterjee 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
8d5a094
Daisuke Miyakawa Merge "Return starred with phone number when phone-only" a4b8d71
Dave Santoro Initialize PhotoStore in background thread.
Bug 5031708

Change-Id: I6a621ca81281c3a146846f89650779f2a73888cc
24bc499
Dave Santoro Fix missing column issue with lookup-by-name query
Also fixed a similar problem for undeleting raw contacts.

Bug 5091427

Change-Id: I043eb51eb53676ee9719834456920a9aff4d3e42
03975f7
Dave Santoro Added query instrumentation when verbose logging.
Change-Id: Id55596034b11f819e4f1d367f648be4bb0e73a33
5517770
Debashish Chatterjee Fix VoicemailProviderTest.
Modified MockPackageManager to stub checkPermissions. This method was
recently used in production code in
Change-Id: I20982572d7f9a08ce98b03b23c9d2d8aa60efc9f

but I missed to update the Mock. Consequently the tests now fail with
unsupportedoperation exception.
46c450d
Debashish Chatterjee 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
d558ccc
Dave Santoro Merge "Added query instrumentation when verbose logging." 75a9533
Debashish Chatterjee Merge "No more use audio mime type for voicemail uris." 3606209
Debashish Chatterjee 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
c6eb4fe
Dave Santoro 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
a09d752
Dave Santoro Merge "Create account record if needed on profile insert." dd13a37
Dave Santoro Populate data_set in values from the URI.
Change-Id: I332596515fc55d9c28ed7b79128650328112da6c
a71dc46
Hugo Hudson 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
1e6310f
Hugo Hudson Merge "Add synthetic columns to voicemail table." deb5824
Eric Fischer Import revised translations.
Change-Id: I8abc0470d538f0cee3384854b78978e2b0583934
48a7160
Eric Fischer Merge "Import revised translations." 3d07c56
Debashish Chatterjee Merge "Delete voicemail data when source package is uninstalled." 61db4f7
Debashish Chatterjee 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
98a77ec
Dave Santoro Fix photo-related tests for Proguard builds.
Bug 5112593

Change-Id: I4b559911a100fdbe466bc79057d22000800e08be
524913c
Dave Santoro Merge "Fix photo-related tests for Proguard builds." 8049e12
Debashish Chatterjee Merge "Renamed permission READ_WRITE_OWN_VOICEMAIL to ADD_VOICEMAIL" 859d213
Debashish Chatterjee Fixed broken VoicemailContentProviderTest.
The tests were broken in two areas following recent changes
- permission READ_WRITE_OWN_VOICEMAIL was renamed to ADD_VOICEMAIL in
  the production code, but was not renamed in test.
- Two new synthetic fields DISPLAY_NAME and SIZE were added in the
  production code but the expected num fields were not updated in the
  tests.

Change-Id: I96c1997af8dadb5a95d7224b0364cf48e6244977
0b442c4
Debashish Chatterjee 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
13cb841
Hugo Hudson 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
1c8e5fc
Debashish Chatterjee Merge "Fixed broken VoicemailContentProviderTest." ca22a2e
Debashish Chatterjee Merge "Fixed a strict mode violation in voicemail/calllog provider." 708cf7d
Debashish Chatterjee 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
eeffa7e
Dave Santoro Fix data set handling for groups.
Bug 5121818

Change-Id: I5bd0c6b0678aed2b708057774d7041b822bf3ed9
3593682
Dave Santoro Merge "Fix data set handling for groups." 83aeb09
Dave Santoro Add support for updating profile raw contacts.
Bug 5122027

Change-Id: I4c0c4dc3b8b9eedbca347929fe16893aa1630005
cce1c9c
Debashish Chatterjee Merge "Allow read-only sharing of Uri in voicemail content provider." 5a423d5
Dianne Hackborn The provider now contains the label for the acore process.
Change-Id: I8503aad9a7c283f661a2781e147033cfeb57c2bb
6094751
Eric Fischer Import revised translations.
Change-Id: I446f6a97b663db69db9ec1aa41f7ee472103f370
6862117
Debashish Chatterjee 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
eaa7d85
Eric Fischer Merge "Import revised translations." 90c8ee2
Daisuke Miyakawa Exclude profile from email filter
Bug: 5131203
Change-Id: I735fc33d00c5d7dde67e3b759365cb8812f69b20
9245089
@flerda flerda 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
aeaba44
@flerda flerda Merge "Automatically add a geocoded location to entries in the call l…
…og."
13a121b
@flerda flerda 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
d5ef590
Debashish Chatterjee 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
2e757d9
Debashish Chatterjee 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
3ae32e2
@flerda flerda Merge "Convert status updates to HTML." 43e6f3b
@jias0001 jias0001 Renaming com.google.i18n.phonenumbers to com.android.i18n.phonenumbers
to avoid name collision.

Bug: 5157607
Change-Id: If7db52ae5eba1696d20e9897860d757021477002
32f5e00
Dave Santoro 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
c6eab50
Isaac Katzenelson 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
3f9ee8a
Eric Fischer Import revised translations.
Change-Id: I0de64ae1b715cb2b374f08e23fbf70558c714897
f6477dd
Dave Santoro Merge "Fix openAssetFile method of inserting photos." 0e27296
Daniel Lehmann 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
0bf6b31
Eric Fischer Merge "Import revised translations." 2327ee3
Daniel Lehmann Merge "Renaming com.google.i18n.phonenumbers to com.android.i18n.phon…
…enumbers to avoid name collision."
73ea285
Isaac Katzenelson 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
3e6cd1f
Isaac Katzenelson Merge "Fix provider empty state status" a473a98
Daisuke Miyakawa 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
3e2aeb5
Daisuke Miyakawa 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
58567ab
Daisuke Miyakawa 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
06c4a28
Daisuke Miyakawa Merge "Use phone number for grouping when normalized number is null" 24109de
@flerda flerda 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
e3a10e4
Eric Fischer Import revised translations.
Change-Id: I102634d828b289fa20485ad363fe5223ae9c7840
910f93d
Eric Fischer Merge "Import revised translations." 9092287
Dianne Hackborn Add boot message when upgrading database.
Change-Id: I3f17aed690066ed4d2ab645a059c66a1bdd7a1f1
fb667e9
Daniel Lehmann Remove the java-synchronization and completely rely on DB transactions
Bug:5134056
Change-Id: Ied50a93fbcd1121ca978cbb8fdcd8556020cb28f
fa4db3d
Makoto Onuki Return proper mime-types for stream items
Bug 5196154
Bug 5198078

Change-Id: I6da42907e900d348294b42d2bc556090c2639ab5
af43bfb
Daniel Lehmann Merge "Remove the java-synchronization and completely rely on DB tran…
…sactions"
518eb86
@flerda flerda 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
fe6c9b5
Daniel Lehmann Fix ambiguity for Contacts._ID and RawContacts._ID in Stream Items
Bug:5134325

Change-Id: Id5159a24c9a2aee58e566b9bc03719e7a6ee0f7c
9b00283
Daisuke Miyakawa Group rows with a same phone number and a contact id.
Bug: 5201809
Change-Id: Ie21abb12736715358dd33bc690269f51ae1e0944
cf55cbe
Daisuke Miyakawa Merge "Group rows with a same phone number and a contact id." d263c07
Daniel Lehmann Fix the creation of the search_index table when the aggregation mode
changes

Original CL submitted by Google TV

Bug:4485628
Change-Id: I1d964bd153cc4de1b5543970bbfd89ff89587451
2c4caaa
@flerda flerda Merge "Fixes convertion to HTML of status updates." dac9925
@flerda flerda 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
7a24e1c
Makoto Onuki Merge "Return proper mime-types for stream items" 0fa5500
Eric Fischer Import revised translations.
Change-Id: I6d9721da9e0321852e63f887c1f8f8a3ae5c9b1c
6b2a03d
Daniel Lehmann Merge "Fix the creation of the search_index table when the aggregatio…
…n mode changes"
e291c7c
Eric Fischer Merge "Import revised translations." 8c9b297
@flerda flerda 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
4747809
Makoto Onuki Add log to measure startup performance
Use this to enable log:

adb shell setprop log.tag.ContactsPerf VERBOSE

Bug 5195464

Change-Id: I8348dffb050c562e708ab81405d556625794fdf3
663b8b8
Daniel Lehmann Add lookup_key to the StreamItemsView (it was missing in the previous…
… CL)

Bug:5134325
Change-Id: I214f5750a9c445b2bca0cc6a448463c38519bfa1
af10329
Makoto Onuki 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
c414472
Makoto Onuki Merge "Lazily-initialize PhoneNumberOfflineGeocoder/PhoneNumberUtil" 28355c6
Dave Santoro 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
5d0a768
@jias0001 jias0001 Enable contact matching for incoming calls which only contain local
number.

Bug: 5197612
Change-Id: Ia38f097e1e1e8ecad9c41a15d5c7593807d13571
3498417
Makoto Onuki Use new api AbstractCursor.setExtras() to return index info
Avoid CursorWrapper, which has performance penalty on cross-process queries.

Bug 5220669

Change-Id: I630fffaaaa2b28846c715ae0d2d536da01b701a8
409605a
Attila Bodis Merge "Enable contact matching for incoming calls which only contain …
…local number."
7b0d7b0
Dave Santoro Switch to using JPGs for tests.
    This should help avoid running out of memory when running the test
    suite.

    Bug 5199245

Change-Id: Ibb2591c3f58777c680eba8f5a89a6cc01f09c198
e6d0d1e
Dave Santoro 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
720277e
Dave Santoro Cleanup variable referring to removed column.
Bug 5242084

Change-Id: I7c8d00701a5a20c97556bf523faf4c4b9fb8a49a
ce39517
Dave Santoro Merge "Cleanup variable referring to removed column." 8289e76
Dave Santoro Merge "Handle profile/contact split for bulk insert." 63f81c9
Daniel Lehmann Don't share SQLiteStatement between threads. Create on the fly
Bug:5229241

Change-Id: I57cda04dbe65afc4b05ddd46dda94b812d0df6bc
11a8344
Daniel Lehmann Merge "Don't share SQLiteStatement between threads. Create on the fly" d4033dd
Makoto Onuki Merge "Use new api AbstractCursor.setExtras() to return index info" e72fee3
Dave Santoro 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
cfc422b
Dave Santoro Merge "Fix photo updates when no photo is specified." ae660f4
Dave Santoro 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
0720793
Makoto Onuki 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
2ebc62b
Makoto Onuki Merge "Fix alphabetical headers for phone-all contacts" 9d42363
Eric Fischer Import revised translations.
Change-Id: Ic65f3bb82cf149ed4e400778011420c1e83bcd50
c622228
Dave Santoro 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
0c5812a
Dave Santoro 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
8d55bbc
Dave Santoro Merge "Add support for I/U/D on profile/data URI." 14fa809
Dave Santoro 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
c5fdfb7
Dave Santoro Merge "Another fix for the bulk insert problem." a5542f6
Dave Santoro Prevent stream item photos from being nuked.
Bug 5250382

Change-Id: Ie121858a4a2c7584f04432e7830bdbeb6cd52bf7
5d9fcba
@flerda flerda 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
f402aaf
Dave Santoro Merge "Fix lookup key generation for inserted profiles." 6bd4c1b
Dave Santoro Merge "Prevent stream item photos from being nuked." 5fc972e
Eric Fischer Merge "Import revised translations." 7033c76
Dave Santoro 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
8278069
Dave Santoro Merge "Clean up stream items when raw contact is deleted." 4358db8
Dave Santoro Fix issue with cleaning up stream item photos.
Bug 5250048

Change-Id: Ibb0daef7a089ec851a9201cfd4163173f713f839
c2714bb
@flerda flerda Merge "Fix voicemail tests." 43e5c84
@flerda flerda Merge "Fix status message in contact updates." d2ee150
Dave Santoro 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
0a3ba72
Dave Santoro Merge "Fix issue with cleaning up stream item photos." 6b55610
Dave Santoro Clean up stream items on account removal.
Bug 5239627

Change-Id: I0c45baeaf6e3a1730760f49696e1f489ef22490f
c88cc79
Dave Santoro Merge "Fix aggregation." 13291f1
Isaac Katzenelson 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
b3a1271
Dave Santoro Add support for profile raw entities URI.
Bug 5274218

Change-Id: Ic5b0b5ace48dfaea81190b8262c622179f20f617
3202ae2
Dave Santoro Fix profile aggregation.
Bug 5248459

Change-Id: I6f09814d5f8b372173e8e82f7cf6dd5b98ba98a6
fabb89d
Dave Santoro Merge "Add support for profile raw entities URI." b7c0834
Isaac Katzenelson Merge "Fix snippetizing cursor" b9be9c4
Dave Santoro 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
f9b77ed
Dave Santoro Merge "Add data_set for Settings." 1a265df
Dave Santoro 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
d9e353f
Dave Santoro Fix a case that would trigger an account error.
Change-Id: I9e09d60a0a60a151c6c43842a499410b65e33693
91abbc9
Dave Santoro Fix snippetization tests.
The tests need to be aware of (and use) deferred snippeting.

Change-Id: Ib566a2884f445c0ff02d8968a9362717798aafb8
6f983fd
Daniel Lehmann 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
7cf5049
Dave Santoro Merge "Fix a case that would trigger an account error." ca8e049
Dave Santoro Merge "Do mimetype filtering based on ID." dc586a1
Dave Santoro Add lookup key support for photo URIs.
Bug 5235737

Change-Id: Iec2ef8ada5b70e22e35b6912ab62e6e680309dc6
bd20dbe
Dave Santoro 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
36aa19f
Dave Santoro Do same photo processing for insert/update.
Specifically, we want to avoid inserting photos with empty byte
arrays.

Bug 5319468

Change-Id: I5c7fb18d76a15eaf202d8e81add189ce053156f2
d0dba67
Martijn Coenen Set the VCardComposer raw contacts URI correctly for the profile.
Bug: 5300714
Change-Id: I87db1056498add7d4c29675fe75b07596242e8d7
3711af1
Dave Santoro 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
41f76a5
Dave Santoro Merge "Re-aggregate all data on raw contact delete." 1c0ff49
Martijn Coenen Merge branch 'master' of ssh://android-git:29418/platform/packages/pr…
…oviders/ContactsProvider
edd81e0
Dave Santoro Merge "Fix deadlock in applyBatch." d022a80
Dave Santoro Merge "Do same photo processing for insert/update." 2e5dda4
Eric Fischer Import revised translations. DO NOT MERGE
Change-Id: I6197d75133a7bbb6975ef13eb25bcb855012a9c6
8834cb2
Dave Santoro 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
78c4830
Eric Fischer am 8834cb2a: (-s ours) Import revised translations. DO NOT MERGE
* commit '8834cb2a5f330b050c760c30a1b3256189668e9d':
  Import revised translations.  DO NOT MERGE
e51c1a6
Dave Santoro Merge "Revert new applyBatch method - it is harmful." 6352657
Eric Fischer Import revised translations.
Change-Id: I449a05629ae6625b7a72a229b0cc90ed81e56709
d99b40a
Dave Santoro 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
4c6e300
Dave Santoro Merge "Cast in_visible_group field as an integer." 790e6ee
Dave Santoro 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
8507733
Dave Santoro 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
078f588
Dave Santoro 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
0e21a86
Dave Santoro Merge "Change Settings insert conflict to do an update." into ics-fac…
…toryrom
ae94a71
Dave Santoro resolved conflicts for merge of 078f588c to master
Change-Id: I17e4d57df3bb24388ca9ead92f9a40fc57bc0fd3
79168d5
Daisuke Miyakawa 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
8f79445
Dave Santoro 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
a9995c9
Dave Santoro am ae94a710: Merge "Change Settings insert conflict to do an update."…
… into ics-factoryrom

* commit 'ae94a710dbc0ea239277c25986e39ba53904c5fc':
  Change Settings insert conflict to do an update.
1744cae
Daisuke Miyakawa Merge "Make search aware of names in "all other contacts"" 4339e63
Dave Santoro am a9995c98: (-s ours) Fixes and cleanup for transactions.
* commit 'a9995c98ba99bcdd101bc4734fdb3ff08e9efe8f':
  Fixes and cleanup for transactions.
a418b1c
@mathewinwood mathewinwood Don't return 'dial' suggesitons if we're not voice capable.
Bug: 5317968
Change-Id: I52f9694de9781d0221e37078715398df69ae0354
873d6be
Dave Santoro 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
6efb7db
Dave Santoro 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
e57045a
Dave Santoro am e57045a9: (-s ours) DO NOT MERGE Port DB upgrades from master.
* commit 'e57045a9b0034063e14ea34b6574b0b0f9fc8998':
  DO NOT MERGE Port DB upgrades from master.
d48c290
@mathewinwood mathewinwood Merge "Don't return 'dial' suggesitons if we're not voice capable." 3746d12
Dave Santoro 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
c990980
Dave Santoro am c990980a: Fix deadlock opportunity.
* commit 'c990980ab4beb7b81c3337526f1bdcd5d1a14730':
  Fix deadlock opportunity.
fcc7025
Mark Brophy Handle complex phone numbers in ContactsProvider.
Use i18n.phonenumber.PhoneNumberUtil to check whether the query is a
phone number.

Bug: 5396858
Change-Id: If389f6d996c6789630d91834d45778f420c6dde3
20e9964
@flerda flerda Add new column for cached formatted number.
Bug: 5316982
Change-Id: I2870778c8056468730d82794ddae90c74cab85fc
13ed285
@flerda flerda Merge "Add new column for cached formatted number." cb639a5
Dave Santoro 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
3661211
Dave Santoro am 36612112: Implement new social stream permissions.
* commit '36612112760df799ef89f7e324e5dfabd5ca0d2b':
  Implement new social stream permissions.
3a2043b
Dave Santoro Fix search tests.
Change-Id: I70c53f954c1b0ef74edf505e8427cb78d66a4a8e
280eaf5
Dave Santoro 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
d9125ef
Dave Santoro 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
376917c
Daisuke Miyakawa 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
897e516
Dave Santoro 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
82792ae
Dave Santoro Merge "Detect profile VCard URIs and support tokens." into ics-mr0 73dab78
Dave Santoro Switch to using SecureRandom for tokens.
Bug 5462343

Change-Id: Ie54fc63eea215491f7e9d842a054996454765fb6
d0eb930
Daniel Lehmann Use hexadecimal collation key for name searches.
Also allow prefix search on name

Bug:5337763

Change-Id: I039264be0c8309224d8925ded06ab02a64a5ce1b
d1746e0
Daniel Lehmann Merge "Use hexadecimal collation key for name searches." into ics-mr0 9650d67
Daniel Lehmann Remove Live-Folders
Bug:5254892
Change-Id: I41cf5df369b887361e545d9e0acccef308824875
4004a43
Daniel Lehmann Merge "Remove Live-Folders" 906cae6
Justin Ho Update Contacts Provider app icon
Change-Id: I85ce57336d552cbda902c753b660232d40c0bf76
a16ece4
Justin Ho am a16ece42: Update Contacts Provider app icon
* commit 'a16ece42302a616832aa783725414d0fba37ddd8':
  Update Contacts Provider app icon
9d66078
Daniel Lehmann Code cleanup. Fixes most of the IDE warnings
Change-Id: Ibeff9a520563f6e1fea3f409ada6f934e98e4814
d1f800d
Daniel Lehmann Merge "Code cleanup. Fixes most of the IDE warnings" 283c573
Eric Fischer Import revised translations. DO NOT MERGE
Change-Id: I29d5c555df45af8d846a165ffb475f0d17577879
954f73f
Eric Fischer Merge "Import revised translations. DO NOT MERGE" into ics-mr0 a232d3f
Eric Fischer am a232d3fe: (-s ours) Merge "Import revised translations. DO NOT MER…
…GE" into ics-mr0

* commit 'a232d3fe5c79de1fae946d778249bd3ffb9d5d54':
  Import revised translations.  DO NOT MERGE
5d9ba56
Eric Fischer Import revised translations.
Change-Id: Iaf087944df02c2ef2525b6ccdc77dd2ac6e28025
837ade8
Eric Fischer Merge "Import revised translations." 43a8203
Eric Fischer Import revised translations. DO NOT MERGE
Change-Id: I9027270527106250574d1154ffe0f88a928f7f12
001465e
Eric Fischer am 001465e6: (-s ours) Import revised translations. DO NOT MERGE
* commit '001465e65436a4de1c781be59e52ff163167f1d0':
  Import revised translations.  DO NOT MERGE
7cbec84
Dave Santoro 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
5dccfb0
Dave Santoro am 5dccfb05: Fix deadlock case when removing accounts.
* commit '5dccfb059f5df0e9fdba026bcfbed677f44922cd':
  Fix deadlock case when removing accounts.
679acd3
Makoto Onuki DO NOT MERGE: Fix test crash in ContactsProvider2.initialize().
Seems like Secure.getLong() (and other methods) internally tries to get
the Settings provider from the passed context when it's called first time,
and it crases in tests because our mock context doesn't have it.

Let's just call it with an actual contxext when tests start so it'll initialize
the settings provider correctly.

Bug 5499268

Change-Id: I863862ead2078715621cb71b1cf15f0dd94c0feb
845da84
Eric Fischer Import revised translations. DO NOT MERGE
Change-Id: I03a17c8b8a2ee4b36624d0b0c3120bae78a4534a
22ac98e
Makoto Onuki 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
ac6f0b8
Makoto Onuki 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
23ba865
Makoto Onuki Merge "Don't use getInstalledPackages()." into ics-mr1 db09128
Makoto Onuki Merge "Speed up query for group tab" into ics-mr1 a2535f3
Daniel Lehmann Fix extreme slowness in FTS search
Bug:5534735
Change-Id: I561bcf32d3c66b1a86b36a043d407a725325419d
1322df8
Daniel Lehmann am 1322df8f: Fix extreme slowness in FTS search
* commit '1322df8f90d80587748ad10539516635326c01e8':
  Fix extreme slowness in FTS search
437d183
Eric Fischer Import revised translations.
Change-Id: Ib7832392ca17129129a2df647f22d4c71ea85d3e
1588582
Eric Fischer Merge "Import revised translations." into ics-mr1 35a2c51
Dave Santoro 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
b91899a
@flerda flerda 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
58795e4
Daniel Lehmann Match contacts if identities match.
Bug:5237405
Change-Id: I5def748ecd5ce7d9c847b06b5111217d5d577492
5f9a2c3
Daniel Lehmann In Email-lookup query, prefer visible over invisible contacts
Bug:5578303
Change-Id: I29beb8ce7ab0745b9f57b399fe017d60fbb96285
071d0e7
Daniel Lehmann Merge "In Email-lookup query, prefer visible over invisible contacts"…
… into ics-mr1
b5000cb
Daisuke Miyakawa 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
8ead0dc
Daniel Lehmann 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
72c4b26
Daniel Lehmann Merge "Optimize STREQUENT queries and fix estimated table row counts"…
… into ics-mr1
38f1fd2
Makoto Onuki 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
f5f038f
Makoto Onuki Fix for arabic crash
Make sure not to localize when using String.format to build SQL.

Bug 5619742

Change-Id: I66fd9c4a50dd6c083099a9def93840ff05aed5a6
a99ffbd
Makoto Onuki Merge "Fix for arabic crash" into ics-mr1 84af796
Eric Fischer Import revised translations. DO NOT MERGE
Change-Id: Icf5bb954609b5e27f033f29c5ff263d5748a2303
0195f51
Eric Fischer Import revised translations. DO NOT MERGE
Change-Id: Ie55a58b8c72816799caf1ab8139aa485c8e8f6b5
a02fe8b
Dave Santoro 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
1bc8603
@samuaz samuaz facebook contacts sync
Change-Id: Ie8b5a625ded04e3f8f061c67d374d3f435ce2f48
ac11b28
@cyanogen
Owner

Please submit all patches thru our Gerrit instance at http://r.cyanogenmod.com

@cyanogen cyanogen closed this
@ur0 ur0 referenced this pull request from a commit
@ur0 ur0 Rebranding commit #1
Change-Id: I1adea31af15e54343cb4621aeeb2422f463f45bb
51c902f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.