diff --git a/res/layout/compact_contact_editor_activity.xml b/res/layout/compact_contact_editor_activity.xml
deleted file mode 100644
index bb89d01..0000000
--- a/res/layout/compact_contact_editor_activity.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-    Copyright (C) 2015 The Android Open Source Project
-
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
--->
-
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <fragment android:id="@+id/compact_contact_editor_fragment"
-        class="com.android.contacts.editor.CompactContactEditorFragment"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
-
-</FrameLayout>
-
diff --git a/res/layout/compact_contact_editor_fragment.xml b/res/layout/compact_contact_editor_fragment.xml
deleted file mode 100644
index eb24510..0000000
--- a/res/layout/compact_contact_editor_fragment.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2015 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@color/background_primary"
-    android:fadingEdge="none"
-    android:fillViewport="true">
-
-    <LinearLayout android:id="@+id/editors"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"/>
-
-</ScrollView>
diff --git a/src/com/android/contacts/activities/CompactContactEditorActivity.java b/src/com/android/contacts/activities/CompactContactEditorActivity.java
deleted file mode 100644
index 066297d..0000000
--- a/src/com/android/contacts/activities/CompactContactEditorActivity.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.activities;
-
-import com.android.contacts.R;
-import com.android.contacts.editor.CompactContactEditorFragment;
-
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-
-/**
- * Contact editor with only the most important fields displayed initially.
- */
-public class CompactContactEditorActivity extends ContactEditorBaseActivity {
-
-    @Override
-    public void onCreate(Bundle savedState) {
-        super.onCreate(savedState);
-
-        setContentView(R.layout.compact_contact_editor_activity);
-
-        mFragment = (CompactContactEditorFragment) getFragmentManager().findFragmentById(
-                R.id.compact_contact_editor_fragment);
-        mFragment.setListener(mFragmentListener);
-
-        final String action = getIntent().getAction();
-        final Uri uri = (Intent.ACTION_EDIT + "_COMPACT").equals(action)
-                ? getIntent().getData() : null;
-        mFragment.load(action, uri, getIntent().getExtras());
-    }
-}
diff --git a/src/com/android/contacts/activities/ContactEditorActivity.java b/src/com/android/contacts/activities/ContactEditorActivity.java
index d04578e..c350da9 100644
--- a/src/com/android/contacts/activities/ContactEditorActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorActivity.java
@@ -16,32 +16,243 @@
 
 package com.android.contacts.activities;
 
-import com.android.contacts.R;
-import com.android.contacts.editor.ContactEditorFragment;
-import com.android.contacts.util.DialogManager;
-
+import android.app.ActionBar;
+import android.app.Dialog;
+import android.content.ContentValues;
+import android.content.Context;
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
+import android.provider.ContactsContract;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.RawContacts;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.TextView;
 
