Merge "Don't initially focus any contact editor input field" into mnc-dev
diff --git a/res/layout-land/compact_contact_editor_fragment.xml b/res/layout-land/compact_contact_editor_fragment.xml
index 2363091..12445cd 100644
--- a/res/layout-land/compact_contact_editor_fragment.xml
+++ b/res/layout-land/compact_contact_editor_fragment.xml
@@ -26,6 +26,13 @@
 
     <include layout="@layout/compact_photo_editor_view" />
 
+    <!-- Dummy view so the first input field is not initially focused. b/21644158 -->
+    <View
+            android:layout_width="0dp"
+            android:layout_height="0dp"
+            android:focusable="true"
+            android:focusableInTouchMode="true"/>
+
     <ScrollView
             android:layout_width="match_parent"
             android:layout_height="match_parent"
diff --git a/res/layout/compact_contact_editor_fragment.xml b/res/layout/compact_contact_editor_fragment.xml
index 696f8db..76b7be3 100644
--- a/res/layout/compact_contact_editor_fragment.xml
+++ b/res/layout/compact_contact_editor_fragment.xml
@@ -32,6 +32,13 @@
 
         <include layout="@layout/compact_photo_editor_view" />
 
+        <!-- Dummy view so the first input field is not initially focused. b/21644158 -->
+        <View
+                android:layout_width="0dp"
+                android:layout_height="0dp"
+                android:focusable="true"
+                android:focusableInTouchMode="true"/>
+
         <include layout="@layout/compact_contact_editor_fields" />
 
     </com.android.contacts.editor.CompactRawContactsEditorView>
diff --git a/res/layout/raw_contact_editor_view.xml b/res/layout/raw_contact_editor_view.xml
index a7e74bc..97c1b49 100644
--- a/res/layout/raw_contact_editor_view.xml
+++ b/res/layout/raw_contact_editor_view.xml
@@ -34,6 +34,13 @@
         android:layout_height="wrap_content"
         android:orientation="vertical" >
 
+        <!-- Dummy view so the first input field is not initially focused. b/21644158 -->
+        <View
+           android:layout_width="0dp"
+           android:layout_height="0dp"
+           android:focusable="true"
+           android:focusableInTouchMode="true"/>
+
         <include
             android:id="@+id/edit_name"
             layout="@layout/structured_name_editor_view" />
diff --git a/src/com/android/contacts/editor/ContactEditorBaseFragment.java b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
index 5488de5..43ec8e1 100644
--- a/src/com/android/contacts/editor/ContactEditorBaseFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
@@ -373,9 +373,6 @@
     // Used to pre-populate the editor with a display name when a user edits a read-only contact.
     protected String mDefaultDisplayName;
 
-    // Whether the name editor should receive focus after being bound
-    protected boolean mRequestFocus;
-
     // Whether to show a Toast message after saves have completed.
     // Does not affect successful toasts shown after joins, which are never displayed.
     protected boolean mShowToastAfterSave = true;
@@ -1155,7 +1152,6 @@
             RawContactDelta oldState, AccountType oldAccountType) {
         mStatus = Status.EDITING;
         mState.add(createNewRawContactDelta(account, accountType, oldState, oldAccountType));
-        mRequestFocus = true;
         mNewContactDataReady = true;
         bindEditors();
     }
@@ -1233,7 +1229,6 @@
                 mState.add(createLocalRawContactDelta());
             }
         }
-        mRequestFocus = true;
         mExistingContactDataReady = true;
         bindEditors();
     }
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 458e325..3ad5261 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -292,10 +292,6 @@
                 };
 
                 final StructuredNameEditorView nameEditor = rawContactEditor.getNameEditor();
-                if (mRequestFocus) {
-                    nameEditor.requestFocus();
-                    mRequestFocus = false;
-                }
                 nameEditor.setEditorListener(structuredNameListener);
                 if (!TextUtils.isEmpty(mDefaultDisplayName)) {
                     nameEditor.setDisplayName(mDefaultDisplayName);
@@ -311,8 +307,6 @@
             }
         }
 
-        mRequestFocus = false;
-
         setGroupMetaData();
 
         // Show editor now that we've loaded state