BUG:
1: Restore the factory settings. After the instance is restarted, set it to Chinese in the setup wizard. Enable WiFi and synchronize the Google Contacts. You can search for the contacts. After synchronization, unplug the battery and reboot, enter the dial or contact. No contact is found.
2: Restore the factory settings. After the instance is restarted, set it to Chinese in the setup wizard. You can search for contacts in the output card. After a period of time, it takes about half an hour (lunch ), enter the dial or contact. No contact is found. (This is irrelevant to the Google account contact)
Cause:
The encoding of the phone number search keyword is related to locale. After locale changes, the encoding of the Name field in the search index table on the mobile phone is not updated and does not match the encoding of the search keyword.
Import countermeasure:
1. Google's modification solution: re-create the search index table when switching the language.
2. Check locale at startup. If the encoding in the search index table is inconsistent with the keyword encoding, re-create the search index table.
3. re-create the search index table when the encoding of the search index table is inconsistent with that of the keyword during each search.
Impact scope:
The modified content is the data support section of the contact.
The following is the patch for modifying the Code:
Commit f054692f0d2cf09dbfed7ff0bcc391baf9295576author: wutuo <wutuo @ e89ae1c7-cfc9-4d8c-8e5a-bd7b9746a3ba> date: Sun Feb 17 09:25:50 2013 + 0000 solution: Google account after synchronization restart cannot find the contact Git-svn-ID: SVN: // XXX. xxx. xxx. xxx/xxx @ 2103 e89ae1c7-cfc9-4d8c-8e5a-bd7b9746a3badiff -- git a/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/contactsdatabasehelper. java B/Alps/packages/providers/contactspro Vider/src/COM/Android/providers/contacts/contactsdatabasehelper. javaindex 3392b38 .. 4010000dd 100644 --- A/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/contactsdatabasehelper. java ++ B/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/contactsdatabasehelper. java @-2597,6 + 2597,7 @ public class contactsdatabasehelper extends sqliteopenhelper {If (upgradesearchindex) {createsearchindextable (db); setproperty (dB, searchindexmanager. property_search_index_version, "0"); + setproperty (dB, searchindexmanager. property_search_index_locale, "");} If (rescandirectories) {diff -- git a/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/contactsprovider2.java B/Alps/packages/providers/contactsprovider/src/COM/android /provid ERS/contacts/contactsprovider2.javaindex 040cc79 .. 8fc4e54 100644 --- A/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/contactsprovider2.java ++ B/Alps/packages/providers/contactsprovider/src/COM /Android/providers/contacts/contactsprovider2.java @-1791,6 + 1791,7 @ public class contactsprovider2 extends actcontactsprovider setproviderstatus (providerstatus. status_ch Anging_locale); mcontactshelper. setlocale (this, currentlocale); mprofilehelper. setlocale (this, currentlocale); + msearchindexmanager. updateindex (true); prefs. edit (). putstring (pref_locale, currentlocale. tostring ()). apply (); invalidatefastscrollingindexcache (); setproviderstatus (providerstatus); @-1821,7 + 1822,7 @ public class contactsprovider2 extends abstractcontactsprovider} protected void UPDA Tesearchindexinbackground () {-msearchindexmanager. updateindex (); + msearchindexmanager. updateindex (false);} protected void Merge (Boolean rescan) {@-5792,6 + 5793,10 @ public class contactsprovider2 extends case phones_filter: Case callables_filter: {+ If (! Msearchindexmanager. getsearchindexlocale (). equals (namenormalizer. getlocale (). tostring () + {+ schedulebackgroundtask (background_task_update_search_index); ++} final string mimetypeisphoneexpression = datacolumns. mimetype_id + "=" + mdbhelper. get (). getmimetypeidforphone (); final string mimetypeissipexpression = diff -- git a/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/Na Menormalizer. java B/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/namenormalizer. javaindex d91bd7c .. 193f449 100644 --- A/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/namenormalizer. java ++ B/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/namenormalizer. java-29,11 + 29,13 import Java. text. rulebasedcollator; Public class namenormalizer {Private Static final rulebasedcollator scompressingcollator; + Private Static final locale mlocale; static {scompressingcollator = (rulebasedcollator) collator. getinstance (locale. getdefault (); scompressingcollator. setstrength (collator. primary); scompressingcollator. setdecomposition (collator. canonical_decomposition); + mlocale = locale. getdefault ();} Private Static F Inal rulebasedcollator scomplexitycollator; static {@-41,6 + 43,10 @ public class namenormalizer {scomplexitycollator. setstrength (collator. secondary);} + public static locale getlocale () {+ return mlocale; +} +/*** converts the supplied name to a string that can be used to perform approximate matching * of names. it ignores non-letter, non-digit characters, and removes accents. diff -- git a/Al PS/packages/providers/contactsprovider/src/COM/Android/providers/contacts/searchindexmanager. java B/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/searchindexmanager. javaindex bd4e1cc .. c9d6fe3 100644 --- A/Alps/packages/providers/contactsprovider/src/COM/Android/providers/contacts/searchindexmanager. java ++ B/Alps/packages/providers/contactsprovider/src/COM/Android/PROV Iders/contacts/searchindexmanager. java @-42,6 + 42,7 @ import Java. util. hashset; import Java. util. list; import Java. util. set; import Java. util. regEx. pattern; + import Java. util. locale;/*** maintains a search index for comprehensive contact search. @-52,6 + 53,7 @ public class searchindexmanager {Private Static final Boolean verbose_logging = log. isloggable (TAG, log. verbose); public static final String property_search_index_version = "search_index"; + public static final string property_search_index_locale = "search_index_locale"; Private Static final int search_index_version = 1; private Static final class contactindexquery {- 243,16 + 245,26 @ public class searchindexmanager {mdbhelper = (contactsdatabasehelper) mcontactsprovider. getdatabasehelper ();}-Public void updateindex (){- If (getsearchindexversion () = search_index_version) {-return;-} + public void updateindex (Boolean force) {+ If (! Getsearchindexlocale (). equals (namenormalizer. getlocale (). tostring () + {+ setsearchindexversion (0); ++ if (Force) {+ setsearchindexversion (0); ++ else + else {+ If (getsearchindexversion () = search_index_version) {+ return; ++} +} sqlitedatabase DB = mdbhelper. getwritabledatabase (); dB. begintransaction (); try {If (getsearchindexversion ()! = Search_index_version) {rebuildindex (db); setsearchindexversion (search_index_version); + setsearchindexlocale (namenormalizer. getlocale (). tostring (); dB. settransactionsuccessful () ;}} finally {@- 394,6 + 406,14 @ public class searchindexmanager {mdbhelper. setproperty (property_search_index_version, String. valueof (Version);} + Public String getsearchindexlocale () {+ return mdbhelper. getproperty (property_search_index_locale, "0"); ++ public void setsearchindexlocale (string locale) {+ mdbhelper. setproperty (property_search_index_locale, locale); ++/*** token separator that matches SQLite's "simple" tokenizer. *-Unicode codepoints >=128: everything