-/**
- * Contact editor with all fields displayed.
- */
-public class ContactEditorActivity extends ContactEditorBaseActivity
+import com.android.contacts.ContactSaveService;
+import com.android.contacts.ContactsActivity;
+import com.android.contacts.R;
+import com.android.contacts.editor.ContactEditorFragment;
+import com.android.contacts.editor.ContactEditorFragment.SaveMode;
+import com.android.contacts.common.model.AccountTypeManager;
+import com.android.contacts.common.model.account.AccountType;
+import com.android.contacts.common.model.account.AccountWithDataSet;
+import com.android.contacts.interactions.ContactDeletionInteraction;
+import com.android.contacts.util.DialogManager;
+
+import java.util.ArrayList;
+
+public class ContactEditorActivity extends ContactsActivity
         implements DialogManager.DialogShowingViewActivity {
+    private static final String TAG = "ContactEditorActivity";
+
+    public static final String ACTION_JOIN_COMPLETED = "joinCompleted";
+    public static final String ACTION_SAVE_COMPLETED = "saveCompleted";
+
+    /**
+     * Boolean intent key that specifies that this activity should finish itself
+     * (instead of launching a new view intent) after the editor changes have been
+     * saved.
+     */
+    public static final String INTENT_KEY_FINISH_ACTIVITY_ON_SAVE_COMPLETED =
+            "finishActivityOnSaveCompleted";
+
+    private ContactEditorFragment mFragment;
+    private boolean mFinishActivityOnSaveCompleted;
+
+    private DialogManager mDialogManager = new DialogManager(this);
 
     @Override
     public void onCreate(Bundle savedState) {
         super.onCreate(savedState);
 
+        final Intent intent = getIntent();
+        final String action = intent.getAction();
+
+        // Determine whether or not this activity should be finished after the user is done
+        // editing the contact or if this activity should launch another activity to view the
+        // contact's details.
+        mFinishActivityOnSaveCompleted = intent.getBooleanExtra(
+                INTENT_KEY_FINISH_ACTIVITY_ON_SAVE_COMPLETED, false);
+
+        // The only situation where action could be ACTION_JOIN_COMPLETED is if the
+        // user joined the contact with another and closed the activity before
+        // the save operation was completed.  The activity should remain closed then.
+        if (ACTION_JOIN_COMPLETED.equals(action)) {
+            finish();
+            return;
+        }
+
+        if (ACTION_SAVE_COMPLETED.equals(action)) {
+            finish();
+            return;
+        }
+
         setContentView(R.layout.contact_editor_activity);
 
+        ActionBar actionBar = getActionBar();
+        if (actionBar != null) {
+            if (Intent.ACTION_EDIT.equals(action)) {
+                actionBar.setTitle(getResources().getString(
+                        R.string.contact_editor_title_existing_contact));
+            } else {
+                actionBar.setTitle(getResources().getString(
+                        R.string.contact_editor_title_new_contact));
+            }
+            actionBar.setDisplayShowHomeEnabled(true);
+            actionBar.setDisplayHomeAsUpEnabled(true);
+        }
+
         mFragment = (ContactEditorFragment) getFragmentManager().findFragmentById(
                 R.id.contact_editor_fragment);
         mFragment.setListener(mFragmentListener);
-
-        final String action = getIntent().getAction();
-        final Uri uri = Intent.ACTION_EDIT.equals(action) ? getIntent().getData() : null;
+        Uri uri = Intent.ACTION_EDIT.equals(action) ? getIntent().getData() : null;
         mFragment.load(action, uri, getIntent().getExtras());
     }
+
+    @Override
+    protected void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+
+        if (mFragment == null) {
+            return;
+        }
+
+        String action = intent.getAction();
+        if (Intent.ACTION_EDIT.equals(action)) {
+            mFragment.setIntentExtras(intent.getExtras());
+        } else if (ACTION_SAVE_COMPLETED.equals(action)) {
+            mFragment.onSaveCompleted(true,
+                    intent.getIntExtra(ContactEditorFragment.SAVE_MODE_EXTRA_KEY, SaveMode.CLOSE),
+                    intent.getBooleanExtra(ContactSaveService.EXTRA_SAVE_SUCCEEDED, false),
+                    intent.getData());
+        } else if (ACTION_JOIN_COMPLETED.equals(action)) {
+            mFragment.onJoinCompleted(intent.getData());
+        }
+    }
+
+    @Override
+    protected Dialog onCreateDialog(int id, Bundle args) {
+        if (DialogManager.isManagedId(id)) return mDialogManager.onCreateDialog(id, args);
+
+        // Nobody knows about the Dialog
+        Log.w(TAG, "Unknown dialog requested, id: " + id + ", args: " + args);
+        return null;
+    }
+
+    @Override
+    public void onBackPressed() {
+        mFragment.save(SaveMode.CLOSE);
+    }
+
+    private final ContactEditorFragment.Listener mFragmentListener =
+            new ContactEditorFragment.Listener() {
+
+        @Override
+        public void onDeleteRequested(Uri contactUri) {
+            ContactDeletionInteraction.start(ContactEditorActivity.this, contactUri, true);
+        }
+
+        @Override
+        public void onReverted() {
+            finish();
+        }
+
+        @Override
+        public void onSaveFinished(Intent resultIntent) {
+            if (mFinishActivityOnSaveCompleted) {
+                setResult(resultIntent == null ? RESULT_CANCELED : RESULT_OK, resultIntent);
+            } else if (resultIntent != null) {
+                startActivity(resultIntent);
+            }
+            finish();
+        }
+
+        @Override
+        public void onContactSplit(Uri newLookupUri) {
+            finish();
+        }
+
+        @Override
+        public void onContactNotFound() {
+            finish();
+        }
+
+        @Override
+        public void onEditOtherContactRequested(
+                Uri contactLookupUri, ArrayList<ContentValues> values) {
+            Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
+            intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+                    | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+            intent.putExtra(ContactEditorFragment.INTENT_EXTRA_ADD_TO_DEFAULT_DIRECTORY, "");
+
+            // Pass on all the data that has been entered so far
+            if (values != null && values.size() != 0) {
+                intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, values);
+            }
+
+            startActivity(intent);
+            finish();
+        }
+
+        @Override
+        public void onCustomCreateContactActivityRequested(AccountWithDataSet account,
+                Bundle intentExtras) {
+            final AccountTypeManager accountTypes =
+                    AccountTypeManager.getInstance(ContactEditorActivity.this);
+            final AccountType accountType = accountTypes.getAccountType(
+                    account.type, account.dataSet);
+
+            Intent intent = new Intent();
+            intent.setClassName(accountType.syncAdapterPackageName,
+                    accountType.getCreateContactActivityClassName());
+            intent.setAction(Intent.ACTION_INSERT);
+            intent.setType(Contacts.CONTENT_ITEM_TYPE);
+            if (intentExtras != null) {
+                intent.putExtras(intentExtras);
+            }
+            intent.putExtra(RawContacts.ACCOUNT_NAME, account.name);
+            intent.putExtra(RawContacts.ACCOUNT_TYPE, account.type);
+            intent.putExtra(RawContacts.DATA_SET, account.dataSet);
+            intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+                    | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+            startActivity(intent);
+            finish();
+        }
+
+        @Override
+        public void onCustomEditContactActivityRequested(AccountWithDataSet account,
+                Uri rawContactUri, Bundle intentExtras, boolean redirect) {
+            final AccountTypeManager accountTypes =
+                    AccountTypeManager.getInstance(ContactEditorActivity.this);
+            final AccountType accountType = accountTypes.getAccountType(
+                    account.type, account.dataSet);
+
+            Intent intent = new Intent();
+            intent.setClassName(accountType.syncAdapterPackageName,
+                    accountType.getEditContactActivityClassName());
+            intent.setAction(Intent.ACTION_EDIT);
+            intent.setData(rawContactUri);
+            if (intentExtras != null) {
+                intent.putExtras(intentExtras);
+            }
+
+            if (redirect) {
+                intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
+                        | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
+                startActivity(intent);
+                finish();
+            } else {
+                startActivity(intent);
+            }
+        }
+    };
+
+    @Override
+    public DialogManager getDialogManager() {
+        return mDialogManager;
+    }
 }
