Merge "Remove never used SocialProvider and activity table" into jb-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 10d33d3..dcd561c 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -59,14 +59,6 @@
             android:permission="com.android.voicemail.permission.ADD_VOICEMAIL">
         </provider>
 
-        <!-- TODO: create permissions for social data -->
-        <provider android:name="SocialProvider"
-            android:authorities="com.android.social"
-            android:syncable="false"
-            android:multiprocess="false"
-            android:readPermission="android.permission.READ_CONTACTS"
-            android:writePermission="android.permission.WRITE_CONTACTS" />
-
         <!-- Handles database upgrades after OTAs, then disables itself -->
         <receiver android:name="ContactsUpgradeReceiver">
             <!-- This broadcast is sent after the core system has finished
diff --git a/src/com/android/providers/contacts/ContactsDatabaseHelper.java b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
index 2e43177..67429ca 100644
--- a/src/com/android/providers/contacts/ContactsDatabaseHelper.java
+++ b/src/com/android/providers/contacts/ContactsDatabaseHelper.java
@@ -72,7 +72,6 @@
 import android.provider.ContactsContract.StatusUpdates;
 import android.provider.ContactsContract.StreamItemPhotos;
 import android.provider.ContactsContract.StreamItems;
-import android.provider.SocialContract.Activities;
 import android.provider.VoicemailContract;
 import android.provider.VoicemailContract.Voicemails;
 import android.telephony.PhoneNumberUtils;
@@ -108,7 +107,7 @@
      *   700-799 Jelly Bean
      * </pre>
      */
-    static final int DATABASE_VERSION = 703;
+    static final int DATABASE_VERSION = 704;
 
     private static final String DATABASE_NAME = "contacts2.db";
     private static final String DATABASE_PRESENCE = "presence_db";
@@ -243,8 +242,6 @@
                 + "  ON (mimetypes.mimetype='" + GroupMembership.CONTENT_ITEM_TYPE + "' "
                 + "      AND groups._id = data." + GroupMembership.GROUP_ROW_ID + ") ";
 
-        public static final String ACTIVITIES = "activities";
-
         public static final String ACTIVITIES_JOIN_MIMETYPES = "activities "
                 + "LEFT OUTER JOIN mimetypes ON (activities.mimetype_id = mimetypes._id)";
 
@@ -702,7 +699,7 @@
     /** In-memory cache of previously found MIME-type mappings */
     private final HashMap<String, Long> mMimetypeCache = new HashMap<String, Long>();
 
-    /** TODO Remove it */
+    /** In-memory cache the packages table */
     private final HashMap<String, Long> mPackageCache = new HashMap<String, Long>();
 
     private long mMimeTypeIdEmail;
@@ -718,7 +715,6 @@
     private SQLiteStatement mContactIdQuery;
     private SQLiteStatement mAggregationModeQuery;
     private SQLiteStatement mDataMimetypeQuery;
-    private SQLiteStatement mActivitiesMimetypeQuery;
 
     /** Precompiled sql statement for setting a data record to the primary. */
     private SQLiteStatement mSetPrimaryStatement;
@@ -787,9 +783,6 @@
      * Clear all the cached database information and re-initialize it.
      *
      * @param db target database
-     * @param accountTableHasId {@code true} if the "accounts" table exists and has the ID column.
-     *    This is normally {@code true}, but needs to be false during database upgrade until
-     *    step 626, where the account ID was introduced.
      */
     private void refreshDatabaseCaches(SQLiteDatabase db) {
         mStatusUpdateDelete = null;
@@ -805,7 +798,6 @@
         mNameLookupInsert = null;
         mNameLookupDelete = null;
         mDataMimetypeQuery = null;
-        mActivitiesMimetypeQuery = null;
         mContactIdQuery = null;
         mAggregationModeQuery = null;
         mContactInDefaultDirectoryQuery = null;
@@ -1265,23 +1257,6 @@
                 VoicemailContract.Status.NOTIFICATION_CHANNEL_STATE + " INTEGER" +
         ");");
 
