Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c327b3f authored by Erica Chang's avatar Erica Chang Committed by Gerrit Code Review
Browse files

Contacts Metrics: added directory search and bug fix

-Added directory search metrics
   >PeopleActivity plugin + fab onclick
   >Contacts card directory search onclick

-Fixed bugs for
    >db upgrade (upgrade only oldversion < new version not <=)
    >auto/manual merge count (was not capturing count increment
    with an existing count entry)
    >PeopleActivity plugin tab login nudge impression count (was
    tracking the event of leaving the plugin tab rather than going
    into the plugin tab)
    >NPE for getBytes() in InCallMetricsHelper.generateNudgeId()

-Consolidated InCallMetricsHelper.increaseCount to handle
all user action event types

CD-501, CD-527, CD-610

Change-Id: I6c8c2d951108d10be735365ebaf1b133cd4d52c1
parent 829ce776
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -34,7 +34,8 @@
        <!-- IntentService for InCall plugin metrics update -->
        <service android:name=".incall.InCallMetricsService" android:exported="false"/>
        <receiver android:name=".incall.InCallMetricsReceiver"
                  android:exported="true">
                  android:exported="true"
                  android:permission="com.android.contacts.incall.METRICS_PERMISSION">
            <intent-filter>
                <action android:name="com.android.contacts.incall.CONTACTS_AUTO_MERGE"/>
            </intent-filter>
+8 −3
Original line number Diff line number Diff line
@@ -971,9 +971,11 @@ public class PeopleActivity extends ContactsActivity implements
                if (fragment != null) {
                    fragment.setUserVisibleHint(true);
                }
                if (mCurrentPrimaryItem instanceof PluginContactBrowseListFragment) {
                    InCallMetricsHelper.increaseImpressionCount(PeopleActivity.this,
                        ((PluginContactBrowseListFragment) mCurrentPrimaryItem).getPluginInfo());
                if (fragment != null && fragment instanceof PluginContactBrowseListFragment) {
                    CallMethodInfo cmi = ((PluginContactBrowseListFragment) fragment)
                            .getPluginInfo().mCallMethodInfo;
                    InCallMetricsHelper.increaseImpressionCount(PeopleActivity.this, cmi,
                        InCallMetricsHelper.Events.INAPP_NUDGE_CONTACTS_TAB_LOGIN);
                }
                mCurrentPrimaryItem = fragment;
            }