diff --git a/src/com/android/contacts/activities/ContactEditorBaseActivity.java b/src/com/android/contacts/activities/ContactEditorBaseActivity.java
deleted file mode 100644
index 94f694e..0000000
--- a/src/com/android/contacts/activities/ContactEditorBaseActivity.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.activities;
-
-import com.android.contacts.ContactSaveService;
-import com.android.contacts.ContactsActivity;
-import com.android.contacts.R;
-import com.android.contacts.common.model.AccountTypeManager;
-import com.android.contacts.common.model.account.AccountType;
-import com.android.contacts.common.model.account.AccountWithDataSet;
-import com.android.contacts.editor.ContactEditorBaseFragment;
-import com.android.contacts.editor.ContactEditorFragment;
-import com.android.contacts.interactions.ContactDeletionInteraction;
-import com.android.contacts.util.DialogManager;
-
-import android.app.ActionBar;
-import android.app.Dialog;
-import android.content.ContentValues;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.ContactsContract;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.RawContacts;
-import android.util.Log;
-
-import java.util.ArrayList;
-
-/**
- * Base Activity for contact editors.
- */
-abstract public class ContactEditorBaseActivity extends ContactsActivity
-        implements DialogManager.DialogShowingViewActivity {
-    protected static final String TAG = "ContactEditorActivity";
-
-    public static final String ACTION_JOIN_COMPLETED = "joinCompleted";
-    public static final String ACTION_SAVE_COMPLETED = "saveCompleted";
-
-    /**
-     * Contract for contact editors Fragments that are managed by this Activity.
-     */
-    public interface ContactEditor {
-
-        /**
-         * Modes that specify what the AsyncTask has to perform after saving
-         */
-        public interface SaveMode {
-            /**
-             * Close the editor after saving
-             */
-            public static final int CLOSE = 0;
-
-            /**
-             * Reload the data so that the user can continue editing
-             */
-            public static final int RELOAD = 1;
-
-            /**
-             * Split the contact after saving
-             */
-            public static final int SPLIT = 2;
-
-            /**
-             * Join another contact after saving
-             */
-            public static final int JOIN = 3;
-
-            /**
-             * Navigate to Contacts Home activity after saving.
-             */
-            public static final int HOME = 4;
-        }
-
-        /**
-         * The status of the contact editor.
-         */
-        public interface Status {
-            /**
-             * The loader is fetching data
-             */
-            public static final int LOADING = 0;
-
-            /**
-             * Not currently busy. We are waiting for the user to enter data
-             */
-            public static final int EDITING = 1;
-
-            /**
-             * The data is currently being saved. This is used to prevent more
-             * auto-saves (they shouldn't overlap)
-             */
-            public static final int SAVING = 2;
-
-            /**
-             * Prevents any more saves. This is used if in the following cases:
-             * - After Save/Close
-             * - After Revert
-             * - After the user has accepted an edit suggestion
-             */
-            public static final int CLOSING = 3;
-
-            /**
-             * Prevents saving while running a child activity.
-             */
-            public static final int SUB_ACTIVITY = 4;
-        }
-
-        /**
-         * Sets the hosting Activity that will receive callbacks from the contact editor.
-         */
-        void setListener(ContactEditorBaseFragment.Listener listener);
-
-        /**
-         * Initialize the contact editor.
-         */
-        void load(String action, Uri lookupUri, Bundle intentExtras);
-
-        /**
-         * Merges extras from the intent.
-         */
-        void setIntentExtras(Bundle extras);
-
-        /**
-         * Saves or creates the contact based on the mode, and if successful
-         * finishes the activity.
-         */
-        boolean save(int saveMode);
-
-        /**
-         * Invoked after the contact is saved.
-         */
-        void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded,
-                Uri contactLookupUri);
-
-        /**
-         * Invoked after the contact is joined.
-         */
-        void onJoinCompleted(Uri uri);
-    }
-
-    /**
-     * Boolean intent key that specifies that this activity should finish itself
-     * (instead of launching a new view intent) after the editor changes have been
-     * saved.
-     */
-    public static final String INTENT_KEY_FINISH_ACTIVITY_ON_SAVE_COMPLETED =
-            "finishActivityOnSaveCompleted";
-
-    protected ContactEditor mFragment;
-    private boolean mFinishActivityOnSaveCompleted;
-
-    private DialogManager mDialogManager = new DialogManager(this);
-
-    @Override
-    public void onCreate(Bundle savedState) {
-        super.onCreate(savedState);
-
-        final Intent intent = getIntent();
-        final String action = intent.getAction();
-
-        // Determine whether or not this activity should be finished after the user is done
-        // editing the contact or if this activity should launch another activity to view the
-        // contact's details.
-        mFinishActivityOnSaveCompleted = intent.getBooleanExtra(
-                INTENT_KEY_FINISH_ACTIVITY_ON_SAVE_COMPLETED, false);
-
-        // The only situation where action could be ACTION_JOIN_COMPLETED is if the
-        // user joined the contact with another and closed the activity before
-        // the save operation was completed.  The activity should remain closed then.
-        if (ACTION_JOIN_COMPLETED.equals(action)) {
-            finish();
-            return;
-        }
-
-        if (ACTION_SAVE_COMPLETED.equals(action)) {
-            finish();
-            return;
-        }
-
-        ActionBar actionBar = getActionBar();
-        if (actionBar != null) {
-            if (Intent.ACTION_EDIT.equals(action)) {
-                actionBar.setTitle(getResources().getString(
-                        R.string.contact_editor_title_existing_contact));
-            } else {
-                actionBar.setTitle(getResources().getString(
-                        R.string.contact_editor_title_new_contact));
-            }
-            actionBar.setDisplayShowHomeEnabled(true);
-            actionBar.setDisplayHomeAsUpEnabled(true);
-        }
-    }
-
-    @Override
-    protected void onNewIntent(Intent intent) {
-        super.onNewIntent(intent);
-
-        if (mFragment == null) {
-            return;
-        }
-
-        String action = intent.getAction();
-        if (Intent.ACTION_EDIT.equals(action)) {
-            mFragment.setIntentExtras(intent.getExtras());
-        } else if (ACTION_SAVE_COMPLETED.equals(action)) {
-            mFragment.onSaveCompleted(true,
-                    intent.getIntExtra(ContactEditorFragment.SAVE_MODE_EXTRA_KEY,
-                            ContactEditor.SaveMode.CLOSE),
-                    intent.getBooleanExtra(ContactSaveService.EXTRA_SAVE_SUCCEEDED, false),
-                    intent.getData());
-        } else if (ACTION_JOIN_COMPLETED.equals(action)) {
-            mFragment.onJoinCompleted(intent.getData());
-        }
-    }
-
-    @Override
-    protected Dialog onCreateDialog(int id, Bundle args) {
-        if (DialogManager.isManagedId(id)) return mDialogManager.onCreateDialog(id, args);
-
-        // Nobody knows about the Dialog
-        Log.w(TAG, "Unknown dialog requested, id: " + id + ", args: " + args);
-        return null;
-    }
-
-    @Override
-    public void onBackPressed() {
-        if (mFragment != null) {
-            mFragment.save(ContactEditor.SaveMode.CLOSE);
-        }
-    }
-
-    protected final ContactEditorBaseFragment.Listener  mFragmentListener =
-            new ContactEditorBaseFragment.Listener() {
-
-        @Override
-        public void onDeleteRequested(Uri contactUri) {
-            ContactDeletionInteraction.start(ContactEditorBaseActivity.this, contactUri, true);
-        }
-
-        @Override
-        public void onReverted() {
-            finish();
-        }
-
-        @Override
-        public void onSaveFinished(Intent resultIntent) {
-            if (mFinishActivityOnSaveCompleted) {
-                setResult(resultIntent == null ? RESULT_CANCELED : RESULT_OK, resultIntent);
-            } else if (resultIntent != null) {
-                startActivity(resultIntent);
-            }
-            finish();
-        }
-
-        @Override
-        public void onContactSplit(Uri newLookupUri) {
-            finish();
-        }
-
-        @Override
-        public void onContactNotFound() {
-            finish();
-        }
-
-        @Override
-        public void onEditOtherContactRequested(
-                Uri contactLookupUri, ArrayList<ContentValues> values) {
-            Intent intent = new Intent(Intent.ACTION_EDIT, contactLookupUri);
-            intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
-                    | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
-            intent.putExtra(ContactEditorFragment.INTENT_EXTRA_ADD_TO_DEFAULT_DIRECTORY, "");
-
-            // Pass on all the data that has been entered so far
-            if (values != null && values.size() != 0) {
-                intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, values);
-            }
-
-            startActivity(intent);
-            finish();
-        }
-
-        @Override
-        public void onCustomCreateContactActivityRequested(AccountWithDataSet account,
-                Bundle intentExtras) {
-            final AccountTypeManager accountTypes =
-                    AccountTypeManager.getInstance(ContactEditorBaseActivity.this);
-            final AccountType accountType = accountTypes.getAccountType(
-                    account.type, account.dataSet);
-
-            Intent intent = new Intent();
-            intent.setClassName(accountType.syncAdapterPackageName,
-                    accountType.getCreateContactActivityClassName());
-            intent.setAction(Intent.ACTION_INSERT);
-            intent.setType(Contacts.CONTENT_ITEM_TYPE);
-            if (intentExtras != null) {
-                intent.putExtras(intentExtras);
-            }
-            intent.putExtra(RawContacts.ACCOUNT_NAME, account.name);
-            intent.putExtra(RawContacts.ACCOUNT_TYPE, account.type);
-            intent.putExtra(RawContacts.DATA_SET, account.dataSet);
-            intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
-                    | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
-            startActivity(intent);
-            finish();
-        }
-
-        @Override
-        public void onCustomEditContactActivityRequested(AccountWithDataSet account,
-                Uri rawContactUri, Bundle intentExtras, boolean redirect) {
-            final AccountTypeManager accountTypes =
-                    AccountTypeManager.getInstance(ContactEditorBaseActivity.this);
-            final AccountType accountType = accountTypes.getAccountType(
-                    account.type, account.dataSet);
-
-            Intent intent = new Intent();
-            intent.setClassName(accountType.syncAdapterPackageName,
-                    accountType.getEditContactActivityClassName());
-            intent.setAction(Intent.ACTION_EDIT);
-            intent.setData(rawContactUri);
-            if (intentExtras != null) {
-                intent.putExtras(intentExtras);
-            }
-
-            if (redirect) {
-                intent.setFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
-                        | Intent.FLAG_ACTIVITY_FORWARD_RESULT);
-                startActivity(intent);
-                finish();
-            } else {
-                startActivity(intent);
-            }
-        }
-    };
-
-    @Override
-    public DialogManager getDialogManager() {
-        return mDialogManager;
-    }
-}
diff --git a/src/com/android/contacts/editor/CompactContactEditorFragment.java b/src/com/android/contacts/editor/CompactContactEditorFragment.java
deleted file mode 100644
index b88e403..0000000
--- a/src/com/android/contacts/editor/CompactContactEditorFragment.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.editor;
-
-import com.android.contacts.R;
-import com.android.contacts.activities.ContactEditorBaseActivity.ContactEditor;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.LinearLayout;
-
-/**
- * Contact editor with only the most important fields displayed initially.
- */
-public class CompactContactEditorFragment extends ContactEditorBaseFragment
-        implements ContactEditor {
-
-    private Context mContext;
-    private ContactEditorBaseFragment.Listener mListener;
-
-    private String mAction;
-    private Uri mLookupUri;
-    private Bundle mIntentExtras;
-
-    private LinearLayout mContent;
-
-    @Override
-    public void onAttach(Activity activity) {
-        super.onAttach(activity);
-        mContext = activity;
-    }
-
-    @Override
-    public void setListener(Listener listener) {
-        mListener = listener;
-    }
-
-    @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedState) {
-        final View view = inflater.inflate(
-                R.layout.compact_contact_editor_fragment, container, false);
-        mContent = (LinearLayout) view.findViewById(R.id.editors);
-        return view;
-    }
-
-    @Override
-    public void load(String action, Uri lookupUri, Bundle intentExtras) {
-        mAction = action;
-        mLookupUri = lookupUri;
-        mIntentExtras = intentExtras;
-    }
-
-    @Override
-    public void setIntentExtras(Bundle extras) {
-    }
-
-    @Override
-    public boolean save(int saveMode) {
-        onSaveCompleted(/* hadChanges =*/ false, saveMode,
-                /* saveSucceeded =*/ mLookupUri != null, mLookupUri);
-        return true;
-    }
-
-    @Override
-    public void onJoinCompleted(Uri uri) {
-        onSaveCompleted(/* hadChanges =*/ false, SaveMode.RELOAD,
-                /* saveSucceeded =*/ uri != null, uri);
-    }
-
-    @Override
-    public void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded,
-            Uri contactLookupUri) {
-        switch (saveMode) {
-            case SaveMode.CLOSE:
-            case SaveMode.HOME:
-                if (mListener != null) {
-                    final Intent resultIntent;
-                    if (saveSucceeded && contactLookupUri != null) {
-                        final Uri lookupUri = maybeConvertToLegacyLookupUri(
-                                mContext, contactLookupUri, mLookupUri);
-                        resultIntent = composeQuickContactsIntent(mContext, lookupUri);
-                    } else {
-                        resultIntent = null;
-                    }
-                    mListener.onSaveFinished(resultIntent);
-                }
-                break;
-        }
-    }
-}
diff --git a/src/com/android/contacts/editor/ContactEditorBaseFragment.java b/src/com/android/contacts/editor/ContactEditorBaseFragment.java
deleted file mode 100644
index dfa51c2..0000000
--- a/src/com/android/contacts/editor/ContactEditorBaseFragment.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.editor;
-
-import com.android.contacts.common.model.account.AccountWithDataSet;
-import com.android.contacts.quickcontact.QuickContactActivity;
-
-import android.app.Fragment;
-import android.content.ContentUris;
-import android.content.ContentValues;
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Rect;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.ContactsContract.Contacts;
-import android.provider.ContactsContract.QuickContact;
-
-import java.util.ArrayList;
-
-/**
- * Base Fragment for contact editors.
- */
-abstract public class ContactEditorBaseFragment extends Fragment {
-
-    protected static final String TAG = "ContactCompactEditor";
-
-    /**
-     * Callbacks for Activities that host contact editors Fragments.
-     */
-    public interface Listener {
-
-        /**
-         * Contact was not found, so somehow close this fragment. This is raised after a contact
-         * is removed via Menu/Delete
-         */
-        void onContactNotFound();
-
-        /**
-         * Contact was split, so we can close now.
-         *
-         * @param newLookupUri The lookup uri of the new contact that should be shown to the user.
-         *                     The editor tries best to chose the most natural contact here.
-         */
-        void onContactSplit(Uri newLookupUri);
-
-        /**
-         * User has tapped Revert, close the fragment now.
-         */
-        void onReverted();
-
-        /**
-         * Contact was saved and the Fragment can now be closed safely.
-         */
-        void onSaveFinished(Intent resultIntent);
-
-        /**
-         * User switched to editing a different contact (a suggestion from the
-         * aggregation engine).
-         */
-        void onEditOtherContactRequested(Uri contactLookupUri,
-                ArrayList<ContentValues> contentValues);
-
-        /**
-         * Contact is being created for an external account that provides its own
-         * new contact activity.
-         */
-        void onCustomCreateContactActivityRequested(AccountWithDataSet account,
-                Bundle intentExtras);
-
-        /**
-         * The edited raw contact belongs to an external account that provides
-         * its own edit activity.
-         *
-         * @param redirect indicates that the current editor should be closed
-         *                 before the custom editor is shown.
-         */
-        void onCustomEditContactActivityRequested(AccountWithDataSet account, Uri rawContactUri,
-                Bundle intentExtras, boolean redirect);
-
-        /**
-         *
-         */
-        void onDeleteRequested(Uri contactUri);
-    }
-
-    /**
-     * Returns a legacy version of the given contactLookupUri if a legacy Uri was originally
-     * passed to the contact editor.
-     *
-     * @param contactLookupUri The Uri to possibly convert to legacy format.
-     * @param requestLookupUri The lookup Uri originally passed to the contact editor
-     *                         (via Intent data), may be null.
-     */
-    protected static Uri maybeConvertToLegacyLookupUri(Context context, Uri contactLookupUri,
-            Uri requestLookupUri) {
-        final String legacyAuthority = "contacts";
-        final String requestAuthority = requestLookupUri == null
-                ? null : requestLookupUri.getAuthority();
-        if (legacyAuthority.equals(requestAuthority)) {
-            // Build a legacy Uri if that is what was requested by caller
-            final long contactId = ContentUris.parseId(Contacts.lookupContact(
-                    context.getContentResolver(), contactLookupUri));
-            final Uri legacyContentUri = Uri.parse("content://contacts/people");
-            return ContentUris.withAppendedId(legacyContentUri, contactId);
-        }
-        // Otherwise pass back a lookup-style Uri
-        return contactLookupUri;
-    }
-
-    /**
-     * Creates the result Intent for the given contactLookupUri that should started after a
-     * successful saving a contact.
-     */
-    protected static Intent composeQuickContactsIntent(Context context, Uri contactLookupUri) {
-        final Intent intent = QuickContact.composeQuickContactsIntent(
-                context, (Rect) null, contactLookupUri, QuickContactActivity.MODE_FULLY_EXPANDED,
-                /* excludedMimes =*/ null);
-        // Make sure not to show QuickContacts on top of another QuickContacts.
-        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-        return intent;
-    }
-}
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index fddb4b3..e98ba7d 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -21,10 +21,12 @@
 import android.app.AlertDialog;
 import android.app.Dialog;
 import android.app.DialogFragment;
