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

Commit b7a922fb authored by riddle_hsu's avatar riddle_hsu Committed by Steve Kondik
Browse files

[ActivityManager] Fix adjust to wrong focused stack

Symptom:
Back from application to home, the previous top activity
of app stack will show awhile then return to home.

Reproduce step:
1.Launch task T from home.
2.Press home key.
3.Launch task A from home.
4.A launches task B.
5.B finish self and A finish onResume.
6.T will show awile and auto return to home.

http://youtu.be/JrFIUHVw4Js

Root Cause:
Not adjust correct focus stack to resume if there is
finishing task.

Solution:
Ignore finishing task when comparing top task.

Change-Id: Id5d6d58ccdac38bdbebba6df50a063b78182cd4f
parent 3d1e1165
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -2543,8 +2543,23 @@ final class ActivityStack {
            ActivityRecord next = topRunningActivityLocked(null);
            if (next != r) {
                final TaskRecord task = r.task;
                if (r.frontOfTask && task == topTask() && task.isOverHomeStack()) {
                if ((next == null || next.task != task) && r.frontOfTask) {
                    if (task.isOverHomeStack() && task == topTask()) {
                        mStackSupervisor.moveHomeStackTaskToTop(task.getTaskToReturnTo());
                    } else {
                        for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
                            final TaskRecord tr  = mTaskHistory.get(taskNdx);
                            if (tr.getTopActivity() == null) {
                                if (tr.isOverHomeStack()) {
                                    mStackSupervisor.moveHomeStackTaskToTop(
                                        task.getTaskToReturnTo());
                                    break;
                                }
                            } else {
                                break;
                            }
                        }
                    }
                }
            }
            ActivityRecord top = mStackSupervisor.topRunningActivityLocked();