summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2023-04-12 23:30:33 +0800
committer Riddle Hsu <riddlehsu@google.com> 2023-04-12 15:33:35 +0000
commitf5e44fca7f23d934289ec1ac0602c24e9901cf28 (patch)
tree7e7c233109604a9b76296f78d8ad939a6f87f4f9
parent7dd18dd3485ff3306fba1edcff873fd1562b822f (diff)
Get dim bounds after super.prepareSurfaces
The dim state may be active when iterating child windows from super.prepareSurfaces. Bug: 159103089 Test: DimmerTests Change-Id: I9326efa0e5d8f265ae7ec62434b850d43802c34e
-rw-r--r--services/core/java/com/android/server/wm/Dimmer.java11
-rw-r--r--services/core/java/com/android/server/wm/DisplayArea.java3
-rw-r--r--services/core/java/com/android/server/wm/Task.java3
-rw-r--r--services/core/java/com/android/server/wm/TaskFragment.java3
4 files changed, 13 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java
index c6db8a7acb6f..8660becf56a9 100644
--- a/services/core/java/com/android/server/wm/Dimmer.java
+++ b/services/core/java/com/android/server/wm/Dimmer.java
@@ -263,16 +263,19 @@ class Dimmer {
* {@link WindowContainer#prepareSurfaces}. After calling this, the container should
* chain {@link WindowContainer#prepareSurfaces} down to it's children to give them
* a chance to request dims to continue.
- * @return Non-null dim bounds if the dimmer is showing.
*/
- Rect resetDimStates() {
+ void resetDimStates() {
if (mDimState == null) {
- return null;
+ return;
}
if (!mDimState.mDontReset) {
mDimState.mDimming = false;
}
- return mDimState.mDimBounds;
+ }
+
+ /** Returns non-null bounds if the dimmer is showing. */
+ Rect getDimBounds() {
+ return mDimState != null ? mDimState.mDimBounds : null;
}
void dontAnimateExit() {
diff --git a/services/core/java/com/android/server/wm/DisplayArea.java b/services/core/java/com/android/server/wm/DisplayArea.java
index 26f56a2e5c0b..9f59f5a30caf 100644
--- a/services/core/java/com/android/server/wm/DisplayArea.java
+++ b/services/core/java/com/android/server/wm/DisplayArea.java
@@ -779,8 +779,9 @@ public class DisplayArea<T extends WindowContainer> extends WindowContainer<T> {
@Override
void prepareSurfaces() {
- final Rect dimBounds = mDimmer.resetDimStates();
+ mDimmer.resetDimStates();
super.prepareSurfaces();
+ final Rect dimBounds = mDimmer.getDimBounds();
if (dimBounds != null) {
// Bounds need to be relative, as the dim layer is a child.
getBounds(dimBounds);
diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java
index fb592e124920..bd9a7a51b414 100644
--- a/services/core/java/com/android/server/wm/Task.java
+++ b/services/core/java/com/android/server/wm/Task.java
@@ -3253,9 +3253,10 @@ class Task extends TaskFragment {
@Override
void prepareSurfaces() {
- final Rect dimBounds = mDimmer.resetDimStates();
+ mDimmer.resetDimStates();
super.prepareSurfaces();
+ final Rect dimBounds = mDimmer.getDimBounds();
if (dimBounds != null) {
getDimBounds(dimBounds);
diff --git a/services/core/java/com/android/server/wm/TaskFragment.java b/services/core/java/com/android/server/wm/TaskFragment.java
index 1d232fe99e3c..311b9a6d2876 100644
--- a/services/core/java/com/android/server/wm/TaskFragment.java
+++ b/services/core/java/com/android/server/wm/TaskFragment.java
@@ -2923,9 +2923,10 @@ class TaskFragment extends WindowContainer<WindowContainer> {
return;
}
- final Rect dimBounds = mDimmer.resetDimStates();
+ mDimmer.resetDimStates();
super.prepareSurfaces();
+ final Rect dimBounds = mDimmer.getDimBounds();
if (dimBounds != null) {
// Bounds need to be relative, as the dim layer is a child.
dimBounds.offsetTo(0 /* newLeft */, 0 /* newTop */);