-        // Activities table
-        db.execSQL("CREATE TABLE " + Tables.ACTIVITIES + " (" +
-                Activities._ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
-                ActivitiesColumns.PACKAGE_ID + " INTEGER REFERENCES package(_id)," +
-                ActivitiesColumns.MIMETYPE_ID + " INTEGER REFERENCES mimetype(_id) NOT NULL," +
-                Activities.RAW_ID + " TEXT," +
-                Activities.IN_REPLY_TO + " TEXT," +
-                Activities.AUTHOR_CONTACT_ID +  " INTEGER REFERENCES raw_contacts(_id)," +
-                Activities.TARGET_CONTACT_ID + " INTEGER REFERENCES raw_contacts(_id)," +
-                Activities.PUBLISHED + " INTEGER NOT NULL," +
-                Activities.THREAD_PUBLISHED + " INTEGER NOT NULL," +
-                Activities.TITLE + " TEXT NOT NULL," +
-                Activities.SUMMARY + " TEXT," +
-                Activities.LINK + " TEXT, " +
-                Activities.THUMBNAIL + " BLOB" +
-        ");");
-
         db.execSQL("CREATE TABLE " + Tables.STATUS_UPDATES + " (" +
                 StatusUpdatesColumns.DATA_ID + " INTEGER PRIMARY KEY REFERENCES data(_id)," +
                 StatusUpdates.STATUS + " TEXT," +
@@ -1940,7 +1915,7 @@
             db.execSQL("DROP TABLE IF EXISTS " + Tables.NAME_LOOKUP + ";");
             db.execSQL("DROP TABLE IF EXISTS " + Tables.NICKNAME_LOOKUP + ";");
             db.execSQL("DROP TABLE IF EXISTS " + Tables.GROUPS + ";");
-            db.execSQL("DROP TABLE IF EXISTS " + Tables.ACTIVITIES + ";");
+            db.execSQL("DROP TABLE IF EXISTS activities;");
             db.execSQL("DROP TABLE IF EXISTS " + Tables.CALLS + ";");
             db.execSQL("DROP TABLE IF EXISTS " + Tables.SETTINGS + ";");
             db.execSQL("DROP TABLE IF EXISTS " + Tables.STATUS_UPDATES + ";");
@@ -2391,6 +2366,11 @@
             oldVersion = 703;
         }
 
+        if (oldVersion < 704) {
+            db.execSQL("DROP TABLE IF EXISTS activities;");
+            oldVersion = 704;
+        }
+
         if (upgradeViewsAndTriggers) {
             createContactsViews(db);
             createGroupsView(db);
@@ -3916,9 +3896,6 @@
             updateIndexStats(db, Tables.STREAM_ITEM_PHOTOS,
                     null, "50");
 
-            updateIndexStats(db, Tables.ACTIVITIES,
-                    null, "5");
-
             updateIndexStats(db, Tables.VOICEMAIL_STATUS,
                     null, "5");
 
@@ -4017,7 +3994,6 @@
         db.execSQL("DELETE FROM " + Tables.GROUPS + ";");
         db.execSQL("DELETE FROM " + Tables.AGGREGATION_EXCEPTIONS + ";");
         db.execSQL("DELETE FROM " + Tables.SETTINGS + ";");
-        db.execSQL("DELETE FROM " + Tables.ACTIVITIES + ";");
         db.execSQL("DELETE FROM " + Tables.CALLS + ";");
         db.execSQL("DELETE FROM " + Tables.DIRECTORIES + ";");
         db.execSQL("DELETE FROM " + Tables.SEARCH_INDEX + ";");
@@ -4204,27 +4180,6 @@
         }
     }
 
