Contacts: added source account name to view/edit activity.

Internal Bug: 2129158
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index 5233619..921d5a7 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -74,13 +74,11 @@
 import android.view.Window;
 import android.view.ContextMenu.ContextMenuInfo;
 import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
 import android.view.animation.TranslateAnimation;
 import android.view.animation.Animation.AnimationListener;
 import android.widget.AdapterView;
 import android.widget.FrameLayout;
 import android.widget.ImageView;
-import android.widget.LinearLayout;
 import android.widget.ListView;
 import android.widget.TextView;
 import android.widget.Toast;
@@ -137,6 +135,7 @@
     protected ScrollingTabWidget mTabWidget;
     protected ContactHeaderWidget mContactHeaderWidget;
     protected View mBelowHeader;
+    protected TextView mAccountName;
     protected View mBufferView;
     private NotifyingAsyncQueryHandler mHandler;
 
@@ -218,6 +217,7 @@
         mTabsVisible = false;
 
         mBelowHeader = findViewById(R.id.below_header);
+        mAccountName = (TextView) findViewById(R.id.account_name);
 
         mTabRawContactIdMap = new SparseArray<Long>();
 
@@ -941,6 +941,14 @@
                     continue;
                 }
 
+                if (mTabsVisible) {
+                    final String accountName = entValues.getAsString(RawContacts.ACCOUNT_NAME);
+                    mAccountName.setText(getString(R.string.account_name_format, accountName));
+                    mAccountName.setVisibility(View.VISIBLE);
+                } else {
+                    mAccountName.setVisibility(View.GONE);
+                }
+
                 for (NamedContentValues subValue : entity.getSubValues()) {
                     ViewEntry entry = new ViewEntry();
 
diff --git a/src/com/android/contacts/ui/EditContactActivity.java b/src/com/android/contacts/ui/EditContactActivity.java
index 51b10c5..bb10a8a 100644
--- a/src/com/android/contacts/ui/EditContactActivity.java
+++ b/src/com/android/contacts/ui/EditContactActivity.java
@@ -97,6 +97,7 @@
 
     private ScrollingTabWidget mTabWidget;
     private ContactHeaderWidget mHeader;
+    private TextView mAccountName;
 
     private ContactEditorView mEditor;
 
@@ -125,6 +126,7 @@
 
         mTabWidget = (ScrollingTabWidget)this.findViewById(R.id.tab_widget);
         mTabWidget.setTabSelectionListener(this);
+        mAccountName = (TextView)this.findViewById(R.id.account_name);
 
         // Build editor and listen for photo requests
         mEditor = (ContactEditorView)this.findViewById(android.R.id.tabcontent);
@@ -394,10 +396,15 @@
         if (entity == null) return;
 
         final Sources sources = Sources.getInstance(this);
-        final String accountType = entity.getValues().getAsString(RawContacts.ACCOUNT_TYPE);
+        final ValuesDelta values = entity.getValues();
+        final String accountType = values.getAsString(RawContacts.ACCOUNT_TYPE);
+        final String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
         final ContactsSource source = sources.getInflatedSource(accountType,
                 ContactsSource.LEVEL_CONSTRAINTS);
 
+        mAccountName.setText(getString(R.string.account_name_format, accountName));
+        mAccountName.setVisibility(View.VISIBLE);
+
         // Assign editor state based on entity and source
         mEditor.setState(entity, source);
     }