+import android.app.Fragment;
 import android.app.LoaderManager;
 import android.app.LoaderManager.LoaderCallbacks;
 import android.content.ActivityNotFoundException;
 import android.content.ContentUris;
+import android.content.ContentValues;
 import android.content.Context;
 import android.content.CursorLoader;
 import android.content.DialogInterface;
@@ -32,6 +34,7 @@
 import android.content.Loader;
 import android.database.Cursor;
 import android.graphics.Bitmap;
+import android.graphics.Rect;
 import android.media.RingtoneManager;
 import android.net.Uri;
 import android.os.Bundle;
@@ -42,8 +45,10 @@
 import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.provider.ContactsContract.CommonDataKinds.Photo;
 import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
+import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.Groups;
 import android.provider.ContactsContract.Intents;
+import android.provider.ContactsContract.QuickContact;
 import android.provider.ContactsContract.RawContacts;
 import android.text.TextUtils;
 import android.util.Log;
@@ -65,7 +70,6 @@
 import com.android.contacts.R;
 import com.android.contacts.activities.ContactEditorAccountsChangedActivity;
 import com.android.contacts.activities.ContactEditorActivity;
-import com.android.contacts.activities.ContactEditorBaseActivity.ContactEditor;
 import com.android.contacts.common.model.AccountTypeManager;
 import com.android.contacts.common.model.ValuesDelta;
 import com.android.contacts.common.model.account.AccountType;
