Fix editor crash on rotation when no default account exists

Persist the current primary account in the fragment. Normally a
default account has to be chosen before a new contact is added
but when adding a new contact from an account view, that account
is passed in through an intent extra and set as the primary for
the fragment. On rotation it's lost because reading the intent
extras only happens when saveState is null.
Also remove an unused constant.

Test: Followed repro steps in the bug and verified no crash
happens and the new contact is saved to the correct account.

Bug: 33691259
Change-Id: I12a86af907be7d11980349583fa6d44b3097de15
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 1a1295b..8f8d10f 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -130,7 +130,7 @@
     private static final String KEY_DISABLE_DELETE_MENU_OPTION = "disableDeleteMenuOption";
     private static final String KEY_NEW_LOCAL_PROFILE = "newLocalProfile";
     private static final String KEY_MATERIAL_PALETTE = "materialPalette";
-
+    private static final String KEY_ACCOUNT = "saveToAccount";
     private static final String KEY_VIEW_ID_GENERATOR = "viewidgenerator";
 
     private static final String KEY_RAW_CONTACTS = "rawContacts";
@@ -161,8 +161,6 @@
     protected static final int REQUEST_CODE_JOIN = 0;
     protected static final int REQUEST_CODE_ACCOUNTS_CHANGED = 1;
 
-    private static final int CURRENT_API_VERSION = android.os.Build.VERSION.SDK_INT;
-
     /**
      * An intent extra that forces the editor to add the edited contact
      * to the default group (e.g. "My Contacts").
@@ -473,7 +471,7 @@
             mDisableDeleteMenuOption = savedState.getBoolean(KEY_DISABLE_DELETE_MENU_OPTION);
             mNewLocalProfile = savedState.getBoolean(KEY_NEW_LOCAL_PROFILE);
             mMaterialPalette = savedState.getParcelable(KEY_MATERIAL_PALETTE);
-
+            mAccountWithDataSet = savedState.getParcelable(KEY_ACCOUNT);
             mRawContacts = ImmutableList.copyOf(savedState.<RawContact>getParcelableArrayList(
                     KEY_RAW_CONTACTS));
             // NOTE: mGroupMetaData is not saved/restored
@@ -603,7 +601,7 @@
         outState.putBoolean(KEY_NEW_CONTACT_READY, mNewContactDataReady);
         outState.putBoolean(KEY_IS_EDIT, mIsEdit);
         outState.putBoolean(KEY_EXISTING_CONTACT_READY, mExistingContactDataReady);
-
+        outState.putParcelable(KEY_ACCOUNT, mAccountWithDataSet);
         outState.putBoolean(KEY_IS_USER_PROFILE, mIsUserProfile);
 
         outState.putBoolean(KEY_ENABLED, mEnabled);