diff options
author | Adam Powell <adamp@google.com> | 2012-05-15 16:51:55 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2012-05-15 16:53:34 -0700 |
commit | 3d193d92f601569bb99fe011bb6e104a492a0a71 (patch) | |
tree | da51966d356042d7f2bf378ccfa408de6b95a31c /core/java/android/app | |
parent | a7ea0d3968dc990aa76f3535c213e735e6d5e186 (diff) | |
download | frameworks_base-3d193d92f601569bb99fe011bb6e104a492a0a71.zip frameworks_base-3d193d92f601569bb99fe011bb6e104a492a0a71.tar.gz frameworks_base-3d193d92f601569bb99fe011bb6e104a492a0a71.tar.bz2 |
Handle returning a result from automatic up navigation from another
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
Diffstat (limited to 'core/java/android/app')
-rw-r--r-- | core/java/android/app/Activity.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index ac55abe..69ee434 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -2713,7 +2713,16 @@ public class Activity extends ContextThemeWrapper 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); } |