Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3d193d92 authored by Adam Powell's avatar Adam Powell
Browse files

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
parent a7ea0d39
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2713,7 +2713,16 @@ public class Activity extends ContextThemeWrapper
                onCreateNavigateUpTaskStack(b);
                onPrepareNavigateUpTaskStack(b);
                b.startActivities();

                // 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);
            }