summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Filip Gruszczynski <gruszczy@google.com> 2015-10-05 12:40:28 -0700
committer Filip Gruszczynski <gruszczy@google.com> 2015-10-05 16:57:37 -0700
commitb1fa0446d3855924459992d0c4b07704497c9fd4 (patch)
tree6bdcb0a49e0ad3effcbdecbc1d4e4177322709d3
parent374abe11a07fe6c742a370da8445c250d908ef6f (diff)
Improve algorithm for deciding which dim layers to animate.
We always want to animate non full screen dim layers, even if there are full screen dimlayers registered. If there are full screen dim layers we prefer the one that is currently dimming, otherwise any of the full screen dim layers (since they are shared). Bug: 24668543 Change-Id: Icfd5cca83fc371c641ceb2e7a7b62178535984b7
-rw-r--r--services/core/java/com/android/server/wm/DimBehindController.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/wm/DimBehindController.java b/services/core/java/com/android/server/wm/DimBehindController.java
index c56af39f6c93..8870dd1ceef2 100644
--- a/services/core/java/com/android/server/wm/DimBehindController.java
+++ b/services/core/java/com/android/server/wm/DimBehindController.java
@@ -159,24 +159,32 @@ class DimBehindController {
boolean animateDimLayers() {
int fullScreen = -1;
+ int fullScreenAndDimming = -1;
+ boolean result = false;
+
for (int i = mState.size() - 1; i >= 0; i--) {
- DimLayer.DimLayerUser dimLayerUser = mState.keyAt(i);
- if (dimLayerUser.isFullscreen()) {
+ DimLayer.DimLayerUser user = mState.keyAt(i);
+ if (user.isFullscreen()) {
fullScreen = i;
if (mState.valueAt(i).continueDimming) {
- break;
+ fullScreenAndDimming = i;
}
+ } else {
+ // We always want to animate the non fullscreen windows, they don't share their
+ // dim layers.
+ result |= animateDimLayers(user);
}
}
- if (fullScreen != -1) {
- return animateDimLayers(mState.keyAt(fullScreen));
- } else {
- boolean result = false;
- for (int i = mState.size() - 1; i >= 0; i--) {
- result |= animateDimLayers(mState.keyAt(i));
- }
- return result;
+ // For the shared, full screen dim layer, we prefer the animation that is causing it to
+ // appear.
+ if (fullScreenAndDimming != -1) {
+ result |= animateDimLayers(mState.keyAt(fullScreenAndDimming));
+ } else if (fullScreen != -1) {
+ // If there is no animation for the full screen dim layer to appear, we can use any of
+ // the animators that will cause it to disappear.
+ result |= animateDimLayers(mState.keyAt(fullScreen));
}
+ return result;
}
private boolean animateDimLayers(DimLayer.DimLayerUser dimLayerUser) {