Wale Ogunwale | e05f501 | 2016-09-16 16:27:29 -0700 | [diff] [blame] | 1 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 2 | package com.android.server.wm; |
| 3 | |
Jorim Jaggi | 3878ca3 | 2017-02-02 17:13:05 -0800 | [diff] [blame] | 4 | import static android.app.ActivityManager.StackId.INVALID_STACK_ID; |
Jorim Jaggi | 3878ca3 | 2017-02-02 17:13:05 -0800 | [diff] [blame] | 5 | import static android.app.ActivityManagerInternal.APP_TRANSITION_SNAPSHOT; |
| 6 | import static android.app.ActivityManagerInternal.APP_TRANSITION_SPLASH_SCREEN; |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 7 | import static android.app.ActivityManagerInternal.APP_TRANSITION_WINDOWS_DRAWN; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 8 | import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_CONFIG; |
| 9 | import static android.view.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 10 | import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_CLOSE; |
| 11 | import static com.android.server.wm.AppTransition.TRANSIT_ACTIVITY_OPEN; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 12 | import static com.android.server.wm.AppTransition.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION; |
| 13 | import static com.android.server.wm.AppTransition.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE; |
| 14 | import static com.android.server.wm.AppTransition.TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER; |
| 15 | import static com.android.server.wm.AppTransition.TRANSIT_KEYGUARD_GOING_AWAY; |
| 16 | import static com.android.server.wm.AppTransition.TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; |
Matthew Ng | 26a1cec | 2017-05-18 14:42:51 -0700 | [diff] [blame] | 17 | import static com.android.server.wm.AppTransition.TRANSIT_NONE; |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 18 | import static com.android.server.wm.AppTransition.TRANSIT_TASK_CLOSE; |
| 19 | import static com.android.server.wm.AppTransition.TRANSIT_TASK_IN_PLACE; |
| 20 | import static com.android.server.wm.AppTransition.TRANSIT_TASK_OPEN; |
| 21 | import static com.android.server.wm.AppTransition.TRANSIT_TASK_TO_BACK; |
| 22 | import static com.android.server.wm.AppTransition.TRANSIT_TASK_TO_FRONT; |
| 23 | import static com.android.server.wm.AppTransition.TRANSIT_WALLPAPER_CLOSE; |
| 24 | import static com.android.server.wm.AppTransition.TRANSIT_WALLPAPER_INTRA_CLOSE; |
| 25 | import static com.android.server.wm.AppTransition.TRANSIT_WALLPAPER_INTRA_OPEN; |
| 26 | import static com.android.server.wm.AppTransition.TRANSIT_WALLPAPER_OPEN; |
Jorim Jaggi | a69243a | 2017-06-15 15:10:38 -0400 | [diff] [blame] | 27 | import static com.android.server.wm.AppTransition.isKeyguardGoingAwayTransit; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 28 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 29 | import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_APP_TRANSITIONS; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 30 | import static com.android.server.wm.WindowManagerDebugConfig.SHOW_LIGHT_TRANSACTIONS; |
| 31 | import static com.android.server.wm.WindowManagerDebugConfig.SHOW_TRANSACTIONS; |
Jorim Jaggi | 192086e | 2016-03-11 17:17:03 +0100 | [diff] [blame] | 32 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME; |
Filip Gruszczynski | 0bd180d | 2015-12-07 15:43:52 -0800 | [diff] [blame] | 33 | import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; |
Jorim Jaggi | 192086e | 2016-03-11 17:17:03 +0100 | [diff] [blame] | 34 | import static com.android.server.wm.WindowManagerService.H.NOTIFY_APP_TRANSITION_STARTING; |
Jorim Jaggi | 192086e | 2016-03-11 17:17:03 +0100 | [diff] [blame] | 35 | import static com.android.server.wm.WindowManagerService.H.REPORT_WINDOWS_CHANGE; |
Jorim Jaggi | 192086e | 2016-03-11 17:17:03 +0100 | [diff] [blame] | 36 | import static com.android.server.wm.WindowManagerService.LAYOUT_REPEAT_THRESHOLD; |
| 37 | import static com.android.server.wm.WindowManagerService.MAX_ANIMATION_DURATION; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 38 | import static com.android.server.wm.WindowManagerService.UPDATE_FOCUS_PLACING_SURFACES; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 39 | |
Andrii Kulian | 441e449 | 2016-09-29 15:25:00 -0700 | [diff] [blame] | 40 | import android.content.res.Configuration; |
Winson Chung | aa7fa01 | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 41 | import android.graphics.GraphicBuffer; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 42 | import android.graphics.PixelFormat; |
| 43 | import android.graphics.Rect; |
Bryce Lee | e6c25d4 | 2017-05-31 10:27:42 -0700 | [diff] [blame] | 44 | import android.os.Binder; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 45 | import android.os.Debug; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 46 | import android.os.Trace; |
Filip Gruszczynski | 49b80af | 2015-09-24 09:04:26 -0700 | [diff] [blame] | 47 | import android.util.ArraySet; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 48 | import android.util.Slog; |
Jorim Jaggi | 3878ca3 | 2017-02-02 17:13:05 -0800 | [diff] [blame] | 49 | import android.util.SparseIntArray; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 50 | import android.view.Display; |
| 51 | import android.view.DisplayInfo; |
| 52 | import android.view.Surface; |
| 53 | import android.view.SurfaceControl; |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 54 | import android.view.WindowManager.LayoutParams; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 55 | import android.view.animation.Animation; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 56 | |
Jorim Jaggi | d75962e | 2016-05-03 15:10:03 -0700 | [diff] [blame] | 57 | import com.android.server.wm.WindowManagerService.H; |
| 58 | |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 59 | import java.io.PrintWriter; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 60 | import java.util.ArrayList; |
| 61 | |
| 62 | /** |
| 63 | * Positions windows and their surfaces. |
| 64 | * |
| 65 | * It sets positions of windows by calculating their frames and then applies this by positioning |
| 66 | * surfaces according to these frames. Z layer is still assigned withing WindowManagerService. |
| 67 | */ |
| 68 | class WindowSurfacePlacer { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 69 | private static final String TAG = TAG_WITH_CLASS_NAME ? "WindowSurfacePlacer" : TAG_WM; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 70 | private final WindowManagerService mService; |
| 71 | private final WallpaperController mWallpaperControllerLocked; |
| 72 | |
| 73 | private boolean mInLayout = false; |
| 74 | |
| 75 | /** Only do a maximum of 6 repeated layouts. After that quit */ |
| 76 | private int mLayoutRepeatCount; |
| 77 | |
| 78 | static final int SET_UPDATE_ROTATION = 1 << 0; |
| 79 | static final int SET_WALLPAPER_MAY_CHANGE = 1 << 1; |
| 80 | static final int SET_FORCE_HIDING_CHANGED = 1 << 2; |
| 81 | static final int SET_ORIENTATION_CHANGE_COMPLETE = 1 << 3; |
| 82 | static final int SET_TURN_ON_SCREEN = 1 << 4; |
| 83 | static final int SET_WALLPAPER_ACTION_PENDING = 1 << 5; |
| 84 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 85 | private final Rect mTmpStartRect = new Rect(); |
Wale Ogunwale | b4ec0a3 | 2015-12-14 10:31:43 -0800 | [diff] [blame] | 86 | private final Rect mTmpContentRect = new Rect(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 87 | |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 88 | private boolean mTraversalScheduled; |
Jorim Jaggi | c402520 | 2015-10-22 16:43:34 +0200 | [diff] [blame] | 89 | private int mDeferDepth = 0; |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 90 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 91 | private static final class LayerAndToken { |
| 92 | public int layer; |
| 93 | public AppWindowToken token; |
| 94 | } |
| 95 | private final LayerAndToken mTmpLayerAndToken = new LayerAndToken(); |
| 96 | |
Jorim Jaggi | 3dac63a | 2016-03-01 12:37:07 +0100 | [diff] [blame] | 97 | private final ArrayList<SurfaceControl> mPendingDestroyingSurfaces = new ArrayList<>(); |
Jorim Jaggi | 3878ca3 | 2017-02-02 17:13:05 -0800 | [diff] [blame] | 98 | private final SparseIntArray mTempTransitionReasons = new SparseIntArray(); |
Jorim Jaggi | 3dac63a | 2016-03-01 12:37:07 +0100 | [diff] [blame] | 99 | |
Jorim Jaggi | ed7993b | 2017-03-28 18:50:01 +0100 | [diff] [blame] | 100 | private final Runnable mPerformSurfacePlacement; |
| 101 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 102 | public WindowSurfacePlacer(WindowManagerService service) { |
| 103 | mService = service; |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 104 | mWallpaperControllerLocked = mService.mRoot.mWallpaperController; |
Jorim Jaggi | ed7993b | 2017-03-28 18:50:01 +0100 | [diff] [blame] | 105 | mPerformSurfacePlacement = () -> { |
| 106 | synchronized (mService.mWindowMap) { |
| 107 | performSurfacePlacement(); |
| 108 | } |
| 109 | }; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 110 | } |
| 111 | |
Jorim Jaggi | c402520 | 2015-10-22 16:43:34 +0200 | [diff] [blame] | 112 | /** |
| 113 | * See {@link WindowManagerService#deferSurfaceLayout()} |
| 114 | */ |
| 115 | void deferLayout() { |
| 116 | mDeferDepth++; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * See {@link WindowManagerService#continueSurfaceLayout()} |
| 121 | */ |
| 122 | void continueLayout() { |
| 123 | mDeferDepth--; |
| 124 | if (mDeferDepth <= 0) { |
| 125 | performSurfacePlacement(); |
| 126 | } |
| 127 | } |
| 128 | |
Jorim Jaggi | 1f83308 | 2017-08-04 18:06:56 +0200 | [diff] [blame] | 129 | boolean isLayoutDeferred() { |
| 130 | return mDeferDepth > 0; |
| 131 | } |
| 132 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 133 | final void performSurfacePlacement() { |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 134 | performSurfacePlacement(false /* force */); |
| 135 | } |
| 136 | |
| 137 | final void performSurfacePlacement(boolean force) { |
| 138 | if (mDeferDepth > 0 && !force) { |
Jorim Jaggi | c402520 | 2015-10-22 16:43:34 +0200 | [diff] [blame] | 139 | return; |
| 140 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 141 | int loopCount = 6; |
| 142 | do { |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 143 | mTraversalScheduled = false; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 144 | performSurfacePlacementLoop(); |
Jorim Jaggi | ed7993b | 2017-03-28 18:50:01 +0100 | [diff] [blame] | 145 | mService.mAnimationHandler.removeCallbacks(mPerformSurfacePlacement); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 146 | loopCount--; |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 147 | } while (mTraversalScheduled && loopCount > 0); |
Wale Ogunwale | e05f501 | 2016-09-16 16:27:29 -0700 | [diff] [blame] | 148 | mService.mRoot.mWallpaperActionPending = false; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 149 | } |
| 150 | |
| 151 | private void performSurfacePlacementLoop() { |
| 152 | if (mInLayout) { |
| 153 | if (DEBUG) { |
| 154 | throw new RuntimeException("Recursive call!"); |
| 155 | } |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 156 | Slog.w(TAG, "performLayoutAndPlaceSurfacesLocked called while in layout. Callers=" |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 157 | + Debug.getCallers(3)); |
| 158 | return; |
| 159 | } |
| 160 | |
| 161 | if (mService.mWaitingForConfig) { |
| 162 | // Our configuration has changed (most likely rotation), but we |
| 163 | // don't yet have the complete configuration to report to |
| 164 | // applications. Don't do any window layout until we have it. |
| 165 | return; |
| 166 | } |
| 167 | |
| 168 | if (!mService.mDisplayReady) { |
| 169 | // Not yet initialized, nothing to do. |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "wmLayout"); |
| 174 | mInLayout = true; |
| 175 | |
| 176 | boolean recoveringMemory = false; |
| 177 | if (!mService.mForceRemoves.isEmpty()) { |
| 178 | recoveringMemory = true; |
| 179 | // Wait a little bit for things to settle down, and off we go. |
| 180 | while (!mService.mForceRemoves.isEmpty()) { |
Wale Ogunwale | adde52e | 2016-07-16 13:11:55 -0700 | [diff] [blame] | 181 | final WindowState ws = mService.mForceRemoves.remove(0); |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 182 | Slog.i(TAG, "Force removing: " + ws); |
Wale Ogunwale | 571771c | 2016-08-26 13:18:50 -0700 | [diff] [blame] | 183 | ws.removeImmediately(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 184 | } |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 185 | Slog.w(TAG, "Due to memory failure, waiting a bit for next layout"); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 186 | Object tmp = new Object(); |
| 187 | synchronized (tmp) { |
| 188 | try { |
| 189 | tmp.wait(250); |
| 190 | } catch (InterruptedException e) { |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | try { |
Wale Ogunwale | e05f501 | 2016-09-16 16:27:29 -0700 | [diff] [blame] | 196 | mService.mRoot.performSurfacePlacement(recoveringMemory); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 197 | |
| 198 | mInLayout = false; |
| 199 | |
Wale Ogunwale | 2b06bfc | 2016-09-28 14:17:05 -0700 | [diff] [blame] | 200 | if (mService.mRoot.isLayoutNeeded()) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 201 | if (++mLayoutRepeatCount < 6) { |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 202 | requestTraversal(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 203 | } else { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 204 | Slog.e(TAG, "Performed 6 layouts in a row. Skipping"); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 205 | mLayoutRepeatCount = 0; |
| 206 | } |
| 207 | } else { |
| 208 | mLayoutRepeatCount = 0; |
| 209 | } |
| 210 | |
| 211 | if (mService.mWindowsChanged && !mService.mWindowChangeListeners.isEmpty()) { |
| 212 | mService.mH.removeMessages(REPORT_WINDOWS_CHANGE); |
| 213 | mService.mH.sendEmptyMessage(REPORT_WINDOWS_CHANGE); |
| 214 | } |
| 215 | } catch (RuntimeException e) { |
| 216 | mInLayout = false; |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 217 | Slog.wtf(TAG, "Unhandled exception while laying out windows", e); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); |
| 221 | } |
| 222 | |
| 223 | void debugLayoutRepeats(final String msg, int pendingLayoutChanges) { |
| 224 | if (mLayoutRepeatCount >= LAYOUT_REPEAT_THRESHOLD) { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 225 | Slog.v(TAG, "Layouts looping: " + msg + |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 226 | ", mPendingLayoutChanges = 0x" + Integer.toHexString(pendingLayoutChanges)); |
| 227 | } |
| 228 | } |
| 229 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 230 | boolean isInLayout() { |
| 231 | return mInLayout; |
| 232 | } |
| 233 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 234 | /** |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 235 | * @return bitmap indicating if another pass through layout must be made. |
| 236 | */ |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 237 | int handleAppTransitionReadyLocked() { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 238 | int appsCount = mService.mOpeningApps.size(); |
Jorim Jaggi | dbaad38 | 2017-07-18 13:22:52 +0200 | [diff] [blame] | 239 | if (!transitionGoodToGo(appsCount, mTempTransitionReasons)) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 240 | return 0; |
| 241 | } |
Chong Zhang | 8784be6 | 2016-06-28 15:25:07 -0700 | [diff] [blame] | 242 | Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "AppTransitionReady"); |
| 243 | |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 244 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "**** GOOD TO GO"); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 245 | int transit = mService.mAppTransition.getAppTransition(); |
Jorim Jaggi | a69243a | 2017-06-15 15:10:38 -0400 | [diff] [blame] | 246 | if (mService.mSkipAppTransitionAnimation && !isKeyguardGoingAwayTransit(transit)) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 247 | transit = AppTransition.TRANSIT_UNSET; |
| 248 | } |
| 249 | mService.mSkipAppTransitionAnimation = false; |
| 250 | mService.mNoAnimationNotifyOnTransitionFinished.clear(); |
| 251 | |
Jorim Jaggi | d75962e | 2016-05-03 15:10:03 -0700 | [diff] [blame] | 252 | mService.mH.removeMessages(H.APP_TRANSITION_TIMEOUT); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 253 | |
Wale Ogunwale | 9adfe57 | 2016-09-08 20:43:58 -0700 | [diff] [blame] | 254 | final DisplayContent displayContent = mService.getDefaultDisplayContentLocked(); |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 255 | // TODO: Don't believe this is really needed... |
| 256 | //mService.mWindowsChanged = true; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 257 | |
Wale Ogunwale | e05f501 | 2016-09-16 16:27:29 -0700 | [diff] [blame] | 258 | mService.mRoot.mWallpaperMayChange = false; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 259 | |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 260 | // The top-most window will supply the layout params, and we will determine it below. |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 261 | LayoutParams animLp = null; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 262 | int bestAnimLayer = -1; |
| 263 | boolean fullscreenAnim = false; |
| 264 | boolean voiceInteraction = false; |
| 265 | |
Chong Zhang | ec8299c | 2016-07-29 13:09:40 -0700 | [diff] [blame] | 266 | int i; |
| 267 | for (i = 0; i < appsCount; i++) { |
| 268 | final AppWindowToken wtoken = mService.mOpeningApps.valueAt(i); |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 269 | // Clearing the mAnimatingExit flag before entering animation. It's set to true if app |
| 270 | // window is removed, or window relayout to invisible. This also affects window |
| 271 | // visibility. We need to clear it *before* maybeUpdateTransitToWallpaper() as the |
| 272 | // transition selection depends on wallpaper target visibility. |
Chong Zhang | ec8299c | 2016-07-29 13:09:40 -0700 | [diff] [blame] | 273 | wtoken.clearAnimatingFlags(); |
| 274 | |
| 275 | } |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 276 | |
Chong Zhang | ec8299c | 2016-07-29 13:09:40 -0700 | [diff] [blame] | 277 | // Adjust wallpaper before we pull the lower/upper target, since pending changes |
| 278 | // (like the clearAnimatingFlags() above) might affect wallpaper target result. |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 279 | // Or, the opening app window should be a wallpaper target. |
| 280 | mWallpaperControllerLocked.adjustWallpaperWindowsForAppTransitionIfNeeded(displayContent, |
Wale Ogunwale | 0303c57 | 2016-10-20 10:16:29 -0700 | [diff] [blame] | 281 | mService.mOpeningApps); |
Chong Zhang | ec8299c | 2016-07-29 13:09:40 -0700 | [diff] [blame] | 282 | |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 283 | final WindowState wallpaperTarget = mWallpaperControllerLocked.getWallpaperTarget(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 284 | boolean openingAppHasWallpaper = false; |
| 285 | boolean closingAppHasWallpaper = false; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 286 | |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 287 | // Do a first pass through the tokens for two things: |
| 288 | // (1) Determine if both the closing and opening app token sets are wallpaper targets, in |
| 289 | // which case special animations are needed (since the wallpaper needs to stay static behind |
| 290 | // them). |
| 291 | // (2) Find the layout params of the top-most application window in the tokens, which is |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 292 | // what will control the animation theme. |
| 293 | final int closingAppsCount = mService.mClosingApps.size(); |
| 294 | appsCount = closingAppsCount + mService.mOpeningApps.size(); |
| 295 | for (i = 0; i < appsCount; i++) { |
| 296 | final AppWindowToken wtoken; |
| 297 | if (i < closingAppsCount) { |
| 298 | wtoken = mService.mClosingApps.valueAt(i); |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 299 | if (wallpaperTarget != null && wtoken.windowsCanBeWallpaperTarget()) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 300 | closingAppHasWallpaper = true; |
| 301 | } |
| 302 | } else { |
| 303 | wtoken = mService.mOpeningApps.valueAt(i - closingAppsCount); |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 304 | if (wallpaperTarget != null && wtoken.windowsCanBeWallpaperTarget()) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 305 | openingAppHasWallpaper = true; |
| 306 | } |
| 307 | } |
| 308 | |
Wale Ogunwale | 72919d2 | 2016-12-08 18:58:50 -0800 | [diff] [blame] | 309 | voiceInteraction |= wtoken.mVoiceInteraction; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 310 | |
Wale Ogunwale | 5136249 | 2016-09-08 17:49:17 -0700 | [diff] [blame] | 311 | if (wtoken.fillsParent()) { |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 312 | final WindowState ws = wtoken.findMainWindow(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 313 | if (ws != null) { |
| 314 | animLp = ws.mAttrs; |
| 315 | bestAnimLayer = ws.mLayer; |
| 316 | fullscreenAnim = true; |
| 317 | } |
| 318 | } else if (!fullscreenAnim) { |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 319 | final WindowState ws = wtoken.findMainWindow(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 320 | if (ws != null) { |
| 321 | if (ws.mLayer > bestAnimLayer) { |
| 322 | animLp = ws.mAttrs; |
| 323 | bestAnimLayer = ws.mLayer; |
| 324 | } |
| 325 | } |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | transit = maybeUpdateTransitToWallpaper(transit, openingAppHasWallpaper, |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 330 | closingAppHasWallpaper); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 331 | |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 332 | // If all closing windows are obscured, then there is no need to do an animation. This is |
| 333 | // the case, for example, when this transition is being done behind the lock screen. |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 334 | if (!mService.mPolicy.allowAppAnimationsLw()) { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 335 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 336 | "Animations disallowed by keyguard or dream."); |
| 337 | animLp = null; |
| 338 | } |
| 339 | |
| 340 | processApplicationsAnimatingInPlace(transit); |
| 341 | |
Jorim Jaggi | 42625d1b | 2016-02-11 20:11:07 -0800 | [diff] [blame] | 342 | mTmpLayerAndToken.token = null; |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 343 | handleClosingApps(transit, animLp, voiceInteraction, mTmpLayerAndToken); |
| 344 | final AppWindowToken topClosingApp = mTmpLayerAndToken.token; |
| 345 | final int topClosingLayer = mTmpLayerAndToken.layer; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 346 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 347 | final AppWindowToken topOpeningApp = handleOpeningApps(transit, |
| 348 | animLp, voiceInteraction, topClosingLayer); |
| 349 | |
Chong Zhang | 1c93f6d | 2016-07-27 17:52:45 -0700 | [diff] [blame] | 350 | mService.mAppTransition.setLastAppTransition(transit, topOpeningApp, topClosingApp); |
| 351 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 352 | final AppWindowAnimator openingAppAnimator = (topOpeningApp == null) ? null : |
| 353 | topOpeningApp.mAppAnimator; |
| 354 | final AppWindowAnimator closingAppAnimator = (topClosingApp == null) ? null : |
| 355 | topClosingApp.mAppAnimator; |
| 356 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 357 | final int flags = mService.mAppTransition.getTransitFlags(); |
| 358 | int layoutRedo = mService.mAppTransition.goodToGo(transit, openingAppAnimator, |
| 359 | closingAppAnimator, mService.mOpeningApps, mService.mClosingApps); |
| 360 | handleNonAppWindowsInTransition(transit, flags); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 361 | mService.mAppTransition.postAnimationCallback(); |
| 362 | mService.mAppTransition.clear(); |
| 363 | |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 364 | mService.mTaskSnapshotController.onTransitionStarting(); |
| 365 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 366 | mService.mOpeningApps.clear(); |
| 367 | mService.mClosingApps.clear(); |
Jorim Jaggi | 5a108c2 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 368 | mService.mUnknownAppVisibilityController.clear(); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 369 | |
| 370 | // This has changed the visibility of windows, so perform |
| 371 | // a new layout to get them all up-to-date. |
Wale Ogunwale | 2b06bfc | 2016-09-28 14:17:05 -0700 | [diff] [blame] | 372 | displayContent.setLayoutNeeded(); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 373 | |
| 374 | // TODO(multidisplay): IMEs are only supported on the default display. |
Wale Ogunwale | ae9adbf | 2016-10-18 15:17:06 -0700 | [diff] [blame] | 375 | final DisplayContent dc = mService.getDefaultDisplayContentLocked(); |
Wale Ogunwale | 6213caa | 2016-12-02 16:47:15 +0000 | [diff] [blame] | 376 | dc.computeImeTarget(true /* updateImeTarget */); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 377 | mService.updateFocusedWindowLocked(UPDATE_FOCUS_PLACING_SURFACES, |
| 378 | true /*updateInputWindows*/); |
| 379 | mService.mFocusMayChange = false; |
Chong Zhang | 8784be6 | 2016-06-28 15:25:07 -0700 | [diff] [blame] | 380 | |
Jorim Jaggi | dbaad38 | 2017-07-18 13:22:52 +0200 | [diff] [blame] | 381 | mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING, |
| 382 | mTempTransitionReasons.clone()).sendToTarget(); |
| 383 | |
Chong Zhang | 8784be6 | 2016-06-28 15:25:07 -0700 | [diff] [blame] | 384 | Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); |
| 385 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 386 | return layoutRedo | FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG; |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 387 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 388 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 389 | private AppWindowToken handleOpeningApps(int transit, LayoutParams animLp, |
| 390 | boolean voiceInteraction, int topClosingLayer) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 391 | AppWindowToken topOpeningApp = null; |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 392 | final int appsCount = mService.mOpeningApps.size(); |
| 393 | for (int i = 0; i < appsCount; i++) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 394 | AppWindowToken wtoken = mService.mOpeningApps.valueAt(i); |
| 395 | final AppWindowAnimator appAnimator = wtoken.mAppAnimator; |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 396 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now opening app" + wtoken); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 397 | |
| 398 | if (!appAnimator.usingTransferredAnimation) { |
| 399 | appAnimator.clearThumbnail(); |
Chong Zhang | 65d15d0 | 2016-03-14 13:59:32 -0700 | [diff] [blame] | 400 | appAnimator.setNullAnimation(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 401 | } |
Chong Zhang | eb22e8e | 2016-01-20 19:52:22 -0800 | [diff] [blame] | 402 | |
Wale Ogunwale | 9f25bee | 2016-08-02 07:23:47 -0700 | [diff] [blame] | 403 | if (!wtoken.setVisibility(animLp, true, transit, false, voiceInteraction)){ |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 404 | // This token isn't going to be animating. Add it to the list of tokens to |
| 405 | // be notified of app transition complete since the notification will not be |
| 406 | // sent be the app window animator. |
| 407 | mService.mNoAnimationNotifyOnTransitionFinished.add(wtoken.token); |
| 408 | } |
| 409 | wtoken.updateReportedVisibilityLocked(); |
| 410 | wtoken.waitingToShow = false; |
Wale Ogunwale | 9f25bee | 2016-08-02 07:23:47 -0700 | [diff] [blame] | 411 | wtoken.setAllAppWinAnimators(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 412 | |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 413 | if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, |
Filip Gruszczynski | 974eb3d | 2015-10-23 17:33:11 -0700 | [diff] [blame] | 414 | ">>> OPEN TRANSACTION handleAppTransitionReadyLocked()"); |
Robert Carr | 68e5c9e | 2016-09-14 10:50:09 -0700 | [diff] [blame] | 415 | mService.openSurfaceTransaction(); |
Filip Gruszczynski | 974eb3d | 2015-10-23 17:33:11 -0700 | [diff] [blame] | 416 | try { |
Wale Ogunwale | 69cf50f | 2015-11-13 11:08:36 -0800 | [diff] [blame] | 417 | mService.mAnimator.orAnimating(appAnimator.showAllWindowsLocked()); |
Filip Gruszczynski | 974eb3d | 2015-10-23 17:33:11 -0700 | [diff] [blame] | 418 | } finally { |
Robert Carr | 68e5c9e | 2016-09-14 10:50:09 -0700 | [diff] [blame] | 419 | mService.closeSurfaceTransaction(); |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 420 | if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, |
Filip Gruszczynski | 974eb3d | 2015-10-23 17:33:11 -0700 | [diff] [blame] | 421 | "<<< CLOSE TRANSACTION handleAppTransitionReadyLocked()"); |
| 422 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 423 | mService.mAnimator.mAppWindowAnimating |= appAnimator.isAnimating(); |
| 424 | |
| 425 | int topOpeningLayer = 0; |
| 426 | if (animLp != null) { |
Wale Ogunwale | 9f25bee | 2016-08-02 07:23:47 -0700 | [diff] [blame] | 427 | final int layer = wtoken.getHighestAnimLayer(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 428 | if (topOpeningApp == null || layer > topOpeningLayer) { |
| 429 | topOpeningApp = wtoken; |
| 430 | topOpeningLayer = layer; |
| 431 | } |
| 432 | } |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 433 | if (mService.mAppTransition.isNextAppTransitionThumbnailUp()) { |
| 434 | createThumbnailAppAnimator(transit, wtoken, topOpeningLayer, topClosingLayer); |
| 435 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 436 | } |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 437 | return topOpeningApp; |
| 438 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 439 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 440 | private void handleClosingApps(int transit, LayoutParams animLp, boolean voiceInteraction, |
| 441 | LayerAndToken layerAndToken) { |
| 442 | final int appsCount; |
| 443 | appsCount = mService.mClosingApps.size(); |
| 444 | for (int i = 0; i < appsCount; i++) { |
| 445 | AppWindowToken wtoken = mService.mClosingApps.valueAt(i); |
Chong Zhang | f58631a | 2016-05-24 16:02:10 -0700 | [diff] [blame] | 446 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 447 | final AppWindowAnimator appAnimator = wtoken.mAppAnimator; |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 448 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now closing app " + wtoken); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 449 | appAnimator.clearThumbnail(); |
Chong Zhang | 65d15d0 | 2016-03-14 13:59:32 -0700 | [diff] [blame] | 450 | appAnimator.setNullAnimation(); |
Winson Chung | 87e5d55 | 2017-04-05 11:49:38 -0700 | [diff] [blame] | 451 | // TODO: Do we need to add to mNoAnimationNotifyOnTransitionFinished like above if not |
| 452 | // animating? |
Wale Ogunwale | 9f25bee | 2016-08-02 07:23:47 -0700 | [diff] [blame] | 453 | wtoken.setVisibility(animLp, false, transit, false, voiceInteraction); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 454 | wtoken.updateReportedVisibilityLocked(); |
| 455 | // Force the allDrawn flag, because we want to start |
| 456 | // this guy's animations regardless of whether it's |
| 457 | // gotten drawn. |
| 458 | wtoken.allDrawn = true; |
| 459 | wtoken.deferClearAllDrawn = false; |
| 460 | // Ensure that apps that are mid-starting are also scheduled to have their |
| 461 | // starting windows removed after the animation is complete |
Jorim Jaggi | ba41f4b | 2016-12-14 17:43:07 -0800 | [diff] [blame] | 462 | if (wtoken.startingWindow != null && !wtoken.startingWindow.mAnimatingExit |
| 463 | && wtoken.getController() != null) { |
| 464 | wtoken.getController().removeStartingWindow(); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 465 | } |
| 466 | mService.mAnimator.mAppWindowAnimating |= appAnimator.isAnimating(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 467 | |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 468 | if (animLp != null) { |
Wale Ogunwale | e4da0c1 | 2016-07-29 12:47:02 -0700 | [diff] [blame] | 469 | int layer = wtoken.getHighestAnimLayer(); |
Filip Gruszczynski | 4cbc315 | 2015-12-07 11:50:57 -0800 | [diff] [blame] | 470 | if (layerAndToken.token == null || layer > layerAndToken.layer) { |
| 471 | layerAndToken.token = wtoken; |
| 472 | layerAndToken.layer = layer; |
| 473 | } |
| 474 | } |
| 475 | if (mService.mAppTransition.isNextAppTransitionThumbnailDown()) { |
| 476 | createThumbnailAppAnimator(transit, wtoken, 0, layerAndToken.layer); |
| 477 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 478 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 479 | } |
| 480 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 481 | private void handleNonAppWindowsInTransition(int transit, int flags) { |
| 482 | if (transit == TRANSIT_KEYGUARD_GOING_AWAY) { |
| 483 | if ((flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_WITH_WALLPAPER) != 0 |
| 484 | && (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_NO_ANIMATION) == 0) { |
| 485 | Animation anim = mService.mPolicy.createKeyguardWallpaperExit( |
| 486 | (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0); |
| 487 | if (anim != null) { |
| 488 | mService.getDefaultDisplayContentLocked().mWallpaperController |
| 489 | .startWallpaperAnimation(anim); |
| 490 | } |
| 491 | } |
| 492 | } |
| 493 | if (transit == TRANSIT_KEYGUARD_GOING_AWAY |
| 494 | || transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER) { |
| 495 | mService.getDefaultDisplayContentLocked().startKeyguardExitOnNonAppWindows( |
| 496 | transit == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER, |
| 497 | (flags & TRANSIT_FLAG_KEYGUARD_GOING_AWAY_TO_SHADE) != 0); |
| 498 | } |
| 499 | } |
| 500 | |
Jorim Jaggi | dbaad38 | 2017-07-18 13:22:52 +0200 | [diff] [blame] | 501 | private boolean transitionGoodToGo(int appsCount, SparseIntArray outReasons) { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 502 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 503 | "Checking " + appsCount + " opening apps (frozen=" |
| 504 | + mService.mDisplayFrozen + " timeout=" |
| 505 | + mService.mAppTransition.isTimeout() + ")..."); |
Robert Carr | 42769ff | 2016-09-20 13:36:42 -0700 | [diff] [blame] | 506 | final ScreenRotationAnimation screenRotationAnimation = |
| 507 | mService.mAnimator.getScreenRotationAnimationLocked( |
| 508 | Display.DEFAULT_DISPLAY); |
| 509 | |
Jorim Jaggi | dbaad38 | 2017-07-18 13:22:52 +0200 | [diff] [blame] | 510 | outReasons.clear(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 511 | if (!mService.mAppTransition.isTimeout()) { |
Robert Carr | 42769ff | 2016-09-20 13:36:42 -0700 | [diff] [blame] | 512 | // Imagine the case where we are changing orientation due to an app transition, but a previous |
| 513 | // orientation change is still in progress. We won't process the orientation change |
| 514 | // for our transition because we need to wait for the rotation animation to finish. |
| 515 | // If we start the app transition at this point, we will interrupt it halfway with a new rotation |
| 516 | // animation after the old one finally finishes. It's better to defer the |
| 517 | // app transition. |
| 518 | if (screenRotationAnimation != null && screenRotationAnimation.isAnimating() && |
| 519 | mService.rotationNeedsUpdateLocked()) { |
| 520 | if (DEBUG_APP_TRANSITIONS) { |
| 521 | Slog.v(TAG, "Delaying app transition for screen rotation animation to finish"); |
| 522 | } |
| 523 | return false; |
| 524 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 525 | for (int i = 0; i < appsCount; i++) { |
| 526 | AppWindowToken wtoken = mService.mOpeningApps.valueAt(i); |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 527 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 528 | "Check opening app=" + wtoken + ": allDrawn=" |
| 529 | + wtoken.allDrawn + " startingDisplayed=" |
| 530 | + wtoken.startingDisplayed + " startingMoved=" |
Chong Zhang | d78ddb4 | 2016-03-02 17:01:14 -0800 | [diff] [blame] | 531 | + wtoken.startingMoved + " isRelaunching()=" |
| 532 | + wtoken.isRelaunching()); |
| 533 | |
Chong Zhang | bfc2f8f | 2016-01-29 15:50:34 -0800 | [diff] [blame] | 534 | |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 535 | final boolean allDrawn = wtoken.allDrawn && !wtoken.isRelaunching(); |
| 536 | if (!allDrawn && !wtoken.startingDisplayed && !wtoken.startingMoved) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 537 | return false; |
| 538 | } |
Jorim Jaggi | 3878ca3 | 2017-02-02 17:13:05 -0800 | [diff] [blame] | 539 | final TaskStack stack = wtoken.getStack(); |
| 540 | final int stackId = stack != null ? stack.mStackId : INVALID_STACK_ID; |
Jorim Jaggi | 02886a8 | 2016-12-06 09:10:06 -0800 | [diff] [blame] | 541 | if (allDrawn) { |
Jorim Jaggi | e7d2b85 | 2017-08-28 17:55:15 +0200 | [diff] [blame^] | 542 | outReasons.put(stackId, APP_TRANSITION_WINDOWS_DRAWN); |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 543 | } else { |
Jorim Jaggi | dbaad38 | 2017-07-18 13:22:52 +0200 | [diff] [blame] | 544 | outReasons.put(stackId, wtoken.startingData instanceof SplashScreenStartingData |
Jorim Jaggi | 3878ca3 | 2017-02-02 17:13:05 -0800 | [diff] [blame] | 545 | ? APP_TRANSITION_SPLASH_SCREEN |
| 546 | : APP_TRANSITION_SNAPSHOT); |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 547 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 548 | } |
| 549 | |
Jorim Jaggi | 2f7d292 | 2015-10-29 13:08:29 +0100 | [diff] [blame] | 550 | // We also need to wait for the specs to be fetched, if needed. |
| 551 | if (mService.mAppTransition.isFetchingAppTransitionsSpecs()) { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 552 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "isFetchingAppTransitionSpecs=true"); |
Jorim Jaggi | 2f7d292 | 2015-10-29 13:08:29 +0100 | [diff] [blame] | 553 | return false; |
| 554 | } |
| 555 | |
Jorim Jaggi | 5a108c2 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 556 | if (!mService.mUnknownAppVisibilityController.allResolved()) { |
| 557 | if (DEBUG_APP_TRANSITIONS) { |
| 558 | Slog.v(TAG, "unknownApps is not empty: " |
| 559 | + mService.mUnknownAppVisibilityController.getDebugMessage()); |
| 560 | } |
| 561 | return false; |
| 562 | } |
| 563 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 564 | // If the wallpaper is visible, we need to check it's ready too. |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 565 | boolean wallpaperReady = !mWallpaperControllerLocked.isWallpaperVisible() || |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 566 | mWallpaperControllerLocked.wallpaperTransitionReady(); |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 567 | if (wallpaperReady) { |
Jorim Jaggi | 275561a | 2016-02-23 10:11:02 -0500 | [diff] [blame] | 568 | return true; |
| 569 | } |
| 570 | return false; |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 571 | } |
| 572 | return true; |
| 573 | } |
| 574 | |
| 575 | private int maybeUpdateTransitToWallpaper(int transit, boolean openingAppHasWallpaper, |
Wale Ogunwale | f4ebe2e | 2016-11-09 13:24:43 -0800 | [diff] [blame] | 576 | boolean closingAppHasWallpaper) { |
Matthew Ng | 26a1cec | 2017-05-18 14:42:51 -0700 | [diff] [blame] | 577 | // Given no app transition pass it through instead of a wallpaper transition |
| 578 | if (transit == TRANSIT_NONE) { |
| 579 | return TRANSIT_NONE; |
| 580 | } |
| 581 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 582 | // if wallpaper is animating in or out set oldWallpaper to null else to wallpaper |
| 583 | final WindowState wallpaperTarget = mWallpaperControllerLocked.getWallpaperTarget(); |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 584 | final WindowState oldWallpaper = mWallpaperControllerLocked.isWallpaperTargetAnimating() |
| 585 | ? null : wallpaperTarget; |
Filip Gruszczynski | 49b80af | 2015-09-24 09:04:26 -0700 | [diff] [blame] | 586 | final ArraySet<AppWindowToken> openingApps = mService.mOpeningApps; |
| 587 | final ArraySet<AppWindowToken> closingApps = mService.mClosingApps; |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 588 | boolean openingCanBeWallpaperTarget = canBeWallpaperTarget(openingApps); |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 589 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 590 | "New wallpaper target=" + wallpaperTarget |
| 591 | + ", oldWallpaper=" + oldWallpaper |
Filip Gruszczynski | 49b80af | 2015-09-24 09:04:26 -0700 | [diff] [blame] | 592 | + ", openingApps=" + openingApps |
| 593 | + ", closingApps=" + closingApps); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 594 | mService.mAnimateWallpaperWithTarget = false; |
Jorim Jaggi | a69243a | 2017-06-15 15:10:38 -0400 | [diff] [blame] | 595 | if (openingCanBeWallpaperTarget && transit == TRANSIT_KEYGUARD_GOING_AWAY) { |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 596 | transit = TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER; |
| 597 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, |
| 598 | "New transit: " + AppTransition.appTransitionToString(transit)); |
Jorim Jaggi | a69243a | 2017-06-15 15:10:38 -0400 | [diff] [blame] | 599 | } |
| 600 | // We never want to change from a Keyguard transit to a non-Keyguard transit, as our logic |
| 601 | // relies on the fact that we always execute a Keyguard transition after preparing one. |
| 602 | else if (!isKeyguardGoingAwayTransit(transit)) { |
| 603 | if (closingAppHasWallpaper && openingAppHasWallpaper) { |
| 604 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Wallpaper animation!"); |
| 605 | switch (transit) { |
| 606 | case TRANSIT_ACTIVITY_OPEN: |
| 607 | case TRANSIT_TASK_OPEN: |
| 608 | case TRANSIT_TASK_TO_FRONT: |
| 609 | transit = TRANSIT_WALLPAPER_INTRA_OPEN; |
| 610 | break; |
| 611 | case TRANSIT_ACTIVITY_CLOSE: |
| 612 | case TRANSIT_TASK_CLOSE: |
| 613 | case TRANSIT_TASK_TO_BACK: |
| 614 | transit = TRANSIT_WALLPAPER_INTRA_CLOSE; |
| 615 | break; |
| 616 | } |
| 617 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, |
| 618 | "New transit: " + AppTransition.appTransitionToString(transit)); |
| 619 | } else if (oldWallpaper != null && !mService.mOpeningApps.isEmpty() |
| 620 | && !openingApps.contains(oldWallpaper.mAppToken) |
| 621 | && closingApps.contains(oldWallpaper.mAppToken)) { |
| 622 | // We are transitioning from an activity with a wallpaper to one without. |
| 623 | transit = TRANSIT_WALLPAPER_CLOSE; |
| 624 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "New transit away from wallpaper: " |
| 625 | + AppTransition.appTransitionToString(transit)); |
| 626 | } else if (wallpaperTarget != null && wallpaperTarget.isVisibleLw() && |
| 627 | openingApps.contains(wallpaperTarget.mAppToken)) { |
| 628 | // We are transitioning from an activity without |
| 629 | // a wallpaper to now showing the wallpaper |
| 630 | transit = TRANSIT_WALLPAPER_OPEN; |
| 631 | if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "New transit into wallpaper: " |
| 632 | + AppTransition.appTransitionToString(transit)); |
| 633 | } else { |
| 634 | mService.mAnimateWallpaperWithTarget = true; |
| 635 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 636 | } |
| 637 | return transit; |
| 638 | } |
| 639 | |
Jorim Jaggi | fe76234 | 2016-10-13 14:33:27 +0200 | [diff] [blame] | 640 | private boolean canBeWallpaperTarget(ArraySet<AppWindowToken> apps) { |
| 641 | for (int i = apps.size() - 1; i >= 0; i--) { |
| 642 | if (apps.valueAt(i).windowsCanBeWallpaperTarget()) { |
| 643 | return true; |
| 644 | } |
| 645 | } |
| 646 | return false; |
| 647 | } |
| 648 | |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 649 | private void processApplicationsAnimatingInPlace(int transit) { |
Wale Ogunwale | 0c4a40ef | 2016-10-07 07:06:40 -0700 | [diff] [blame] | 650 | if (transit == TRANSIT_TASK_IN_PLACE) { |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 651 | // Find the focused window |
Wale Ogunwale | 63d4ecc | 2016-09-08 18:48:26 -0700 | [diff] [blame] | 652 | final WindowState win = mService.getDefaultDisplayContentLocked().findFocusedWindow(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 653 | if (win != null) { |
| 654 | final AppWindowToken wtoken = win.mAppToken; |
| 655 | final AppWindowAnimator appAnimator = wtoken.mAppAnimator; |
| 656 | if (DEBUG_APP_TRANSITIONS) |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 657 | Slog.v(TAG, "Now animating app in place " + wtoken); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 658 | appAnimator.clearThumbnail(); |
Chong Zhang | 65d15d0 | 2016-03-14 13:59:32 -0700 | [diff] [blame] | 659 | appAnimator.setNullAnimation(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 660 | mService.updateTokenInPlaceLocked(wtoken, transit); |
| 661 | wtoken.updateReportedVisibilityLocked(); |
Wale Ogunwale | 9f25bee | 2016-08-02 07:23:47 -0700 | [diff] [blame] | 662 | wtoken.setAllAppWinAnimators(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 663 | mService.mAnimator.mAppWindowAnimating |= appAnimator.isAnimating(); |
Wale Ogunwale | 69cf50f | 2015-11-13 11:08:36 -0800 | [diff] [blame] | 664 | mService.mAnimator.orAnimating(appAnimator.showAllWindowsLocked()); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 665 | } |
| 666 | } |
| 667 | } |
| 668 | |
| 669 | private void createThumbnailAppAnimator(int transit, AppWindowToken appToken, |
| 670 | int openingLayer, int closingLayer) { |
| 671 | AppWindowAnimator openingAppAnimator = (appToken == null) ? null : appToken.mAppAnimator; |
| 672 | if (openingAppAnimator == null || openingAppAnimator.animation == null) { |
| 673 | return; |
| 674 | } |
Bryce Lee | 6d41026 | 2017-02-28 15:30:17 -0800 | [diff] [blame] | 675 | final int taskId = appToken.getTask().mTaskId; |
Winson Chung | aa7fa01 | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 676 | final GraphicBuffer thumbnailHeader = |
| 677 | mService.mAppTransition.getAppTransitionThumbnailHeader(taskId); |
| 678 | if (thumbnailHeader == null) { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 679 | if (DEBUG_APP_TRANSITIONS) Slog.d(TAG, "No thumbnail header bitmap for: " + taskId); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 680 | return; |
| 681 | } |
| 682 | // This thumbnail animation is very special, we need to have |
| 683 | // an extra surface with the thumbnail included with the animation. |
| 684 | Rect dirty = new Rect(0, 0, thumbnailHeader.getWidth(), thumbnailHeader.getHeight()); |
| 685 | try { |
| 686 | // TODO(multi-display): support other displays |
| 687 | final DisplayContent displayContent = mService.getDefaultDisplayContentLocked(); |
| 688 | final Display display = displayContent.getDisplay(); |
| 689 | final DisplayInfo displayInfo = displayContent.getDisplayInfo(); |
| 690 | |
| 691 | // Create a new surface for the thumbnail |
Albert Chaulk | e4338f8 | 2017-04-19 15:54:08 -0400 | [diff] [blame] | 692 | WindowState window = appToken.findMainWindow(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 693 | SurfaceControl surfaceControl = new SurfaceControl(mService.mFxSession, |
| 694 | "thumbnail anim", dirty.width(), dirty.height(), |
Albert Chaulk | e4338f8 | 2017-04-19 15:54:08 -0400 | [diff] [blame] | 695 | PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN, |
Bryce Lee | e6c25d4 | 2017-05-31 10:27:42 -0700 | [diff] [blame] | 696 | appToken.windowType, |
| 697 | window != null ? window.mOwnerUid : Binder.getCallingUid()); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 698 | surfaceControl.setLayerStack(display.getLayerStack()); |
| 699 | if (SHOW_TRANSACTIONS) { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 700 | Slog.i(TAG, " THUMBNAIL " + surfaceControl + ": CREATE"); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 701 | } |
| 702 | |
Winson Chung | aa7fa01 | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 703 | // Transfer the thumbnail to the surface |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 704 | Surface drawSurface = new Surface(); |
| 705 | drawSurface.copyFrom(surfaceControl); |
Winson Chung | aa7fa01 | 2017-05-24 15:50:06 -0700 | [diff] [blame] | 706 | drawSurface.attachAndQueueBuffer(thumbnailHeader); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 707 | drawSurface.release(); |
| 708 | |
| 709 | // Get the thumbnail animation |
| 710 | Animation anim; |
| 711 | if (mService.mAppTransition.isNextThumbnailTransitionAspectScaled()) { |
| 712 | // If this is a multi-window scenario, we use the windows frame as |
| 713 | // destination of the thumbnail header animation. If this is a full screen |
| 714 | // window scenario, we use the whole display as the target. |
| 715 | WindowState win = appToken.findMainWindow(); |
| 716 | Rect appRect = win != null ? win.getContentFrameLw() : |
| 717 | new Rect(0, 0, displayInfo.appWidth, displayInfo.appHeight); |
Jorim Jaggi | de63d44 | 2016-03-14 14:56:56 +0100 | [diff] [blame] | 718 | Rect insets = win != null ? win.mContentInsets : null; |
Andrii Kulian | 441e449 | 2016-09-29 15:25:00 -0700 | [diff] [blame] | 719 | final Configuration displayConfig = displayContent.getConfiguration(); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 720 | // For the new aspect-scaled transition, we want it to always show |
| 721 | // above the animating opening/closing window, and we want to |
| 722 | // synchronize its thumbnail surface with the surface for the |
| 723 | // open/close animation (only on the way down) |
| 724 | anim = mService.mAppTransition.createThumbnailAspectScaleAnimationLocked(appRect, |
Andrii Kulian | 441e449 | 2016-09-29 15:25:00 -0700 | [diff] [blame] | 725 | insets, thumbnailHeader, taskId, displayConfig.uiMode, |
| 726 | displayConfig.orientation); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 727 | openingAppAnimator.thumbnailForceAboveLayer = Math.max(openingLayer, closingLayer); |
| 728 | openingAppAnimator.deferThumbnailDestruction = |
| 729 | !mService.mAppTransition.isNextThumbnailTransitionScaleUp(); |
| 730 | } else { |
| 731 | anim = mService.mAppTransition.createThumbnailScaleAnimationLocked( |
| 732 | displayInfo.appWidth, displayInfo.appHeight, transit, thumbnailHeader); |
| 733 | } |
| 734 | anim.restrictDuration(MAX_ANIMATION_DURATION); |
| 735 | anim.scaleCurrentDuration(mService.getTransitionAnimationScaleLocked()); |
| 736 | |
| 737 | openingAppAnimator.thumbnail = surfaceControl; |
| 738 | openingAppAnimator.thumbnailLayer = openingLayer; |
| 739 | openingAppAnimator.thumbnailAnimation = anim; |
| 740 | mService.mAppTransition.getNextAppTransitionStartRect(taskId, mTmpStartRect); |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 741 | } catch (Surface.OutOfResourcesException e) { |
Filip Gruszczynski | ce4ec40 | 2016-01-22 11:22:47 -0800 | [diff] [blame] | 742 | Slog.e(TAG, "Can't allocate thumbnail/Canvas surface w=" |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 743 | + dirty.width() + " h=" + dirty.height(), e); |
| 744 | openingAppAnimator.clearThumbnail(); |
| 745 | } |
| 746 | } |
| 747 | |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 748 | void requestTraversal() { |
| 749 | if (!mTraversalScheduled) { |
| 750 | mTraversalScheduled = true; |
Jorim Jaggi | ed7993b | 2017-03-28 18:50:01 +0100 | [diff] [blame] | 751 | mService.mAnimationHandler.post(mPerformSurfacePlacement); |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 752 | } |
| 753 | } |
| 754 | |
Jorim Jaggi | 3dac63a | 2016-03-01 12:37:07 +0100 | [diff] [blame] | 755 | /** |
| 756 | * Puts the {@param surface} into a pending list to be destroyed after the current transaction |
| 757 | * has been committed. |
| 758 | */ |
| 759 | void destroyAfterTransaction(SurfaceControl surface) { |
| 760 | mPendingDestroyingSurfaces.add(surface); |
| 761 | } |
| 762 | |
| 763 | /** |
| 764 | * Destroys any surfaces that have been put into the pending list with |
| 765 | * {@link #destroyAfterTransaction}. |
| 766 | */ |
| 767 | void destroyPendingSurfaces() { |
| 768 | for (int i = mPendingDestroyingSurfaces.size() - 1; i >= 0; i--) { |
| 769 | mPendingDestroyingSurfaces.get(i).destroy(); |
| 770 | } |
| 771 | mPendingDestroyingSurfaces.clear(); |
| 772 | } |
| 773 | |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 774 | public void dump(PrintWriter pw, String prefix) { |
Wale Ogunwale | e05f501 | 2016-09-16 16:27:29 -0700 | [diff] [blame] | 775 | pw.println(prefix + "mTraversalScheduled=" + mTraversalScheduled); |
| 776 | pw.println(prefix + "mHoldScreenWindow=" + mService.mRoot.mHoldScreenWindow); |
Wale Ogunwale | d4a00a0 | 2016-10-10 11:29:17 -0700 | [diff] [blame] | 777 | pw.println(prefix + "mObscuringWindow=" + mService.mRoot.mObscuringWindow); |
Filip Gruszczynski | 24966d4 | 2015-09-05 15:00:00 -0700 | [diff] [blame] | 778 | } |
Filip Gruszczynski | 4501d23 | 2015-09-02 13:00:02 -0700 | [diff] [blame] | 779 | } |