From 132b7de9ed3ca96d613fdff20ccf0e2ebbad0d34 Mon Sep 17 00:00:00 2001 From: Erica Chang Date: Tue, 15 Mar 2016 19:32:49 -0700 Subject: Contacts: automatic merge count metrics CD-297 Change-Id: I08250503463b9fa3cedd2f800b20c298cc1b0786 --- Android.mk | 2 ++ AndroidManifest_cm.xml | 5 +++++ .../providers/contacts/aggregation/ContactAggregator2.java | 11 +++++++++++ 3 files changed, 18 insertions(+) create mode 100644 AndroidManifest_cm.xml diff --git a/Android.mk b/Android.mk index 0d4b81a..b13fcce 100644 --- a/Android.mk +++ b/Android.mk @@ -10,6 +10,8 @@ LOCAL_SRC_FILES += \ LOCAL_JAVA_LIBRARIES := ext telephony-common +LOCAL_FULL_LIBS_MANIFEST_FILES := $(LOCAL_PATH)/AndroidManifest_cm.xml + LOCAL_STATIC_JAVA_AAR_LIBRARIES := ambientsdk-internal LOCAL_STATIC_JAVA_LIBRARIES += android-common com.android.vcard guava diff --git a/AndroidManifest_cm.xml b/AndroidManifest_cm.xml new file mode 100644 index 0000000..e5e5aff --- /dev/null +++ b/AndroidManifest_cm.xml @@ -0,0 +1,5 @@ + + + + diff --git a/src/com/android/providers/contacts/aggregation/ContactAggregator2.java b/src/com/android/providers/contacts/aggregation/ContactAggregator2.java index 5372bbd..133a508 100644 --- a/src/com/android/providers/contacts/aggregation/ContactAggregator2.java +++ b/src/com/android/providers/contacts/aggregation/ContactAggregator2.java @@ -19,6 +19,8 @@ package com.android.providers.contacts.aggregation; import static com.android.providers.contacts.aggregation.util.RawContactMatcher.SCORE_THRESHOLD_PRIMARY; import static com.android.providers.contacts.aggregation.util.RawContactMatcher.SCORE_THRESHOLD_SECONDARY; import static com.android.providers.contacts.aggregation.util.RawContactMatcher.SCORE_THRESHOLD_SUGGEST; + +import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.provider.ContactsContract.AggregationExceptions; @@ -71,6 +73,10 @@ public class ContactAggregator2 extends AbstractContactAggregator { private final RawContactMatcher mMatcher = new RawContactMatcher(); + private static final String ACTION_CONTACTS_AUTO_MERGE = + "com.android.contacts.incall.CONTACTS_AUTO_MERGE"; + private static final String CONTACT_AUTO_MERGE_KEY_RAW_IDS = "RAW_IDS"; + /** * Constructor. */ @@ -367,6 +373,11 @@ public class ContactAggregator2 extends AbstractContactAggregator { if (VERBOSE_LOGGING) { Log.v(TAG, "Aggregating rids=" + connectedRawContactIds); } + // metrics + Intent intent = new Intent(ACTION_CONTACTS_AUTO_MERGE); + intent.putExtra(CONTACT_AUTO_MERGE_KEY_RAW_IDS, connectedRids); + mContactsProvider.getContext().sendBroadcast(intent); + markAggregated(db, connectedRids); for (Long cid : cidsNeedToBeUpdated) { -- cgit v1.1