diff options
author | Rohit Yengisetty <rohit@cyngn.com> | 2015-10-08 18:31:42 -0700 |
---|---|---|
committer | Rohit Yengisetty <rohit@cyngn.com> | 2015-12-14 14:29:55 -0800 |
commit | 4852f70aaa45078b6874c146d38bf872f6b6b509 (patch) | |
tree | 726178fd8411206ace7ce36b8e8c2c362afd87d5 /res | |
parent | 7394f186d54d676516bd2766be39ab8182d1614e (diff) | |
download | packages_providers_ContactsProvider-4852f70aaa45078b6874c146d38bf872f6b6b509.zip packages_providers_ContactsProvider-4852f70aaa45078b6874c146d38bf872f6b6b509.tar.gz packages_providers_ContactsProvider-4852f70aaa45078b6874c146d38bf872f6b6b509.tar.bz2 |
Add a richer system around preloading contacts
Change-Id: I2c3b6b79ee41eb73948f9a053454654ee8566a12
Diffstat (limited to 'res')
-rw-r--r-- | res/raw/preloaded_contacts.json | 0 | ||||
-rw-r--r-- | res/raw/preloaded_contacts_schema.json | 59 | ||||
-rw-r--r-- | res/values/config.xml | 3 |
3 files changed, 62 insertions, 0 deletions
diff --git a/res/raw/preloaded_contacts.json b/res/raw/preloaded_contacts.json new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/res/raw/preloaded_contacts.json diff --git a/res/raw/preloaded_contacts_schema.json b/res/raw/preloaded_contacts_schema.json new file mode 100644 index 0000000..384d87f --- /dev/null +++ b/res/raw/preloaded_contacts_schema.json @@ -0,0 +1,59 @@ +/* + This file encodes the contact information that must be preloaded into + the contacts database. The contact information is encoded according + to the schema outlined below. + + The top-level object is an array of 'contacts'. Each of the array elements + is a contact with an array called 'data' defined within. Each of the objects + within 'data' objects describe an aspect of the contact - name, phone number, + address etc. Each aspect becomes a row in the raw_contacts table within + the contacts database. + + When describing a property for a contact aspect, the keys and values can + reference java fields. These fields will be resolved at runtime. This enables + us to leverage the fields defined in android.provider.ContactsContract.* classes + to describe the contact information. + + Note that if any java fields are referenced, they must be fully qualified names + as seen from a ClassLoader's perspective. There is no validation done to ensure + that the fields names can be resolved till runtime. + + Conveniences afforded while declaring contact information : + @ = android.provider.ContactsContract$CommonDataKinds + @mimetype = android.provider.ContactsContract$Data.MIMETYPE + + Example : + { + "contacts": [ + { + "data": [ + { + "@mimetype": "{{@$StructuredName.CONTENT_ITEM_TYPE}}", + "@$StructuredName.DISPLAY_NAME": "John Doe" + }, + + { + "@mimetype": "{{@$Phone.CONTENT_ITEM_TYPE}}", + "@$Phone.NUMBER": "123-456-7890", + "@$Phone.TYPE": "{{@$Phone.TYPE_WORK}}" + } + ] + } + ] + } + + Property values can be static values or expressions that need to be evaluated, like + the property keys. Values are interpolated when enclosed within + double-curly-braces - '{{' - akin to a templating system like Handlebars. + + Limitations : + - currently, for property values, there is no provision to embed an + expression-to-be-evaluated, within a larger string + ex. "{{com.example.foo.BAR}} additional content" isn't valid + + - lack of compile time validation of the java fields specified or of the syntax + + - lack of compile time validation of the property keys' with-respect-to the + columns of the raw_contacts table + +*/
\ No newline at end of file diff --git a/res/values/config.xml b/res/values/config.xml index 3707bcc..4c97cb8 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -33,4 +33,7 @@ <!-- If true, it supports fuzzy search for contacts number --> <bool name="phone_number_fuzzy_search">false</bool> + <!-- request to attempt preload-ing contacts --> + <bool name="config_preload_contacts">false</bool> + </resources> |