summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bernardo Rufino <brufino@google.com> 2021-03-08 14:25:45 +0000
committer Bernardo Rufino <brufino@google.com> 2021-03-08 17:36:02 +0000
commit2aa90a594032f947ccf27d9f6c60c53500fed8d8 (patch)
tree4bde334d768c33f52ebe724bf542d398a58b5e73
parentd620cd52cf1dfa7d6587c4c1c7c0278a04d79ee0 (diff)
Do not collapse shade auto when SysUI start activities
We introduced a rule to automatically close the notification shade when an UID was starting an activity and had a visible window above the notification shade. However, this introduced problems when the caller was SysUI and it was trying to perform animations. So, only collapsing now when the UID that has a window above it is not the owner of the shade either. This is fine since the owner of the shade should always be able to collapse it. Bug: 182132239 Test: atest CloseSystemDialogsTest Change-Id: Iae0fff4a39cf006dcd50789c60f20f0f08259056
-rw-r--r--services/core/java/com/android/server/wm/ActivityStarter.java2
-rw-r--r--services/core/java/com/android/server/wm/ActivityTaskManagerService.java4
-rw-r--r--services/core/java/com/android/server/wm/RootWindowContainer.java13
3 files changed, 12 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 60ca725b118e..dfc99bdafe2a 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -1572,7 +1572,7 @@ class ActivityStarter {
}
} else {
if (!mAvoidMoveToFront && mDoResume
- && mRootWindowContainer.hasVisibleWindowAboveNotificationShade(
+ && mRootWindowContainer.hasVisibleWindowAboveButDoesNotOwnNotificationShade(
r.launchedFromUid)) {
// If the UID launching the activity has a visible window on top of the
// notification shade and it's launching an activity that's going to be at the
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index b803fc37a421..75d29305b576 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -2940,7 +2940,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
// startActivity() for these apps.
if (!CompatChanges.isChangeEnabled(LOCK_DOWN_CLOSE_SYSTEM_DIALOGS, uid)) {
synchronized (mGlobalLock) {
- if (mRootWindowContainer.hasVisibleWindowAboveNotificationShade(uid)) {
+ // It's ok that the owner of the shade is not allowed *per this rule* because it has
+ // BROADCAST_CLOSE_SYSTEM_DIALOGS (SystemUI), so it would fall into that rule.
+ if (mRootWindowContainer.hasVisibleWindowAboveButDoesNotOwnNotificationShade(uid)) {
return true;
}
}
diff --git a/services/core/java/com/android/server/wm/RootWindowContainer.java b/services/core/java/com/android/server/wm/RootWindowContainer.java
index 3f9ea1fd2afd..9432a94b55cf 100644
--- a/services/core/java/com/android/server/wm/RootWindowContainer.java
+++ b/services/core/java/com/android/server/wm/RootWindowContainer.java
@@ -3143,11 +3143,14 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
}
/**
- * Returns {@code true} if {@code uid} has a visible window that's above a window of type {@link
- * WindowManager.LayoutParams#TYPE_NOTIFICATION_SHADE}. If there is no window with type {@link
- * WindowManager.LayoutParams#TYPE_NOTIFICATION_SHADE}, it returns {@code false}.
+ * Returns {@code true} if {@code uid} has a visible window that's above the window of type
+ * {@link WindowManager.LayoutParams#TYPE_NOTIFICATION_SHADE} and {@code uid} is not owner of
+ * the window of type {@link WindowManager.LayoutParams#TYPE_NOTIFICATION_SHADE}.
+ *
+ * If there is no window with type {@link WindowManager.LayoutParams#TYPE_NOTIFICATION_SHADE},
+ * it returns {@code false}.
*/
- boolean hasVisibleWindowAboveNotificationShade(int uid) {
+ boolean hasVisibleWindowAboveButDoesNotOwnNotificationShade(int uid) {
boolean[] visibleWindowFound = {false};
// We only return true if we found the notification shade (ie. window of type
// TYPE_NOTIFICATION_SHADE). Usually, it should always be there, but if for some reason
@@ -3157,7 +3160,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
visibleWindowFound[0] = true;
}
if (w.mAttrs.type == TYPE_NOTIFICATION_SHADE) {
- return visibleWindowFound[0];
+ return visibleWindowFound[0] && w.mOwnerUid != uid;
}
return false;
}, true /* traverseTopToBottom */);