Use AccountManager for details, handle INSERT cases.

Connected Sources to use AccountManager and inflate details
through registered sync adapters.  Each ContactsSource now
has a "level" of inflation, since deeper levels aren't
always needed right away.  Several places we're making
blocking calls into other processes that are tied to the UI
thread.  (This would take a large effort to fix.)

Turned most background Edit activity operations into
WeakAsyncTask, which helps finish background tasks while
preventing leaked Contexts.  This allows us to hold the UI
thread while saving, but release it just before ANR,
allowing the background operation to complete.

Enabled INSERT case, both from overall list and when already
editing an aggregate.  Finally, cleaned up the manifest
intent-filters to directly match authorities.
diff --git a/src/com/android/contacts/BaseContactCardActivity.java b/src/com/android/contacts/BaseContactCardActivity.java
index b4980f6..58ea990 100644
--- a/src/com/android/contacts/BaseContactCardActivity.java
+++ b/src/com/android/contacts/BaseContactCardActivity.java
@@ -18,9 +18,9 @@
 
 import java.util.ArrayList;
 
-import com.android.contacts.NotifyingAsyncQueryHandler.AsyncQueryListener;
 import com.android.contacts.ScrollingTabWidget.OnTabSelectionChangedListener;
 import com.android.contacts.model.ContactsSource;
+import com.android.contacts.util.NotifyingAsyncQueryHandler;
 import com.android.contacts.model.Sources;
 import com.android.internal.widget.ContactHeaderWidget;
 
@@ -49,9 +49,8 @@
 /**
  * The base Activity class for viewing and editing a contact.
  */
-public abstract class BaseContactCardActivity extends Activity
-        implements AsyncQueryListener, OnTabSelectionChangedListener,
-        Sources.SourcesCompleteListener {
+public abstract class BaseContactCardActivity extends Activity implements
+        NotifyingAsyncQueryHandler.AsyncQueryListener, OnTabSelectionChangedListener {
 
     private static final String TAG = "BaseContactCardActivity";
 
@@ -75,8 +74,6 @@
 
     private static final int TOKEN_TABS = 0;
 
-    private Sources mSources;
-
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
@@ -100,12 +97,7 @@
 
         mHandler = new NotifyingAsyncQueryHandler(this, this);
 
-        Sources.requestInstance(this, this);
-
-    }
-
-    public void onSourcesComplete(Sources sources) {
-        mSources = sources;
+        // TODO: turn this into async call instead of blocking ui
         asyncSetupTabs();
     }
 
@@ -165,12 +157,17 @@
      * associated with the contact being displayed.
      */
     protected void bindTabs(ArrayList<Entity> entities) {
+        final Sources sources = Sources.getInstance(this);
+
         for (Entity entity : entities) {
             final String accountType = entity.getEntityValues().
                     getAsString(RawContacts.ACCOUNT_TYPE);
             final Long rawContactId = entity.getEntityValues().
                     getAsLong(RawContacts._ID);
-            ContactsSource source = mSources.getSourceForType(accountType);
+
+            // TODO: ensure inflation on background task so we don't block UI thread here
+            final ContactsSource source = sources.getInflatedSource(accountType,
+                    ContactsSource.LEVEL_SUMMARY);
             addTab(rawContactId, createTabIndicatorView(mTabWidget, source));
         }
         mTabWidget.setCurrentTab(0);
@@ -271,5 +268,4 @@
         }
         return createTabIndicatorView(parent, null, icon);
     }
-
 }