summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/wm/WindowAnimator.java
blob: 0be661200404d7f96937517715c8bb3d2985e55b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
// Copyright 2012 Google Inc. All Rights Reserved.

package com.android.server.wm;

import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;

import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE;
import static com.android.server.wm.WindowManagerService.LayoutFields.SET_FORCE_HIDING_CHANGED;

import static com.android.server.wm.WindowManagerService.H.SET_DIM_PARAMETERS;

import android.content.Context;
import android.os.SystemClock;
import android.util.Log;
import android.util.Slog;
import android.view.Surface;
import android.view.WindowManager;
import android.view.WindowManagerPolicy;
import android.view.animation.Animation;

import com.android.internal.policy.impl.PhoneWindowManager;

import java.io.PrintWriter;
import java.util.HashSet;

/**
 * Singleton class that carries out the animations and Surface operations in a separate task
 * on behalf of WindowManagerService.
 */
public class WindowAnimator {
    private static final String TAG = "WindowAnimator";

    final WindowManagerService mService;
    final Context mContext;
    final WindowManagerPolicy mPolicy;

    HashSet<WindowStateAnimator> mWinAnimators = new HashSet<WindowStateAnimator>();
    HashSet<WindowStateAnimator> mFinished = new HashSet<WindowStateAnimator>();

    boolean mAnimating;
    boolean mTokenMayBeDrawn;
    boolean mForceHiding;
    WindowState mWindowAnimationBackground;
    int mWindowAnimationBackgroundColor;
    int mAdjResult;

    int mPendingLayoutChanges;

    /** Overall window dimensions */
    int mDw, mDh;

    /** Interior window dimensions */
    int mInnerDw, mInnerDh;

    /** Time of current animation step. Reset on each iteration */
    long mCurrentTime;

    /** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this
     * is a long initialized to Long.MIN_VALUE so that it doesn't match this value on startup. */
    private int mTransactionSequence;

    /** The one and only screen rotation if one is happening */
    ScreenRotationAnimation mScreenRotationAnimation = null;

    // Window currently running an animation that has requested it be detached
    // from the wallpaper.  This means we need to ensure the wallpaper is
    // visible behind it in case it animates in a way that would allow it to be
    // seen.
    WindowState mWindowDetachedWallpaper = null;
    WindowState mDetachedWallpaper = null;
    DimSurface mWindowAnimationBackgroundSurface = null;

    int mBulkUpdateParams = 0;

    DimAnimator mDimAnimator = null;
    DimAnimator.Parameters mDimParams = null;

    WindowAnimator(final WindowManagerService service, final Context context,
            final WindowManagerPolicy policy) {
        mService = service;
        mContext = context;
        mPolicy = policy;
    }

    private void testWallpaperAndBackgroundLocked() {
        if (mWindowDetachedWallpaper != mDetachedWallpaper) {
            if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG,
                    "Detached wallpaper changed from " + mWindowDetachedWallpaper
                    + " to " + mDetachedWallpaper);
            mWindowDetachedWallpaper = mDetachedWallpaper;
            mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
        }

