summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/contacts/ProfileAwareUriMatcher.java
Commit message (Collapse)AuthorAgeFilesLines
* Use content_uri constants instead of locally defined string.Chiao Cheng2013-11-011-1/+7
| | | | | | This makes it easier to trace URI to provider methods and visa versa. Change-Id: I7961eeba3b88362f1323483ede14865dc7f56948
* Reorganize import in contacts providerMakoto Onuki2012-06-271-3/+3
| | | | Change-Id: If3afb134ea36bd93859efcd114885526e1592b91
* Detect profile VCard URIs and support tokens.Dave Santoro2011-10-131-1/+7
| | | | | | | | | | 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
* Separate the profile out into a separate database.Dave Santoro2011-08-301-0/+121
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