Prevent multiple editors from opening
Before we start the editor, destroy the loader so it isn't listening
for changes to CP2 which would cause it to reload and go through the
loadEditor code path again.
Test:
Added a manual forceLoad (after the loadEditor call) in
onLoadFinished and saw that it started more than one editor.
Added the destroyLoader call and confirmed even with the above only
one instance opened.
Bug: 32119921
Change-Id: Ib683cb60175fd816b38bd8b6d12b445ca236cd9e
diff --git a/src/com/android/contacts/activities/ContactEditorSpringBoardActivity.java b/src/com/android/contacts/activities/ContactEditorSpringBoardActivity.java
index 74991b0..a0db4c5 100644
--- a/src/com/android/contacts/activities/ContactEditorSpringBoardActivity.java
+++ b/src/com/android/contacts/activities/ContactEditorSpringBoardActivity.java
@@ -155,6 +155,9 @@
intent = EditorIntents.createEditContactIntent(this, mUri, mMaterialPalette, -1);
intent.setClass(this, ContactEditorActivity.class);
}
+ // Destroy the loader to prevent multiple onLoadFinished calls in case CP2 is updating in
+ // the background.
+ getLoaderManager().destroyLoader(LOADER_RAW_CONTACTS);
ImplicitIntentsUtil.startActivityInApp(this, intent);
}