diff options
author | Chiao Cheng <chiaocheng@google.com> | 2013-11-07 11:13:33 -0800 |
---|---|---|
committer | Chiao Cheng <chiaocheng@google.com> | 2013-11-07 11:13:33 -0800 |
commit | ff3e7fb1c51dc695d4cdf64e25cb17f1364bcddc (patch) | |
tree | fdc64c3c3f7c9a8281bc6e939cc771887c0c34cb | |
parent | 116f57fe659db05186ce85aa192bd65a974684e9 (diff) | |
download | ContactsProvider-ff3e7fb1c51dc695d4cdf64e25cb17f1364bcddc.tar.gz |
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
-rw-r--r-- | src/com/android/providers/contacts/ContactsDatabaseHelper.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java index 4cd01eb9..068e595a 100644 --- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java +++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java @@ -1358,6 +1358,14 @@ public class ContactsDatabaseHelper extends SQLiteOpenHelper { ContentResolver.requestSync(null /* all accounts */, ContactsContract.AUTHORITY, new Bundle()); + + // Only send broadcasts for regular contacts db. + if (dbForProfile() == 0) { + final Intent dbCreatedIntent = new Intent( + ContactsContract.Intents.CONTACTS_DATABASE_CREATED); + dbCreatedIntent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); + mContext.sendBroadcast(dbCreatedIntent, android.Manifest.permission.READ_CONTACTS); + } } protected void initializeAutoIncrementSequences(SQLiteDatabase db) { |