Call finish() in QC if contact doesn't exist
Bug: 17946654
Change-Id: I1550b1007c4daaa1022297556831db7bedcbaac0
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index e5574d9..5afa022 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -1760,29 +1760,29 @@
@Override
public void onLoadFinished(Loader<Contact> loader, Contact data) {
Trace.beginSection("onLoadFinished()");
+ try {
- if (isFinishing()) {
- return;
- }
- if (data.isError()) {
- // This shouldn't ever happen, so throw an exception. The {@link ContactLoader}
- // should log the actual exception.
- throw new IllegalStateException("Failed to load contact", data.getException());
- }
- if (data.isNotFound()) {
- if (mHasAlreadyBeenOpened) {
- finish();
- } else {
+ if (isFinishing()) {
+ return;
+ }
+ if (data.isError()) {
+ // This shouldn't ever happen, so throw an exception. The {@link ContactLoader}
+ // should log the actual exception.
+ throw new IllegalStateException("Failed to load contact", data.getException());
+ }
+ if (data.isNotFound()) {
Log.i(TAG, "No contact found: " + ((ContactLoader)loader).getLookupUri());
Toast.makeText(QuickContactActivity.this, R.string.invalidContactMessage,
Toast.LENGTH_LONG).show();
+ finish();
+ return;
}
- return;
+
+ bindContactData(data);
+
+ } finally {
+ Trace.endSection();
}
-
- bindContactData(data);
-
- Trace.endSection();
}
@Override