Fix editor crash on rotation when no default account exists
am: c135a5d502
Change-Id: Ide3f311c0eaae6d53aa94f0d83029c599bace1a6
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 213648f..bc0c7f8 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").
@@ -472,7 +470,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
@@ -602,7 +600,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);