• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

Revision5d11899b6d8ab3edd8ef0d5ca3ca5ea89a009c89 (tree)
Time2020-07-11 16:40:13
Authorutzcoz <utzcoz@outl...>
Commiterutzcoz

Log Message

Keep stack order when starting activity from recents

When starting activity from recents, the AMS will move home stack to
front and then move selected activity stack to front. So when we start
many freeform windows, the operation will move unselected freeform
windows to back. It's not good for usage. So this patch will remove the
logic to move home stack to front when starting activity from recents,
and move recents stack to background to dismiss the recents page.

For split screen secondary windowing, we keep the origin logic to move
home stack to front. If we find rigid problems when starting split
screen window or pip window, we should review this patch again to check
whether this patch causes the problem.

Signed-off-by: utzcoz <utzcoz@outlook.com>

Change Summary

Incremental Difference

--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1048,7 +1048,11 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
10481048 }
10491049 }
10501050
1051- if (!isActivityTypeHome() && returnsToHomeStack()) {
1051+ // region @boringdroid
1052+ // if (!isActivityTypeHome() && returnsToHomeStack()) {
1053+ // We don't need to move to home stack after recents finished.
1054+ if (!isActivityTypeHome() && !isActivityTypeRecents() && returnsToHomeStack()) {
1055+ // endregion
10521056 // Make sure the home stack is behind this stack since that is where we should return to
10531057 // when this stack is no longer visible.
10541058 mStackSupervisor.moveHomeStackToFront(reason + " returnToHome");
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -738,6 +738,15 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
738738 recentsStack.moveToFront(reason);
739739 }
740740 }
741+ // region @boringdroid
742+ void moveRecentsStackToBack(String reason) {
743+ final ActivityStack recentsStack = getDefaultDisplay().getStack(
744+ WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_RECENTS);
745+ if (recentsStack != null) {
746+ recentsStack.moveToBack(reason, null);
747+ }
748+ }
749+ // endregion
741750
742751 /** Returns true if the focus activity was adjusted to the home stack top activity. */
743752 boolean moveHomeStackTaskToTop(String reason) {
@@ -2293,8 +2302,12 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
22932302
22942303 final ActivityRecord prev = topRunningActivityLocked();
22952304
2296- if ((flags & ActivityManager.MOVE_TASK_WITH_HOME) != 0
2297- || (prev != null && prev.isActivityTypeRecents())) {
2305+ // region @boringdroid
2306+ // We only move home stack to from if the task wants to move task with home.
2307+ if ((flags & ActivityManager.MOVE_TASK_WITH_HOME) != 0) {
2308+ // if ((flags & ActivityManager.MOVE_TASK_WITH_HOME) != 0
2309+ // || (prev != null && prev.isActivityTypeRecents())) {
2310+ // endregion
22982311 // Caller wants the home activity moved with it or the previous task is recents in which
22992312 // case we always return home from the task we are moving to the front.
23002313 moveHomeStackToFront("findTaskToMoveToFront");
@@ -4811,7 +4824,17 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
48114824 // We always want to return to the home activity instead of the recents activity
48124825 // from whatever is started from the recents activity, so move the home stack
48134826 // forward.
4814- moveHomeStackToFront("startActivityFromRecents");
4827+ // region @boringdroid
4828+ // We only move the home stack forward for split screen. We don't do it for
4829+ // fullscreen or freeform activity. For other windowing mode activity, we should
4830+ // consider this check logic when encountering rigid problem.
4831+ // moveHomeStackToFront("startActivityFromRecents");
4832+ if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY) {
4833+ moveHomeStackToFront("startActivityFromRecents");
4834+ } else {
4835+ moveRecentsStackToBack("startActivityFromRecents");
4836+ }
4837+ // endregion
48154838 }
48164839
48174840 // If the user must confirm credentials (e.g. when first launching a work app and the