@@ -83,6 +87,7 @@
 import com.android.contacts.common.model.RawContactDeltaList;
 import com.android.contacts.common.model.RawContactModifier;
 import com.android.contacts.list.UiIntentActions;
+import com.android.contacts.quickcontact.QuickContactActivity;
 import com.android.contacts.util.ContactPhotoUtils;
 import com.android.contacts.util.HelpUtils;
 import com.android.contacts.util.PhoneCapabilityTester;
@@ -91,19 +96,19 @@
 import com.google.common.collect.Lists;
 
 import java.io.FileNotFoundException;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 
-/**
- * Contact editor with all fields displayed.
- */
-public class ContactEditorFragment extends ContactEditorBaseFragment implements
-        ContactEditor, SplitContactConfirmationDialogFragment.Listener,
+public class ContactEditorFragment extends Fragment implements
+        SplitContactConfirmationDialogFragment.Listener,
         AggregationSuggestionEngine.Listener, AggregationSuggestionView.Listener,
         RawContactReadOnlyEditorView.Listener {
 
+    private static final String TAG = ContactEditorFragment.class.getSimpleName();
+
     private static final int LOADER_DATA = 1;
     private static final int LOADER_GROUPS = 2;
 
@@ -134,6 +139,7 @@
 
     public static final String SAVE_MODE_EXTRA_KEY = "saveMode";
 
+
     /**
      * An intent extra that forces the editor to add the edited contact
      * to the default group (e.g. "My Contacts").
@@ -145,6 +151,67 @@
     public static final String INTENT_EXTRA_DISABLE_DELETE_MENU_OPTION =
             "disableDeleteMenuOption";
 
+    /**
+     * Modes that specify what the AsyncTask has to perform after saving
+     */
+    public interface SaveMode {
+        /**
+         * Close the editor after saving
+         */
+        public static final int CLOSE = 0;
+
+        /**
+         * Reload the data so that the user can continue editing
+         */
+        public static final int RELOAD = 1;
+
+        /**
+         * Split the contact after saving
+         */
+        public static final int SPLIT = 2;
+
+        /**
+         * Join another contact after saving
+         */
+        public static final int JOIN = 3;
+
+        /**
+         * Navigate to Contacts Home activity after saving.
+         */
+        public static final int HOME = 4;
+    }
+
+    private interface Status {
+        /**
+         * The loader is fetching data
+         */
+        public static final int LOADING = 0;
+
+        /**
+         * Not currently busy. We are waiting for the user to enter data
+         */
+        public static final int EDITING = 1;
+
+        /**
+         * The data is currently being saved. This is used to prevent more
+         * auto-saves (they shouldn't overlap)
+         */
+        public static final int SAVING = 2;
+
+        /**
+         * Prevents any more saves. This is used if in the following cases:
+         * - After Save/Close
+         * - After Revert
+         * - After the user has accepted an edit suggestion
+         */
+        public static final int CLOSING = 3;
+
+        /**
+         * Prevents saving while running a child activity.
+         */
+        public static final int SUB_ACTIVITY = 4;
+    }
+
     private static final int REQUEST_CODE_JOIN = 0;
     private static final int REQUEST_CODE_ACCOUNTS_CHANGED = 1;
     private static final int REQUEST_CODE_PICK_RINGTONE = 2;
@@ -175,7 +242,7 @@
     private String mAction;
     private Uri mLookupUri;
     private Bundle mIntentExtras;
-    private ContactEditorBaseFragment.Listener mListener;
+    private Listener mListener;
 
     private long mContactIdForJoin;
     private boolean mContactWritableForJoin;
@@ -405,7 +472,6 @@
         super.onStart();
     }
 
