Skip to content

Commit 6d332c5

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Minor refactoring prior to major refactoring."
2 parents ad32461 + 2fb98b1 commit 6d332c5

5 files changed

Lines changed: 80 additions & 157 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private boolean stepAnimation(long currentTime) {
222222

223223
// This must be called while inside a transaction.
224224
boolean stepAnimationLocked(long currentTime, int dw, int dh) {
225-
if (!service.mDisplayFrozen && service.mPolicy.isScreenOnFully()) {
225+
if (service.okToDisplay()) {
226226
// We will run animations as long as the display isn't frozen.
227227

228228
if (animation == WindowManagerService.sDummyAnimation) {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ public class BlackFrame {
3232
class BlackSurface {
3333
final int left;
3434
final int top;
35+
final int layer;
3536
final Surface surface;
3637

3738
BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b)
3839
throws Surface.OutOfResourcesException {
3940
left = l;
4041
top = t;
42+
this.layer = layer;
4143
int w = r-l;
4244
int h = b-t;
4345
surface = new Surface(session, 0, "BlackSurface",
4446
-1, w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
4547
if (WindowManagerService.SHOW_TRANSACTIONS ||
4648
WindowManagerService.SHOW_SURFACE_ALLOC) Slog.i(WindowManagerService.TAG,
4749
" BLACK " + surface + ": CREATE layer=" + layer);
48-
surface.setAlpha(1.0f);
49-
surface.setLayer(layer);
5050
}
5151

5252
void setMatrix(Matrix matrix) {
@@ -58,6 +58,8 @@ void setMatrix(Matrix matrix) {
5858
surface.setMatrix(
5959
mTmpFloats[Matrix.MSCALE_X], mTmpFloats[Matrix.MSKEW_Y],
6060
mTmpFloats[Matrix.MSKEW_X], mTmpFloats[Matrix.MSCALE_Y]);
61+
surface.setAlpha(1.0f);
62+
surface.setLayer(layer);
6163
if (false) {
6264
Slog.i(WindowManagerService.TAG, "Black Surface @ (" + left + "," + top + "): ("
6365
+ mTmpFloats[Matrix.MTRANS_X] + ","

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,33 +130,31 @@ boolean updateSurface(boolean dimming, long currentTime, boolean displayFrozen)
130130
}
131131
}
132132

133-
boolean animating = false;
134-
if (mLastDimAnimTime != 0) {
133+
boolean animating = mLastDimAnimTime != 0;
134+
if (animating) {
135135
mDimCurrentAlpha += mDimDeltaPerMs
136136
* (currentTime-mLastDimAnimTime);
137-
boolean more = true;
138137
if (displayFrozen) {
139138
// If the display is frozen, there is no reason to animate.
140-
more = false;
139+
animating = false;
141140
} else if (mDimDeltaPerMs > 0) {
142141
if (mDimCurrentAlpha > mDimTargetAlpha) {
143-
more = false;
142+
animating = false;
144143
}
145144
} else if (mDimDeltaPerMs < 0) {
146145
if (mDimCurrentAlpha < mDimTargetAlpha) {
147-
more = false;
146+
animating = false;
148147
}
149148
} else {
150-
more = false;
149+
animating = false;
151150
}
152151

153152
// Do we need to continue animating?
154-
if (more) {
153+
if (animating) {
155154
if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i(WindowManagerService.TAG, " DIM "
156155
+ mDimSurface + ": alpha=" + mDimCurrentAlpha);
157156
mLastDimAnimTime = currentTime;
158157
mDimSurface.setAlpha(mDimCurrentAlpha);
159-
animating = true;
160158
} else {
161159
mDimCurrentAlpha = mDimTargetAlpha;
162160
mLastDimAnimTime = 0;

0 commit comments

Comments
 (0)