Get ViewContactActivity working at a basic level with ContactsProvider2.
With this change the ViewContactActivity is able to display the common
data types defined in ContactsContract. The intents associated with
clicking each item will not necessarily work, as the receiving apps
don't know about the schema changes yet.
Also removed links to ContactsContract.java and SocialContract.java
since those classes have been moved on android.providers and are
accessible without the hard links now.
Made a trivial chane to the fastrack UI by changing the scaleType of the
contact method images from fitCenter to centerInside.
diff --git a/src/com/android/contacts/ContactEntryAdapter.java b/src/com/android/contacts/ContactEntryAdapter.java
index b8d9fe8..64f2585 100644
--- a/src/com/android/contacts/ContactEntryAdapter.java
+++ b/src/com/android/contacts/ContactEntryAdapter.java
@@ -19,8 +19,8 @@
import android.content.Context;
import android.net.Uri;
import android.os.Parcel;
-import android.provider.Contacts.Organizations;
-import android.provider.Contacts.People;
+import android.provider.ContactsContract.Aggregates;
+import android.provider.ContactsContract.Data;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -31,82 +31,38 @@
public abstract class ContactEntryAdapter<E extends ContactEntryAdapter.Entry>
extends BaseAdapter {
- public static final String[] CONTACT_PROJECTION = new String[] {
- People._ID, // 0
- People.NAME, // 1
- People.NOTES, // 2
- People.PRIMARY_PHONE_ID, // 3
- People.PRESENCE_STATUS, // 4
- People.STARRED, // 5
- People.CUSTOM_RINGTONE, // 6
- People.SEND_TO_VOICEMAIL, // 7
- People.PHONETIC_NAME, // 8
+ public static final String[] AGGREGATE_PROJECTION = new String[] {
+ Aggregates.DISPLAY_NAME, // 0
+ Aggregates.STARRED, //1
+ Data._ID, // 2
+ Data.PACKAGE, //3
+ Data.MIMETYPE, //4
+ Data.DATA1, //5
+ Data.DATA2, //6
+ Data.DATA3, //7
+ Data.DATA4, //8
+ Data.DATA5, //9
+ Data.DATA6, //10
+ Data.DATA7, //11
+ Data.DATA8, //12
+ Data.DATA9, //13
+ Data.DATA10, //14
};
- public static final int CONTACT_ID_COLUMN = 0;
- public static final int CONTACT_NAME_COLUMN = 1;
- public static final int CONTACT_NOTES_COLUMN = 2;
- public static final int CONTACT_PREFERRED_PHONE_COLUMN = 3;
- public static final int CONTACT_SERVER_STATUS_COLUMN = 4;
- public static final int CONTACT_STARRED_COLUMN = 5;
- public static final int CONTACT_CUSTOM_RINGTONE_COLUMN = 6;
- public static final int CONTACT_SEND_TO_VOICEMAIL_COLUMN = 7;
- public static final int CONTACT_PHONETIC_NAME_COLUMN = 8;
-
- public static final String[] PHONES_PROJECTION = new String[] {
- People.Phones._ID, // 0
- People.Phones.NUMBER, // 1
- People.Phones.TYPE, // 2
- People.Phones.LABEL, // 3
- People.Phones.ISPRIMARY, // 4
- };
- public static final int PHONES_ID_COLUMN = 0;
- public static final int PHONES_NUMBER_COLUMN = 1;
- public static final int PHONES_TYPE_COLUMN = 2;
- public static final int PHONES_LABEL_COLUMN = 3;
- public static final int PHONES_ISPRIMARY_COLUMN = 4;
-
- public static final String[] METHODS_PROJECTION = new String[] {
- People.ContactMethods._ID, // 0
- People.ContactMethods.KIND, // 1
- People.ContactMethods.DATA, // 2
- People.ContactMethods.TYPE, // 3
- People.ContactMethods.LABEL, // 4
- People.ContactMethods.ISPRIMARY, // 5
- People.ContactMethods.AUX_DATA, // 6
- };
- public static final String[] METHODS_WITH_PRESENCE_PROJECTION = new String[] {
- People.ContactMethods._ID, // 0
- People.ContactMethods.KIND, // 1
- People.ContactMethods.DATA, // 2
- People.ContactMethods.TYPE, // 3
- People.ContactMethods.LABEL, // 4
- People.ContactMethods.ISPRIMARY, // 5
- People.ContactMethods.AUX_DATA, // 6
- People.PRESENCE_STATUS, // 7
- };
- public static final int METHODS_ID_COLUMN = 0;
- public static final int METHODS_KIND_COLUMN = 1;
- public static final int METHODS_DATA_COLUMN = 2;
- public static final int METHODS_TYPE_COLUMN = 3;
- public static final int METHODS_LABEL_COLUMN = 4;
- public static final int METHODS_ISPRIMARY_COLUMN = 5;
- public static final int METHODS_AUX_DATA_COLUMN = 6;
- public static final int METHODS_STATUS_COLUMN = 7;
-
- public static final String[] ORGANIZATIONS_PROJECTION = new String[] {
- Organizations._ID, // 0
- Organizations.TYPE, // 1
- Organizations.LABEL, // 2
- Organizations.COMPANY, // 3
- Organizations.TITLE, // 4
- Organizations.ISPRIMARY, // 5
- };
- public static final int ORGANIZATIONS_ID_COLUMN = 0;
- public static final int ORGANIZATIONS_TYPE_COLUMN = 1;
- public static final int ORGANIZATIONS_LABEL_COLUMN = 2;
- public static final int ORGANIZATIONS_COMPANY_COLUMN = 3;
- public static final int ORGANIZATIONS_TITLE_COLUMN = 4;
- public static final int ORGANIZATIONS_ISPRIMARY_COLUMN = 5;
+ public static final int AGGREGATE_DISPLAY_NAME_COLUMN = 0;
+ public static final int AGGREGATE_STARRED_COLUMN = 1;
+ public static final int DATA_ID_COLUMN = 2;
+ public static final int DATA_PACKAGE_COLUMN = 3;
+ public static final int DATA_MIMETYPE_COLUMN = 4;
+ public static final int DATA_1_COLUMN = 5;
+ public static final int DATA_2_COLUMN = 6;
+ public static final int DATA_3_COLUMN = 7;
+ public static final int DATA_4_COLUMN = 8;
+ public static final int DATA_5_COLUMN = 9;
+ public static final int DATA_6_COLUMN = 10;
+ public static final int DATA_7_COLUMN = 11;
+ public static final int DATA_8_COLUMN = 12;
+ public static final int DATA_9_COLUMN = 13;
+ public static final int DATA_10_COLUMN = 14;
protected ArrayList<ArrayList<E>> mSections;
protected LayoutInflater mInflater;
diff --git a/src/com/android/contacts/ContactsListActivity.java b/src/com/android/contacts/ContactsListActivity.java
index e384c3e..6ab769a 100644
--- a/src/com/android/contacts/ContactsListActivity.java
+++ b/src/com/android/contacts/ContactsListActivity.java
@@ -45,6 +45,10 @@
import android.provider.Contacts.Presence;
import android.provider.Contacts.Intents.Insert;
import android.provider.Contacts.Intents.UI;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Aggregates;
+import android.provider.ContactsContract.CommonDataKinds;
+import android.provider.ContactsContract.Data;
import android.text.TextUtils;
import android.util.Log;
import android.util.SparseArray;
@@ -72,11 +76,6 @@
import java.util.ArrayList;
import java.util.Locale;
-import com.android.providers.contacts2.ContactsContract;
-import com.android.providers.contacts2.ContactsContract.Aggregates;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds;
-
-
/*TODO(emillar) I commented most of the code that deals with modes and filtering. It should be
* brought back in as we add back that functionality.
*/
@@ -191,69 +190,19 @@
Aggregates._ID, // 0
Aggregates.DISPLAY_NAME, // 1
Aggregates.STARRED, //2
- CommonDataKinds.Phone.TYPE, //3
- CommonDataKinds.Phone.LABEL, //4
- CommonDataKinds.Phone.NUMBER, //3
+ Aggregates.PRIMARY_PHONE_ID, //3
+ CommonDataKinds.Phone.TYPE, //4
+ CommonDataKinds.Phone.LABEL, //5
+ CommonDataKinds.Phone.NUMBER, //6
};
- /* static final String[] CONTACTS_PROJECTION = new String[] {
- People._ID, // 0
- NAME_COLUMN, // 1
- People.NUMBER, // 2
- People.TYPE, // 3
- People.LABEL, // 4
- People.STARRED, // 5
- People.PRIMARY_PHONE_ID, // 6
- People.PRIMARY_EMAIL_ID, // 7
- People.PRESENCE_STATUS, // 8
- SORT_STRING, // 9
- };
-
- static final String[] SIMPLE_CONTACTS_PROJECTION = new String[] {
- People._ID, // 0
- NAME_COLUMN, // 1
- };
-
- static final String[] STREQUENT_PROJECTION = new String[] {
- People._ID, // 0
- NAME_COLUMN, // 1
- People.NUMBER, // 2
- People.TYPE, // 3
- People.LABEL, // 4
- People.STARRED, // 5
- People.PRIMARY_PHONE_ID, // 6
- People.PRIMARY_EMAIL_ID, // 7
- People.PRESENCE_STATUS, // 8
- "photo_data", // 9
- People.TIMES_CONTACTED, // 10 (not displayed, but required for the order by to work)
- };
-
- static final String[] PHONES_PROJECTION = new String[] {
- Phones._ID, // 0
- NAME_COLUMN, // 1
- Phones.NUMBER, // 2
- Phones.TYPE, // 3
- Phones.LABEL, // 4
- Phones.STARRED, // 5
- Phones.PERSON_ID, // 6
- };
-
- static final String[] CONTACT_METHODS_PROJECTION = new String[] {
- ContactMethods._ID, // 0
- NAME_COLUMN, // 1
- ContactMethods.DATA, // 2
- ContactMethods.TYPE, // 3
- ContactMethods.LABEL, // 4
- ContactMethods.STARRED, // 5
- ContactMethods.PERSON_ID, // 6
- }; */
-
static final int ID_COLUMN_INDEX = 0;
static final int NAME_COLUMN_INDEX = 1;
static final int STARRED_COLUMN_INDEX = 2;
- static final int PRIMARY_PHONE_TYPE_COLUMN_INDEX = 3;
- static final int PRIMARY_PHONE_LABEL_COLUMN_INDEX = 4;
- static final int PRIMARY_PHONE_NUMBER_COLUMN_INDEX = 5;
+ static final int PRIMARY_PHONE_ID_COLUMN_INDEX = 3;
+ static final int PRIMARY_PHONE_TYPE_COLUMN_INDEX = 4;
+ static final int PRIMARY_PHONE_LABEL_COLUMN_INDEX = 5;
+ static final int PRIMARY_PHONE_NUMBER_COLUMN_INDEX = 6;
static final int PHONES_PERSON_ID_INDEX = 6;
static final int SIMPLE_CONTACTS_PERSON_ID_INDEX = 0;
@@ -874,34 +823,34 @@
return;
}
long id = info.id;
- Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, id);
+ Uri dataUri = Uri.withAppendedPath(Aggregates.CONTENT_URI, id + "/data");
// Setup the menu header
menu.setHeaderTitle(cursor.getString(NAME_COLUMN_INDEX));
- /*
// View contact details
menu.add(0, MENU_ITEM_VIEW_CONTACT, 0, R.string.menu_viewContact)
- .setIntent(new Intent(Intent.ACTION_VIEW, personUri));
-
-
+ .setIntent(new Intent(Intent.ACTION_VIEW, dataUri));
+
// Calling contact
long phoneId = cursor.getLong(PRIMARY_PHONE_ID_COLUMN_INDEX);
if (phoneId > 0) {
// Get the display label for the number
- CharSequence label = cursor.getString(LABEL_COLUMN_INDEX);
- int type = cursor.getInt(TYPE_COLUMN_INDEX);
- label = Phones.getDisplayLabel(this, type, label);
+ CharSequence label = cursor.getString(PRIMARY_PHONE_LABEL_COLUMN_INDEX);
+ int type = cursor.getInt(PRIMARY_PHONE_TYPE_COLUMN_INDEX);
+ label = ContactsUtils.getDisplayLabel(
+ this, CommonDataKinds.Phone.CONTENT_ITEM_TYPE, type, label);
Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED,
- ContentUris.withAppendedId(Phones.CONTENT_URI, phoneId));
- menu.add(0, MENU_ITEM_CALL, 0, String.format(getString(R.string.menu_callNumber), label))
- .setIntent(intent);
+ ContentUris.withAppendedId(Data.CONTENT_URI, id));
+ menu.add(0, MENU_ITEM_CALL, 0,
+ String.format(getString(R.string.menu_callNumber), label)).setIntent(intent);
// Send SMS item
menu.add(0, MENU_ITEM_SEND_SMS, 0, R.string.menu_sendSMS)
.setIntent(new Intent(Intent.ACTION_SENDTO,
- Uri.fromParts("sms", cursor.getString(NUMBER_COLUMN_INDEX), null)));
- } */
+ Uri.fromParts("sms",
+ cursor.getString(PRIMARY_PHONE_NUMBER_COLUMN_INDEX), null)));
+ }
// Star toggling
int starState = cursor.getInt(STARRED_COLUMN_INDEX);
@@ -1022,7 +971,7 @@
if (id != -1) {
if ((mMode & MODE_MASK_PICKER) == 0) {
Intent intent = new Intent(Intent.ACTION_VIEW,
- ContentUris.withAppendedId(People.CONTENT_URI, id));
+ ContentUris.withAppendedId(Aggregates.CONTENT_URI, id));
startActivity(intent);
} /*else if (mMode == MODE_QUERY_PICK_TO_VIEW) {
// Started with query that should launch to view contact
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
new file mode 100644
index 0000000..e812cc8
--- /dev/null
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -0,0 +1,110 @@
+package com.android.contacts;
+
+
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Im;
+import android.provider.ContactsContract.CommonDataKinds.Organization;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Postal;
+import android.provider.Im.ProviderNames;
+
+import android.content.Context;
+import android.text.TextUtils;
+
+public class ContactsUtils {
+
+ public static final CharSequence getDisplayLabel(Context context, String mimetype, int type,
+ CharSequence label) {
+ CharSequence display = "";
+ final int customType;
+ final int defaultType;
+ final int arrayResId;
+
+ if (Phone.CONTENT_ITEM_TYPE.equals(mimetype)) {
+ defaultType = Phone.TYPE_HOME;
+ customType = Phone.TYPE_CUSTOM;
+ arrayResId = com.android.internal.R.array.phoneTypes;
+ } else if (Email.CONTENT_ITEM_TYPE.equals(mimetype)) {
+ defaultType = Email.TYPE_HOME;
+ customType = Email.TYPE_CUSTOM;
+ arrayResId = com.android.internal.R.array.emailAddressTypes;
+ } else if (Postal.CONTENT_ITEM_TYPE.equals(mimetype)) {
+ defaultType = Postal.TYPE_HOME;
+ customType = Postal.TYPE_CUSTOM;
+ arrayResId = com.android.internal.R.array.postalAddressTypes;
+ } else if (Organization.CONTENT_ITEM_TYPE.equals(mimetype)) {
+ defaultType = Organization.TYPE_HOME;
+ customType = Organization.TYPE_CUSTOM;
+ arrayResId = com.android.internal.R.array.organizationTypes;
+ } else {
+ // Can't return display label for given mimetype.
+ return display;
+ }
+
+ if (type != customType) {
+ CharSequence[] labels = context.getResources().getTextArray(arrayResId);
+ try {
+ display = labels[type - 1];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ display = labels[defaultType - 1];
+ }
+ } else {
+ if (!TextUtils.isEmpty(label)) {
+ display = label;
+ }
+ }
+ return display;
+ }
+
+ public static Object decodeImProtocol(String encodedString) {
+ if (encodedString == null) {
+ return null;
+ }
+
+ if (encodedString.startsWith("pre:")) {
+ return Integer.parseInt(encodedString.substring(4));
+ }
+
+ if (encodedString.startsWith("custom:")) {
+ return encodedString.substring(7);
+ }
+
+ throw new IllegalArgumentException(
+ "the value is not a valid encoded protocol, " + encodedString);
+ }
+
+
+
+ /**
+ * This looks up the provider name defined in
+ * {@link android.provider.Im.ProviderNames} from the predefined IM protocol id.
+ * This is used for interacting with the IM application.
+ *
+ * @param protocol the protocol ID
+ * @return the provider name the IM app uses for the given protocol, or null if no
+ * provider is defined for the given protocol
+ * @hide
+ */
+ public static String lookupProviderNameFromId(int protocol) {
+ switch (protocol) {
+ case Im.PROTOCOL_GOOGLE_TALK:
+ return ProviderNames.GTALK;
+ case Im.PROTOCOL_AIM:
+ return ProviderNames.AIM;
+ case Im.PROTOCOL_MSN:
+ return ProviderNames.MSN;
+ case Im.PROTOCOL_YAHOO:
+ return ProviderNames.YAHOO;
+ case Im.PROTOCOL_ICQ:
+ return ProviderNames.ICQ;
+ case Im.PROTOCOL_JABBER:
+ return ProviderNames.JABBER;
+ case Im.PROTOCOL_SKYPE:
+ return ProviderNames.SKYPE;
+ case Im.PROTOCOL_QQ:
+ return ProviderNames.QQ;
+ }
+ return null;
+ }
+
+}
diff --git a/src/com/android/contacts/EditContactActivity.java b/src/com/android/contacts/EditContactActivity.java
index 4d5a669..3ad051d 100644
--- a/src/com/android/contacts/EditContactActivity.java
+++ b/src/com/android/contacts/EditContactActivity.java
@@ -16,33 +16,8 @@
package com.android.contacts;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_CUSTOM_RINGTONE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_NAME_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_NOTES_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_SEND_TO_VOICEMAIL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_PHONETIC_NAME_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_AUX_DATA_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_DATA_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_ID_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_ISPRIMARY_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_KIND_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_LABEL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.METHODS_TYPE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_COMPANY_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_ID_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_ISPRIMARY_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_LABEL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_TITLE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_TYPE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_ID_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_ISPRIMARY_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_LABEL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_NUMBER_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.PHONES_TYPE_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.AGGREGATE_DISPLAY_NAME_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.AGGREGATE_PROJECTION;
import com.android.contacts.ViewContactActivity.ViewEntry;
@@ -1314,7 +1289,7 @@
* @param extras the extras used to start this activity, may be null
*/
private void buildEntriesForEdit(Bundle extras) {
- Cursor personCursor = mResolver.query(mUri, CONTACT_PROJECTION, null, null, null);
+ Cursor personCursor = mResolver.query(mUri, AGGREGATE_PROJECTION, null, null, null);
if (personCursor == null) {
Log.e(TAG, "invalid contact uri: " + mUri);
finish();
@@ -1335,7 +1310,7 @@
EditEntry entry;
// Name
- mNameView.setText(personCursor.getString(CONTACT_NAME_COLUMN));
+ mNameView.setText(personCursor.getString(AGGREGATE_DISPLAY_NAME_COLUMN));
mNameView.addTextChangedListener(this);
// Photo
@@ -1347,167 +1322,168 @@
mPhotoImageView.setImageBitmap(mPhoto);
}
- // Organizations
- Uri organizationsUri = Uri.withAppendedPath(mUri, Organizations.CONTENT_DIRECTORY);
- Cursor organizationsCursor = mResolver.query(organizationsUri, ORGANIZATIONS_PROJECTION,
- null, null, null);
-
- if (organizationsCursor != null) {
- while (organizationsCursor.moveToNext()) {
- int type = organizationsCursor.getInt(ORGANIZATIONS_TYPE_COLUMN);
- String label = organizationsCursor.getString(ORGANIZATIONS_LABEL_COLUMN);
- String company = organizationsCursor.getString(ORGANIZATIONS_COMPANY_COLUMN);
- String title = organizationsCursor.getString(ORGANIZATIONS_TITLE_COLUMN);
- long id = organizationsCursor.getLong(ORGANIZATIONS_ID_COLUMN);
- Uri uri = ContentUris.withAppendedId(Organizations.CONTENT_URI, id);
-
- // Add an organization entry
- entry = EditEntry.newOrganizationEntry(this, label, type, company, title, uri, id);
- entry.isPrimary = organizationsCursor.getLong(ORGANIZATIONS_ISPRIMARY_COLUMN) != 0;
- mOrgEntries.add(entry);
- }
- organizationsCursor.close();
- }
-
- // Notes
- if (!personCursor.isNull(CONTACT_NOTES_COLUMN)) {
- entry = EditEntry.newNotesEntry(this, personCursor.getString(CONTACT_NOTES_COLUMN),
- mUri);
- mNoteEntries.add(entry);
- }
-
- // Groups
- populateGroups();
- if (mGroups != null) {
- entry = EditEntry.newGroupEntry(this, generateGroupList(), mUri,
- personCursor.getLong(0));
- mOtherEntries.add(entry);
- }
-
- // Ringtone
- entry = EditEntry.newRingtoneEntry(this,
- personCursor.getString(CONTACT_CUSTOM_RINGTONE_COLUMN), mUri);
- mOtherEntries.add(entry);
-
- // Send to voicemail
- entry = EditEntry.newSendToVoicemailEntry(this,
- personCursor.getString(CONTACT_SEND_TO_VOICEMAIL_COLUMN), mUri);
- mOtherEntries.add(entry);
-
- // Phonetic name
- mPhoneticNameView.setText(personCursor.getString(CONTACT_PHONETIC_NAME_COLUMN));
- mPhoneticNameView.addTextChangedListener(this);
-
- personCursor.close();
-
- // Build up the phone entries
- Uri phonesUri = Uri.withAppendedPath(mUri, People.Phones.CONTENT_DIRECTORY);
- Cursor phonesCursor = mResolver.query(phonesUri, PHONES_PROJECTION,
- null, null, null);
-
- if (phonesCursor != null) {
- while (phonesCursor.moveToNext()) {
- int type = phonesCursor.getInt(PHONES_TYPE_COLUMN);
- String label = phonesCursor.getString(PHONES_LABEL_COLUMN);
- String number = phonesCursor.getString(PHONES_NUMBER_COLUMN);
- long id = phonesCursor.getLong(PHONES_ID_COLUMN);
- boolean isPrimary = phonesCursor.getLong(PHONES_ISPRIMARY_COLUMN) != 0;
- Uri uri = ContentUris.withAppendedId(phonesUri, id);
-
- // Add a phone number entry
- entry = EditEntry.newPhoneEntry(this, label, type, number, uri, id);
- entry.isPrimary = isPrimary;
- mPhoneEntries.add(entry);
-
- // Keep track of which primary types have been added
- if (type == Phones.TYPE_MOBILE) {
- mMobilePhoneAdded = true;
- }
- }
-
- phonesCursor.close();
- }
-
- // Build the contact method entries
- Uri methodsUri = Uri.withAppendedPath(mUri, People.ContactMethods.CONTENT_DIRECTORY);
- Cursor methodsCursor = mResolver.query(methodsUri, METHODS_PROJECTION, null, null, null);
-
- if (methodsCursor != null) {
- while (methodsCursor.moveToNext()) {
- int kind = methodsCursor.getInt(METHODS_KIND_COLUMN);
- String label = methodsCursor.getString(METHODS_LABEL_COLUMN);
- String data = methodsCursor.getString(METHODS_DATA_COLUMN);
- String auxData = methodsCursor.getString(METHODS_AUX_DATA_COLUMN);
- int type = methodsCursor.getInt(METHODS_TYPE_COLUMN);
- long id = methodsCursor.getLong(METHODS_ID_COLUMN);
- boolean isPrimary = methodsCursor.getLong(METHODS_ISPRIMARY_COLUMN) != 0;
- Uri uri = ContentUris.withAppendedId(methodsUri, id);
-
- switch (kind) {
- case Contacts.KIND_EMAIL: {
- entry = EditEntry.newEmailEntry(this, label, type, data, uri, id);
- entry.isPrimary = isPrimary;
- mEmailEntries.add(entry);
-
- if (isPrimary) {
- mPrimaryEmailAdded = true;
- }
- break;
- }
-
- case Contacts.KIND_POSTAL: {
- entry = EditEntry.newPostalEntry(this, label, type, data, uri, id);
- entry.isPrimary = isPrimary;
- mPostalEntries.add(entry);
- break;
- }
-
- case Contacts.KIND_IM: {
- Object protocolObj = ContactMethods.decodeImProtocol(auxData);
- if (protocolObj == null) {
- // Invalid IM protocol, log it then ignore.
- Log.e(TAG, "Couldn't decode IM protocol: " + auxData);
- continue;
- } else {
- if (protocolObj instanceof Number) {
- int protocol = ((Number) protocolObj).intValue();
- entry = EditEntry.newImEntry(this,
- getLabelsForKind(this, Contacts.KIND_IM)[protocol], protocol,
- data, uri, id);
- } else {
- entry = EditEntry.newImEntry(this, protocolObj.toString(), -1, data,
- uri, id);
- }
- mImEntries.add(entry);
- }
- break;
- }
- }
- }
-
- methodsCursor.close();
- }
-
- // Add values from the extras, if there are any
- if (extras != null) {
- addFromExtras(extras, phonesUri, methodsUri);
- }
-
- // Add the base types if needed
- if (!mMobilePhoneAdded) {
- entry = EditEntry.newPhoneEntry(this,
- Uri.withAppendedPath(mUri, People.Phones.CONTENT_DIRECTORY),
- DEFAULT_PHONE_TYPE);
- mPhoneEntries.add(entry);
- }
-
- if (!mPrimaryEmailAdded) {
- entry = EditEntry.newEmailEntry(this,
- Uri.withAppendedPath(mUri, People.ContactMethods.CONTENT_DIRECTORY),
- DEFAULT_EMAIL_TYPE);
- entry.isPrimary = true;
- mEmailEntries.add(entry);
- }
+ // TODO(emillar) Re-implement all this.
+// // Organizations
+// Uri organizationsUri = Uri.withAppendedPath(mUri, Organizations.CONTENT_DIRECTORY);
+// Cursor organizationsCursor = mResolver.query(organizationsUri, ORGANIZATIONS_PROJECTION,
+// null, null, null);
+//
+// if (organizationsCursor != null) {
+// while (organizationsCursor.moveToNext()) {
+// int type = organizationsCursor.getInt(ORGANIZATIONS_TYPE_COLUMN);
+// String label = organizationsCursor.getString(ORGANIZATIONS_LABEL_COLUMN);
+// String company = organizationsCursor.getString(ORGANIZATIONS_COMPANY_COLUMN);
+// String title = organizationsCursor.getString(ORGANIZATIONS_TITLE_COLUMN);
+// long id = organizationsCursor.getLong(ORGANIZATIONS_ID_COLUMN);
+// Uri uri = ContentUris.withAppendedId(Organizations.CONTENT_URI, id);
+//
+// // Add an organization entry
+// entry = EditEntry.newOrganizationEntry(this, label, type, company, title, uri, id);
+// entry.isPrimary = organizationsCursor.getLong(ORGANIZATIONS_ISPRIMARY_COLUMN) != 0;
+// mOrgEntries.add(entry);
+// }
+// organizationsCursor.close();
+// }
+//
+// // Notes
+// if (!personCursor.isNull(CONTACT_NOTES_COLUMN)) {
+// entry = EditEntry.newNotesEntry(this, personCursor.getString(CONTACT_NOTES_COLUMN),
+// mUri);
+// mNoteEntries.add(entry);
+// }
+//
+// // Groups
+// populateGroups();
+// if (mGroups != null) {
+// entry = EditEntry.newGroupEntry(this, generateGroupList(), mUri,
+// personCursor.getLong(0));
+// mOtherEntries.add(entry);
+// }
+//
+// // Ringtone
+// entry = EditEntry.newRingtoneEntry(this,
+// personCursor.getString(CONTACT_CUSTOM_RINGTONE_COLUMN), mUri);
+// mOtherEntries.add(entry);
+//
+// // Send to voicemail
+// entry = EditEntry.newSendToVoicemailEntry(this,
+// personCursor.getString(CONTACT_SEND_TO_VOICEMAIL_COLUMN), mUri);
+// mOtherEntries.add(entry);
+//
+// // Phonetic name
+// mPhoneticNameView.setText(personCursor.getString(CONTACT_PHONETIC_NAME_COLUMN));
+// mPhoneticNameView.addTextChangedListener(this);
+//
+// personCursor.close();
+//
+// // Build up the phone entries
+// Uri phonesUri = Uri.withAppendedPath(mUri, People.Phones.CONTENT_DIRECTORY);
+// Cursor phonesCursor = mResolver.query(phonesUri, PHONES_PROJECTION,
+// null, null, null);
+//
+// if (phonesCursor != null) {
+// while (phonesCursor.moveToNext()) {
+// int type = phonesCursor.getInt(PHONES_TYPE_COLUMN);
+// String label = phonesCursor.getString(PHONES_LABEL_COLUMN);
+// String number = phonesCursor.getString(PHONES_NUMBER_COLUMN);
+// long id = phonesCursor.getLong(PHONES_ID_COLUMN);
+// boolean isPrimary = phonesCursor.getLong(PHONES_ISPRIMARY_COLUMN) != 0;
+// Uri uri = ContentUris.withAppendedId(phonesUri, id);
+//
+// // Add a phone number entry
+// entry = EditEntry.newPhoneEntry(this, label, type, number, uri, id);
+// entry.isPrimary = isPrimary;
+// mPhoneEntries.add(entry);
+//
+// // Keep track of which primary types have been added
+// if (type == Phones.TYPE_MOBILE) {
+// mMobilePhoneAdded = true;
+// }
+// }
+//
+// phonesCursor.close();
+// }
+//
+// // Build the contact method entries
+// Uri methodsUri = Uri.withAppendedPath(mUri, People.ContactMethods.CONTENT_DIRECTORY);
+// Cursor methodsCursor = mResolver.query(methodsUri, METHODS_PROJECTION, null, null, null);
+//
+// if (methodsCursor != null) {
+// while (methodsCursor.moveToNext()) {
+// int kind = methodsCursor.getInt(METHODS_KIND_COLUMN);
+// String label = methodsCursor.getString(METHODS_LABEL_COLUMN);
+// String data = methodsCursor.getString(METHODS_DATA_COLUMN);
+// String auxData = methodsCursor.getString(METHODS_AUX_DATA_COLUMN);
+// int type = methodsCursor.getInt(METHODS_TYPE_COLUMN);
+// long id = methodsCursor.getLong(METHODS_ID_COLUMN);
+// boolean isPrimary = methodsCursor.getLong(METHODS_ISPRIMARY_COLUMN) != 0;
+// Uri uri = ContentUris.withAppendedId(methodsUri, id);
+//
+// switch (kind) {
+// case Contacts.KIND_EMAIL: {
+// entry = EditEntry.newEmailEntry(this, label, type, data, uri, id);
+// entry.isPrimary = isPrimary;
+// mEmailEntries.add(entry);
+//
+// if (isPrimary) {
+// mPrimaryEmailAdded = true;
+// }
+// break;
+// }
+//
+// case Contacts.KIND_POSTAL: {
+// entry = EditEntry.newPostalEntry(this, label, type, data, uri, id);
+// entry.isPrimary = isPrimary;
+// mPostalEntries.add(entry);
+// break;
+// }
+//
+// case Contacts.KIND_IM: {
+// Object protocolObj = ContactMethods.decodeImProtocol(auxData);
+// if (protocolObj == null) {
+// // Invalid IM protocol, log it then ignore.
+// Log.e(TAG, "Couldn't decode IM protocol: " + auxData);
+// continue;
+// } else {
+// if (protocolObj instanceof Number) {
+// int protocol = ((Number) protocolObj).intValue();
+// entry = EditEntry.newImEntry(this,
+// getLabelsForKind(this, Contacts.KIND_IM)[protocol], protocol,
+// data, uri, id);
+// } else {
+// entry = EditEntry.newImEntry(this, protocolObj.toString(), -1, data,
+// uri, id);
+// }
+// mImEntries.add(entry);
+// }
+// break;
+// }
+// }
+// }
+//
+// methodsCursor.close();
+// }
+//
+// // Add values from the extras, if there are any
+// if (extras != null) {
+// addFromExtras(extras, phonesUri, methodsUri);
+// }
+//
+// // Add the base types if needed
+// if (!mMobilePhoneAdded) {
+// entry = EditEntry.newPhoneEntry(this,
+// Uri.withAppendedPath(mUri, People.Phones.CONTENT_DIRECTORY),
+// DEFAULT_PHONE_TYPE);
+// mPhoneEntries.add(entry);
+// }
+//
+// if (!mPrimaryEmailAdded) {
+// entry = EditEntry.newEmailEntry(this,
+// Uri.withAppendedPath(mUri, People.ContactMethods.CONTENT_DIRECTORY),
+// DEFAULT_EMAIL_TYPE);
+// entry.isPrimary = true;
+// mEmailEntries.add(entry);
+// }
mContactChanged = false;
}
diff --git a/src/com/android/contacts/FastTrackWindow.java b/src/com/android/contacts/FastTrackWindow.java
index 7758c87..2eae8aa 100644
--- a/src/com/android/contacts/FastTrackWindow.java
+++ b/src/com/android/contacts/FastTrackWindow.java
@@ -20,15 +20,6 @@
import com.android.contacts.SocialStreamActivity.MappingCache;
import com.android.contacts.SocialStreamActivity.Mapping;
import com.android.internal.policy.PolicyManager;
-import com.android.providers.contacts2.ContactsContract;
-import com.android.providers.contacts2.ContactsContract.Aggregates;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds;
-import com.android.providers.contacts2.ContactsContract.Data;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Email;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Im;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Phone;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Photo;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Postal;
import android.app.Activity;
import android.content.ActivityNotFoundException;
@@ -43,6 +34,15 @@
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.provider.Contacts.Phones;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Aggregates;
+import android.provider.ContactsContract.CommonDataKinds;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.CommonDataKinds.Email;
+import android.provider.ContactsContract.CommonDataKinds.Im;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.ContactsContract.CommonDataKinds.Postal;
import android.text.SpannableStringBuilder;
import android.text.style.CharacterStyle;
import android.text.style.ForegroundColorSpan;
diff --git a/src/com/android/contacts/ShowOrCreateActivity.java b/src/com/android/contacts/ShowOrCreateActivity.java
index aa7a1c5..1111f62 100755
--- a/src/com/android/contacts/ShowOrCreateActivity.java
+++ b/src/com/android/contacts/ShowOrCreateActivity.java
@@ -17,8 +17,6 @@
package com.android.contacts;
import com.android.contacts.NotifyingAsyncQueryHandler.QueryCompleteListener;
-import com.android.providers.contacts2.ContactsContract;
-import com.android.providers.contacts2.ContactsContract.Aggregates;
import android.app.Activity;
import android.app.AlertDialog;
@@ -37,6 +35,8 @@
import android.provider.Contacts.Intents;
import android.provider.Contacts.People;
import android.provider.Contacts.Phones;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Aggregates;
import android.view.View;
/**
diff --git a/src/com/android/contacts/SocialStreamActivity.java b/src/com/android/contacts/SocialStreamActivity.java
index 888748b..33d4333 100644
--- a/src/com/android/contacts/SocialStreamActivity.java
+++ b/src/com/android/contacts/SocialStreamActivity.java
@@ -17,13 +17,6 @@
package com.android.contacts;
import com.android.contacts.EdgeTriggerView.EdgeTriggerListener;
-import com.android.providers.contacts2.ContactsContract;
-import com.android.providers.contacts2.ContactsContract.Aggregates;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds;
-import com.android.providers.contacts2.ContactsContract.Contacts;
-import com.android.providers.contacts2.ContactsContract.Data;
-import com.android.providers.contacts2.ContactsContract.CommonDataKinds.Photo;
-import com.android.providers.contacts2.SocialContract.Activities;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@@ -47,6 +40,13 @@
import android.graphics.Rect;
import android.net.Uri;
import android.os.Bundle;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Aggregates;
+import android.provider.ContactsContract.CommonDataKinds;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.CommonDataKinds.Photo;
+import android.provider.SocialContract.Activities;
import android.text.SpannableStringBuilder;
import android.text.format.DateUtils;
import android.text.style.StyleSpan;
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index e5afdc2..b38156d 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -16,33 +16,22 @@
package com.android.contacts;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_CUSTOM_RINGTONE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_NAME_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_NOTES_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_PHONETIC_NAME_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_SEND_TO_VOICEMAIL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.CONTACT_STARRED_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_AUX_DATA_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_DATA_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_ID_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_KIND_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_LABEL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_STATUS_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_TYPE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.METHODS_WITH_PRESENCE_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_COMPANY_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_ID_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_LABEL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_TITLE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.ORGANIZATIONS_TYPE_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_ID_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_ISPRIMARY_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_LABEL_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_NUMBER_COLUMN;
-import static com.android.contacts.ContactEntryAdapter.PHONES_PROJECTION;
-import static com.android.contacts.ContactEntryAdapter.PHONES_TYPE_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.AGGREGATE_DISPLAY_NAME_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.AGGREGATE_PROJECTION;
+import static com.android.contacts.ContactEntryAdapter.AGGREGATE_STARRED_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_ID_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_PACKAGE_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_MIMETYPE_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_1_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_2_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_3_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_4_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_5_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_6_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_7_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_8_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_9_COLUMN;
+import static com.android.contacts.ContactEntryAdapter.DATA_10_COLUMN;
import com.android.internal.telephony.ITelephony;
@@ -61,6 +50,7 @@
import android.content.res.Resources;
import android.database.ContentObserver;
import android.database.Cursor;
+import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.media.Ringtone;
import android.media.RingtoneManager;
@@ -70,15 +60,10 @@
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemClock;
-import android.provider.Contacts;
+import android.provider.ContactsContract.CommonDataKinds;
+import android.provider.ContactsContract.Aggregates;
+import android.provider.ContactsContract.Data;
import android.provider.Im;
-import android.provider.Contacts.ContactMethods;
-import android.provider.Contacts.Groups;
-import android.provider.Contacts.GroupMembership;
-import android.provider.Contacts.Organizations;
-import android.provider.Contacts.People;
-import android.provider.Contacts.Phones;
-import android.provider.Contacts.Presence;
import android.text.TextUtils;
import android.util.Log;
import android.view.ContextMenu;
@@ -108,18 +93,6 @@
private static final String SHOW_BARCODE_INTENT = "com.google.zxing.client.android.ENCODE";
private static final boolean SHOW_SEPARATORS = false;
-
- private static final String[] PHONE_KEYS = {
- Contacts.Intents.Insert.PHONE,
- Contacts.Intents.Insert.SECONDARY_PHONE,
- Contacts.Intents.Insert.TERTIARY_PHONE
- };
-
- private static final String[] EMAIL_KEYS = {
- Contacts.Intents.Insert.EMAIL,
- Contacts.Intents.Insert.SECONDARY_EMAIL,
- Contacts.Intents.Insert.TERTIARY_EMAIL
- };
private static final int DIALOG_CONFIRM_DELETE = 1;
@@ -178,9 +151,9 @@
}
switch (view.getId()) {
case R.id.star: {
- int oldStarredState = mCursor.getInt(CONTACT_STARRED_COLUMN);
+ int oldStarredState = mCursor.getInt(AGGREGATE_STARRED_COLUMN);
ContentValues values = new ContentValues(1);
- values.put(People.STARRED, oldStarredState == 1 ? 0 : 1);
+ values.put(Aggregates.STARRED, oldStarredState == 1 ? 0 : 1);
getContentResolver().update(mUri, values, null, null);
break;
}
@@ -238,7 +211,7 @@
//TODO Read this value from a preference
mShowSmsLinksForAllPhones = true;
- mCursor = mResolver.query(mUri, CONTACT_PROJECTION, null, null, null);
+ mCursor = mResolver.query(mUri, AGGREGATE_PROJECTION, null, null, null);
}
@Override
@@ -294,24 +267,28 @@
mCursor.requery();
if (mCursor.moveToFirst()) {
// Set the name
- String name = mCursor.getString(CONTACT_NAME_COLUMN);
+ String name = mCursor.getString(AGGREGATE_DISPLAY_NAME_COLUMN);
if (TextUtils.isEmpty(name)) {
mNameView.setText(getText(android.R.string.unknownName));
} else {
mNameView.setText(name);
}
- if (mPhoneticNameView != null) {
+ // TODO(emillar) Bring this back.
+ /*if (mPhoneticNameView != null) {
String phoneticName = mCursor.getString(CONTACT_PHONETIC_NAME_COLUMN);
mPhoneticNameView.setText(phoneticName);
}
// Load the photo
mPhotoView.setImageBitmap(People.loadContactPhoto(this, mUri, mNoPhotoResource,
- null /* use the default options */));
+ null)); */
+
+ mPhotoView.setImageBitmap(BitmapFactory.decodeResource(getResources(),
+ mNoPhotoResource, null));
// Set the star
- mStarView.setChecked(mCursor.getInt(CONTACT_STARRED_COLUMN) == 1 ? true : false);
+ mStarView.setChecked(mCursor.getInt(AGGREGATE_STARRED_COLUMN) == 1 ? true : false);
// Build up the contact entries
buildEntries(mCursor);
@@ -378,8 +355,9 @@
Log.e(TAG, "bad menuInfo");
return;
}
-
- ViewEntry entry = ContactEntryAdapter.getEntry(mSections, info.position, SHOW_SEPARATORS);
+
+ // TODO(emillar) Bring this back.
+ /*ViewEntry entry = ContactEntryAdapter.getEntry(mSections, info.position, SHOW_SEPARATORS);
switch (entry.kind) {
case Contacts.KIND_PHONE: {
menu.add(0, 0, 0, R.string.menu_call).setIntent(entry.intent);
@@ -404,7 +382,7 @@
menu.add(0, 0, 0, R.string.menu_viewGroup).setIntent(entry.intent);
break;
}
- }
+ } */
}
@Override
@@ -415,12 +393,14 @@
showDialog(DIALOG_CONFIRM_DELETE);
return true;
}
- case MENU_ITEM_SHOW_BARCODE:
+
+ // TODO(emillar) Bring this back.
+ /*case MENU_ITEM_SHOW_BARCODE:
if (mCursor.moveToFirst()) {
Intent intent = new Intent(SHOW_BARCODE_INTENT);
intent.putExtra("ENCODE_TYPE", "CONTACT_TYPE");
Bundle bundle = new Bundle();
- String name = mCursor.getString(CONTACT_NAME_COLUMN);
+ String name = mCursor.getString(AGGREGATE_DISPLAY_NAME_COLUMN);
if (!TextUtils.isEmpty(name)) {
// Correctly handle when section headers are hidden
int sepAdjust = SHOW_SEPARATORS ? 1 : 0;
@@ -455,7 +435,7 @@
return true;
}
}
- break;
+ break; */
}
return super.onOptionsItemSelected(item);
}
@@ -464,7 +444,8 @@
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_ITEM_MAKE_DEFAULT: {
- AdapterView.AdapterContextMenuInfo info;
+ //TODO(emillar) Bring this back.
+ /*AdapterView.AdapterContextMenuInfo info;
try {
info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
} catch (ClassCastException e) {
@@ -475,9 +456,9 @@
ViewEntry entry = ContactEntryAdapter.getEntry(mSections, info.position,
SHOW_SEPARATORS);
ContentValues values = new ContentValues(1);
- values.put(People.PRIMARY_PHONE_ID, entry.id);
+ values.put(PRIMARY_PHONE_ID, entry.id);
getContentResolver().update(mUri, values, null, null);
- dataChanged();
+ dataChanged();*/
return true;
}
}
@@ -502,9 +483,8 @@
int index = getListView().getSelectedItemPosition();
if (index != -1) {
ViewEntry entry = ViewAdapter.getEntry(mSections, index, SHOW_SEPARATORS);
- if (entry.kind == Contacts.KIND_PHONE) {
- Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, entry.uri);
- startActivity(intent);
+ if (entry.intent.getAction() == Intent.ACTION_CALL_PRIVILEGED) {
+ startActivity(entry.intent);
}
} else if (mNumPhoneNumbers != 0) {
// There isn't anything selected, call the default number
@@ -611,7 +591,7 @@
*
* @param personCursor the URI for the contact being displayed
*/
- private final void buildEntries(Cursor personCursor) {
+ private final void buildEntries(Cursor aggCursor) {
// Clear out the old entries
final int numSections = mSections.size();
for (int i = 0; i < numSections; i++) {
@@ -621,123 +601,104 @@
if (SHOW_SEPARATORS) {
buildSeparators();
}
-
- // Build up the phone entries
- final Uri phonesUri = Uri.withAppendedPath(mUri, People.Phones.CONTENT_DIRECTORY);
- final Cursor phonesCursor = mResolver.query(phonesUri, PHONES_PROJECTION, null, null,
- Phones.ISPRIMARY + " DESC");
-
- if (phonesCursor != null) {
- while (phonesCursor.moveToNext()) {
- final int type = phonesCursor.getInt(PHONES_TYPE_COLUMN);
- final String number = phonesCursor.getString(PHONES_NUMBER_COLUMN);
- final String label = phonesCursor.getString(PHONES_LABEL_COLUMN);
- final boolean isPrimary = phonesCursor.getInt(PHONES_ISPRIMARY_COLUMN) == 1;
- final long id = phonesCursor.getLong(PHONES_ID_COLUMN);
- final Uri uri = ContentUris.withAppendedId(phonesUri, id);
-
- // Don't crash if the number is bogus
- if (TextUtils.isEmpty(number)) {
- Log.w(TAG, "empty number for phone " + id);
- continue;
- }
-
- mNumPhoneNumbers++;
+
+ // Build up method entries
+ if (mUri != null) {
+ while (aggCursor.moveToNext()) {
+ final String mimetype = aggCursor.getString(DATA_MIMETYPE_COLUMN);
+ final String pkg = aggCursor.getString(DATA_PACKAGE_COLUMN);
- // Add a phone number entry
- final ViewEntry entry = new ViewEntry();
- final CharSequence displayLabel = Phones.getDisplayLabel(this, type, label);
- entry.label = buildActionString(R.string.actionCall, displayLabel, true);
- entry.data = number;
- entry.id = id;
- entry.uri = uri;
- entry.intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, entry.uri);
- entry.auxIntent = new Intent(Intent.ACTION_SENDTO,
- Uri.fromParts("sms", number, null));
- entry.kind = Contacts.KIND_PHONE;
- if (isPrimary) {
- entry.primaryIcon = R.drawable.ic_default_number;
- }
- entry.actionIcon = android.R.drawable.sym_action_call;
- mPhoneEntries.add(entry);
-
- if (type == Phones.TYPE_MOBILE || mShowSmsLinksForAllPhones) {
- // Add an SMS entry
- ViewEntry smsEntry = new ViewEntry();
- smsEntry.label = buildActionString(R.string.actionText, displayLabel, true);
- smsEntry.data = number;
- smsEntry.id = id;
- smsEntry.uri = uri;
- smsEntry.intent = entry.auxIntent;
- smsEntry.kind = ViewEntry.KIND_SMS;
- smsEntry.actionIcon = R.drawable.sym_action_sms;
- mSmsEntries.add(smsEntry);
- }
- }
-
- phonesCursor.close();
- }
-
- // Build the contact method entries
- final Uri methodsUri = Uri.withAppendedPath(mUri, People.ContactMethods.CONTENT_DIRECTORY);
- Cursor methodsCursor = mResolver.query(
- Uri.withAppendedPath(mUri, "contact_methods_with_presence"),
- METHODS_WITH_PRESENCE_PROJECTION, null, null, null);
-
- if (methodsCursor != null) {
- String[] protocolStrings = getResources().getStringArray(android.R.array.imProtocols);
-
- while (methodsCursor.moveToNext()) {
- final int kind = methodsCursor.getInt(METHODS_KIND_COLUMN);
- final String label = methodsCursor.getString(METHODS_LABEL_COLUMN);
- final String data = methodsCursor.getString(METHODS_DATA_COLUMN);
- final int type = methodsCursor.getInt(METHODS_TYPE_COLUMN);
- final long id = methodsCursor.getLong(METHODS_ID_COLUMN);
- final Uri uri = ContentUris.withAppendedId(methodsUri, id);
-
- // Don't crash if the data is bogus
- if (TextUtils.isEmpty(data)) {
- Log.w(TAG, "empty data for contact method " + id);
- continue;
- }
-
ViewEntry entry = new ViewEntry();
+
+ final long id = aggCursor.getLong(DATA_ID_COLUMN);
+ final Uri uri = ContentUris.withAppendedId(Data.CONTENT_URI, id);
entry.id = id;
entry.uri = uri;
- entry.kind = kind;
+ //TODO(emillar) Can we get rid of kind?
+ entry.kind = 0;
- switch (kind) {
- case Contacts.KIND_EMAIL:
+ if (mimetype.equals(CommonDataKinds.Phone.CONTENT_ITEM_TYPE)
+ || mimetype.equals(CommonDataKinds.Email.CONTENT_ITEM_TYPE)
+ || mimetype.equals(CommonDataKinds.Postal.CONTENT_ITEM_TYPE)
+ || mimetype.equals(CommonDataKinds.Im.CONTENT_ITEM_TYPE)) {
+ final int type = aggCursor.getInt(DATA_1_COLUMN);
+ final String label = aggCursor.getString(DATA_2_COLUMN);
+ final String data = aggCursor.getString(DATA_3_COLUMN);
+ final boolean isPrimary = "1".equals(aggCursor.getString(DATA_4_COLUMN));
+
+ // Don't crash if the data is bogus
+ if (TextUtils.isEmpty(data)) {
+ Log.w(TAG, "empty data for contact method " + id);
+ continue;
+ }
+
+ // Build phone entries
+ if (mimetype.equals(CommonDataKinds.Phone.CONTENT_ITEM_TYPE)) {
+ mNumPhoneNumbers++;
+
+ final CharSequence displayLabel = ContactsUtils.getDisplayLabel(
+ this, mimetype, type, label);
+ entry.label = buildActionString(R.string.actionCall, displayLabel, true);
+ entry.data = data;
+ entry.intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, entry.uri);
+ entry.auxIntent = new Intent(Intent.ACTION_SENDTO,
+ Uri.fromParts("sms", data, null));
+ if (isPrimary) {
+ entry.primaryIcon = R.drawable.ic_default_number;
+ }
+ entry.actionIcon = android.R.drawable.sym_action_call;
+ mPhoneEntries.add(entry);
+
+ if (type == CommonDataKinds.Phone.TYPE_MOBILE
+ || mShowSmsLinksForAllPhones) {
+ // Add an SMS entry
+ ViewEntry smsEntry = new ViewEntry();
+ smsEntry.label = buildActionString(
+ R.string.actionText, displayLabel, true);
+ smsEntry.data = data;
+ smsEntry.id = id;
+ smsEntry.uri = uri;
+ smsEntry.intent = entry.auxIntent;
+ smsEntry.kind = ViewEntry.KIND_SMS;
+ smsEntry.actionIcon = R.drawable.sym_action_sms;
+ mSmsEntries.add(smsEntry);
+ }
+ // Build email entries
+ } else if (mimetype.equals(CommonDataKinds.Email.CONTENT_ITEM_TYPE)) {
entry.label = buildActionString(R.string.actionEmail,
- ContactMethods.getDisplayLabel(this, kind, type, label), true);
+ ContactsUtils.getDisplayLabel(this, mimetype, type, label), true);
entry.data = data;
entry.intent = new Intent(Intent.ACTION_SENDTO,
Uri.fromParts("mailto", data, null));
entry.actionIcon = android.R.drawable.sym_action_email;
+ if (isPrimary) {
+ entry.primaryIcon = R.drawable.ic_default_number;
+ }
mEmailEntries.add(entry);
- break;
-
- case Contacts.KIND_POSTAL:
+ // Build postal entries
+ } else if (mimetype.equals(CommonDataKinds.Postal.CONTENT_ITEM_TYPE)) {
entry.label = buildActionString(R.string.actionMap,
- ContactMethods.getDisplayLabel(this, kind, type, label), true);
+ ContactsUtils.getDisplayLabel(this, mimetype, type, label), true);
entry.data = data;
entry.maxLines = 4;
entry.intent = new Intent(Intent.ACTION_VIEW, uri);
entry.actionIcon = R.drawable.sym_action_map;
mPostalEntries.add(entry);
- break;
-
- case Contacts.KIND_IM: {
- Object protocolObj = ContactMethods.decodeImProtocol(
- methodsCursor.getString(METHODS_AUX_DATA_COLUMN));
+ // Build im entries
+ } else if (mimetype.equals(CommonDataKinds.Im.CONTENT_ITEM_TYPE)) {
+ String[] protocolStrings = getResources().getStringArray(
+ android.R.array.imProtocols);
+ Object protocolObj = ContactsUtils.decodeImProtocol(
+ aggCursor.getString(DATA_5_COLUMN));
String host = null;
if (protocolObj instanceof Number) {
int protocol = ((Number) protocolObj).intValue();
entry.label = buildActionString(R.string.actionChat,
protocolStrings[protocol], false);
- host = ContactMethods.lookupProviderNameFromId(protocol).toLowerCase();
- if (protocol == ContactMethods.PROTOCOL_GOOGLE_TALK
- || protocol == ContactMethods.PROTOCOL_MSN) {
+ host = ContactsUtils.lookupProviderNameFromId(
+ protocol).toLowerCase();
+ if (protocol == CommonDataKinds.Im.PROTOCOL_GOOGLE_TALK
+ || protocol == CommonDataKinds.Im.PROTOCOL_MSN) {
entry.maxLabelLines = 2;
}
} else if (protocolObj != null) {
@@ -753,203 +714,132 @@
constructImToUrl(host, data));
}
entry.data = data;
- if (!methodsCursor.isNull(METHODS_STATUS_COLUMN)) {
+ //TODO(emillar) Do we want presence info?
+ /*if (!aggCursor.isNull(METHODS_STATUS_COLUMN)) {
entry.presenceIcon = Presence.getPresenceIconResourceId(
- methodsCursor.getInt(METHODS_STATUS_COLUMN));
- }
+ aggCursor.getInt(METHODS_STATUS_COLUMN));
+ }*/
entry.actionIcon = android.R.drawable.sym_action_chat;
mImEntries.add(entry);
- break;
+ }
+ // Build organization entries
+ } else if (mimetype.equals(CommonDataKinds.Organization.CONTENT_ITEM_TYPE)) {
+ final int type = aggCursor.getInt(DATA_1_COLUMN);
+ final String label = aggCursor.getString(DATA_2_COLUMN);
+ final String company = aggCursor.getString(DATA_3_COLUMN);
+ final String title = aggCursor.getString(DATA_4_COLUMN);
+ final boolean isPrimary = "1".equals(aggCursor.getString(DATA_5_COLUMN));
+
+ if (isPrimary) {
+ entry.primaryIcon = R.drawable.ic_default_number;
}
- }
- }
-
- methodsCursor.close();
- }
-
- // Build IM entries for things we have presence info about but not explicit IM entries for
- long personId = ContentUris.parseId(mUri);
- String[] projection = new String[] {
- Presence.IM_HANDLE, // 0
- Presence.IM_PROTOCOL, // 1
- Presence.PRESENCE_STATUS, // 2
- };
- Cursor presenceCursor = mResolver.query(Presence.CONTENT_URI, projection,
- Presence.PERSON_ID + "=" + personId, null, null);
- if (presenceCursor != null) {
- try {
- while (presenceCursor.moveToNext()) {
- // Find the display info for the provider
- String data = presenceCursor.getString(0);
- String label;
- Object protocolObj = ContactMethods.decodeImProtocol(
- presenceCursor.getString(1));
- String host;
- if (protocolObj instanceof Number) {
- int protocol = ((Number) protocolObj).intValue();
- label = getResources().getStringArray(
- android.R.array.imProtocols)[protocol];
- host = ContactMethods.lookupProviderNameFromId(protocol).toLowerCase();
- } else {
- String providerName = (String) protocolObj;
- label = providerName;
- host = providerName.toLowerCase();
- }
-
- if (TextUtils.isEmpty(host)) {
- // A valid provider name is required
+
+ // Don't crash if the data is bogus
+ if (TextUtils.isEmpty(company) && TextUtils.isEmpty(title)) {
+ Log.w(TAG, "empty data for contact method " + id);
continue;
}
+
+ entry.data = title;
+ entry.actionIcon = R.drawable.sym_action_organization;
+ entry.label = company;
+ mOrganizationEntries.add(entry);
+ // Build note entries
+ } else if (mimetype.equals(CommonDataKinds.Note.CONTENT_ITEM_TYPE)) {
+ entry.label = getString(R.string.label_notes);
+ entry.data = aggCursor.getString(DATA_1_COLUMN);
+ entry.id = 0;
+ entry.uri = null;
+ entry.intent = null;
+ entry.maxLines = 10;
+ entry.actionIcon = R.drawable.sym_note;
- Intent intent = new Intent(Intent.ACTION_SENDTO, constructImToUrl(host, data));
-
- // Check to see if there is already an entry for this IM account
- boolean addEntry = true;
- int numImEntries = mImEntries.size();
- for (int i = 0; i < numImEntries; i++) {
- // Check to see if the intent point to the same thing, if so we won't
- // add this entry to the list since there is already an explict entry
- // for the IM account
- Intent existingIntent = mImEntries.get(i).intent;
- if (intent.filterEquals(existingIntent)) {
- addEntry = false;
- break;
- }
- }
-
- // Add the entry if an existing one wasn't found
- if (addEntry) {
- ViewEntry entry = new ViewEntry();
- entry.kind = Contacts.KIND_IM;
- entry.data = data;
- entry.label = label;
- entry.intent = intent;
- entry.actionIcon = android.R.drawable.sym_action_chat;
- entry.presenceIcon = Presence.getPresenceIconResourceId(
- presenceCursor.getInt(2));
- entry.maxLabelLines = 2;
- mImEntries.add(entry);
- }
- }
- } finally {
- presenceCursor.close();
- }
- }
-
- // Build the organization entries
- final Uri organizationsUri = Uri.withAppendedPath(mUri, Organizations.CONTENT_DIRECTORY);
- Cursor organizationsCursor = mResolver.query(organizationsUri, ORGANIZATIONS_PROJECTION,
- null, null, null);
-
- if (organizationsCursor != null) {
- while (organizationsCursor.moveToNext()) {
- ViewEntry entry = new ViewEntry();
- entry.id = organizationsCursor.getLong(ORGANIZATIONS_ID_COLUMN);
- entry.uri = ContentUris.withAppendedId(organizationsUri, entry.id);
- entry.kind = Contacts.KIND_ORGANIZATION;
- entry.label = organizationsCursor.getString(ORGANIZATIONS_COMPANY_COLUMN);
- entry.data = organizationsCursor.getString(ORGANIZATIONS_TITLE_COLUMN);
- entry.actionIcon = R.drawable.sym_action_organization;
-/*
- entry.label = Organizations.getDisplayLabel(this,
- organizationsCursor.getInt(ORGANIZATIONS_TYPE_COLUMN),
- organizationsCursor.getString(ORGANIZATIONS_LABEL_COLUMN)).toString();
-*/
- mOrganizationEntries.add(entry);
- }
-
- organizationsCursor.close();
- }
-
- // Build the other entries
- String note = personCursor.getString(CONTACT_NOTES_COLUMN);
- if (!TextUtils.isEmpty(note)) {
- ViewEntry entry = new ViewEntry();
- entry.label = getString(R.string.label_notes);
- entry.data = note;
- entry.id = 0;
- entry.kind = ViewEntry.KIND_CONTACT;
- entry.uri = null;
- entry.intent = null;
- entry.maxLines = 10;
- entry.actionIcon = R.drawable.sym_note;
- mOtherEntries.add(entry);
- }
-
- // Build the group entries
- final Uri groupsUri = Uri.withAppendedPath(mUri, GroupMembership.CONTENT_DIRECTORY);
- Cursor groupCursor = mResolver.query(groupsUri, ContactsListActivity.GROUPS_PROJECTION,
- null, null, Groups.DEFAULT_SORT_ORDER);
- if (groupCursor != null) {
- try {
- StringBuilder sb = new StringBuilder();
-
- while (groupCursor.moveToNext()) {
- String systemId = groupCursor.getString(
- ContactsListActivity.GROUPS_COLUMN_INDEX_SYSTEM_ID);
-
- if (systemId != null || Groups.GROUP_MY_CONTACTS.equals(systemId)) {
+ if (TextUtils.isEmpty(entry.data)) {
+ Log.w(TAG, "empty data for contact method " + id);
continue;
}
-
- String name = groupCursor.getString(ContactsListActivity.GROUPS_COLUMN_INDEX_NAME);
- if (!TextUtils.isEmpty(name)) {
- if (sb.length() == 0) {
- sb.append(name);
- } else {
- sb.append(getString(R.string.group_list, name));
- }
- }
- }
-
- if (sb.length() > 0) {
- ViewEntry entry = new ViewEntry();
- entry.kind = ContactEntryAdapter.Entry.KIND_GROUP;
- entry.label = getString(R.string.label_groups);
- entry.data = sb.toString();
- entry.intent = new Intent(Intent.ACTION_EDIT, mUri);
-
- // TODO: Add an icon for the groups item.
-
- mGroupEntries.add(entry);
- }
- } finally {
- groupCursor.close();
- }
- }
-
- // Build the ringtone entry
- String ringtoneStr = personCursor.getString(CONTACT_CUSTOM_RINGTONE_COLUMN);
- if (!TextUtils.isEmpty(ringtoneStr)) {
- // Get the URI
- Uri ringtoneUri = Uri.parse(ringtoneStr);
- if (ringtoneUri != null) {
- Ringtone ringtone = RingtoneManager.getRingtone(this, ringtoneUri);
- if (ringtone != null) {
- ViewEntry entry = new ViewEntry();
- entry.label = getString(R.string.label_ringtone);
- entry.data = ringtone.getTitle(this);
- entry.kind = ViewEntry.KIND_CONTACT;
- entry.uri = ringtoneUri;
- entry.actionIcon = R.drawable.sym_ringtone;
+
mOtherEntries.add(entry);
- }
- }
- }
+ // Build the ringtone and send to voicemail entries
+ } else if (mimetype.equals(CommonDataKinds.CustomRingtone.CONTENT_ITEM_TYPE)) {
+ final Boolean sendToVoicemail = "1".equals(aggCursor.getString(DATA_1_COLUMN));
+ final String ringtoneStr = aggCursor.getString(DATA_2_COLUMN);
- // Build the send directly to voice mail entry
- boolean sendToVoicemail = personCursor.getInt(CONTACT_SEND_TO_VOICEMAIL_COLUMN) == 1;
- if (sendToVoicemail) {
- ViewEntry entry = new ViewEntry();
- entry.label = getString(R.string.actionIncomingCall);
- entry.data = getString(R.string.detailIncomingCallsGoToVoicemail);
- entry.kind = ViewEntry.KIND_CONTACT;
- entry.actionIcon = R.drawable.sym_send_to_voicemail;
- mOtherEntries.add(entry);
+ // TODO(emillar) we need to enforce uniqueness of custom ringtone entries on a
+ // single aggregate. This could be done by checking against the reference ID stored
+ // in the aggregate.
+
+ // Build the send directly to voice mail entry
+ if (sendToVoicemail) {
+ entry.label = getString(R.string.actionIncomingCall);
+ entry.data = getString(R.string.detailIncomingCallsGoToVoicemail);
+ entry.actionIcon = R.drawable.sym_send_to_voicemail;
+ mOtherEntries.add(entry);
+ } else if (!TextUtils.isEmpty(ringtoneStr)) {
+ // Get the URI
+ Uri ringtoneUri = Uri.parse(ringtoneStr);
+ if (ringtoneUri != null) {
+ Ringtone ringtone = RingtoneManager.getRingtone(this, ringtoneUri);
+ if (ringtone != null) {
+ entry.label = getString(R.string.label_ringtone);
+ entry.data = ringtone.getTitle(this);
+ entry.uri = ringtoneUri;
+ entry.actionIcon = R.drawable.sym_ringtone;
+ mOtherEntries.add(entry);
+ }
+ }
+ }
+ }
+
+ // TODO(emillar) Add group entries
+// // Build the group entries
+// final Uri groupsUri = Uri.withAppendedPath(mUri, GroupMembership.CONTENT_DIRECTORY);
+// Cursor groupCursor = mResolver.query(groupsUri, ContactsListActivity.GROUPS_PROJECTION,
+// null, null, Groups.DEFAULT_SORT_ORDER);
+// if (groupCursor != null) {
+// try {
+// StringBuilder sb = new StringBuilder();
+//
+// while (groupCursor.moveToNext()) {
+// String systemId = groupCursor.getString(
+// ContactsListActivity.GROUPS_COLUMN_INDEX_SYSTEM_ID);
+//
+// if (systemId != null || Groups.GROUP_MY_CONTACTS.equals(systemId)) {
+// continue;
+// }
+//
+// String name = groupCursor.getString(ContactsListActivity.GROUPS_COLUMN_INDEX_NAME);
+// if (!TextUtils.isEmpty(name)) {
+// if (sb.length() == 0) {
+// sb.append(name);
+// } else {
+// sb.append(getString(R.string.group_list, name));
+// }
+// }
+// }
+//
+// if (sb.length() > 0) {
+// ViewEntry entry = new ViewEntry();
+// entry.kind = ContactEntryAdapter.Entry.KIND_GROUP;
+// entry.label = getString(R.string.label_groups);
+// entry.data = sb.toString();
+// entry.intent = new Intent(Intent.ACTION_EDIT, mUri);
+//
+// // TODO: Add an icon for the groups item.
+//
+// mGroupEntries.add(entry);
+// }
+// } finally {
+// groupCursor.close();
+// }
+// }
+
+ }
}
}
+
String buildActionString(int actionResId, CharSequence type, boolean lowerCase) {
// If there is no type just display an empty string
if (type == null) {
diff --git a/src/com/android/providers/contacts2/ContactsContract.java b/src/com/android/providers/contacts2/ContactsContract.java
deleted file mode 120000
index 206b35a..0000000
--- a/src/com/android/providers/contacts2/ContactsContract.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../providers/ContactsProvider2/src/com/android/providers/contacts2/ContactsContract.java
\ No newline at end of file
diff --git a/src/com/android/providers/contacts2/SocialContract.java b/src/com/android/providers/contacts2/SocialContract.java
deleted file mode 120000
index 40cafe1..0000000
--- a/src/com/android/providers/contacts2/SocialContract.java
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../../providers/ContactsProvider2/src/com/android/providers/contacts2/SocialContract.java
\ No newline at end of file