Handle saving and communicating selected tab between View/Edit activities.

EditContactActivity now accepts intents with raw_contacts instead of
contacts. In addition it reports back which raw_contact was selected on
exit.

ViewContactActivity now saves and restores which raw_contact was
currently being viewed, and uses the raw_contact reported back from
EditContactActivity. The overall effect is when moving from View->Edit
or Edit->View the selected tab doesn't change.
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index d2a01ca..33bbf1c 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -21,6 +21,8 @@
 
 import java.io.ByteArrayInputStream;
 import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract.RawContacts;
+
 import java.io.InputStream;
 
 import android.net.Uri;
@@ -230,4 +232,22 @@
         intent.putExtra("return-data", true);
         return intent;
     }
+
+    public static long queryForContactId(ContentResolver cr, long rawContactId) {
+        Cursor contactIdCursor = null;
+        long contactId = -1;
+        try {
+            contactIdCursor = cr.query(RawContacts.CONTENT_URI,
+                    new String[] {RawContacts.CONTACT_ID},
+                    RawContacts._ID + "=" + rawContactId, null, null);
+            if (contactIdCursor != null && contactIdCursor.moveToFirst()) {
+                contactId = contactIdCursor.getLong(0);
+            }
+        } finally {
+            if (contactIdCursor != null) {
+                contactIdCursor.close();
+            }
+        }
+        return contactId;
+    }
 }