task.
When navigating up from a different task, if the current activity has
a result set only finish the current activity instead of trying
finishAffinity. Log this so that developers know why this behavior is
happening.
Bug
6465336
Change-Id: Ic7cec6f0c0d5861296091e2aea9344309f5fc600
onCreateNavigateUpTaskStack(b);
onPrepareNavigateUpTaskStack(b);
b.startActivities();
- finishAffinity();
+
+ // We can't finishAffinity if we have a result.
+ // Fall back and simply finish the current activity instead.
+ if (mResultCode != RESULT_CANCELED || mResultData != null) {
+ // Tell the developer what's going on to avoid hair-pulling.
+ Log.i(TAG, "onNavigateUp only finishing topmost activity to return a result");
+ finish();
+ } else {
+ finishAffinity();
+ }
} else {
navigateUpTo(upIntent);
}