summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wale Ogunwale <ogunwale@google.com> 2018-02-15 13:58:46 -0800
committer Wale Ogunwale <ogunwale@google.com> 2018-02-15 13:58:46 -0800
commitdd2ae3da441aafb7794c24cad01a0159297bee78 (patch)
treef34d618e1685f4a178f687e42c7e921dc005b998
parentee3a2ba97204f7d23c733504991d930aefd9fe7b (diff)
Move home stack forward while entering split-screen in some cases
If the home activity if the top split-screen secondary stack, then the primary split-screen stack is in the minimized mode which means it can't receive input keys, so we should move the focused app to the home app so that window manager can correctly calculate the focus window that can receive input keys. Change-Id: If7379d6259e0f589cae03f235a4cc7d03cc41e52 Fixes: 73349992 Test: Steps from bug
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java34
1 files changed, 20 insertions, 14 deletions
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 5c30764e1e85..f4f60c2c43a9 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -4516,7 +4516,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
int startActivityFromRecents(int callingPid, int callingUid, int taskId,
SafeActivityOptions options) {
- final TaskRecord task;
+ TaskRecord task = null;
final String callingPackage;
final Intent intent;
final int userId;
@@ -4579,13 +4579,6 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
targetActivity);
}
- // If we are launching the task in the docked stack, put it into resizing mode so
- // the window renders full-screen with the background filling the void. Also only
- // call this at the end to make sure that tasks exists on the window manager side.
- if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
- setResizingDuringAnimation(task);
- }
-
mService.getActivityStartController().postStartActivityProcessingForLastStarter(
task.getTopActivity(), ActivityManager.START_TASK_TO_FRONT,
task.getStack());
@@ -4595,15 +4588,28 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
intent = task.intent;
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY);
userId = task.userId;
- int result = mService.getActivityStartController().startActivityInPackage(
+ return mService.getActivityStartController().startActivityInPackage(
task.mCallingUid, callingPid, callingUid, callingPackage, intent, null, null,
- null, 0, 0, options, userId, task,
- "startActivityFromRecents");
- if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
+ null, 0, 0, options, userId, task, "startActivityFromRecents");
+ } finally {
+ if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY && task != null) {
+ // If we are launching the task in the docked stack, put it into resizing mode so
+ // the window renders full-screen with the background filling the void. Also only
+ // call this at the end to make sure that tasks exists on the window manager side.
setResizingDuringAnimation(task);
+
+ final ActivityDisplay display = task.getStack().getDisplay();
+ final ActivityStack topSecondaryStack =
+ display.getTopStackInWindowingMode(WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
+ if (topSecondaryStack.isActivityTypeHome()) {
+ // If the home activity if the top split-screen secondary stack, then the
+ // primary split-screen stack is in the minimized mode which means it can't
+ // receive input keys, so we should move the focused app to the home app so that
+ // window manager can correctly calculate the focus window that can receive
+ // input keys.
+ moveHomeStackToFront("startActivityFromRecents: homeVisibleInSplitScreen");
+ }
}
- return result;
- } finally {
mWindowManager.continueSurfaceLayout();
}
}