Skip to content

Commit 1cd955b

Browse files
Dianne HackbornAndroid (Google) Code Review
authored andcommitted
Merge "Get rid of some animation flickers and other bad things."
2 parents 7fc8f51 + d02a9e9 commit 1cd955b

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

services/java/com/android/server/wm/DimSurface.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,22 @@ class DimSurface {
5353
void show(int dw, int dh, int layer, int color) {
5454
if (!mDimShown) {
5555
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DIM " + mDimSurface + ": SHOW pos=(0,0) (" +
56-
dw + "x" + dh + ")");
56+
dw + "x" + dh + " layer=" + layer + ")");
5757
mDimShown = true;
5858
try {
5959
mLastDimWidth = dw;
6060
mLastDimHeight = dh;
6161
mDimSurface.setPosition(0, 0);
6262
mDimSurface.setSize(dw, dh);
63+
mDimSurface.setLayer(layer);
6364
mDimSurface.show();
6465
} catch (RuntimeException e) {
6566
Slog.w(WindowManagerService.TAG, "Failure showing dim surface", e);
6667
}
6768
} else if (mLastDimWidth != dw || mLastDimHeight != dh || mDimColor != color
6869
|| mLayer != layer) {
70+
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DIM " + mDimSurface + ": pos=(0,0) (" +
71+
dw + "x" + dh + " layer=" + layer + ")");
6972
mLastDimWidth = dw;
7073
mLastDimHeight = dh;
7174
mLayer = layer;
@@ -80,6 +83,7 @@ void hide() {
8083
if (mDimShown) {
8184
mDimShown = false;
8285
try {
86+
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " HIDE " + mDimSurface);
8387
mDimSurface.hide();
8488
} catch (RuntimeException e) {
8589
Slog.w(WindowManagerService.TAG, "Illegal argument exception hiding dim surface");

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7458,9 +7458,12 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
74587458
windowDetachedWallpaper = w;
74597459
}
74607460
if (w.mAnimation.getBackgroundColor() != 0) {
7461-
windowAnimationBackground = w;
7462-
windowAnimationBackgroundColor =
7463-
w.mAnimation.getBackgroundColor();
7461+
if (windowAnimationBackground == null || w.mAnimLayer <
7462+
windowAnimationBackground.mAnimLayer) {
7463+
windowAnimationBackground = w;
7464+
windowAnimationBackgroundColor =
7465+
w.mAnimation.getBackgroundColor();
7466+
}
74647467
}
74657468
}
74667469
animating = true;
@@ -7469,14 +7472,18 @@ private final void performLayoutAndPlaceSurfacesLockedInner(
74697472
// If this window's app token is running a detached wallpaper
74707473
// animation, make a note so we can ensure the wallpaper is
74717474
// displayed behind it.
7472-
if (w.mAppToken != null && w.mAppToken.animation != null) {
7475+
if (w.mAppToken != null && w.mAppToken.animation != null
7476+
&& w.mAppToken.animating) {
74737477
if (w.mAppToken.animation.getDetachWallpaper()) {
74747478
windowDetachedWallpaper = w;
74757479
}
74767480
if (w.mAppToken.animation.getBackgroundColor() != 0) {
7477-
windowAnimationBackground = w;
7478-
windowAnimationBackgroundColor =
7479-
w.mAppToken.animation.getBackgroundColor();
7481+
if (windowAnimationBackground == null || w.mAnimLayer <
7482+
windowAnimationBackground.mAnimLayer) {
7483+
windowAnimationBackground = w;
7484+
windowAnimationBackgroundColor =
7485+
w.mAppToken.animation.getBackgroundColor();
7486+
}
74807487
}
74817488
}
74827489

0 commit comments

Comments
 (0)