Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 1 | // Copyright 2012 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | package com.android.server.wm; |
| 4 | |
| 5 | import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER; |
Craig Mautner | f12100e | 2012-06-25 11:13:24 -0700 | [diff] [blame] | 6 | import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 7 | |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 8 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_UPDATE_ROTATION; |
| 9 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_MAY_CHANGE; |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 10 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_FORCE_HIDING_CHANGED; |
Craig Mautner | 2639da5 | 2012-07-09 09:39:06 -0700 | [diff] [blame] | 11 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_ORIENTATION_CHANGE_COMPLETE; |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 12 | import static com.android.server.wm.WindowManagerService.LayoutFields.SET_WALLPAPER_ACTION_PENDING; |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 13 | |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 14 | import android.content.Context; |
Dianne Hackborn | 9812973 | 2012-11-01 16:28:16 -0700 | [diff] [blame] | 15 | import android.os.Debug; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 16 | import android.os.SystemClock; |
| 17 | import android.util.Log; |
| 18 | import android.util.Slog; |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 19 | import android.util.SparseArray; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 20 | import android.util.SparseIntArray; |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 21 | import android.util.TimeUtils; |
Craig Mautner | 6881a10 | 2012-07-27 13:04:51 -0700 | [diff] [blame] | 22 | import android.view.Display; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 23 | import android.view.Surface; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 24 | import android.view.WindowManagerPolicy; |
| 25 | import android.view.animation.Animation; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 26 | |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 27 | import com.android.server.wm.WindowManagerService.LayoutFields; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 28 | |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 29 | import java.io.PrintWriter; |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 30 | import java.util.ArrayList; |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 31 | |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 32 | /** |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 33 | * Singleton class that carries out the animations and Surface operations in a separate task |
| 34 | * on behalf of WindowManagerService. |
| 35 | */ |
| 36 | public class WindowAnimator { |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 37 | private static final String TAG = "WindowAnimator"; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 38 | |
| 39 | final WindowManagerService mService; |
| 40 | final Context mContext; |
| 41 | final WindowManagerPolicy mPolicy; |
| 42 | |
| 43 | boolean mAnimating; |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 44 | |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 45 | final Runnable mAnimationRunnable; |
| 46 | |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 47 | int mAdjResult; |
| 48 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 49 | // Layout changes for individual Displays. Indexed by displayId. |
| 50 | SparseIntArray mPendingLayoutChanges = new SparseIntArray(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 51 | |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 52 | /** Time of current animation step. Reset on each iteration */ |
| 53 | long mCurrentTime; |
| 54 | |
| 55 | /** Skip repeated AppWindowTokens initialization. Note that AppWindowsToken's version of this |
| 56 | * is a long initialized to Long.MIN_VALUE so that it doesn't match this value on startup. */ |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 57 | private int mAnimTransactionSequence; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 58 | |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 59 | // Window currently running an animation that has requested it be detached |
| 60 | // from the wallpaper. This means we need to ensure the wallpaper is |
| 61 | // visible behind it in case it animates in a way that would allow it to be |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 62 | // seen. If multiple windows satisfy this, use the lowest window. |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 63 | WindowState mWindowDetachedWallpaper = null; |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 64 | |
Dianne Hackborn | a4b7f2f | 2012-05-21 11:28:41 -0700 | [diff] [blame] | 65 | WindowStateAnimator mUniverseBackground = null; |
| 66 | int mAboveUniverseLayer = 0; |
| 67 | |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 68 | int mBulkUpdateParams = 0; |
| 69 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 70 | SparseArray<DisplayContentsAnimator> mDisplayContentsAnimators = |
| 71 | new SparseArray<WindowAnimator.DisplayContentsAnimator>(); |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 72 | |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 73 | boolean mInitialized = false; |
| 74 | |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 75 | // forceHiding states. |
| 76 | static final int KEYGUARD_NOT_SHOWN = 0; |
| 77 | static final int KEYGUARD_ANIMATING_IN = 1; |
| 78 | static final int KEYGUARD_SHOWN = 2; |
| 79 | static final int KEYGUARD_ANIMATING_OUT = 3; |
| 80 | int mForceHiding = KEYGUARD_NOT_SHOWN; |
| 81 | |
| 82 | private String forceHidingToString() { |
| 83 | switch (mForceHiding) { |
| 84 | case KEYGUARD_NOT_SHOWN: return "KEYGUARD_NOT_SHOWN"; |
| 85 | case KEYGUARD_ANIMATING_IN: return "KEYGUARD_ANIMATING_IN"; |
| 86 | case KEYGUARD_SHOWN: return "KEYGUARD_SHOWN"; |
| 87 | case KEYGUARD_ANIMATING_OUT:return "KEYGUARD_ANIMATING_OUT"; |
| 88 | default: return "KEYGUARD STATE UNKNOWN " + mForceHiding; |
| 89 | } |
| 90 | } |
| 91 | |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 92 | WindowAnimator(final WindowManagerService service) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 93 | mService = service; |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 94 | mContext = service.mContext; |
| 95 | mPolicy = service.mPolicy; |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 96 | |
| 97 | mAnimationRunnable = new Runnable() { |
| 98 | @Override |
| 99 | public void run() { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 100 | synchronized (mService.mWindowMap) { |
| 101 | mService.mAnimationScheduled = false; |
| 102 | animateLocked(); |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 103 | } |
| 104 | } |
| 105 | }; |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 106 | } |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 107 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 108 | void addDisplayLocked(final int displayId) { |
Craig Mautner | ac439e5 | 2012-09-21 08:58:34 -0700 | [diff] [blame] | 109 | // Create the DisplayContentsAnimator object by retrieving it. |
| 110 | getDisplayContentsAnimatorLocked(displayId); |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 111 | if (displayId == Display.DEFAULT_DISPLAY) { |
| 112 | mInitialized = true; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | void removeDisplayLocked(final int displayId) { |
Craig Mautner | d5523dc | 2012-10-02 13:49:22 -0700 | [diff] [blame] | 117 | final DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.get(displayId); |
| 118 | if (displayAnimator != null) { |
| 119 | if (displayAnimator.mWindowAnimationBackgroundSurface != null) { |
| 120 | displayAnimator.mWindowAnimationBackgroundSurface.kill(); |
| 121 | displayAnimator.mWindowAnimationBackgroundSurface = null; |
| 122 | } |
| 123 | if (displayAnimator.mScreenRotationAnimation != null) { |
| 124 | displayAnimator.mScreenRotationAnimation.kill(); |
| 125 | displayAnimator.mScreenRotationAnimation = null; |
| 126 | } |
| 127 | if (displayAnimator.mDimAnimator != null) { |
| 128 | displayAnimator.mDimAnimator.kill(); |
| 129 | displayAnimator.mDimAnimator = null; |
| 130 | } |
| 131 | } |
| 132 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 133 | mDisplayContentsAnimators.delete(displayId); |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 134 | mPendingLayoutChanges.delete(displayId); |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 135 | } |
| 136 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 137 | AppWindowAnimator getWallpaperAppAnimator() { |
| 138 | return mService.mWallpaperTarget == null |
| 139 | ? null : mService.mWallpaperTarget.mAppToken == null |
| 140 | ? null : mService.mWallpaperTarget.mAppToken.mAppAnimator; |
Craig Mautner | 711f90a | 2012-07-03 18:43:52 -0700 | [diff] [blame] | 141 | } |
| 142 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 143 | void hideWallpapersLocked(final WindowState w) { |
| 144 | final WindowState wallpaperTarget = mService.mWallpaperTarget; |
| 145 | final WindowState lowerWallpaperTarget = mService.mLowerWallpaperTarget; |
| 146 | final ArrayList<WindowToken> wallpaperTokens = mService.mWallpaperTokens; |
| 147 | |
Dianne Hackborn | 9812973 | 2012-11-01 16:28:16 -0700 | [diff] [blame] | 148 | if ((wallpaperTarget == w && lowerWallpaperTarget == null) || wallpaperTarget == null) { |
| 149 | final int numTokens = wallpaperTokens.size(); |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 150 | for (int i = numTokens - 1; i >= 0; i--) { |
Dianne Hackborn | 9812973 | 2012-11-01 16:28:16 -0700 | [diff] [blame] | 151 | final WindowToken token = wallpaperTokens.get(i); |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 152 | final int numWindows = token.windows.size(); |
| 153 | for (int j = numWindows - 1; j >= 0; j--) { |
| 154 | final WindowState wallpaper = token.windows.get(j); |
Craig Mautner | b9836b9 | 2012-06-11 11:40:09 -0700 | [diff] [blame] | 155 | final WindowStateAnimator winAnimator = wallpaper.mWinAnimator; |
| 156 | if (!winAnimator.mLastHidden) { |
| 157 | winAnimator.hide(); |
Craig Mautner | 507a2ee | 2012-06-13 08:39:38 -0700 | [diff] [blame] | 158 | mService.dispatchWallpaperVisibility(wallpaper, false); |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 159 | setPendingLayoutChanges(Display.DEFAULT_DISPLAY, |
| 160 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | b9836b9 | 2012-06-11 11:40:09 -0700 | [diff] [blame] | 161 | } |
| 162 | } |
Dianne Hackborn | ef03a7f | 2012-10-29 18:46:52 -0700 | [diff] [blame] | 163 | if (WindowManagerService.DEBUG_WALLPAPER_LIGHT && !token.hidden) Slog.d(TAG, |
Dianne Hackborn | 2ea9bae | 2012-11-02 18:43:48 -0700 | [diff] [blame] | 164 | "Hiding wallpaper " + token + " from " + w |
| 165 | + " target=" + wallpaperTarget + " lower=" + lowerWallpaperTarget |
| 166 | + "\n" + Debug.getCallers(5, " ")); |
Craig Mautner | b9836b9 | 2012-06-11 11:40:09 -0700 | [diff] [blame] | 167 | token.hidden = true; |
Craig Mautner | 0afddcb | 2012-05-08 15:38:00 -0700 | [diff] [blame] | 168 | } |
Craig Mautner | 0afddcb | 2012-05-08 15:38:00 -0700 | [diff] [blame] | 169 | } |
| 170 | } |
| 171 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 172 | private void updateAppWindowsLocked() { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 173 | int i; |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 174 | final ArrayList<AppWindowToken> appTokens = mService.mAnimatingAppTokens; |
| 175 | final int NAT = appTokens.size(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 176 | for (i=0; i<NAT; i++) { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 177 | final AppWindowAnimator appAnimator = appTokens.get(i).mAppAnimator; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 178 | final boolean wasAnimating = appAnimator.animation != null |
Craig Mautner | fbf378c | 2012-04-23 17:24:21 -0700 | [diff] [blame] | 179 | && appAnimator.animation != AppWindowAnimator.sDummyAnimation; |
Craig Mautner | 9339c40 | 2012-11-30 11:23:56 -0800 | [diff] [blame] | 180 | if (appAnimator.stepAnimationLocked(mCurrentTime)) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 181 | mAnimating = true; |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 182 | } else if (wasAnimating) { |
| 183 | // stopped animating, do one more pass through the layout |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 184 | setAppLayoutChanges(appAnimator, WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER, |
| 185 | "appToken " + appAnimator.mAppToken + " done"); |
Craig Mautner | 83339b4 | 2012-05-01 22:13:23 -0700 | [diff] [blame] | 186 | if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG, |
| 187 | "updateWindowsApps...: done animating " + appAnimator.mAppToken); |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 188 | } |
| 189 | } |
Craig Mautner | a2c7705 | 2012-03-26 12:14:43 -0700 | [diff] [blame] | 190 | |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 191 | final int NEAT = mService.mExitingAppTokens.size(); |
| 192 | for (i=0; i<NEAT; i++) { |
Craig Mautner | e4d8a5d | 2012-04-05 13:10:37 -0700 | [diff] [blame] | 193 | final AppWindowAnimator appAnimator = mService.mExitingAppTokens.get(i).mAppAnimator; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 194 | final boolean wasAnimating = appAnimator.animation != null |
Craig Mautner | fbf378c | 2012-04-23 17:24:21 -0700 | [diff] [blame] | 195 | && appAnimator.animation != AppWindowAnimator.sDummyAnimation; |
Craig Mautner | 9339c40 | 2012-11-30 11:23:56 -0800 | [diff] [blame] | 196 | if (appAnimator.stepAnimationLocked(mCurrentTime)) { |
Craig Mautner | bb1449b | 2012-03-23 16:11:14 -0700 | [diff] [blame] | 197 | mAnimating = true; |
| 198 | } else if (wasAnimating) { |
| 199 | // stopped animating, do one more pass through the layout |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 200 | setAppLayoutChanges(appAnimator, WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER, |
| 201 | "exiting appToken " + appAnimator.mAppToken + " done"); |
Craig Mautner | 83339b4 | 2012-05-01 22:13:23 -0700 | [diff] [blame] | 202 | if (WindowManagerService.DEBUG_ANIM) Slog.v(TAG, |
| 203 | "updateWindowsApps...: done animating exiting " + appAnimator.mAppToken); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 204 | } |
| 205 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 206 | } |
| 207 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 208 | private void updateWindowsLocked(final int displayId) { |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 209 | ++mAnimTransactionSequence; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 210 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 211 | final WindowList windows = mService.getWindowListLocked(displayId); |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 212 | ArrayList<WindowStateAnimator> unForceHiding = null; |
| 213 | boolean wallpaperInUnForceHiding = false; |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 214 | mForceHiding = KEYGUARD_NOT_SHOWN; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 215 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 216 | for (int i = windows.size() - 1; i >= 0; i--) { |
| 217 | WindowState win = windows.get(i); |
| 218 | WindowStateAnimator winAnimator = win.mWinAnimator; |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 219 | final int flags = winAnimator.mAttrFlags; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 220 | |
Craig Mautner | c2f9be0 | 2012-03-27 17:32:29 -0700 | [diff] [blame] | 221 | if (winAnimator.mSurface != null) { |
Craig Mautner | a2c7705 | 2012-03-26 12:14:43 -0700 | [diff] [blame] | 222 | final boolean wasAnimating = winAnimator.mWasAnimating; |
| 223 | final boolean nowAnimating = winAnimator.stepAnimationLocked(mCurrentTime); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 224 | |
| 225 | if (WindowManagerService.DEBUG_WALLPAPER) { |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 226 | Slog.v(TAG, win + ": wasAnimating=" + wasAnimating + |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 227 | ", nowAnimating=" + nowAnimating); |
| 228 | } |
| 229 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 230 | if (wasAnimating && !winAnimator.mAnimating && mService.mWallpaperTarget == win) { |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 231 | mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 232 | setPendingLayoutChanges(Display.DEFAULT_DISPLAY, |
| 233 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 234 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 235 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 2", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 236 | mPendingLayoutChanges.get(Display.DEFAULT_DISPLAY)); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 237 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 238 | } |
| 239 | |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 240 | if (mPolicy.doesForceHide(win, win.mAttrs)) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 241 | if (!wasAnimating && nowAnimating) { |
Craig Mautner | 83339b4 | 2012-05-01 22:13:23 -0700 | [diff] [blame] | 242 | if (WindowManagerService.DEBUG_ANIM || |
| 243 | WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, |
| 244 | "Animation started that could impact force hide: " + win); |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 245 | mBulkUpdateParams |= SET_FORCE_HIDING_CHANGED; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 246 | setPendingLayoutChanges(displayId, |
| 247 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 248 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 249 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 3", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 250 | mPendingLayoutChanges.get(displayId)); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 251 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 252 | mService.mFocusMayChange = true; |
Dianne Hackborn | ac92087 | 2012-05-22 11:49:49 -0700 | [diff] [blame] | 253 | } |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 254 | if (win.isReadyForDisplay()) { |
| 255 | if (nowAnimating) { |
| 256 | if (winAnimator.mAnimationIsEntrance) { |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 257 | mForceHiding = KEYGUARD_ANIMATING_IN; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 258 | } else { |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 259 | mForceHiding = KEYGUARD_ANIMATING_OUT; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 260 | } |
| 261 | } else { |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 262 | mForceHiding = KEYGUARD_SHOWN; |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 263 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 264 | } |
Dianne Hackborn | ac92087 | 2012-05-22 11:49:49 -0700 | [diff] [blame] | 265 | if (WindowManagerService.DEBUG_VISIBILITY) Slog.v(TAG, |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 266 | "Force hide " + mForceHiding |
Dianne Hackborn | ac92087 | 2012-05-22 11:49:49 -0700 | [diff] [blame] | 267 | + " hasSurface=" + win.mHasSurface |
| 268 | + " policyVis=" + win.mPolicyVisibility |
| 269 | + " destroying=" + win.mDestroying |
| 270 | + " attHidden=" + win.mAttachedHidden |
| 271 | + " vis=" + win.mViewVisibility |
| 272 | + " hidden=" + win.mRootToken.hidden |
| 273 | + " anim=" + win.mWinAnimator.mAnimation); |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 274 | } else if (mPolicy.canBeForceHidden(win, win.mAttrs)) { |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 275 | final boolean hideWhenLocked = |
| 276 | (winAnimator.mAttrFlags & FLAG_SHOW_WHEN_LOCKED) == 0; |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 277 | final boolean changed; |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 278 | if (((mForceHiding == KEYGUARD_ANIMATING_IN) |
Craig Mautner | 4bf18a7 | 2012-07-10 14:08:16 -0700 | [diff] [blame] | 279 | && (!winAnimator.isAnimating() || hideWhenLocked)) |
Craig Mautner | 178af59 | 2012-09-17 10:37:29 -0700 | [diff] [blame] | 280 | || ((mForceHiding == KEYGUARD_SHOWN) && hideWhenLocked)) { |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 281 | changed = win.hideLw(false, false); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 282 | if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG, |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 283 | "Now policy hidden: " + win); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 284 | } else { |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 285 | changed = win.showLw(false, false); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 286 | if (WindowManagerService.DEBUG_VISIBILITY && changed) Slog.v(TAG, |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 287 | "Now policy shown: " + win); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 288 | if (changed) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 289 | if ((mBulkUpdateParams & SET_FORCE_HIDING_CHANGED) != 0 |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 290 | && win.isVisibleNow() /*w.isReadyForDisplay()*/) { |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 291 | if (unForceHiding == null) { |
| 292 | unForceHiding = new ArrayList<WindowStateAnimator>(); |
| 293 | } |
| 294 | unForceHiding.add(winAnimator); |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 295 | if ((flags & FLAG_SHOW_WALLPAPER) != 0) { |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 296 | wallpaperInUnForceHiding = true; |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 297 | } |
| 298 | } |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 299 | if (mCurrentFocus == null || mCurrentFocus.mLayer < win.mLayer) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 300 | // We are showing on to of the current |
| 301 | // focus, so re-evaluate focus to make |
| 302 | // sure it is correct. |
| 303 | mService.mFocusMayChange = true; |
| 304 | } |
| 305 | } |
| 306 | } |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 307 | if (changed && (flags & FLAG_SHOW_WALLPAPER) != 0) { |
Craig Mautner | a608b88 | 2012-03-30 13:03:49 -0700 | [diff] [blame] | 308 | mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 309 | setPendingLayoutChanges(Display.DEFAULT_DISPLAY, |
| 310 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 311 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 312 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 4", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 313 | mPendingLayoutChanges.get(Display.DEFAULT_DISPLAY)); |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 314 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 315 | } |
| 316 | } |
| 317 | } |
| 318 | |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 319 | final AppWindowToken atoken = win.mAppToken; |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 320 | if (winAnimator.mDrawState == WindowStateAnimator.READY_TO_SHOW) { |
| 321 | if (atoken == null || atoken.allDrawn) { |
| 322 | if (winAnimator.performShowLocked()) { |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 323 | mPendingLayoutChanges.put(displayId, |
| 324 | WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 325 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
| 326 | mService.debugLayoutRepeats("updateWindowsAndWallpaperLocked 5", |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 327 | mPendingLayoutChanges.get(displayId)); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 328 | } |
| 329 | } |
Craig Mautner | cf8cbbe | 2012-03-25 21:54:36 -0700 | [diff] [blame] | 330 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 331 | } |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 332 | final AppWindowAnimator appAnimator = winAnimator.mAppAnimator; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 333 | if (appAnimator != null && appAnimator.thumbnail != null) { |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 334 | if (appAnimator.thumbnailTransactionSeq != mAnimTransactionSequence) { |
| 335 | appAnimator.thumbnailTransactionSeq = mAnimTransactionSequence; |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 336 | appAnimator.thumbnailLayer = 0; |
Dianne Hackborn | 8078d8c | 2012-03-20 11:11:26 -0700 | [diff] [blame] | 337 | } |
Craig Mautner | 5943163 | 2012-04-04 11:56:44 -0700 | [diff] [blame] | 338 | if (appAnimator.thumbnailLayer < winAnimator.mAnimLayer) { |
| 339 | appAnimator.thumbnailLayer = winAnimator.mAnimLayer; |
Dianne Hackborn | 8078d8c | 2012-03-20 11:11:26 -0700 | [diff] [blame] | 340 | } |
| 341 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 342 | } // end forall windows |
Dianne Hackborn | 0c2acff | 2012-04-12 15:17:07 -0700 | [diff] [blame] | 343 | |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 344 | // If we have windows that are being show due to them no longer |
| 345 | // being force-hidden, apply the appropriate animation to them. |
| 346 | if (unForceHiding != null) { |
| 347 | for (int i=unForceHiding.size()-1; i>=0; i--) { |
| 348 | Animation a = mPolicy.createForceHideEnterAnimation(wallpaperInUnForceHiding); |
| 349 | if (a != null) { |
| 350 | final WindowStateAnimator winAnimator = unForceHiding.get(i); |
| 351 | winAnimator.setAnimation(a); |
| 352 | winAnimator.mAnimationIsEntrance = true; |
| 353 | } |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 358 | private void updateWallpaperLocked(int displayId) { |
| 359 | final DisplayContentsAnimator displayAnimator = |
| 360 | getDisplayContentsAnimatorLocked(displayId); |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 361 | final WindowList windows = mService.getWindowListLocked(displayId); |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 362 | WindowStateAnimator windowAnimationBackground = null; |
| 363 | int windowAnimationBackgroundColor = 0; |
| 364 | WindowState detachedWallpaper = null; |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 365 | final DimSurface windowAnimationBackgroundSurface = |
| 366 | displayAnimator.mWindowAnimationBackgroundSurface; |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 367 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 368 | for (int i = windows.size() - 1; i >= 0; i--) { |
| 369 | final WindowState win = windows.get(i); |
| 370 | WindowStateAnimator winAnimator = win.mWinAnimator; |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 371 | if (winAnimator.mSurface == null) { |
| 372 | continue; |
| 373 | } |
| 374 | |
| 375 | final int flags = winAnimator.mAttrFlags; |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 376 | |
| 377 | // If this window is animating, make a note that we have |
| 378 | // an animating window and take care of a request to run |
| 379 | // a detached wallpaper animation. |
| 380 | if (winAnimator.mAnimating) { |
| 381 | if (winAnimator.mAnimation != null) { |
| 382 | if ((flags & FLAG_SHOW_WALLPAPER) != 0 |
| 383 | && winAnimator.mAnimation.getDetachWallpaper()) { |
| 384 | detachedWallpaper = win; |
| 385 | } |
| 386 | final int backgroundColor = winAnimator.mAnimation.getBackgroundColor(); |
| 387 | if (backgroundColor != 0) { |
| 388 | if (windowAnimationBackground == null || (winAnimator.mAnimLayer < |
| 389 | windowAnimationBackground.mAnimLayer)) { |
| 390 | windowAnimationBackground = winAnimator; |
| 391 | windowAnimationBackgroundColor = backgroundColor; |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | mAnimating = true; |
| 396 | } |
| 397 | |
| 398 | // If this window's app token is running a detached wallpaper |
| 399 | // animation, make a note so we can ensure the wallpaper is |
| 400 | // displayed behind it. |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 401 | final AppWindowAnimator appAnimator = winAnimator.mAppAnimator; |
Craig Mautner | 078ea0a | 2012-06-25 11:04:29 -0700 | [diff] [blame] | 402 | if (appAnimator != null && appAnimator.animation != null |
| 403 | && appAnimator.animating) { |
| 404 | if ((flags & FLAG_SHOW_WALLPAPER) != 0 |
| 405 | && appAnimator.animation.getDetachWallpaper()) { |
| 406 | detachedWallpaper = win; |
| 407 | } |
| 408 | |
| 409 | final int backgroundColor = appAnimator.animation.getBackgroundColor(); |
| 410 | if (backgroundColor != 0) { |
| 411 | if (windowAnimationBackground == null || (winAnimator.mAnimLayer < |
| 412 | windowAnimationBackground.mAnimLayer)) { |
| 413 | windowAnimationBackground = winAnimator; |
| 414 | windowAnimationBackgroundColor = backgroundColor; |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | } // end forall windows |
| 419 | |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 420 | if (mWindowDetachedWallpaper != detachedWallpaper) { |
| 421 | if (WindowManagerService.DEBUG_WALLPAPER) Slog.v(TAG, |
| 422 | "Detached wallpaper changed from " + mWindowDetachedWallpaper |
| 423 | + " to " + detachedWallpaper); |
| 424 | mWindowDetachedWallpaper = detachedWallpaper; |
| 425 | mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE; |
| 426 | } |
| 427 | |
| 428 | if (windowAnimationBackgroundColor != 0) { |
| 429 | // If the window that wants black is the current wallpaper |
| 430 | // target, then the black goes *below* the wallpaper so we |
| 431 | // don't cause the wallpaper to suddenly disappear. |
| 432 | int animLayer = windowAnimationBackground.mAnimLayer; |
| 433 | WindowState win = windowAnimationBackground.mWin; |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 434 | if (mService.mWallpaperTarget == win || mService.mLowerWallpaperTarget == win |
| 435 | || mService.mUpperWallpaperTarget == win) { |
| 436 | final int N = windows.size(); |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 437 | for (int i = 0; i < N; i++) { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 438 | WindowStateAnimator winAnimator = windows.get(i).mWinAnimator; |
Craig Mautner | 918b53b | 2012-07-09 14:15:54 -0700 | [diff] [blame] | 439 | if (winAnimator.mIsWallpaper) { |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 440 | animLayer = winAnimator.mAnimLayer; |
| 441 | break; |
| 442 | } |
| 443 | } |
| 444 | } |
| 445 | |
Craig Mautner | d5523dc | 2012-10-02 13:49:22 -0700 | [diff] [blame] | 446 | if (windowAnimationBackgroundSurface != null) { |
Craig Mautner | 9339c40 | 2012-11-30 11:23:56 -0800 | [diff] [blame] | 447 | windowAnimationBackgroundSurface.show( |
Craig Mautner | d5523dc | 2012-10-02 13:49:22 -0700 | [diff] [blame] | 448 | animLayer - WindowManagerService.LAYER_OFFSET_DIM, |
| 449 | windowAnimationBackgroundColor); |
| 450 | } |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 451 | } else { |
Craig Mautner | d5523dc | 2012-10-02 13:49:22 -0700 | [diff] [blame] | 452 | if (windowAnimationBackgroundSurface != null) { |
| 453 | windowAnimationBackgroundSurface.hide(); |
| 454 | } |
Craig Mautner | 9e80944 | 2012-06-22 17:13:04 -0700 | [diff] [blame] | 455 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 456 | } |
| 457 | |
Craig Mautner | 9339c40 | 2012-11-30 11:23:56 -0800 | [diff] [blame] | 458 | /** See if any windows have been drawn, so they (and others associated with them) can now be |
| 459 | * shown. */ |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 460 | private void testTokenMayBeDrawnLocked() { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 461 | // See if any windows have been drawn, so they (and others |
| 462 | // associated with them) can now be shown. |
| 463 | final ArrayList<AppWindowToken> appTokens = mService.mAnimatingAppTokens; |
| 464 | final int NT = appTokens.size(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 465 | for (int i=0; i<NT; i++) { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 466 | AppWindowToken wtoken = appTokens.get(i); |
| 467 | AppWindowAnimator appAnimator = wtoken.mAppAnimator; |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 468 | final boolean allDrawn = wtoken.allDrawn; |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 469 | if (allDrawn != appAnimator.allDrawn) { |
| 470 | appAnimator.allDrawn = allDrawn; |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 471 | if (allDrawn) { |
| 472 | // The token has now changed state to having all |
| 473 | // windows shown... what to do, what to do? |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 474 | if (appAnimator.freezingScreen) { |
| 475 | appAnimator.showAllWindowsLocked(); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 476 | mService.unsetAppFreezingScreenLocked(wtoken, false, true); |
| 477 | if (WindowManagerService.DEBUG_ORIENTATION) Slog.i(TAG, |
| 478 | "Setting mOrientationChangeComplete=true because wtoken " |
| 479 | + wtoken + " numInteresting=" + wtoken.numInterestingWindows |
| 480 | + " numDrawn=" + wtoken.numDrawnWindows); |
| 481 | // This will set mOrientationChangeComplete and cause a pass through layout. |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 482 | setAppLayoutChanges(appAnimator, |
| 483 | WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER, |
| 484 | "testTokenMayBeDrawnLocked: freezingScreen"); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 485 | } else { |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 486 | setAppLayoutChanges(appAnimator, |
| 487 | WindowManagerPolicy.FINISH_LAYOUT_REDO_ANIM, |
| 488 | "testTokenMayBeDrawnLocked"); |
| 489 | |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 490 | // We can now show all of the drawn windows! |
| 491 | if (!mService.mOpeningApps.contains(wtoken)) { |
Craig Mautner | 322e403 | 2012-07-13 13:35:20 -0700 | [diff] [blame] | 492 | mAnimating |= appAnimator.showAllWindowsLocked(); |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 493 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 494 | } |
| 495 | } |
| 496 | } |
| 497 | } |
| 498 | } |
| 499 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 500 | private void performAnimationsLocked(final int displayId) { |
| 501 | updateWindowsLocked(displayId); |
| 502 | updateWallpaperLocked(displayId); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 503 | } |
| 504 | |
Craig Mautner | 1caa399 | 2012-06-22 09:46:48 -0700 | [diff] [blame] | 505 | // TODO(cmautner): Change the following comment when no longer locked on mWindowMap */ |
| 506 | /** Locked on mService.mWindowMap and this. */ |
| 507 | private void animateLocked() { |
Craig Mautner | b47bbc3 | 2012-08-22 17:41:48 -0700 | [diff] [blame] | 508 | if (!mInitialized) { |
| 509 | return; |
| 510 | } |
Craig Mautner | 59c0097 | 2012-07-30 12:10:24 -0700 | [diff] [blame] | 511 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 512 | mPendingLayoutChanges.clear(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 513 | mCurrentTime = SystemClock.uptimeMillis(); |
Craig Mautner | 2639da5 | 2012-07-09 09:39:06 -0700 | [diff] [blame] | 514 | mBulkUpdateParams = SET_ORIENTATION_CHANGE_COMPLETE; |
Chet Haase | 198e564 | 2012-05-10 09:55:15 -0700 | [diff] [blame] | 515 | boolean wasAnimating = mAnimating; |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 516 | mAnimating = false; |
| 517 | if (WindowManagerService.DEBUG_WINDOW_TRACE) { |
| 518 | Slog.i(TAG, "!!! animate: entry time=" + mCurrentTime); |
| 519 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 520 | |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 521 | if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i( |
| 522 | TAG, ">>> OPEN TRANSACTION animateLocked"); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 523 | Surface.openTransaction(); |
Jamie Gennis | b6ce6e4 | 2012-10-15 19:14:58 -0700 | [diff] [blame] | 524 | Surface.setAnimationTransaction(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 525 | try { |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 526 | updateAppWindowsLocked(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 527 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 528 | final int numDisplays = mDisplayContentsAnimators.size(); |
| 529 | for (int i = 0; i < numDisplays; i++) { |
| 530 | final int displayId = mDisplayContentsAnimators.keyAt(i); |
| 531 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i); |
| 532 | |
| 533 | final ScreenRotationAnimation screenRotationAnimation = |
| 534 | displayAnimator.mScreenRotationAnimation; |
| 535 | if (screenRotationAnimation != null && screenRotationAnimation.isAnimating()) { |
| 536 | if (screenRotationAnimation.stepAnimationLocked(mCurrentTime)) { |
| 537 | mAnimating = true; |
| 538 | } else { |
| 539 | mBulkUpdateParams |= SET_UPDATE_ROTATION; |
| 540 | screenRotationAnimation.kill(); |
| 541 | displayAnimator.mScreenRotationAnimation = null; |
| 542 | } |
| 543 | } |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 544 | |
| 545 | // Update animations of all applications, including those |
| 546 | // associated with exiting/removed apps |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 547 | performAnimationsLocked(displayId); |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 548 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 549 | final WindowList windows = mService.getWindowListLocked(displayId); |
| 550 | final int N = windows.size(); |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 551 | for (int j = 0; j < N; j++) { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 552 | windows.get(j).mWinAnimator.prepareSurfaceLocked(true); |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 553 | } |
| 554 | } |
| 555 | |
| 556 | testTokenMayBeDrawnLocked(); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 557 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 558 | for (int i = 0; i < numDisplays; i++) { |
| 559 | final int displayId = mDisplayContentsAnimators.keyAt(i); |
| 560 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i); |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 561 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 562 | final ScreenRotationAnimation screenRotationAnimation = |
| 563 | displayAnimator.mScreenRotationAnimation; |
| 564 | if (screenRotationAnimation != null) { |
| 565 | screenRotationAnimation.updateSurfacesInTransaction(); |
| 566 | } |
| 567 | |
| 568 | final DimAnimator.Parameters dimParams = displayAnimator.mDimParams; |
| 569 | final DimAnimator dimAnimator = displayAnimator.mDimAnimator; |
Craig Mautner | d5523dc | 2012-10-02 13:49:22 -0700 | [diff] [blame] | 570 | if (dimAnimator != null && dimParams != null) { |
| 571 | dimAnimator.updateParameters(mContext.getResources(), dimParams, mCurrentTime); |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 572 | } |
| 573 | if (dimAnimator != null && dimAnimator.mDimShown) { |
| 574 | mAnimating |= dimAnimator.updateSurface(isDimmingLocked(displayId), |
| 575 | mCurrentTime, !mService.okToDisplay()); |
| 576 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 577 | } |
| 578 | |
Craig Mautner | 7358fbf | 2012-04-12 21:06:33 -0700 | [diff] [blame] | 579 | if (mService.mWatermark != null) { |
| 580 | mService.mWatermark.drawIfNeeded(); |
| 581 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 582 | } catch (RuntimeException e) { |
| 583 | Log.wtf(TAG, "Unhandled exception in Window Manager", e); |
| 584 | } finally { |
| 585 | Surface.closeTransaction(); |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 586 | if (WindowManagerService.SHOW_TRANSACTIONS) Slog.i( |
| 587 | TAG, "<<< CLOSE TRANSACTION animateLocked"); |
| 588 | } |
| 589 | |
| 590 | for (int i = mPendingLayoutChanges.size() - 1; i >= 0; i--) { |
| 591 | if ((mPendingLayoutChanges.valueAt(i) |
| 592 | & WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER) != 0) { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 593 | mBulkUpdateParams |= SET_WALLPAPER_ACTION_PENDING; |
Craig Mautner | ea3a09a | 2012-09-04 09:49:35 -0700 | [diff] [blame] | 594 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 595 | } |
Craig Mautner | c2f9be0 | 2012-03-27 17:32:29 -0700 | [diff] [blame] | 596 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 597 | if (mBulkUpdateParams != 0 || mPendingLayoutChanges.size() > 0) { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 598 | if (mService.copyAnimToLayoutParamsLocked()) { |
| 599 | mService.requestTraversalLocked(); |
| 600 | } |
Craig Mautner | 01cd0e7 | 2012-06-18 10:19:11 -0700 | [diff] [blame] | 601 | } |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 602 | |
| 603 | if (mAnimating) { |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 604 | mService.scheduleAnimationLocked(); |
Chet Haase | 198e564 | 2012-05-10 09:55:15 -0700 | [diff] [blame] | 605 | } else if (wasAnimating) { |
| 606 | mService.requestTraversalLocked(); |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 607 | } |
| 608 | if (WindowManagerService.DEBUG_WINDOW_TRACE) { |
| 609 | Slog.i(TAG, "!!! animate: exit mAnimating=" + mAnimating |
| 610 | + " mBulkUpdateParams=" + Integer.toHexString(mBulkUpdateParams) |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 611 | + " mPendingLayoutChanges(DEFAULT_DISPLAY)=" |
| 612 | + Integer.toHexString(mPendingLayoutChanges.get(Display.DEFAULT_DISPLAY))); |
Craig Mautner | 7d8df39 | 2012-04-06 15:26:23 -0700 | [diff] [blame] | 613 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 614 | } |
| 615 | |
| 616 | WindowState mCurrentFocus; |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 617 | void setCurrentFocus(final WindowState currentFocus) { |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 618 | mCurrentFocus = currentFocus; |
| 619 | } |
| 620 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 621 | boolean isDimmingLocked(int displayId) { |
| 622 | return getDisplayContentsAnimatorLocked(displayId).mDimParams != null; |
Craig Mautner | f8d4fbb | 2012-04-11 09:25:53 -0700 | [diff] [blame] | 623 | } |
| 624 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 625 | boolean isDimmingLocked(final WindowStateAnimator winAnimator) { |
| 626 | DimAnimator.Parameters dimParams = |
| 627 | getDisplayContentsAnimatorLocked(winAnimator.mWin.getDisplayId()).mDimParams; |
| 628 | return dimParams != null && dimParams.mDimWinAnimator == winAnimator; |
Craig Mautner | acafd19 | 2012-05-10 10:41:02 -0700 | [diff] [blame] | 629 | } |
| 630 | |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 631 | static String bulkUpdateParamsToString(int bulkUpdateParams) { |
| 632 | StringBuilder builder = new StringBuilder(128); |
| 633 | if ((bulkUpdateParams & LayoutFields.SET_UPDATE_ROTATION) != 0) { |
| 634 | builder.append(" UPDATE_ROTATION"); |
| 635 | } |
| 636 | if ((bulkUpdateParams & LayoutFields.SET_WALLPAPER_MAY_CHANGE) != 0) { |
| 637 | builder.append(" WALLPAPER_MAY_CHANGE"); |
| 638 | } |
| 639 | if ((bulkUpdateParams & LayoutFields.SET_FORCE_HIDING_CHANGED) != 0) { |
| 640 | builder.append(" FORCE_HIDING_CHANGED"); |
| 641 | } |
| 642 | if ((bulkUpdateParams & LayoutFields.SET_ORIENTATION_CHANGE_COMPLETE) != 0) { |
| 643 | builder.append(" ORIENTATION_CHANGE_COMPLETE"); |
| 644 | } |
| 645 | if ((bulkUpdateParams & LayoutFields.SET_TURN_ON_SCREEN) != 0) { |
| 646 | builder.append(" TURN_ON_SCREEN"); |
| 647 | } |
| 648 | return builder.toString(); |
| 649 | } |
| 650 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 651 | public void dumpLocked(PrintWriter pw, String prefix, boolean dumpAll) { |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 652 | final String subPrefix = " " + prefix; |
| 653 | final String subSubPrefix = " " + subPrefix; |
| 654 | |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 655 | for (int i = 0; i < mDisplayContentsAnimators.size(); i++) { |
| 656 | pw.print(prefix); pw.print("DisplayContentsAnimator #"); |
| 657 | pw.print(mDisplayContentsAnimators.keyAt(i)); |
| 658 | pw.println(":"); |
| 659 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.valueAt(i); |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 660 | final WindowList windows = |
| 661 | mService.getWindowListLocked(mDisplayContentsAnimators.keyAt(i)); |
| 662 | final int N = windows.size(); |
| 663 | for (int j = 0; j < N; j++) { |
| 664 | WindowStateAnimator wanim = windows.get(j).mWinAnimator; |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 665 | pw.print(subPrefix); pw.print("Window #"); pw.print(j); |
| 666 | pw.print(": "); pw.println(wanim); |
| 667 | } |
| 668 | if (displayAnimator.mWindowAnimationBackgroundSurface != null) { |
| 669 | if (dumpAll || displayAnimator.mWindowAnimationBackgroundSurface.mDimShown) { |
| 670 | pw.print(subPrefix); pw.println("mWindowAnimationBackgroundSurface:"); |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 671 | displayAnimator.mWindowAnimationBackgroundSurface.printTo(subSubPrefix, pw); |
| 672 | } |
Craig Mautner | 6fbda63 | 2012-07-03 09:26:39 -0700 | [diff] [blame] | 673 | } |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 674 | if (displayAnimator.mDimAnimator != null) { |
| 675 | if (dumpAll || displayAnimator.mDimAnimator.mDimShown) { |
| 676 | pw.print(subPrefix); pw.println("mDimAnimator:"); |
| 677 | displayAnimator.mDimAnimator.printTo(subSubPrefix, pw); |
| 678 | } |
| 679 | } else if (dumpAll) { |
| 680 | pw.print(subPrefix); pw.println("no DimAnimator "); |
| 681 | } |
| 682 | if (displayAnimator.mDimParams != null) { |
| 683 | pw.print(subPrefix); pw.println("mDimParams:"); |
| 684 | displayAnimator.mDimParams.printTo(subSubPrefix, pw); |
| 685 | } else if (dumpAll) { |
| 686 | pw.print(subPrefix); pw.println("no DimParams "); |
| 687 | } |
| 688 | if (displayAnimator.mScreenRotationAnimation != null) { |
| 689 | pw.print(subPrefix); pw.println("mScreenRotationAnimation:"); |
| 690 | displayAnimator.mScreenRotationAnimation.printTo(subSubPrefix, pw); |
| 691 | } else if (dumpAll) { |
| 692 | pw.print(subPrefix); pw.println("no ScreenRotationAnimation "); |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | pw.println(); |
| 697 | |
| 698 | if (dumpAll) { |
| 699 | pw.print(prefix); pw.print("mAnimTransactionSequence="); |
| 700 | pw.print(mAnimTransactionSequence); |
| 701 | pw.print(" mForceHiding="); pw.println(forceHidingToString()); |
| 702 | pw.print(prefix); pw.print("mCurrentTime="); |
| 703 | pw.println(TimeUtils.formatUptime(mCurrentTime)); |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 704 | } |
| 705 | if (mBulkUpdateParams != 0) { |
| 706 | pw.print(prefix); pw.print("mBulkUpdateParams=0x"); |
| 707 | pw.print(Integer.toHexString(mBulkUpdateParams)); |
| 708 | pw.println(bulkUpdateParamsToString(mBulkUpdateParams)); |
| 709 | } |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 710 | if (mWindowDetachedWallpaper != null) { |
| 711 | pw.print(prefix); pw.print("mWindowDetachedWallpaper="); |
| 712 | pw.println(mWindowDetachedWallpaper); |
| 713 | } |
Dianne Hackborn | 529e744 | 2012-11-01 14:22:28 -0700 | [diff] [blame] | 714 | if (mUniverseBackground != null) { |
| 715 | pw.print(prefix); pw.print("mUniverseBackground="); pw.print(mUniverseBackground); |
| 716 | pw.print(" mAboveUniverseLayer="); pw.println(mAboveUniverseLayer); |
Craig Mautner | d09cc4b | 2012-04-04 10:23:31 -0700 | [diff] [blame] | 717 | } |
Craig Mautner | e7ae250 | 2012-03-26 17:11:19 -0700 | [diff] [blame] | 718 | } |
Craig Mautner | bec53f7 | 2012-04-05 11:49:05 -0700 | [diff] [blame] | 719 | |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 720 | void setPendingLayoutChanges(final int displayId, final int changes) { |
| 721 | mPendingLayoutChanges.put(displayId, mPendingLayoutChanges.get(displayId) | changes); |
| 722 | } |
| 723 | |
| 724 | void setAppLayoutChanges(final AppWindowAnimator appAnimator, final int changes, String s) { |
| 725 | // Used to track which displays layout changes have been done. |
| 726 | SparseIntArray displays = new SparseIntArray(); |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 727 | WindowList windows = appAnimator.mAppToken.allAppWindows; |
| 728 | for (int i = windows.size() - 1; i >= 0; i--) { |
| 729 | final int displayId = windows.get(i).getDisplayId(); |
Craig Mautner | 76a7165 | 2012-09-03 23:23:58 -0700 | [diff] [blame] | 730 | if (displays.indexOfKey(displayId) < 0) { |
| 731 | setPendingLayoutChanges(displayId, changes); |
| 732 | if (WindowManagerService.DEBUG_LAYOUT_REPEATS) { |
| 733 | mService.debugLayoutRepeats(s, mPendingLayoutChanges.get(displayId)); |
| 734 | } |
| 735 | // Keep from processing this display again. |
| 736 | displays.put(displayId, changes); |
| 737 | } |
| 738 | } |
Craig Mautner | 4d7349b | 2012-04-20 14:52:47 -0700 | [diff] [blame] | 739 | } |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 740 | |
Craig Mautner | 9686833 | 2012-12-04 14:29:11 -0800 | [diff] [blame^] | 741 | void setDimParamsLocked(int displayId, DimAnimator.Parameters dimParams) { |
| 742 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.get(displayId); |
| 743 | if (dimParams == null) { |
| 744 | displayAnimator.mDimParams = null; |
| 745 | } else { |
| 746 | final WindowStateAnimator newWinAnimator = dimParams.mDimWinAnimator; |
| 747 | |
| 748 | // Only set dim params on the highest dimmed layer. |
| 749 | final WindowStateAnimator existingDimWinAnimator = |
| 750 | displayAnimator.mDimParams == null ? |
| 751 | null : displayAnimator.mDimParams.mDimWinAnimator; |
| 752 | // Don't turn on for an unshown surface, or for any layer but the highest |
| 753 | // dimmed layer. |
| 754 | if (newWinAnimator.mSurfaceShown && (existingDimWinAnimator == null |
| 755 | || !existingDimWinAnimator.mSurfaceShown |
| 756 | || existingDimWinAnimator.mAnimLayer < newWinAnimator.mAnimLayer)) { |
| 757 | displayAnimator.mDimParams = new DimAnimator.Parameters(dimParams); |
| 758 | } |
| 759 | } |
| 760 | } |
| 761 | |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 762 | private DisplayContentsAnimator getDisplayContentsAnimatorLocked(int displayId) { |
| 763 | DisplayContentsAnimator displayAnimator = mDisplayContentsAnimators.get(displayId); |
| 764 | if (displayAnimator == null) { |
Craig Mautner | ac439e5 | 2012-09-21 08:58:34 -0700 | [diff] [blame] | 765 | displayAnimator = new DisplayContentsAnimator(displayId); |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 766 | mDisplayContentsAnimators.put(displayId, displayAnimator); |
| 767 | } |
| 768 | return displayAnimator; |
| 769 | } |
| 770 | |
| 771 | void setScreenRotationAnimationLocked(int displayId, ScreenRotationAnimation animation) { |
| 772 | getDisplayContentsAnimatorLocked(displayId).mScreenRotationAnimation = animation; |
| 773 | } |
| 774 | |
| 775 | ScreenRotationAnimation getScreenRotationAnimationLocked(int displayId) { |
| 776 | return getDisplayContentsAnimatorLocked(displayId).mScreenRotationAnimation; |
| 777 | } |
| 778 | |
Craig Mautner | ac439e5 | 2012-09-21 08:58:34 -0700 | [diff] [blame] | 779 | private class DisplayContentsAnimator { |
Craig Mautner | d5523dc | 2012-10-02 13:49:22 -0700 | [diff] [blame] | 780 | DimAnimator mDimAnimator = null; |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 781 | DimAnimator.Parameters mDimParams = null; |
Craig Mautner | d5523dc | 2012-10-02 13:49:22 -0700 | [diff] [blame] | 782 | DimSurface mWindowAnimationBackgroundSurface = null; |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 783 | ScreenRotationAnimation mScreenRotationAnimation = null; |
Craig Mautner | ac439e5 | 2012-09-21 08:58:34 -0700 | [diff] [blame] | 784 | |
| 785 | public DisplayContentsAnimator(int displayId) { |
| 786 | mDimAnimator = new DimAnimator(mService.mFxSession, displayId); |
Craig Mautner | 9339c40 | 2012-11-30 11:23:56 -0800 | [diff] [blame] | 787 | mWindowAnimationBackgroundSurface = new DimSurface(mService.mFxSession, |
| 788 | mService.getDisplayContentLocked(displayId)); |
Craig Mautner | ac439e5 | 2012-09-21 08:58:34 -0700 | [diff] [blame] | 789 | } |
Craig Mautner | a91f9e2 | 2012-09-14 16:22:08 -0700 | [diff] [blame] | 790 | } |
Craig Mautner | 764983d | 2012-03-22 11:37:36 -0700 | [diff] [blame] | 791 | } |