        if (mWindowAnimationBackgroundColor != 0) {
            // If the window that wants black is the current wallpaper
            // target, then the black goes *below* the wallpaper so we
            // don't cause the wallpaper to suddenly disappear.
            WindowState target = mWindowAnimationBackground;
            if (mService.mWallpaperTarget == target
                    || mService.mLowerWallpaperTarget == target
                    || mService.mUpperWallpaperTarget == target) {
                final int N = mService.mWindows.size();
                for (int i = 0; i < N; i++) {
                    WindowState w = mService.mWindows.get(i);
                    if (w.mIsWallpaper) {
                        target = w;
                        break;
                    }
                }
            }
            if (mWindowAnimationBackgroundSurface == null) {
                mWindowAnimationBackgroundSurface = new DimSurface(mService.mFxSession);
            }
            final int dw = mDw;
            final int dh = mDh;
            mWindowAnimationBackgroundSurface.show(dw, dh,
                    target.mWinAnimator.mAnimLayer - WindowManagerService.LAYER_OFFSET_DIM,
                    mWindowAnimationBackgroundColor);
        } else if (mWindowAnimationBackgroundSurface != null) {
            mWindowAnimationBackgroundSurface.hide();
        }
    }

    private void updateWindowsAppsAndRotationAnimationsLocked() {
        int i;
        final int NAT = mService.mAppTokens.size();
        for (i=0; i<NAT; i++) {
            final AppWindowAnimator appAnimator = mService.mAppTokens.get(i).mAppAnimator;
            final boolean wasAnimating = appAnimator.animation != null
                    && appAnimator.animation != WindowManagerService.sDummyAnimation;
            if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
                mAnimating = true;
            } else if (wasAnimating) {
                // stopped animating, do one more pass through the layout
                mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                    mService.debugLayoutRepeats("appToken " + appAnimator.mAppToken + " done",
                        mPendingLayoutChanges);
                }
            }
        }

        final int NEAT = mService.mExitingAppTokens.size();
        for (i=0; i<NEAT; i++) {
            final AppWindowAnimator appAnimator = mService.mExitingAppTokens.get(i).mAppAnimator;
            final boolean wasAnimating = appAnimator.animation != null
                    && appAnimator.animation != WindowManagerService.sDummyAnimation;
            if (appAnimator.stepAnimationLocked(mCurrentTime, mInnerDw, mInnerDh)) {
                mAnimating = true;
            } else if (wasAnimating) {
                // stopped animating, do one more pass through the layout
                mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                    mService.debugLayoutRepeats("exiting appToken " + appAnimator.mAppToken 
                        + " done", mPendingLayoutChanges);
                }
            }
        }

        if (mScreenRotationAnimation != null &&
                (mScreenRotationAnimation.isAnimating() ||
                        mScreenRotationAnimation.mFinishAnimReady)) {
            if (mScreenRotationAnimation.stepAnimationLocked(mCurrentTime)) {
                mAnimating = true;
            } else {
                mBulkUpdateParams |= SET_UPDATE_ROTATION;
                mScreenRotationAnimation.kill();
                mScreenRotationAnimation = null;
            }
        }
    }

    private void updateWindowsAndWallpaperLocked() {
        ++mTransactionSequence;

        for (int i = mService.mWindows.size() - 1; i >= 0; i--) {
            WindowState win = mService.mWindows.get(i);
            WindowStateAnimator winAnimator = win.mWinAnimator;
            final int flags = winAnimator.mAttrFlags;

            if (winAnimator.mSurface != null) {
                final boolean wasAnimating = winAnimator.mWasAnimating;
                final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime);

                if (WindowManagerService.DEBUG_WALLPAPER) {
                    Slog.v(TAG, win + ": wasAnimating=" + wasAnimating +
                            ", nowAnimating=" + nowAnimating);
                }

                // If this window is animating, make a note that we have
                // an animating window and take care of a request to run
                // a detached wallpaper animation.
                if (nowAnimating) {
                    if (winAnimator.mAnimation != null) {
                        if ((flags & FLAG_SHOW_WALLPAPER) != 0
                                && winAnimator.mAnimation.getDetachWallpaper()) {
                            mDetachedWallpaper = win;
                        }
                        final int backgroundColor = winAnimator.mAnimation.getBackgroundColor();
                        if (backgroundColor != 0) {
                            if (mWindowAnimationBackground == null
                                    || (winAnimator.mAnimLayer <
                                            mWindowAnimationBackground.mWinAnimator.mAnimLayer)) {
                                mWindowAnimationBackground = win;
                                mWindowAnimationBackgroundColor = backgroundColor;
                            }
                        }
                    }
                    mAnimating = true;
                }

                // If this window's app token is running a detached wallpaper
                // animation, make a note so we can ensure the wallpaper is
                // displayed behind it.
                final AppWindowAnimator appAnimator =
                        win.mAppToken == null ? null : win.mAppToken.mAppAnimator;
                if (appAnimator != null && appAnimator.animation != null
                        && appAnimator.animating) {
                    if ((flags & FLAG_SHOW_WALLPAPER) != 0
                            && appAnimator.animation.getDetachWallpaper()) {
                        mDetachedWallpaper = win;
                    }
                    final int backgroundColor = appAnimator.animation.getBackgroundColor();
                    if (backgroundColor != 0) {
                        if (mWindowAnimationBackground == null
                                || (winAnimator.mAnimLayer <
                                        mWindowAnimationBackground.mWinAnimator.mAnimLayer)) {
                            mWindowAnimationBackground = win;
                            mWindowAnimationBackgroundColor = backgroundColor;
                        }
                    }
                }

                if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == win) {
                    mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
                    mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                    if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                        mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2",
                            mPendingLayoutChanges);
                    }
                }

                if (mPolicy.doesForceHide(win, win.mAttrs)) {
                    if (!wasAnimating && nowAnimating) {
                        if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
                                "Animation started that could impact force hide: "
                                + win);
                        mBulkUpdateParams |= SET_FORCE_HIDING_CHANGED;
                        mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                        if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                            mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3",
                                mPendingLayoutChanges);
                        }
                        mService.mFocusMayChange = true;
                    } else if (win.isReadyForDisplay() && winAnimator.mAnimation == null) {
                        mForceHiding = true;
                    }
                } else if (mPolicy.canBeForceHidden(win, win.mAttrs)) {
                    final boolean changed;
                    if (mForceHiding) {
                        changed = win.hideLw(false, false);
                        if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
                                "Now policy hidden: " + win);
                    } else {
                        changed = win.showLw(false, false);
                        if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG,
                                "Now policy shown: " + win);
                        if (changed) {
                            if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0
                                    && win.isVisibleNow() /*w.isReadyForDisplay()*/) {
                                // Assume we will need to animate.  If
                                // we don't (because the wallpaper will
                                // stay with the lock screen), then we will
                                // clean up later.
                                Animation a = mPolicy.createForceHideEnterAnimation();
                                if (a != null) {
                                    winAnimator.setAnimation(a);
                                }
                            }
                            if (mCurrentFocus == null || mCurrentFocus.mLayer < win.mLayer) {
                                // We are showing on to of the current
                                // focus, so re-evaluate focus to make
                                // sure it is correct.
                                mService.mFocusMayChange = true;
                            }
                        }
                    }
                    if (changed && (flags & WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER) != 0) {
                        mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
                        mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
                        if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                            mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4",
                                mPendingLayoutChanges);
                        }
                    }
                }
            }

            final AppWindowToken atoken = win.mAppToken;
            if (atoken != null && (!atoken.allDrawn || atoken.mAppAnimator.freezingScreen)) {
                if (atoken.lastTransactionSequence != mTransactionSequence) {
                    atoken.lastTransactionSequence = mTransactionSequence;
                    atoken.numInterestingWindows = atoken.numDrawnWindows = 0;
                    atoken.startingDisplayed = false;
                }
                if ((win.isOnScreen() || winAnimator.mAttrType
                        == WindowManager.LayoutParams.TYPE_BASE_APPLICATION)
                        && !win.mExiting && !win.mDestroying) {
                    if (WindowManagerService.DEBUG_VISIBILITY ||
                            WindowManagerService.DEBUG_ORIENTATION) {
                        Slog.v(TAG, "Eval win " + win + ": isDrawn=" + win.isDrawnLw()
                                + ", isAnimating=" + winAnimator.isAnimating());
                        if (!win.isDrawnLw()) {
                            Slog.v(TAG, "Not displayed: s=" + winAnimator.mSurface
                                    + " pv=" + win.mPolicyVisibility
                                    + " mDrawState=" + winAnimator.mDrawState
                                    + " ah=" + win.mAttachedHidden
                                    + " th=" + atoken.hiddenRequested
                                    + " a=" + winAnimator.mAnimating);
                        }
                    }
                    if (win != atoken.startingWindow) {
                        if (!atoken.mAppAnimator.freezingScreen || !win.mAppFreezing) {
                            atoken.numInterestingWindows++;
                            if (win.isDrawnLw()) {
                                atoken.numDrawnWindows++;
                                if (WindowManagerService.DEBUG_VISIBILITY ||
                                        WindowManagerService.DEBUG_ORIENTATION) Slog.v(TAG,
                                        "tokenMayBeDrawn: " + atoken
                                        + " freezingScreen=" + atoken.mAppAnimator.freezingScreen
                                        + " mAppFreezing=" + win.mAppFreezing);
                                mTokenMayBeDrawn = true;
                            }
                        }
                    } else if (win.isDrawnLw()) {
                        atoken.startingDisplayed = true;
                    }
                }
            } else if (winAnimator.mDrawState == WindowStateAnimator.READY_TO_SHOW) {
                if (winAnimator.performShowLocked()) {
                    mPendingLayoutChanges |= WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM;
                    if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                        mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5",
                            mPendingLayoutChanges);
                    }
                }
            }
            final AppWindowAnimator appAnimator =
                    atoken == null ? null : atoken.mAppAnimator;
            if (appAnimator != null && appAnimator.thumbnail != null) {
                if (appAnimator.thumbnailTransactionSeq != mTransactionSequence) {
                    appAnimator.thumbnailTransactionSeq = mTransactionSequence;
                    appAnimator.thumbnailLayer = 0;
                }
                if (appAnimator.thumbnailLayer < winAnimator.mAnimLayer) {
                    appAnimator.thumbnailLayer = winAnimator.mAnimLayer;
                }
            }
        } // end forall windows
    }

    private void testTokenMayBeDrawnLocked() {
        // See if any windows have been drawn, so they (and others
        // associated with them) can now be shown.
        final int NT = mService.mAppTokens.size();
        for (int i=0; i<NT; i++) {
            AppWindowToken wtoken = mService.mAppTokens.get(i);
            if (wtoken.mAppAnimator.freezingScreen) {
                int numInteresting = wtoken.numInterestingWindows;
                if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
                    if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
                            "allDrawn: " + wtoken
                            + " interesting=" + numInteresting
                            + " drawn=" + wtoken.numDrawnWindows);
                    wtoken.mAppAnimator.showAllWindowsLocked();
                    mService.unsetAppFreezingScreenLocked(wtoken, false, true);
                    if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG,
                            "Setting mOrientationChangeComplete=true because wtoken "
                            + wtoken + " numInteresting=" + numInteresting
                            + " numDrawn=" + wtoken.numDrawnWindows);
                }
            } else if (!wtoken.allDrawn) {
                int numInteresting = wtoken.numInterestingWindows;
                if (numInteresting > 0 && wtoken.numDrawnWindows >= numInteresting) {
                    if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG,
                            "allDrawn: " + wtoken
                            + " interesting=" + numInteresting
                            + " drawn=" + wtoken.numDrawnWindows);
                    wtoken.allDrawn = true;
                    mPendingLayoutChanges |= PhoneWindowManager.FINISH_LAYOUT_REDO_ANIM;
                    if (WindowManagerService.DEBUG_LAYOUT_REPEATS) {
                        mService.debugLayoutRepeats("testTokenMayBeDrawnLocked",
                            mPendingLayoutChanges);
                    }

                    // We can now show all of the drawn windows!
                    if (!mService.mOpeningApps.contains(wtoken)) {
                        mAnimating |= wtoken.mAppAnimator.showAllWindowsLocked();
                    }
                }
            }
        }
    }

    private void performAnimationsLocked() {
        mTokenMayBeDrawn = false;
        mForceHiding = false;
        mDetachedWallpaper = null;
        mWindowAnimationBackground = null;
        mWindowAnimationBackgroundColor = 0;

        updateWindowsAndWallpaperLocked();

        if (mTokenMayBeDrawn) {
            testTokenMayBeDrawnLocked();
        }
    }

    void animate() {
        mPendingLayoutChanges = 0;
        mCurrentTime = SystemClock.uptimeMillis();
        mBulkUpdateParams = 0;

        // Update animations of all applications, including those
        // associated with exiting/removed apps
        Surface.openTransaction();

        try {
            testWallpaperAndBackgroundLocked();
            updateWindowsAppsAndRotationAnimationsLocked();
            performAnimationsLocked();

            // THIRD LOOP: Update the surfaces of all windows.

            if (mScreenRotationAnimation != null) {
                mScreenRotationAnimation.updateSurfaces();
            }

            mFinished.clear();
            for (final WindowStateAnimator winAnimator : mWinAnimators) {
                if (winAnimator.mSurface == null) {
                    mFinished.add(winAnimator);
                } else {
                    winAnimator.prepareSurfaceLocked(true);
                }
            }
            for (final WindowStateAnimator winAnimator : mFinished) {
                mWinAnimators.remove(winAnimator);
            }

            if (mDimParams != null) {
                mDimAnimator.updateParameters(mContext.getResources(), mDimParams, mCurrentTime);
            }
            if (mDimAnimator != null && mDimAnimator.mDimShown) {
                mAnimating |= mDimAnimator.updateSurface(isDimming(), mCurrentTime,
                        !mService.okToDisplay());
            }

            if (mService.mBlackFrame != null) {
                if (mScreenRotationAnimation != null) {
                    mService.mBlackFrame.setMatrix(
                            mScreenRotationAnimation.getEnterTransformation().getMatrix());
                } else {
                    mService.mBlackFrame.clearMatrix();
                }
            }
        } catch (RuntimeException e) {
            Log.wtf(TAG, "Unhandled exception in Window Manager", e);
        } finally {
            Surface.closeTransaction();
        }

        mService.bulkSetParameters(mBulkUpdateParams);
    }

    WindowState mCurrentFocus;
    void setCurrentFocus(final WindowState currentFocus) {
        mCurrentFocus = currentFocus;
    }

    void setDisplayDimensions(final int curWidth, final int curHeight,
                        final int appWidth, final int appHeight) {
        mDw = curWidth;
        mDh = curHeight;
        mInnerDw = appWidth;
        mInnerDh = appHeight;
    }

    void startDimming(final WindowStateAnimator winAnimator, final float target,
                      final int width, final int height) {
        if (mDimAnimator == null) {
            mDimAnimator = new DimAnimator(mService.mFxSession);
        }
        mService.mH.sendMessage(mService.mH.obtainMessage(SET_DIM_PARAMETERS,
                new DimAnimator.Parameters(winAnimator, width, height, target)));
    }

    // TODO(cmautner): Move into Handler
    void stopDimming() {
        mService.mH.sendMessage(mService.mH.obtainMessage(SET_DIM_PARAMETERS, null));
    }

    boolean isDimming() {
        return mDimParams != null;
    }

    public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
        if (mWindowDetachedWallpaper != null) {
            pw.print("  mWindowDetachedWallpaper="); pw.println(mWindowDetachedWallpaper);
        }
        if (mWindowAnimationBackgroundSurface != null) {
            pw.println("  mWindowAnimationBackgroundSurface:");
            mWindowAnimationBackgroundSurface.printTo("    ", pw);
        }
        if (mDimAnimator != null) {
            pw.println("  mDimAnimator:");
            mDimAnimator.printTo("    ", pw);
        } else {
            pw.println( "  no DimAnimator ");
        }
    }

    static class SetAnimationParams {
        final WindowStateAnimator mWinAnimator;
        final Animation mAnimation;
        final int mAnimDw;
        final int mAnimDh;
        public SetAnimationParams(final WindowStateAnimator winAnimator,
                                  final Animation animation, final int animDw, final int animDh) {
            mWinAnimator = winAnimator;
            mAnimation = animation;
            mAnimDw = animDw;
            mAnimDh = animDh;
        }
    }
}