-    @Override
     public void load(String action, Uri lookupUri, Bundle intentExtras) {
         mAction = action;
         mLookupUri = lookupUri;
@@ -418,7 +484,6 @@
                 && mIntentExtras.getBoolean(INTENT_EXTRA_DISABLE_DELETE_MENU_OPTION);
     }
 
-    @Override
     public void setListener(Listener value) {
         mListener = value;
     }
@@ -1144,7 +1209,10 @@
         return RawContactModifier.hasChanges(mState, accountTypes);
     }
 
-    @Override
+    /**
+     * Saves or creates the contact based on the mode, and if successful
+     * finishes the activity.
+     */
     public boolean save(int saveMode) {
         if (!hasValidState() || mStatus != Status.EDITING) {
             return false;
@@ -1292,9 +1360,27 @@
             case SaveMode.HOME:
                 final Intent resultIntent;
                 if (saveSucceeded && contactLookupUri != null) {
-                    final Uri lookupUri = maybeConvertToLegacyLookupUri(
-                            mContext, contactLookupUri, mLookupUri);
-                    resultIntent = composeQuickContactsIntent(mContext, lookupUri);
+                    final String requestAuthority =
+                            mLookupUri == null ? null : mLookupUri.getAuthority();
+
+                    final String legacyAuthority = "contacts";
+                    final Uri lookupUri;
+                    if (legacyAuthority.equals(requestAuthority)) {
+                        // Build legacy Uri when requested by caller
+                        final long contactId = ContentUris.parseId(Contacts.lookupContact(
+                                mContext.getContentResolver(), contactLookupUri));
+                        final Uri legacyContentUri = Uri.parse("content://contacts/people");
+                        final Uri legacyUri = ContentUris.withAppendedId(
+                                legacyContentUri, contactId);
+                        lookupUri = legacyUri;
+                    } else {
+                        // Otherwise pass back a lookup-style Uri
+                        lookupUri = contactLookupUri;
+                    }
+                    resultIntent = QuickContact.composeQuickContactsIntent(getActivity(),
+                            (Rect) null, lookupUri, QuickContactActivity.MODE_FULLY_EXPANDED, null);
+                    // Make sure not to show QuickContacts on top of another QuickContacts.
+                    resultIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                 } else {
                     resultIntent = null;
                 }
@@ -1378,6 +1464,57 @@
         return mNewLocalProfile || mIsUserProfile;
     }
 
+    public static interface Listener {
+        /**
+         * Contact was not found, so somehow close this fragment. This is raised after a contact
+         * is removed via Menu/Delete
+         */
+        void onContactNotFound();
+
+        /**
+         * Contact was split, so we can close now.
+         * @param newLookupUri The lookup uri of the new contact that should be shown to the user.
+         * The editor tries best to chose the most natural contact here.
+         */
+        void onContactSplit(Uri newLookupUri);
+
+        /**
+         * User has tapped Revert, close the fragment now.
+         */
+        void onReverted();
+
+        /**
+         * Contact was saved and the Fragment can now be closed safely.
+         */
+        void onSaveFinished(Intent resultIntent);
+
+        /**
+         * User switched to editing a different contact (a suggestion from the
+         * aggregation engine).
+         */
+        void onEditOtherContactRequested(
+                Uri contactLookupUri, ArrayList<ContentValues> contentValues);
+
+        /**
+         * Contact is being created for an external account that provides its own
+         * new contact activity.
+         */
+        void onCustomCreateContactActivityRequested(AccountWithDataSet account,
+                Bundle intentExtras);
+
+        /**
+         * The edited raw contact belongs to an external account that provides
+         * its own edit activity.
+         *
+         * @param redirect indicates that the current editor should be closed
+         *            before the custom editor is shown.
+         */
+        void onCustomEditContactActivityRequested(AccountWithDataSet account, Uri rawContactUri,
+                Bundle intentExtras, boolean redirect);
+
+        void onDeleteRequested(Uri contactUri);
+    }
+
     private class EntityDeltaComparator implements Comparator<RawContactDelta> {
         /**
          * Compare EntityDeltas for sorting the stack of editors.
