blob: 741492815bd7f4e270adb39496340f8e1181a5a4 [file] [log] [blame]
Filip Gruszczynski0689ae92015-10-01 12:30:31 -07001package com.android.server.wm;
2
Jorim Jaggi72a6f052016-05-05 16:25:43 -07003import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
Filip Gruszczynski0bd180d2015-12-07 15:43:52 -08004import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_DIM_LAYER;
5import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
6import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
Chong Zhang112eb8c2015-11-02 11:17:00 -08007import static com.android.server.wm.WindowManagerService.LAYER_OFFSET_DIM;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -07008
9import android.graphics.Rect;
10import android.util.ArrayMap;
11import android.util.Slog;
12import android.util.TypedValue;
13
Andrii Kulian45a61fe2017-01-05 16:53:19 -080014import com.android.internal.annotations.VisibleForTesting;
Jorim Jaggibc5425c2016-03-01 13:51:16 +010015import com.android.server.wm.DimLayer.DimLayerUser;
16
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070017import java.io.PrintWriter;
18
19/**
20 * Centralizes the control of dim layers used for
Chong Zhang112eb8c2015-11-02 11:17:00 -080021 * {@link android.view.WindowManager.LayoutParams#FLAG_DIM_BEHIND}
22 * as well as other use cases (such as dimming above a dead window).
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070023 */
Chong Zhang112eb8c2015-11-02 11:17:00 -080024class DimLayerController {
Jorim Jaggibc5425c2016-03-01 13:51:16 +010025 private static final String TAG_LOCAL = "DimLayerController";
26 private static final String TAG = TAG_WITH_CLASS_NAME ? TAG_LOCAL : TAG_WM;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070027
28 /** Amount of time in milliseconds to animate the dim surface from one value to another,
29 * when no window animation is driving it. */
30 private static final int DEFAULT_DIM_DURATION = 200;
31
Chong Zhang112eb8c2015-11-02 11:17:00 -080032 /**
33 * The default amount of dim applied over a dead window
34 */
35 private static final float DEFAULT_DIM_AMOUNT_DEAD_WINDOW = 0.5f;
36
37 // Shared dim layer for fullscreen users. {@link DimLayerState#dimLayer} will point to this
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070038 // instead of creating a new object per fullscreen task on a display.
39 private DimLayer mSharedFullScreenDimLayer;
40
Chong Zhang112eb8c2015-11-02 11:17:00 -080041 private ArrayMap<DimLayer.DimLayerUser, DimLayerState> mState = new ArrayMap<>();
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070042
43 private DisplayContent mDisplayContent;
44
45 private Rect mTmpBounds = new Rect();
46
Chong Zhang112eb8c2015-11-02 11:17:00 -080047 DimLayerController(DisplayContent displayContent) {
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070048 mDisplayContent = displayContent;
49 }
50
51 /** Updates the dim layer bounds, recreating it if needed. */
52 void updateDimLayer(DimLayer.DimLayerUser dimLayerUser) {
Wale Ogunwale29bfbb82016-05-12 15:13:52 -070053 final DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070054 final boolean previousFullscreen = state.dimLayer != null
55 && state.dimLayer == mSharedFullScreenDimLayer;
56 DimLayer newDimLayer;
57 final int displayId = mDisplayContent.getDisplayId();
Wale Ogunwale29bfbb82016-05-12 15:13:52 -070058 if (dimLayerUser.dimFullscreen()) {
59 if (previousFullscreen && mSharedFullScreenDimLayer != null) {
60 // Update the bounds for fullscreen in case of rotation.
61 mSharedFullScreenDimLayer.setBoundsForFullscreen();
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070062 return;
63 }
64 // Use shared fullscreen dim layer
65 newDimLayer = mSharedFullScreenDimLayer;
66 if (newDimLayer == null) {
67 if (state.dimLayer != null) {
68 // Re-purpose the previous dim layer.
69 newDimLayer = state.dimLayer;
70 } else {
71 // Create new full screen dim layer.
Jorim Jaggibc5425c2016-03-01 13:51:16 +010072 newDimLayer = new DimLayer(mDisplayContent.mService, dimLayerUser, displayId,
73 getDimLayerTag(dimLayerUser));
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070074 }
Chong Zhang4c9ba52a2015-11-10 18:36:33 -080075 dimLayerUser.getDimBounds(mTmpBounds);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070076 newDimLayer.setBounds(mTmpBounds);
77 mSharedFullScreenDimLayer = newDimLayer;
78 } else if (state.dimLayer != null) {
Chong Zhang112eb8c2015-11-02 11:17:00 -080079 state.dimLayer.destroySurface();
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070080 }
81 } else {
82 newDimLayer = (state.dimLayer == null || previousFullscreen)
Jorim Jaggibc5425c2016-03-01 13:51:16 +010083 ? new DimLayer(mDisplayContent.mService, dimLayerUser, displayId,
84 getDimLayerTag(dimLayerUser))
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070085 : state.dimLayer;
Chong Zhang4c9ba52a2015-11-10 18:36:33 -080086 dimLayerUser.getDimBounds(mTmpBounds);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070087 newDimLayer.setBounds(mTmpBounds);
88 }
89 state.dimLayer = newDimLayer;
90 }
91
Jorim Jaggibc5425c2016-03-01 13:51:16 +010092 private static String getDimLayerTag(DimLayerUser dimLayerUser) {
93 return TAG_LOCAL + "/" + dimLayerUser.toShortString();
94 }
95
Chong Zhang4c9ba52a2015-11-10 18:36:33 -080096 private DimLayerState getOrCreateDimLayerState(DimLayer.DimLayerUser dimLayerUser) {
Chong Zhang112eb8c2015-11-02 11:17:00 -080097 if (DEBUG_DIM_LAYER) Slog.v(TAG, "getOrCreateDimLayerState, dimLayerUser="
Filip Gruszczynski0689ae92015-10-01 12:30:31 -070098 + dimLayerUser.toShortString());
Chong Zhang112eb8c2015-11-02 11:17:00 -080099 DimLayerState state = mState.get(dimLayerUser);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700100 if (state == null) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800101 state = new DimLayerState();
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700102 mState.put(dimLayerUser, state);
103 }
104 return state;
105 }
106
107 private void setContinueDimming(DimLayer.DimLayerUser dimLayerUser) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800108 DimLayerState state = mState.get(dimLayerUser);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700109 if (state == null) {
110 if (DEBUG_DIM_LAYER) Slog.w(TAG, "setContinueDimming, no state for: "
111 + dimLayerUser.toShortString());
112 return;
113 }
114 state.continueDimming = true;
115 }
116
117 boolean isDimming() {
118 for (int i = mState.size() - 1; i >= 0; i--) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800119 DimLayerState state = mState.valueAt(i);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700120 if (state.dimLayer != null && state.dimLayer.isDimming()) {
121 return true;
122 }
123 }
124 return false;
125 }
126
127 void resetDimming() {
128 for (int i = mState.size() - 1; i >= 0; i--) {
129 mState.valueAt(i).continueDimming = false;
130 }
131 }
132
133 private boolean getContinueDimming(DimLayer.DimLayerUser dimLayerUser) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800134 DimLayerState state = mState.get(dimLayerUser);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700135 return state != null && state.continueDimming;
136 }
137
138 void startDimmingIfNeeded(DimLayer.DimLayerUser dimLayerUser,
Chong Zhang112eb8c2015-11-02 11:17:00 -0800139 WindowStateAnimator newWinAnimator, boolean aboveApp) {
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700140 // Only set dim params on the highest dimmed layer.
141 // Don't turn on for an unshown surface, or for any layer but the highest dimmed layer.
Chong Zhang4c9ba52a2015-11-10 18:36:33 -0800142 DimLayerState state = getOrCreateDimLayerState(dimLayerUser);
143 state.dimAbove = aboveApp;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700144 if (DEBUG_DIM_LAYER) Slog.v(TAG, "startDimmingIfNeeded,"
145 + " dimLayerUser=" + dimLayerUser.toShortString()
146 + " newWinAnimator=" + newWinAnimator
147 + " state.animator=" + state.animator);
Robert Carre6a83512015-11-03 16:09:21 -0800148 if (newWinAnimator.getShown() && (state.animator == null
149 || !state.animator.getShown()
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700150 || state.animator.mAnimLayer <= newWinAnimator.mAnimLayer)) {
151 state.animator = newWinAnimator;
Wale Ogunwale29bfbb82016-05-12 15:13:52 -0700152 if (state.animator.mWin.mAppToken == null && !dimLayerUser.dimFullscreen()) {
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700153 // Dim should cover the entire screen for system windows.
154 mDisplayContent.getLogicalDisplayRect(mTmpBounds);
Robert Carr7393c7b2016-04-17 19:24:21 -0700155 } else {
156 dimLayerUser.getDimBounds(mTmpBounds);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700157 }
Robert Carr7393c7b2016-04-17 19:24:21 -0700158 state.dimLayer.setBounds(mTmpBounds);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700159 }
160 }
161
162 void stopDimmingIfNeeded() {
163 if (DEBUG_DIM_LAYER) Slog.v(TAG, "stopDimmingIfNeeded, mState.size()=" + mState.size());
164 for (int i = mState.size() - 1; i >= 0; i--) {
165 DimLayer.DimLayerUser dimLayerUser = mState.keyAt(i);
166 stopDimmingIfNeeded(dimLayerUser);
167 }
168 }
169
170 private void stopDimmingIfNeeded(DimLayer.DimLayerUser dimLayerUser) {
171 // No need to check if state is null, we know the key has a value.
Chong Zhang112eb8c2015-11-02 11:17:00 -0800172 DimLayerState state = mState.get(dimLayerUser);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700173 if (DEBUG_DIM_LAYER) Slog.v(TAG, "stopDimmingIfNeeded,"
174 + " dimLayerUser=" + dimLayerUser.toShortString()
175 + " state.continueDimming=" + state.continueDimming
176 + " state.dimLayer.isDimming=" + state.dimLayer.isDimming());
Robert Carr9fe459d2016-04-07 23:32:28 -0700177 if (state.animator != null && state.animator.mWin.mWillReplaceWindow) {
178 return;
179 }
180
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700181 if (!state.continueDimming && state.dimLayer.isDimming()) {
182 state.animator = null;
Chong Zhang4c9ba52a2015-11-10 18:36:33 -0800183 dimLayerUser.getDimBounds(mTmpBounds);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700184 state.dimLayer.setBounds(mTmpBounds);
185 }
186 }
187
188 boolean animateDimLayers() {
189 int fullScreen = -1;
Filip Gruszczynskib1fa0442015-10-05 12:40:28 -0700190 int fullScreenAndDimming = -1;
Robert Carre3024512017-05-02 15:00:50 -0700191 int topFullScreenUserLayer = 0;
Filip Gruszczynskib1fa0442015-10-05 12:40:28 -0700192 boolean result = false;
193
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700194 for (int i = mState.size() - 1; i >= 0; i--) {
Wale Ogunwalef0a60a92017-01-19 09:44:40 -0800195 final DimLayer.DimLayerUser user = mState.keyAt(i);
196 final DimLayerState state = mState.valueAt(i);
197
198 if (!user.isAttachedToDisplay()) {
199 // Leaked dim user that is no longer attached to the display. Go ahead and clean it
200 // clean-up and log what happened.
201 // TODO: This is a work around for b/34395537 as the dim user should have cleaned-up
202 // it self when it was detached from the display. Need to investigate how the dim
203 // user is leaking...
Wale Ogunwalef4692622017-04-18 05:58:44 -0700204 //Slog.wtfStack(TAG_WM, "Leaked dim user=" + user.toShortString()
205 // + " state=" + state);
206 Slog.w(TAG_WM, "Leaked dim user=" + user.toShortString() + " state=" + state);
Wale Ogunwalef0a60a92017-01-19 09:44:40 -0800207 removeDimLayerUser(user);
208 continue;
209 }
210
Wale Ogunwale29bfbb82016-05-12 15:13:52 -0700211 // We have to check that we are actually the shared fullscreen layer
Robert Carr063988c2016-03-31 18:39:40 -0700212 // for this path. If we began as non fullscreen and became fullscreen
213 // (e.g. Docked stack closing), then we may not be the shared layer
214 // and we have to make sure we always animate the layer.
Wale Ogunwale29bfbb82016-05-12 15:13:52 -0700215 if (user.dimFullscreen() && state.dimLayer == mSharedFullScreenDimLayer) {
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700216 fullScreen = i;
Robert Carre3024512017-05-02 15:00:50 -0700217 if (!state.continueDimming) {
218 continue;
219 }
220
221 // When choosing which user to assign the shared fullscreen layer to
222 // we need to look at Z-order.
223 if (topFullScreenUserLayer == 0 ||
224 (state.animator != null && state.animator.mAnimLayer > topFullScreenUserLayer)) {
Filip Gruszczynskib1fa0442015-10-05 12:40:28 -0700225 fullScreenAndDimming = i;
Robert Carre3024512017-05-02 15:00:50 -0700226 if (state.animator != null) {
227 topFullScreenUserLayer = state.animator.mAnimLayer;
228 }
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700229 }
Filip Gruszczynskib1fa0442015-10-05 12:40:28 -0700230 } else {
231 // We always want to animate the non fullscreen windows, they don't share their
232 // dim layers.
233 result |= animateDimLayers(user);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700234 }
235 }
Filip Gruszczynskib1fa0442015-10-05 12:40:28 -0700236 // For the shared, full screen dim layer, we prefer the animation that is causing it to
237 // appear.
238 if (fullScreenAndDimming != -1) {
239 result |= animateDimLayers(mState.keyAt(fullScreenAndDimming));
240 } else if (fullScreen != -1) {
241 // If there is no animation for the full screen dim layer to appear, we can use any of
242 // the animators that will cause it to disappear.
243 result |= animateDimLayers(mState.keyAt(fullScreen));
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700244 }
Filip Gruszczynskib1fa0442015-10-05 12:40:28 -0700245 return result;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700246 }
247
248 private boolean animateDimLayers(DimLayer.DimLayerUser dimLayerUser) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800249 DimLayerState state = mState.get(dimLayerUser);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700250 if (DEBUG_DIM_LAYER) Slog.v(TAG, "animateDimLayers,"
251 + " dimLayerUser=" + dimLayerUser.toShortString()
252 + " state.animator=" + state.animator
253 + " state.continueDimming=" + state.continueDimming);
254 final int dimLayer;
255 final float dimAmount;
256 if (state.animator == null) {
257 dimLayer = state.dimLayer.getLayer();
258 dimAmount = 0;
259 } else {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800260 if (state.dimAbove) {
261 dimLayer = state.animator.mAnimLayer + LAYER_OFFSET_DIM;
262 dimAmount = DEFAULT_DIM_AMOUNT_DEAD_WINDOW;
263 } else {
Winson Chungbe9be7f2017-06-28 10:55:22 -0700264 dimLayer = dimLayerUser.getLayerForDim(state.animator, LAYER_OFFSET_DIM,
265 state.animator.mAnimLayer - LAYER_OFFSET_DIM);
Chong Zhang112eb8c2015-11-02 11:17:00 -0800266 dimAmount = state.animator.mWin.mAttrs.dimAmount;
267 }
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700268 }
269 final float targetAlpha = state.dimLayer.getTargetAlpha();
270 if (targetAlpha != dimAmount) {
271 if (state.animator == null) {
272 state.dimLayer.hide(DEFAULT_DIM_DURATION);
273 } else {
274 long duration = (state.animator.mAnimating && state.animator.mAnimation != null)
275 ? state.animator.mAnimation.computeDurationHint()
276 : DEFAULT_DIM_DURATION;
277 if (targetAlpha > dimAmount) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800278 duration = getDimLayerFadeDuration(duration);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700279 }
280 state.dimLayer.show(dimLayer, dimAmount, duration);
Jorim Jaggi72a6f052016-05-05 16:25:43 -0700281
282 // If we showed a dim layer, make sure to redo the layout because some things depend
283 // on whether a dim layer is showing or not.
284 if (targetAlpha == 0) {
285 mDisplayContent.pendingLayoutChanges |= FINISH_LAYOUT_REDO_LAYOUT;
Wale Ogunwale2b06bfc2016-09-28 14:17:05 -0700286 mDisplayContent.setLayoutNeeded();
Jorim Jaggi72a6f052016-05-05 16:25:43 -0700287 }
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700288 }
289 } else if (state.dimLayer.getLayer() != dimLayer) {
290 state.dimLayer.setLayer(dimLayer);
291 }
292 if (state.dimLayer.isAnimating()) {
Adrian Roose94c15c2017-05-09 13:17:54 -0700293 if (!mDisplayContent.mService.okToAnimate()) {
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700294 // Jump to the end of the animation.
295 state.dimLayer.show();
296 } else {
297 return state.dimLayer.stepAnimation();
298 }
299 }
300 return false;
301 }
302
303 boolean isDimming(DimLayer.DimLayerUser dimLayerUser, WindowStateAnimator winAnimator) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800304 DimLayerState state = mState.get(dimLayerUser);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700305 return state != null && state.animator == winAnimator && state.dimLayer.isDimming();
306 }
307
Chong Zhang112eb8c2015-11-02 11:17:00 -0800308 private long getDimLayerFadeDuration(long duration) {
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700309 TypedValue tv = new TypedValue();
310 mDisplayContent.mService.mContext.getResources().getValue(
311 com.android.internal.R.fraction.config_dimBehindFadeDuration, tv, true);
312 if (tv.type == TypedValue.TYPE_FRACTION) {
313 duration = (long) tv.getFraction(duration, duration);
314 } else if (tv.type >= TypedValue.TYPE_FIRST_INT && tv.type <= TypedValue.TYPE_LAST_INT) {
315 duration = tv.data;
316 }
317 return duration;
318 }
319
320 void close() {
321 for (int i = mState.size() - 1; i >= 0; i--) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800322 DimLayerState state = mState.valueAt(i);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700323 state.dimLayer.destroySurface();
324 }
325 mState.clear();
326 mSharedFullScreenDimLayer = null;
327 }
328
329 void removeDimLayerUser(DimLayer.DimLayerUser dimLayerUser) {
Chong Zhangcb1887e2015-11-04 20:59:26 -0800330 DimLayerState state = mState.get(dimLayerUser);
331 if (state != null) {
332 // Destroy the surface, unless it's the shared fullscreen dim.
333 if (state.dimLayer != mSharedFullScreenDimLayer) {
334 state.dimLayer.destroySurface();
335 }
336 mState.remove(dimLayerUser);
337 }
Andrii Kulian367ff7f2017-01-25 19:45:34 -0800338 if (mState.isEmpty()) {
339 mSharedFullScreenDimLayer = null;
340 }
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700341 }
342
Andrii Kulian45a61fe2017-01-05 16:53:19 -0800343 @VisibleForTesting
344 boolean hasDimLayerUser(DimLayer.DimLayerUser dimLayerUser) {
345 return mState.containsKey(dimLayerUser);
346 }
347
Andrii Kulian367ff7f2017-01-25 19:45:34 -0800348 @VisibleForTesting
349 boolean hasSharedFullScreenDimLayer() {
350 return mSharedFullScreenDimLayer != null;
351 }
352
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700353 void applyDimBehind(DimLayer.DimLayerUser dimLayerUser, WindowStateAnimator animator) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800354 applyDim(dimLayerUser, animator, false /* aboveApp */);
355 }
356
357 void applyDimAbove(DimLayer.DimLayerUser dimLayerUser, WindowStateAnimator animator) {
358 applyDim(dimLayerUser, animator, true /* aboveApp */);
359 }
360
Robert Carr9fe459d2016-04-07 23:32:28 -0700361 void applyDim(
Chong Zhang112eb8c2015-11-02 11:17:00 -0800362 DimLayer.DimLayerUser dimLayerUser, WindowStateAnimator animator, boolean aboveApp) {
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700363 if (dimLayerUser == null) {
364 Slog.e(TAG, "Trying to apply dim layer for: " + this
365 + ", but no dim layer user found.");
366 return;
367 }
368 if (!getContinueDimming(dimLayerUser)) {
369 setContinueDimming(dimLayerUser);
370 if (!isDimming(dimLayerUser, animator)) {
371 if (DEBUG_DIM_LAYER) Slog.v(TAG, "Win " + this + " start dimming.");
Chong Zhang112eb8c2015-11-02 11:17:00 -0800372 startDimmingIfNeeded(dimLayerUser, animator, aboveApp);
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700373 }
374 }
375 }
376
Chong Zhang112eb8c2015-11-02 11:17:00 -0800377 private static class DimLayerState {
378 // The particular window requesting a dim layer. If null, hide dimLayer.
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700379 WindowStateAnimator animator;
380 // Set to false at the start of performLayoutAndPlaceSurfaces. If it is still false by the
381 // end then stop any dimming.
382 boolean continueDimming;
383 DimLayer dimLayer;
Chong Zhang112eb8c2015-11-02 11:17:00 -0800384 boolean dimAbove;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700385 }
386
387 void dump(String prefix, PrintWriter pw) {
Chong Zhang112eb8c2015-11-02 11:17:00 -0800388 pw.println(prefix + "DimLayerController");
Wale Ogunwale29bfbb82016-05-12 15:13:52 -0700389 final String doubleSpace = " ";
390 final String prefixPlusDoubleSpace = prefix + doubleSpace;
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700391
Wale Ogunwale29bfbb82016-05-12 15:13:52 -0700392 for (int i = 0, n = mState.size(); i < n; i++) {
393 pw.println(prefixPlusDoubleSpace + mState.keyAt(i).toShortString());
394 DimLayerState state = mState.valueAt(i);
395 pw.println(prefixPlusDoubleSpace + doubleSpace + "dimLayer="
396 + (state.dimLayer == mSharedFullScreenDimLayer ? "shared" : state.dimLayer)
397 + ", animator=" + state.animator + ", continueDimming=" + state.continueDimming);
398 if (state.dimLayer != null) {
399 state.dimLayer.printTo(prefixPlusDoubleSpace + doubleSpace, pw);
400 }
Filip Gruszczynski0689ae92015-10-01 12:30:31 -0700401 }
402 }
403}