@@ -1794,6 +1796,9 @@ public class PeopleActivity extends ContactsActivity implements
                        } catch (PendingIntent.CanceledException e) {
                            Log.d(TAG, "directory search exception: ", e);
                        }
                        InCallMetricsHelper.increaseCount(this,
                                InCallMetricsHelper.Events.DIRECTORY_SEARCH,
                                pluginInfo.mCallMethodInfo.mComponent.flattenToString());
                    }
                } else {
                    Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+148 −91
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

import com.google.common.base.Preconditions;

import java.util.LinkedList;
import java.util.List;

@@ -45,6 +43,11 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
            InAppColumns.NUDGE_ID + "==? AND " + InAppColumns.EVENT_ACCEPTANCE_TIME + " ==? ";
    private static final String SELECT_PROVIDER_AND_EVENT =
            UserActionsColumns.PROVIDER_NAME + "==? AND " + UserActionsColumns.EVENT_NAME + " ==?";
    private static final String SELECT_PROVIDER_AND_EVENT_AND_RAWID =
            UserActionsColumns.PROVIDER_NAME + "==? AND " + UserActionsColumns.EVENT_NAME +
                    " ==? AND " + UserActionsColumns.RAW_ID + " ==?";
    private static final String SELECT_EVENT_AND_RAWID = UserActionsColumns.EVENT_NAME + " ==? AND "
            + UserActionsColumns.RAW_ID + " ==?";

    public interface Tables {
        // stores events in the INAPP_ACTIONS category
@@ -116,24 +119,28 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
        entry.put(InAppColumns.PROVIDER_NAME, provider);
        String[] selectionArgs = new String[] {nudgeId, String.valueOf(0)};
        SQLiteDatabase db = getWritableDatabase();
        Cursor queryCursor = db.query(
        try (Cursor queryCursor = db.query(
                Tables.INAPP_TABLE,
                INAPP_PROJECTION,
                SELECT_NUDGE_ID_AND_ACCEPT_TIME,
                selectionArgs,
                null,
                null,
                null);
                null)) {
            if (queryCursor != null && queryCursor.moveToFirst()) {
                // increment existing entry
                entry.put(colName, queryCursor.getInt(queryCursor.getColumnIndex(colName)) + 1);
            db.update(Tables.INAPP_TABLE, entry, SELECT_NUDGE_ID_AND_ACCEPT_TIME, selectionArgs);
                db.update(Tables.INAPP_TABLE, entry, SELECT_NUDGE_ID_AND_ACCEPT_TIME,
                        selectionArgs);
            } else {
                // no entry where acceptance time is not set
                entry.put(colName, 1);
                db.insert(Tables.INAPP_TABLE, null, entry);
            }
        queryCursor.close();
        } catch (RuntimeException e) {
            Log.e(TAG, "incrementInAppParam exception: ", e);
        }

    }

    /**
@@ -159,6 +166,7 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
        }
        String[] selectionArgs = new String[] {nudgeId, String.valueOf(0)};
        SQLiteDatabase db = getWritableDatabase();
        try (
            Cursor queryCursor = db.query(
                    Tables.INAPP_TABLE,
                    INAPP_PROJECTION,
@@ -166,7 +174,8 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
                    selectionArgs,
                    null,
                    null,
                null);
                    null)) {

            ContentValues entry = new ContentValues();
            entry.put(InAppColumns.EVENT_NAME, event);
            entry.put(InAppColumns.CATEGORY, cat);
@@ -175,11 +184,16 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
            entry.put(InAppColumns.EVENT_ACCEPTANCE, accept);
            entry.put(InAppColumns.EVENT_ACCEPTANCE_TIME, System.currentTimeMillis());
            if (queryCursor != null && queryCursor.moveToFirst()) {
            db.update(Tables.INAPP_TABLE, entry, SELECT_NUDGE_ID_AND_ACCEPT_TIME, selectionArgs);
                db.update(Tables.INAPP_TABLE, entry, SELECT_NUDGE_ID_AND_ACCEPT_TIME,
                        selectionArgs);
            } else {
                entry.put(InAppColumns.COUNT, 1);
                db.insert(Tables.INAPP_TABLE, null, entry);
            }
            queryCursor.close();
        } catch (RuntimeException e) {
            Log.e(TAG, "setInAppAcceptance exception: ", e);
        }
    }

    /**
@@ -188,6 +202,7 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
     * increment the count stored in the "colName" column. Otherwise, create a new entry.
     *
     * @param  provider component name of the InCall provider
     * @param  rawIds   raw Ids of the contacts that are merged (auto or manual)
     * @param  event    metric event
     * @param  cat      metric category
     * @param  colName  database column name to increment
@@ -196,35 +211,67 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
            cat, String colName) {
        // query for event type, update, if not found insert
        ContentValues entry = new ContentValues();
        entry.put(UserActionsColumns.EVENT_NAME, event);
        entry.put(UserActionsColumns.CATEGORY, cat);
        entry.put(UserActionsColumns.PROVIDER_NAME, provider);
        entry.put(UserActionsColumns.RAW_ID, rawIds);

        String selectionString;
        String[] selectionArgs = new String[] {provider, event};
        SQLiteDatabase db = getWritableDatabase();
        Cursor queryCursor = db.query(
        boolean isMergeEvent = event.equals(InCallMetricsHelper.Events.CONTACTS_AUTO_MERGED.value())
                || event.equals(InCallMetricsHelper.Events.CONTACTS_MANUAL_MERGED.value());
        if (event.equals(InCallMetricsHelper.Events.CONTACTS_AUTO_MERGED.value())) {
            // contacts provider fires the auto aggregation intent even after a manual merge,
            // need to check if there's an existing manual merge entry first
            try (Cursor queryCursor = db.query(
                        Tables.USER_ACTIONS_TABLE,
                        USER_ACTIONS_PROJECTION,
                SELECT_PROVIDER_AND_EVENT,
                selectionArgs,
                        SELECT_EVENT_AND_RAWID,
                        new String[]
                                {InCallMetricsHelper.Events.CONTACTS_MANUAL_MERGED.value(), rawIds},
                        null,
                        null,
                null);
                        null)) {
                if (queryCursor != null && queryCursor.moveToFirst()) {
            // increment existing entry, only increment if it's manual merge
            if (event.equals(InCallMetricsHelper.Events.CONTACTS_MANUAL_MERGED)) {
                    // there's already a manual entry, return
                    return;
                }
            } catch (RuntimeException e) {
                Log.e(TAG, "incrementUserActionsParam query existing entry exception: ", e);
            }
        }
        entry.put(UserActionsColumns.EVENT_NAME, event);
        if (isMergeEvent) {
            selectionString = SELECT_PROVIDER_AND_EVENT_AND_RAWID;
            selectionArgs = new String[] {provider, event, rawIds};
        } else {
            selectionString = SELECT_PROVIDER_AND_EVENT;
            selectionArgs = new String[] {provider, event};
        }
        try (Cursor cursor = db.query(
                    Tables.USER_ACTIONS_TABLE,
                    USER_ACTIONS_PROJECTION,
                    selectionString,
                    selectionArgs,
                    null,
                    null,
                    null)) {
            if (cursor != null && cursor.moveToFirst()) {
                // increment count for an existing entry
                if (!isMergeEvent) {
                    // do not update existing merge count entries
                    entry.put(colName,
                        queryCursor.getInt(queryCursor.getColumnIndex(colName)) + 1);
                db.update(Tables.USER_ACTIONS_TABLE, entry, SELECT_PROVIDER_AND_EVENT,
                        selectionArgs);
                            cursor.getInt(cursor.getColumnIndex(colName)) + 1);
                    db.update(Tables.USER_ACTIONS_TABLE, entry, selectionString, selectionArgs);
                }
            } else {
            // no existing entry, create one
                // no existing entry, create a new one
                entry.put(colName, 1);
                db.insert(Tables.USER_ACTIONS_TABLE, null, entry);
            }
        queryCursor.close();
        } catch (RuntimeException e) {
            Log.e(TAG, "incrementUserActionsParam query and update exception: ", e);
        }
    }

    /**
@@ -248,7 +295,7 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
                return list;
        }
        SQLiteDatabase db = getWritableDatabase();
        Cursor cursor = db.rawQuery("SELECT * FROM " + table, null);
        try (Cursor cursor = db.rawQuery("SELECT * FROM " + table, null)) {
            if (cursor != null && cursor.moveToFirst()) {
                do {
                    ContentValues entry = new ContentValues();
@@ -259,7 +306,9 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
            if (!DEBUG && clear) {
                db.delete(table, null, null);
            }
        cursor.close();
        } catch (RuntimeException e) {
            Log.e(TAG, "getAllEntries exception: ", e);
        }
        return list;
    }

@@ -274,7 +323,7 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
            Log.e(TAG, "Malformed database version..recreating database");
        }

        if (oldVersion <= newVersion) {
        if (oldVersion < newVersion) {
            setupTables(db);
        }
    }
@@ -303,6 +352,7 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {

    private void setupTables(SQLiteDatabase db) {
        dropTables(db);
        try {
            db.execSQL("CREATE TABLE " + Tables.INAPP_TABLE + " (" +
                    InAppColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " +
                    InAppColumns.CATEGORY + " TEXT, " +
@@ -321,10 +371,17 @@ public class InCallMetricsDbHelper extends SQLiteOpenHelper {
                    UserActionsColumns.PROVIDER_NAME + " TEXT, " +
                    UserActionsColumns.RAW_ID + " INTEGER DEFAULT 0" +
                    ");");
        } catch (RuntimeException e) {
            Log.e(TAG, "setupTables exception: ", e);
        }
    }

    public void dropTables(SQLiteDatabase db) {
        try {
            db.execSQL("DROP TABLE IF EXISTS " + Tables.INAPP_TABLE);
            db.execSQL("DROP TABLE IF EXISTS " + Tables.USER_ACTIONS_TABLE);
        } catch (RuntimeException e) {
            Log.e(TAG, "dropTables exception: ", e);
        }
    }
}
 No newline at end of file
+104 −90
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.Handler;
import android.os.HandlerThread;
import android.os.SystemClock;
import android.provider.ContactsContract.RawContacts;
import android.text.TextUtils;
import android.util.Log;

import com.android.phone.common.ambient.AmbientConnection;
@@ -41,11 +42,12 @@ import cyanogenmod.providers.CMSettings;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;

public class InCallMetricsHelper {
    private static final String TAG = InCallMetricsHelper.class.getSimpleName();
@@ -83,6 +85,7 @@ public class InCallMetricsHelper {
        CONTACTS_MANUAL_MERGED("CONTACTS_MANUAL_MERGED"),
        CONTACTS_AUTO_MERGED("CONTACTS_AUTO_MERGED"),
        INVITES_SENT("INVITES_SENT"),
        DIRECTORY_SEARCH("DIRECTORY_SEARCH"),
        INAPP_NUDGE_CONTACTS_LOGIN("INAPP_NUDGE_CONTACTS_LOGIN"),
        INAPP_NUDGE_CONTACTS_INSTALL("INAPP_NUDGE_CONTACTS_INSTALL"),
        INAPP_NUDGE_CONTACTS_TAB_LOGIN("INAPP_NUDGE_CONTACTS_TAB_LOGIN"),
@@ -121,6 +124,12 @@ public class InCallMetricsHelper {
            return mValue.toLowerCase();
        }
   }
    private static Comparator<String> sRawIdComparator = new Comparator<String> () {
        @Override
        public int compare(String o1, String o2)  {
            return Integer.parseInt(o1) - Integer.parseInt(o2);
        }
    };

    public static void init(Context context) {
        InCallMetricsHelper helper = getInstance(context);
@@ -286,7 +295,8 @@ public class InCallMetricsHelper {
        return true;
    }

    public static void increaseInviteCount(final Context context, final String provider) {
    public static void increaseCount(final Context context, final Events event, final String
            provider) {
        final InCallMetricsHelper helper = getInstance(context);
        helper.mHandler.post(new Runnable() {
            @Override
@@ -294,8 +304,7 @@ public class InCallMetricsHelper {
                if (!statsOptIn(context)) {
                    return;
                }
                helper.mDbHelper.incrementUserActionsParam(provider, "",
                        Events.INVITES_SENT.value(),
                helper.mDbHelper.incrementUserActionsParam(provider, "", event.value(),
                        Categories.USER_ACTIONS.value(),
                        Parameters.COUNT.value().toLowerCase());
            }
@@ -342,7 +351,7 @@ public class InCallMetricsHelper {
    }

    /**
     * Increases the impression count for different nudges in contacts card
     * Increases the impression count for different nudges in
     *
     * @param  context  context
     * @param  cmi      CallMethodInfo for the entry
@@ -350,7 +359,7 @@ public class InCallMetricsHelper {
     */
    public static void increaseImpressionCount(final Context context, final CallMethodInfo cmi,
            final Events event) {
        if (cmi == null) {
        if (cmi == null || cmi.mComponent == null) {
            return;
        }
        final InCallMetricsHelper helper = getInstance(context);
@@ -373,44 +382,23 @@ public class InCallMetricsHelper {
                                generateNudgeId(cmi.mLoginNudgeSubtitle),
                                Parameters.COUNT.toCol());
                        break;
                    default:
                        break;
                }
            }
        });
    }

    /**
     * Increases the impression count for contacts tab login
     *
     * @param  context    context
     * @param  pluginInfo list of plugin info
     */
    public static void increaseImpressionCount(final Context context, final InCallPluginInfo
            pluginInfo) {
        final InCallMetricsHelper helper = getInstance(context);
        if (pluginInfo == null) {
            return;
        }
        helper.mHandler.post(new Runnable() {
            @Override
            public void run() {
                if (!statsOptIn(context)) {
                    return;
                }
                CallMethodInfo cmi = pluginInfo.mCallMethodInfo;
                    case INAPP_NUDGE_CONTACTS_TAB_LOGIN:
                        if (!cmi.mIsAuthenticated) {
                            helper.mDbHelper.incrementInAppParam(cmi.mComponent.flattenToString(),
                            Events.INAPP_NUDGE_CONTACTS_TAB_LOGIN.value(),
                            Categories.INAPP_NUDGES.value(), generateNudgeId(cmi.mLoginSubtitle),
                                    event.value(),
                                    Categories.INAPP_NUDGES.value(),
                                    generateNudgeId(cmi.mLoginSubtitle),
                                    Parameters.COUNT.toCol());
                        }
                    default:
                        break;
                }
            }
        });
    }

    /**
     * Increases contact merge counts
     * Increases manual contact merge counts
     *
     * @param  context          context
     * @param  contactIdForJoin the primary contact ID to be merged
@@ -425,30 +413,28 @@ public class InCallMetricsHelper {
                if (!statsOptIn(context)) {
                    return;
                }
                HashMap<ComponentName, CallMethodInfo> plugins = ContactsDataSubscription.get
                        (context).getPluginInfo();
                HashMap<String, String> pluginMap = new HashMap<String, String>();
                for (CallMethodInfo cmi : plugins.values()) {
                    if (DEBUG) {
                        Log.d(TAG, "increaseContactMergeCount:" + cmi.mAccountType + " " +
                                cmi.mComponent.flattenToString());
                    }
                    pluginMap.put(cmi.mAccountType, cmi.mComponent.flattenToString());
                }
                Set<String> providerSet = queryContactProviderByContactIds(context,
                        contactIdForJoin, contactId, pluginMap);

                SortedSet<String> rawIdSet = new TreeSet<String>(sRawIdComparator);
                SortedSet<String> providerSet = queryContactProviderByContactIds(context,
                        contactIdForJoin, contactId, rawIdSet);
                String[] rawIdArray = rawIdSet.toArray(new String[rawIdSet.size()]);
                List<String> providerList = new ArrayList<String>(providerSet);
                Collections.sort(providerList);
                String joinedProvider = providerList.size() == 0 ? "" :
                        Joiner.on(",").skipNulls().join(providerList);
                helper.mDbHelper.incrementUserActionsParam(joinedProvider, "",
                String joinedRawIds = rawIdArray.length == 0 ? "" :
                        Joiner.on(",").skipNulls().join(rawIdArray);
                helper.mDbHelper.incrementUserActionsParam(joinedProvider, joinedRawIds,
                        InCallMetricsHelper.Events.CONTACTS_MANUAL_MERGED.value(),
                        Categories.USER_ACTIONS.value(), Parameters.COUNT.toCol());
            }
        });
    }

    /**
     * Increases auto contact merge counts
     *
     * @param  context  context
     * @param  rawIds   the merged raw contact IDs
     */
    public static void increaseContactAutoMergeCount(final Context context, final String rawIds) {
        final InCallMetricsHelper helper = getInstance(context);
        helper.mHandler.post(new Runnable() {
@@ -458,11 +444,11 @@ public class InCallMetricsHelper {
                    return;
                }
                String[] rawIdArray = rawIds.split(",");
                Arrays.sort(rawIdArray);
                Set<String> providerSet = queryContactProviderByRawContactIds(context, rawIdArray);

                Arrays.sort(rawIdArray, sRawIdComparator);
                SortedSet<String> providerSet = queryContactProviderByRawContactIds(context,
                        rawIdArray);
                List<String> providerList = new ArrayList<String>(providerSet);
                Collections.sort(providerList);

                String joinedProvider = providerList.size() == 0 ? "" :
                        Joiner.on(",").skipNulls().join(providerList);
                String joinedRawIds = rawIdArray.length == 0 ? "" :
@@ -477,54 +463,82 @@ public class InCallMetricsHelper {
    }

    /**
     * Check if the provided contact IDs is from an account type that matches a InCall
     * provider.
     * Check if the provided contact IDs is from an account type that matches a InCall provider.
     *
     * @param  context     context
     * @param  contactId   the primary contact ID to be merged
     * @param  contactId2  the secondary contact ID to be merged
     * @parma  pluginMap        the <accountType, plugin name> pairs for lookup
     * @param  rawIdSet    merged raw contac ID set filled by this method
     */
    private static Set<String> queryContactProviderByContactIds(Context context, long contactId,
            long contactId2, HashMap<String, String> pluginMap) {
        Set<String> providerSet = new HashSet<String>();
        Cursor cursor = context.getContentResolver().query(RawContacts.CONTENT_URI,
                new String[] {RawContacts.ACCOUNT_TYPE},
    private static SortedSet<String> queryContactProviderByContactIds(Context context, long
            contactId, long contactId2, Set<String> rawIdSet) {
        SortedSet<String> providerSet = new TreeSet<String>();
        HashMap<String, String> pluginMap = InCallPluginUtils.getPluginAccountComponentPairs
                (context);
        try (Cursor cursor = context.getContentResolver().query(RawContacts.CONTENT_URI,
                    new String[]{RawContacts.ACCOUNT_TYPE, RawContacts._ID},
                    RawContacts.CONTACT_ID + "=? OR " + RawContacts.CONTACT_ID + "=?",
                new String[]{String.valueOf(contactId), String.valueOf(contactId2)}, null);
        if (cursor != null && cursor.moveToFirst()) {
            do {
                providerSet.add(cursor.getString(0));
                    new String[]{String.valueOf(contactId), String.valueOf(contactId2)}, null)) {
            if (cursor != null) {
                while (cursor.moveToNext()) {
                    String accountType = cursor.getString(0); // RawContacts.ACCOUNT_TYPE
                    if (pluginMap.containsKey(accountType)) {
                        // a plugin, use component name
                        providerSet.add(pluginMap.get(accountType));
                    } else {
                        // not a plugin, use account type instead
                        providerSet.add(accountType);
                    }
                    rawIdSet.add(String.valueOf(cursor.getInt(1))); // _ID
                    if (DEBUG) Log.d(TAG, "queryContactProvider:" + cursor.getString(0));
            } while (cursor.moveToNext());
                }
        cursor.close();
            }
        } catch (RuntimeException e) {
            Log.e(TAG, "queryContactProiderByContactIds exception: ", e);
        }
        return providerSet;
    }

    private static Set<String> queryContactProviderByRawContactIds(Context context, String[]
    /**
     * Check if the provided raw contact IDs is from an account type that matches an InCall
     * provider.
     *
     * @param  context  context
     * @param  rawIds   raw contact IDs of the contacts
     */
    private static SortedSet<String> queryContactProviderByRawContactIds(Context context, String[]
            rawIds) {
        Set<String> providerSet = new HashSet<String>();
        Cursor cursor = null;
        SortedSet<String> providerSet = new TreeSet<String>();
        HashMap<String, String> pluginMap = InCallPluginUtils.getPluginAccountComponentPairs
                (context);
        for (String rawId : rawIds) {
            cursor = context.getContentResolver().query(RawContacts.CONTENT_URI,
            try (Cursor cursor = context.getContentResolver().query(RawContacts.CONTENT_URI,
                        new String[]{RawContacts.ACCOUNT_TYPE},
                        RawContacts._ID + "=?",
                    new String[]{rawId}, null);
            if (cursor != null && cursor.moveToFirst()) {
                do {
                    providerSet.add(cursor.getString(0));
                    if (DEBUG) Log.d(TAG, "queryContactProvider:" + cursor.getString(0));
                } while (cursor.moveToNext());
                        new String[]{rawId}, null)) {
                if (cursor != null) {
                    while (cursor.moveToFirst()) {
                        String accountType = cursor.getString(0); // RawContacts.ACCOUNT_TYPE
                        if (pluginMap.containsKey(accountType)) {
                            providerSet.add(pluginMap.get(accountType));
                        } else {
                            providerSet.add(accountType);
                        }
                        providerSet.add(accountType);
                        if (DEBUG) Log.d(TAG, "queryContactProvider:" + accountType);
                    }
                }
            } catch (RuntimeException e) {
                Log.e(TAG, "queryContactProviderByRawContactIds exception: ", e);
            }
        if (cursor != null) {
            cursor.close();
        }
        return providerSet;
    }

    public static String generateNudgeId(String data) {
        if (TextUtils.isEmpty(data)) {
            return "";
        }
        return java.util.UUID.nameUUIDFromBytes(data.getBytes()).toString();
    }

+17 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading