diff options
author | Walter Jang <wjang@google.com> | 2015-05-22 09:38:42 -0700 |
---|---|---|
committer | Walter Jang <wjang@google.com> | 2015-05-27 10:00:51 -0700 |
commit | 3e76408e47ca135c092b5eee73ae49d8697b0a10 (patch) | |
tree | b4bef74fc3e4af59260125288f818c32c60fa7a9 /src/com/android/contacts/activities/ContactEditorBaseActivity.java | |
parent | 117082633dd4f358816a1daed08bdf9e5aaa8e3c (diff) | |
download | Contacts-3e76408e47ca135c092b5eee73ae49d8697b0a10.tar.gz |
Distinguish between editor back button presses and framework stopage
We carry whether the editor fragment is being stopped
because of a back button press or because the framework
stopped the hosting Activity all the way through the various
editor fragment callbacks and the ContactSaveService because
it is not until ContactEditorBaseActivity.onSaveFinished
where we start the next Intent -- starting it causes a
"flash" if recents is clicked and follwed by an immediate
starting of the next editor Activity, which is the bug
that was filed.
With this change, we only use the ContactSaveService
resultIntent to go back to the compact editor on back
presses. The expected behavior/tested scenarios are
described at go/b21198041
Bug 21198041
Bug 19624360
Change-Id: Ic350e12aa447cff81747e003f504f25100bd5c60
Diffstat (limited to 'src/com/android/contacts/activities/ContactEditorBaseActivity.java')
-rw-r--r-- | src/com/android/contacts/activities/ContactEditorBaseActivity.java | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/com/android/contacts/activities/ContactEditorBaseActivity.java b/src/com/android/contacts/activities/ContactEditorBaseActivity.java index ec2f9b67b..41b0c6b67 100644 --- a/src/com/android/contacts/activities/ContactEditorBaseActivity.java +++ b/src/com/android/contacts/activities/ContactEditorBaseActivity.java @@ -153,14 +153,17 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity /** * Saves or creates the contact based on the mode, and if successful * finishes the activity. + * + * @param backPressed whether the save was initiated as a result of a back button press + * or because the framework stopped the editor Activity */ - boolean save(int saveMode); + boolean save(int saveMode, boolean backPressed); /** * Invoked after the contact is saved. */ void onSaveCompleted(boolean hadChanges, int saveMode, boolean saveSucceeded, - Uri contactLookupUri, Bundle updatedPhotos); + Uri contactLookupUri, Bundle updatedPhotos, boolean backPressed); /** * Invoked after the contact is joined. @@ -238,7 +241,9 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity ContactEditor.SaveMode.CLOSE), intent.getBooleanExtra(ContactSaveService.EXTRA_SAVE_SUCCEEDED, false), intent.getData(), - (Bundle) intent.getParcelableExtra(ContactSaveService.EXTRA_UPDATED_PHOTOS)); + (Bundle) intent.getParcelableExtra(ContactSaveService.EXTRA_UPDATED_PHOTOS), + intent.getBooleanExtra(ContactEditorFragment.INTENT_EXTRA_SAVE_BACK_PRESSED, + false)); } else if (ACTION_JOIN_COMPLETED.equals(action)) { mFragment.onJoinCompleted(intent.getData()); } @@ -268,11 +273,15 @@ abstract public class ContactEditorBaseActivity extends ContactsActivity @Override public void onSaveFinished(Intent resultIntent) { + final boolean backPressed = resultIntent == null ? false : resultIntent.getBooleanExtra( + ContactEditorBaseFragment.INTENT_EXTRA_SAVE_BACK_PRESSED, false); if (mFinishActivityOnSaveCompleted) { setResult(resultIntent == null ? RESULT_CANCELED : RESULT_OK, resultIntent); } else if (resultIntent != null) { - ImplicitIntentsUtil.startActivityInApp(ContactEditorBaseActivity.this, - resultIntent); + if (backPressed) { + ImplicitIntentsUtil.startActivityInApp(ContactEditorBaseActivity.this, + resultIntent); + } } finish(); } |