summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wale Ogunwale <ogunwale@google.com> 2018-03-15 16:41:05 -0700
committer Wale Ogunwale <ogunwale@google.com> 2018-03-16 05:13:31 -0700
commit17696de97c8a68b25a7e57cb3d3b30f65639b8fe (patch)
tree24c924a5e1863d02e8f12a95a31f0948675683d3
parenta88c9b558faa68fc68498a4a175e30604349c2b7 (diff)
Don't allow focus on activity in minimized split-screen.
Return false for ActivityRecord.isFocusable() for activities in minimized split-screen since their windows can't be focused or interacted with. Also, move focus off split-screen primary stack when we enter minimize mode. Change-Id: Iecec5d55123f1c3530c461314fa69498575ef5c3 Fixes: 74404706 Fixes: 74837107 Fixes: 74919175 Test: Put an app in split-screen, launch it from launch again, and observe ANR. Test: atest ActivityManagerAppConfigurationTests#testDialogWhenLargeSplitSmall Test: atest ActivityManagerSplitScreenTests#testNoUserLeaveHintOnMultiWindowModeChanged
-rw-r--r--services/core/java/com/android/server/am/ActivityRecord.java3
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java2
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java25
3 files changed, 21 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 8c49472b58c6..68c47d58f92d 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -1193,6 +1193,9 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
}
boolean isFocusable() {
+ if (inSplitScreenPrimaryWindowingMode() && mStackSupervisor.mIsDockMinimized) {
+ return false;
+ }
return getWindowConfiguration().canReceiveKeys() || isAlwaysFocusable();
}
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 2c4eac0e391b..1223632ccf53 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -3416,7 +3416,7 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
}
/** Find next proper focusable stack and make it focused. */
- private boolean adjustFocusToNextFocusableStack(String reason) {
+ boolean adjustFocusToNextFocusableStack(String reason) {
return adjustFocusToNextFocusableStack(reason, false /* allowFocusSelf */);
}
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index efc0d7d87e63..be826f7dc025 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2455,19 +2455,20 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
if (currentWindowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY
&& candidate == null && stack.inSplitScreenPrimaryWindowingMode()) {
- // If the currently focused stack is in split-screen secondary we would prefer
- // the focus to move to another split-screen secondary stack or fullscreen stack
- // over the primary split screen stack to avoid:
- // - Moving the focus to the primary split-screen stack when it can't be focused
- // because it will be minimized, but AM doesn't know that yet
- // - primary split-screen stack overlapping with a fullscreen stack when a
- // fullscreen stack is higher in z than the next split-screen stack. Assistant
- // stack, I am looking at you...
+ // If the currently focused stack is in split-screen secondary we save off the
+ // top primary split-screen stack as a candidate for focus because we might
+ // prefer focus to move to an other stack to avoid primary split-screen stack
+ // overlapping with a fullscreen stack when a fullscreen stack is higher in z
+ // than the next split-screen stack. Assistant stack, I am looking at you...
// We only move the focus to the primary-split screen stack if there isn't a
// better alternative.
candidate = stack;
continue;
}
+ if (candidate != null && stack.inSplitScreenSecondaryWindowingMode()) {
+ // Use the candidate stack since we are now at the secondary split-screen.
+ return candidate;
+ }
return stack;
}
}
@@ -4413,6 +4414,14 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
void setDockedStackMinimized(boolean minimized) {
mIsDockMinimized = minimized;
+ if (mIsDockMinimized) {
+ final ActivityStack current = getFocusedStack();
+ if (current.inSplitScreenPrimaryWindowingMode()) {
+ // The primary split-screen stack can't be focused while it is minimize, so move
+ // focus to something else.
+ current.adjustFocusToNextFocusableStack("setDockedStackMinimized");
+ }
+ }
}
void wakeUp(String reason) {