-    /**
-     * Find the mime-type for the given {@link Activities#_ID}.
-     */
-    public String getActivityMimeType(long activityId) {
-        if (mActivitiesMimetypeQuery == null) {
-            mActivitiesMimetypeQuery = getWritableDatabase().compileStatement(
-                    "SELECT " + MimetypesColumns.MIMETYPE +
-                    " FROM " + Tables.ACTIVITIES_JOIN_MIMETYPES +
-                    " WHERE " + Tables.ACTIVITIES + "." + Activities._ID + "=?");
-        }
-        try {
-            // Try database query to find mimetype
-            DatabaseUtils.bindObjectToProgram(mActivitiesMimetypeQuery, 1, activityId);
-            String mimetype = mActivitiesMimetypeQuery.simpleQueryForString();
-            return mimetype;
-        } catch (SQLiteDoneException e) {
-            // No valid mapping found, so return null
-            return null;
-        }
-    }
-
     public void invalidateAllCache() {
         Log.w(TAG, "invalidateAllCache: [" + getClass().getSimpleName() + "]");
 
diff --git a/src/com/android/providers/contacts/SocialProvider.java b/src/com/android/providers/contacts/SocialProvider.java
deleted file mode 100644
index 58a2a05..0000000
--- a/src/com/android/providers/contacts/SocialProvider.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.providers.contacts;
-
-import com.android.providers.contacts.ContactsDatabaseHelper.ActivitiesColumns;
-import com.android.providers.contacts.ContactsDatabaseHelper.ContactsColumns;
-import com.android.providers.contacts.ContactsDatabaseHelper.PackagesColumns;
-import com.android.providers.contacts.ContactsDatabaseHelper.Tables;
-
-import android.content.ContentProvider;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.UriMatcher;
-import android.database.Cursor;
-import android.database.sqlite.SQLiteDatabase;
-import android.database.sqlite.SQLiteQueryBuilder;
-import android.provider.BaseColumns;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.RawContacts;
-import android.provider.SocialContract;
-import android.provider.SocialContract.Activities;
-
-import android.net.Uri;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-/**
- * Social activity content provider. The contract between this provider and
- * applications is defined in {@link SocialContract}.
- */
-public class SocialProvider extends ContentProvider {
-    // TODO: clean up debug tag
-    private static final String TAG = "SocialProvider ~~~~";
-
-    private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
-
-    private static final int ACTIVITIES = 1000;
-    private static final int ACTIVITIES_ID = 1001;
-    private static final int ACTIVITIES_AUTHORED_BY = 1002;
-
-    private static final int CONTACT_STATUS_ID = 3000;
-
-    private static final String DEFAULT_SORT_ORDER = Activities.THREAD_PUBLISHED + " DESC, "
-            + Activities.PUBLISHED + " ASC";
-
-    /** Contains just the contacts columns */
-    private static final HashMap<String, String> sContactsProjectionMap;
-    /** Contains just the contacts columns */
-    private static final HashMap<String, String> sRawContactsProjectionMap;
-    /** Contains just the activities columns */
-    private static final HashMap<String, String> sActivitiesProjectionMap;
-
-    /** Contains the activities, raw contacts, and contacts columns, for joined tables */
-    private static final HashMap<String, String> sActivitiesContactsProjectionMap;
-
-    static {
-        // Contacts URI matching table
-        final UriMatcher matcher = sUriMatcher;
-
-        matcher.addURI(SocialContract.AUTHORITY, "activities", ACTIVITIES);
-        matcher.addURI(SocialContract.AUTHORITY, "activities/#", ACTIVITIES_ID);
-        matcher.addURI(SocialContract.AUTHORITY, "activities/authored_by/#", ACTIVITIES_AUTHORED_BY);
-
-        matcher.addURI(SocialContract.AUTHORITY, "contact_status/#", CONTACT_STATUS_ID);
-
-        HashMap<String, String> columns;
-
-        // Contacts projection map
-        columns = new HashMap<String, String>();
-        // TODO: fix display name reference (in fact, use the contacts view instead of the table)
-        columns.put(Contacts.DISPLAY_NAME, "contact." + Contacts.DISPLAY_NAME + " AS "
-                + Contacts.DISPLAY_NAME);
-        sContactsProjectionMap = columns;
-
-        // Contacts projection map
-        columns = new HashMap<String, String>();
-        columns.put(RawContacts._ID, Tables.RAW_CONTACTS + "." + RawContacts._ID + " AS _id");
-        columns.put(RawContacts.CONTACT_ID, RawContacts.CONTACT_ID);
-        sRawContactsProjectionMap = columns;
-
-        // Activities projection map
-        columns = new HashMap<String, String>();
-        columns.put(Activities._ID, "activities._id AS _id");
-        columns.put(Activities.RES_PACKAGE, PackagesColumns.PACKAGE + " AS "
-                + Activities.RES_PACKAGE);
-        columns.put(Activities.MIMETYPE, Activities.MIMETYPE);
-        columns.put(Activities.RAW_ID, Activities.RAW_ID);
-        columns.put(Activities.IN_REPLY_TO, Activities.IN_REPLY_TO);
-        columns.put(Activities.AUTHOR_CONTACT_ID, Activities.AUTHOR_CONTACT_ID);
-        columns.put(Activities.TARGET_CONTACT_ID, Activities.TARGET_CONTACT_ID);
-        columns.put(Activities.PUBLISHED, Activities.PUBLISHED);
-        columns.put(Activities.THREAD_PUBLISHED, Activities.THREAD_PUBLISHED);
-        columns.put(Activities.TITLE, Activities.TITLE);
-        columns.put(Activities.SUMMARY, Activities.SUMMARY);
-        columns.put(Activities.LINK, Activities.LINK);
-        columns.put(Activities.THUMBNAIL, Activities.THUMBNAIL);
-        sActivitiesProjectionMap = columns;
-
-        // Activities, raw contacts, and contacts projection map for joins
-        columns = new HashMap<String, String>();
-        columns.putAll(sContactsProjectionMap);
-        columns.putAll(sRawContactsProjectionMap);
-        columns.putAll(sActivitiesProjectionMap); // Final _id will be from Activities
-        sActivitiesContactsProjectionMap = columns;
-
-    }
-
-    private ContactsDatabaseHelper mDbHelper;
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean onCreate() {
-        final Context context = getContext();
-        mDbHelper = ContactsDatabaseHelper.getInstance(context);
-        return true;
-    }
-
-    /**
-     * Called when a change has been made.
-     *
-     * @param uri the uri that the change was made to
-     */
-    private void onChange(Uri uri) {
-        getContext().getContentResolver().notifyChange(ContactsContract.AUTHORITY_URI, null);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean isTemporary() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Uri insert(Uri uri, ContentValues values) {
-        final int match = sUriMatcher.match(uri);
-        long id = 0;
-        switch (match) {
-            case ACTIVITIES: {
-                id = insertActivity(values);
-                break;
-            }
-
-            default:
-                throw new UnsupportedOperationException("Unknown uri: " + uri);
-        }
-
-        final Uri result = ContentUris.withAppendedId(Activities.CONTENT_URI, id);
-        onChange(result);
-        return result;
-    }
-
-    /**
-     * Inserts an item into the {@link Tables#ACTIVITIES} table.
-     *
-     * @param values the values for the new row
-     * @return the row ID of the newly created row
-     */
-    private long insertActivity(ContentValues values) {
-
-        // TODO verify that IN_REPLY_TO != RAW_ID
-
-        final SQLiteDatabase db = mDbHelper.getWritableDatabase();
-        long id = 0;
-        db.beginTransaction();
-        try {
-            // TODO: Consider enforcing Binder.getCallingUid() for package name
-            // requested by this insert.
-
-            // Replace package name and mime-type with internal mappings
-            final String packageName = values.getAsString(Activities.RES_PACKAGE);
-            if (packageName != null) {
-                values.put(ActivitiesColumns.PACKAGE_ID, mDbHelper.getPackageId(packageName));
-            }
-            values.remove(Activities.RES_PACKAGE);
-
-            final String mimeType = values.getAsString(Activities.MIMETYPE);
-            values.put(ActivitiesColumns.MIMETYPE_ID, mDbHelper.getMimeTypeId(mimeType));
-            values.remove(Activities.MIMETYPE);
-
-            long published = values.getAsLong(Activities.PUBLISHED);
-            long threadPublished = published;
-
-            String inReplyTo = values.getAsString(Activities.IN_REPLY_TO);
-            if (inReplyTo != null) {
-                threadPublished = getThreadPublished(db, inReplyTo, published);
-            }
-
-            values.put(Activities.THREAD_PUBLISHED, threadPublished);
-
-            // Insert the data row itself
-            id = db.insert(Tables.ACTIVITIES, Activities.RAW_ID, values);
-
-            // Adjust thread timestamps on replies that have already been inserted
-            if (values.containsKey(Activities.RAW_ID)) {
-                adjustReplyTimestamps(db, values.getAsString(Activities.RAW_ID), published);
-            }
-
-            db.setTransactionSuccessful();
-        } finally {
-            db.endTransaction();
-        }
-        return id;
-    }
-
-    /**
-     * Finds the timestamp of the original message in the thread. If not found, returns
-     * {@code defaultValue}.
-     */
-    private long getThreadPublished(SQLiteDatabase db, String rawId, long defaultValue) {
-        String inReplyTo = null;
-        long threadPublished = defaultValue;
-
-        final Cursor c = db.query(Tables.ACTIVITIES,
-                new String[]{Activities.IN_REPLY_TO, Activities.PUBLISHED},
-                Activities.RAW_ID + " = ?", new String[]{rawId}, null, null, null);
-        try {
-            if (c.moveToFirst()) {
-                inReplyTo = c.getString(0);
-                threadPublished = c.getLong(1);
-            }
-        } finally {
-            c.close();
-        }
-
-        if (inReplyTo != null) {
-
-            // Call recursively to obtain the original timestamp of the entire thread
-            return getThreadPublished(db, inReplyTo, threadPublished);
-        }
-
-        return threadPublished;
-    }
-
-    /**
-     * In case the original message of a thread arrives after its reply messages, we need
-     * to check if there are any replies in the database and if so adjust their thread_published.
-     */
-    private void adjustReplyTimestamps(SQLiteDatabase db, String inReplyTo, long threadPublished) {
-
-        ContentValues values = new ContentValues();
-        values.put(Activities.THREAD_PUBLISHED, threadPublished);
-
-        /*
-         * Issuing an exploratory update. If it updates nothing, we are done.  Otherwise,
-         * we will run a query to find the updated records again and repeat recursively.
-         */
-        int replies = db.update(Tables.ACTIVITIES, values,
-                Activities.IN_REPLY_TO + "= ?", new String[] {inReplyTo});
-
-        if (replies == 0) {
-            return;
-        }
-
-        /*
-         * Presumably this code will be executed very infrequently since messages tend to arrive
-         * in the order they get sent.
-         */
-        ArrayList<String> rawIds = new ArrayList<String>(replies);
-        final Cursor c = db.query(Tables.ACTIVITIES,
-                new String[]{Activities.RAW_ID},
-                Activities.IN_REPLY_TO + " = ?", new String[] {inReplyTo}, null, null, null);
-        try {
-            while (c.moveToNext()) {
-                rawIds.add(c.getString(0));
-            }
-        } finally {
-            c.close();
-        }
-
-        for (String rawId : rawIds) {
-            adjustReplyTimestamps(db, rawId, threadPublished);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int delete(Uri uri, String selection, String[] selectionArgs) {
-        final SQLiteDatabase db = mDbHelper.getWritableDatabase();
-
-        final int match = sUriMatcher.match(uri);
-        switch (match) {
-            case ACTIVITIES_ID: {
-                final long activityId = ContentUris.parseId(uri);
-                return db.delete(Tables.ACTIVITIES, Activities._ID + "=" + activityId, null);
-            }
-
-            case ACTIVITIES_AUTHORED_BY: {
-                final long contactId = ContentUris.parseId(uri);
-                return db.delete(Tables.ACTIVITIES, Activities.AUTHOR_CONTACT_ID + "=" + contactId, null);
-            }
-
-            default:
-                throw new UnsupportedOperationException("Unknown uri: " + uri);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
-        throw new UnsupportedOperationException();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
-            String sortOrder) {
-        final SQLiteDatabase db = mDbHelper.getReadableDatabase();
-        final SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
-        String limit = null;
-
-        final int match = sUriMatcher.match(uri);
-        switch (match) {
-            case ACTIVITIES: {
-                qb.setTables(Tables.ACTIVITIES_JOIN_PACKAGES_MIMETYPES_RAW_CONTACTS_CONTACTS);
-                qb.setProjectionMap(sActivitiesContactsProjectionMap);
-                break;
-            }
-
-            case ACTIVITIES_ID: {
-                // TODO: enforce that caller has read access to this data
-                long activityId = ContentUris.parseId(uri);
-                qb.setTables(Tables.ACTIVITIES_JOIN_PACKAGES_MIMETYPES_RAW_CONTACTS_CONTACTS);
-                qb.setProjectionMap(sActivitiesContactsProjectionMap);
-                qb.appendWhere(Activities._ID + "=" + activityId);
-                break;
-            }
-
-            case ACTIVITIES_AUTHORED_BY: {
-                long contactId = ContentUris.parseId(uri);
-                qb.setTables(Tables.ACTIVITIES_JOIN_PACKAGES_MIMETYPES_RAW_CONTACTS_CONTACTS);
-                qb.setProjectionMap(sActivitiesContactsProjectionMap);
-                qb.appendWhere(Activities.AUTHOR_CONTACT_ID + "=" + contactId);
-                break;
-            }
-
-            case CONTACT_STATUS_ID: {
-                long aggId = ContentUris.parseId(uri);
-                qb.setTables(Tables.ACTIVITIES_JOIN_PACKAGES_MIMETYPES_RAW_CONTACTS_CONTACTS);
-                qb.setProjectionMap(sActivitiesContactsProjectionMap);
-
-                // Latest status of a contact is any top-level status
-                // authored by one of its children contacts.
-                qb.appendWhere(Activities.IN_REPLY_TO + " IS NULL AND ");
-                qb.appendWhere(Activities.AUTHOR_CONTACT_ID + " IN (SELECT " + BaseColumns._ID
-                        + " FROM " + Tables.RAW_CONTACTS + " WHERE " + RawContacts.CONTACT_ID + "="
-                        + aggId + ")");
-                sortOrder = Activities.PUBLISHED + " DESC";
-                limit = "1";
-                break;
-            }
-
-            default:
-                throw new UnsupportedOperationException("Unknown uri: " + uri);
-        }
-
-        // Default to reverse-chronological sort if nothing requested
-        if (sortOrder == null) {
-            sortOrder = DEFAULT_SORT_ORDER;
-        }
-
-        // Perform the query and set the notification uri
-        final Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, sortOrder, limit);
-        if (c != null) {
-            c.setNotificationUri(getContext().getContentResolver(), ContactsContract.AUTHORITY_URI);
-        }
-        return c;
-    }
-
-    @Override
-    public String getType(Uri uri) {
-        final int match = sUriMatcher.match(uri);
-        switch (match) {
-            case ACTIVITIES:
-            case ACTIVITIES_AUTHORED_BY:
-                return Activities.CONTENT_TYPE;
-            case ACTIVITIES_ID:
-                final SQLiteDatabase db = mDbHelper.getReadableDatabase();
-                long activityId = ContentUris.parseId(uri);
-                return mDbHelper.getActivityMimeType(activityId);
-            case CONTACT_STATUS_ID:
-                return Contacts.CONTENT_ITEM_TYPE;
-        }
-        throw new UnsupportedOperationException("Unknown uri: " + uri);
-    }
-}