blob: 231a6bd5cf935022283ee0e5ef671d1388866756 [file] [log] [blame]
Craig Mautner164d4bb2012-11-26 13:51:23 -08001/*
2 * Copyright (C) 2011 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.server.wm;
18
Craig Mautner164d4bb2012-11-26 13:51:23 -080019import android.content.Context;
Winson Chung2820c452014-04-15 15:34:44 -070020import android.content.res.Configuration;
Craig Mautner164d4bb2012-11-26 13:51:23 -080021import android.graphics.Bitmap;
Winson Chung399f6202014-03-19 10:47:20 -070022import android.graphics.Rect;
Craig Mautner164d4bb2012-11-26 13:51:23 -080023import android.os.Debug;
24import android.os.Handler;
25import android.os.IRemoteCallback;
26import android.util.Slog;
27import android.view.WindowManager;
Craig Mautner164d4bb2012-11-26 13:51:23 -080028import android.view.animation.AlphaAnimation;
29import android.view.animation.Animation;
30import android.view.animation.AnimationSet;
31import android.view.animation.AnimationUtils;
Winson Chung399f6202014-03-19 10:47:20 -070032import android.view.animation.ClipRectAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -080033import android.view.animation.Interpolator;
34import android.view.animation.ScaleAnimation;
Winson Chung399f6202014-03-19 10:47:20 -070035import android.view.animation.TranslateAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -080036import com.android.internal.util.DumpUtils.Dump;
37import com.android.server.AttributeCache;
38import com.android.server.wm.WindowManagerService.H;
39
40import java.io.PrintWriter;
41
Craig Mautner9a29a5d2012-12-27 19:03:40 -080042import static com.android.internal.R.styleable.WindowAnimation_activityOpenEnterAnimation;
43import static com.android.internal.R.styleable.WindowAnimation_activityOpenExitAnimation;
44import static com.android.internal.R.styleable.WindowAnimation_activityCloseEnterAnimation;
45import static com.android.internal.R.styleable.WindowAnimation_activityCloseExitAnimation;
46import static com.android.internal.R.styleable.WindowAnimation_taskOpenEnterAnimation;
47import static com.android.internal.R.styleable.WindowAnimation_taskOpenExitAnimation;
Craig Mautner3b2cd1d2014-08-25 14:25:54 -070048import static com.android.internal.R.styleable.WindowAnimation_launchTaskBehindTargetAnimation;
Craig Mautnerbb742462014-07-07 15:28:55 -070049import static com.android.internal.R.styleable.WindowAnimation_launchTaskBehindSourceAnimation;
Craig Mautner9a29a5d2012-12-27 19:03:40 -080050import static com.android.internal.R.styleable.WindowAnimation_taskCloseEnterAnimation;
51import static com.android.internal.R.styleable.WindowAnimation_taskCloseExitAnimation;
52import static com.android.internal.R.styleable.WindowAnimation_taskToFrontEnterAnimation;
53import static com.android.internal.R.styleable.WindowAnimation_taskToFrontExitAnimation;
54import static com.android.internal.R.styleable.WindowAnimation_taskToBackEnterAnimation;
55import static com.android.internal.R.styleable.WindowAnimation_taskToBackExitAnimation;
56import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenEnterAnimation;
57import static com.android.internal.R.styleable.WindowAnimation_wallpaperOpenExitAnimation;
58import static com.android.internal.R.styleable.WindowAnimation_wallpaperCloseEnterAnimation;
59import static com.android.internal.R.styleable.WindowAnimation_wallpaperCloseExitAnimation;
60import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenEnterAnimation;
61import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraOpenExitAnimation;
62import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseEnterAnimation;
63import static com.android.internal.R.styleable.WindowAnimation_wallpaperIntraCloseExitAnimation;
64
Craig Mautner164d4bb2012-11-26 13:51:23 -080065// State management of app transitions. When we are preparing for a
66// transition, mNextAppTransition will be the kind of transition to
67// perform or TRANSIT_NONE if we are not waiting. If we are waiting,
68// mOpeningApps and mClosingApps are the lists of tokens that will be
69// made visible or hidden at the next transition.
70public class AppTransition implements Dump {
71 private static final String TAG = "AppTransition";
Craig Mautner321bdf52012-12-18 09:53:24 -080072 private static final boolean DEBUG_APP_TRANSITIONS =
73 WindowManagerService.DEBUG_APP_TRANSITIONS;
74 private static final boolean DEBUG_ANIM = WindowManagerService.DEBUG_ANIM;
75
Craig Mautner9a29a5d2012-12-27 19:03:40 -080076
Craig Mautner4b71aa12012-12-27 17:20:01 -080077 /** Not set up for a transition. */
78 public static final int TRANSIT_UNSET = -1;
79 /** No animation for transition. */
80 public static final int TRANSIT_NONE = 0;
81 /** A window in a new activity is being opened on top of an existing one in the same task. */
Craig Mautnerbb742462014-07-07 15:28:55 -070082 public static final int TRANSIT_ACTIVITY_OPEN = 6;
Craig Mautner4b71aa12012-12-27 17:20:01 -080083 /** The window in the top-most activity is being closed to reveal the
84 * previous activity in the same task. */
Craig Mautnerbb742462014-07-07 15:28:55 -070085 public static final int TRANSIT_ACTIVITY_CLOSE = 7;
Craig Mautner4b71aa12012-12-27 17:20:01 -080086 /** A window in a new task is being opened on top of an existing one
87 * in another activity's task. */
Craig Mautnerbb742462014-07-07 15:28:55 -070088 public static final int TRANSIT_TASK_OPEN = 8;
Craig Mautner4b71aa12012-12-27 17:20:01 -080089 /** A window in the top-most activity is being closed to reveal the
90 * previous activity in a different task. */
Craig Mautnerbb742462014-07-07 15:28:55 -070091 public static final int TRANSIT_TASK_CLOSE = 9;
Craig Mautner4b71aa12012-12-27 17:20:01 -080092 /** A window in an existing task is being displayed on top of an existing one
93 * in another activity's task. */
Craig Mautnerbb742462014-07-07 15:28:55 -070094 public static final int TRANSIT_TASK_TO_FRONT = 10;
Craig Mautner4b71aa12012-12-27 17:20:01 -080095 /** A window in an existing task is being put below all other tasks. */
Craig Mautnerbb742462014-07-07 15:28:55 -070096 public static final int TRANSIT_TASK_TO_BACK = 11;
Craig Mautner9a29a5d2012-12-27 19:03:40 -080097 /** A window in a new activity that doesn't have a wallpaper is being opened on top of one that
98 * does, effectively closing the wallpaper. */
Craig Mautnerbb742462014-07-07 15:28:55 -070099 public static final int TRANSIT_WALLPAPER_CLOSE = 12;
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800100 /** A window in a new activity that does have a wallpaper is being opened on one that didn't,
101 * effectively opening the wallpaper. */
Craig Mautnerbb742462014-07-07 15:28:55 -0700102 public static final int TRANSIT_WALLPAPER_OPEN = 13;
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800103 /** A window in a new activity is being opened on top of an existing one, and both are on top
104 * of the wallpaper. */
Craig Mautnerbb742462014-07-07 15:28:55 -0700105 public static final int TRANSIT_WALLPAPER_INTRA_OPEN = 14;
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800106 /** The window in the top-most activity is being closed to reveal the previous activity, and
107 * both are on top of the wallpaper. */
Craig Mautnerbb742462014-07-07 15:28:55 -0700108 public static final int TRANSIT_WALLPAPER_INTRA_CLOSE = 15;
109 /** A window in a new task is being opened behind an existing one in another activity's task.
110 * The new window will show briefly and then be gone. */
111 public static final int TRANSIT_TASK_OPEN_BEHIND = 16;
Winson Chung044d5292014-11-06 11:05:19 -0800112 /** A window in a task is being animated in-place. */
113 public static final int TRANSIT_TASK_IN_PLACE = 17;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800114
Winson Chunga4ccb862014-08-22 15:26:27 -0700115 /** Fraction of animation at which the recents thumbnail stays completely transparent */
116 private static final float RECENTS_THUMBNAIL_FADEIN_FRACTION = 0.7f;
Craig Mautner321bdf52012-12-18 09:53:24 -0800117 /** Fraction of animation at which the recents thumbnail becomes completely transparent */
Winson Chunga4ccb862014-08-22 15:26:27 -0700118 private static final float RECENTS_THUMBNAIL_FADEOUT_FRACTION = 0.3f;
Craig Mautner321bdf52012-12-18 09:53:24 -0800119
Winson Chung5393dff2014-05-08 14:25:43 -0700120 private static final int DEFAULT_APP_TRANSITION_DURATION = 250;
Winson Chungb255e492014-12-03 13:45:36 -0800121 private static final int THUMBNAIL_APP_TRANSITION_DURATION = 325;
Winson Chunga4ccb862014-08-22 15:26:27 -0700122 private static final int THUMBNAIL_APP_TRANSITION_ALPHA_DURATION = 325;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800123
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800124 private final Context mContext;
125 private final Handler mH;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800126
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800127 private int mNextAppTransition = TRANSIT_UNSET;
128
129 private static final int NEXT_TRANSIT_TYPE_NONE = 0;
130 private static final int NEXT_TRANSIT_TYPE_CUSTOM = 1;
131 private static final int NEXT_TRANSIT_TYPE_SCALE_UP = 2;
132 private static final int NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP = 3;
133 private static final int NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN = 4;
Winson Chunga4ccb862014-08-22 15:26:27 -0700134 private static final int NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP = 5;
135 private static final int NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN = 6;
Winson Chung044d5292014-11-06 11:05:19 -0800136 private static final int NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE = 7;
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800137 private int mNextAppTransitionType = NEXT_TRANSIT_TYPE_NONE;
138
Winson Chung399f6202014-03-19 10:47:20 -0700139 // These are the possible states for the enter/exit activities during a thumbnail transition
140 private static final int THUMBNAIL_TRANSITION_ENTER_SCALE_UP = 0;
141 private static final int THUMBNAIL_TRANSITION_EXIT_SCALE_UP = 1;
142 private static final int THUMBNAIL_TRANSITION_ENTER_SCALE_DOWN = 2;
143 private static final int THUMBNAIL_TRANSITION_EXIT_SCALE_DOWN = 3;
144
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800145 private String mNextAppTransitionPackage;
146 private Bitmap mNextAppTransitionThumbnail;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800147 // Used for thumbnail transitions. True if we're scaling up, false if scaling down
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800148 private boolean mNextAppTransitionScaleUp;
149 private IRemoteCallback mNextAppTransitionCallback;
150 private int mNextAppTransitionEnter;
151 private int mNextAppTransitionExit;
Winson Chung044d5292014-11-06 11:05:19 -0800152 private int mNextAppTransitionInPlace;
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800153 private int mNextAppTransitionStartX;
154 private int mNextAppTransitionStartY;
155 private int mNextAppTransitionStartWidth;
156 private int mNextAppTransitionStartHeight;
Winson Chunga4ccb862014-08-22 15:26:27 -0700157 private Rect mNextAppTransitionInsets = new Rect();
Craig Mautner164d4bb2012-11-26 13:51:23 -0800158
Winson Chung2820c452014-04-15 15:34:44 -0700159 private Rect mTmpFromClipRect = new Rect();
160 private Rect mTmpToClipRect = new Rect();
161
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800162 private final static int APP_STATE_IDLE = 0;
163 private final static int APP_STATE_READY = 1;
164 private final static int APP_STATE_RUNNING = 2;
165 private final static int APP_STATE_TIMEOUT = 3;
166 private int mAppTransitionState = APP_STATE_IDLE;
167
168 private final int mConfigShortAnimTime;
Craig Mautner321bdf52012-12-18 09:53:24 -0800169 private final Interpolator mDecelerateInterpolator;
Winson Chunga4ccb862014-08-22 15:26:27 -0700170 private final Interpolator mThumbnailFadeInInterpolator;
171 private final Interpolator mThumbnailFadeOutInterpolator;
Winson Chung60a729c2014-08-12 16:33:32 -0700172 private final Interpolator mThumbnailFastOutSlowInInterpolator;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800173
Amith Yamasani4befbec2013-07-10 16:18:01 -0700174 private int mCurrentUserId = 0;
175
Craig Mautner164d4bb2012-11-26 13:51:23 -0800176 AppTransition(Context context, Handler h) {
177 mContext = context;
178 mH = h;
179 mConfigShortAnimTime = context.getResources().getInteger(
180 com.android.internal.R.integer.config_shortAnimTime);
Craig Mautner321bdf52012-12-18 09:53:24 -0800181 mDecelerateInterpolator = AnimationUtils.loadInterpolator(context,
182 com.android.internal.R.interpolator.decelerate_cubic);
Winson Chung60a729c2014-08-12 16:33:32 -0700183 mThumbnailFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(context,
Winson Chung5393dff2014-05-08 14:25:43 -0700184 com.android.internal.R.interpolator.fast_out_slow_in);
Winson Chunga4ccb862014-08-22 15:26:27 -0700185 mThumbnailFadeInInterpolator = new Interpolator() {
186 @Override
187 public float getInterpolation(float input) {
188 // Linear response for first fraction, then complete after that.
189 if (input < RECENTS_THUMBNAIL_FADEIN_FRACTION) {
190 return 0f;
191 }
192 return (input - RECENTS_THUMBNAIL_FADEIN_FRACTION) /
193 (1f - RECENTS_THUMBNAIL_FADEIN_FRACTION);
194 }
195 };
196 mThumbnailFadeOutInterpolator = new Interpolator() {
Craig Mautner321bdf52012-12-18 09:53:24 -0800197 @Override
198 public float getInterpolation(float input) {
199 // Linear response for first fraction, then complete after that.
200 if (input < RECENTS_THUMBNAIL_FADEOUT_FRACTION) {
201 return input / RECENTS_THUMBNAIL_FADEOUT_FRACTION;
202 }
Winson Chunga4ccb862014-08-22 15:26:27 -0700203 return 1f;
Craig Mautner321bdf52012-12-18 09:53:24 -0800204 }
205 };
Craig Mautner164d4bb2012-11-26 13:51:23 -0800206 }
207
208 boolean isTransitionSet() {
209 return mNextAppTransition != TRANSIT_UNSET;
210 }
211
212 boolean isTransitionNone() {
213 return mNextAppTransition == TRANSIT_NONE;
214 }
215
216 boolean isTransitionEqual(int transit) {
217 return mNextAppTransition == transit;
218 }
219
220 int getAppTransition() {
Craig Mautner321bdf52012-12-18 09:53:24 -0800221 return mNextAppTransition;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800222 }
223
224 void setAppTransition(int transit) {
225 mNextAppTransition = transit;
226 }
227
228 boolean isReady() {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800229 return mAppTransitionState == APP_STATE_READY
230 || mAppTransitionState == APP_STATE_TIMEOUT;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800231 }
232
Craig Mautnerae446592012-12-06 19:05:05 -0800233 void setReady() {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800234 mAppTransitionState = APP_STATE_READY;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800235 }
236
237 boolean isRunning() {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800238 return mAppTransitionState == APP_STATE_RUNNING;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800239 }
240
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800241 void setIdle() {
242 mAppTransitionState = APP_STATE_IDLE;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800243 }
244
245 boolean isTimeout() {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800246 return mAppTransitionState == APP_STATE_TIMEOUT;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800247 }
248
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800249 void setTimeout() {
250 mAppTransitionState = APP_STATE_TIMEOUT;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800251 }
252
253 Bitmap getNextAppTransitionThumbnail() {
254 return mNextAppTransitionThumbnail;
255 }
256
Winson Chunga4ccb862014-08-22 15:26:27 -0700257 /** Returns whether the next thumbnail transition is aspect scaled up. */
258 boolean isNextThumbnailTransitionAspectScaled() {
259 return mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP ||
260 mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN;
261 }
262
263 /** Returns whether the next thumbnail transition is scaling up. */
264 boolean isNextThumbnailTransitionScaleUp() {
265 return mNextAppTransitionScaleUp;
266 }
267
268 int getStartingX() {
269 return mNextAppTransitionStartX;
270 }
271
272 int getStartingY() {
273 return mNextAppTransitionStartY;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800274 }
275
Craig Mautner164d4bb2012-11-26 13:51:23 -0800276 void prepare() {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800277 if (!isRunning()) {
278 mAppTransitionState = APP_STATE_IDLE;
279 }
Craig Mautner164d4bb2012-11-26 13:51:23 -0800280 }
281
282 void goodToGo() {
Craig Mautner4b71aa12012-12-27 17:20:01 -0800283 mNextAppTransition = TRANSIT_UNSET;
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800284 mAppTransitionState = APP_STATE_RUNNING;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800285 }
286
287 void clear() {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800288 mNextAppTransitionType = NEXT_TRANSIT_TYPE_NONE;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800289 mNextAppTransitionPackage = null;
290 mNextAppTransitionThumbnail = null;
291 }
292
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800293 void freeze() {
294 setAppTransition(AppTransition.TRANSIT_UNSET);
295 clear();
296 setReady();
297 }
298
Craig Mautner164d4bb2012-11-26 13:51:23 -0800299 private AttributeCache.Entry getCachedAnimations(WindowManager.LayoutParams lp) {
300 if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: layout params pkg="
301 + (lp != null ? lp.packageName : null)
302 + " resId=0x" + (lp != null ? Integer.toHexString(lp.windowAnimations) : null));
303 if (lp != null && lp.windowAnimations != 0) {
304 // If this is a system resource, don't try to load it from the
305 // application resources. It is nice to avoid loading application
306 // resources if we can.
307 String packageName = lp.packageName != null ? lp.packageName : "android";
308 int resId = lp.windowAnimations;
309 if ((resId&0xFF000000) == 0x01000000) {
310 packageName = "android";
311 }
312 if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
313 + packageName);
314 return AttributeCache.instance().get(packageName, resId,
Amith Yamasani4befbec2013-07-10 16:18:01 -0700315 com.android.internal.R.styleable.WindowAnimation, mCurrentUserId);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800316 }
317 return null;
318 }
319
320 private AttributeCache.Entry getCachedAnimations(String packageName, int resId) {
321 if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: package="
322 + packageName + " resId=0x" + Integer.toHexString(resId));
323 if (packageName != null) {
324 if ((resId&0xFF000000) == 0x01000000) {
325 packageName = "android";
326 }
327 if (DEBUG_ANIM) Slog.v(TAG, "Loading animations: picked package="
328 + packageName);
329 return AttributeCache.instance().get(packageName, resId,
Amith Yamasani4befbec2013-07-10 16:18:01 -0700330 com.android.internal.R.styleable.WindowAnimation, mCurrentUserId);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800331 }
332 return null;
333 }
334
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700335 Animation loadAnimationAttr(WindowManager.LayoutParams lp, int animAttr) {
Craig Mautner164d4bb2012-11-26 13:51:23 -0800336 int anim = 0;
337 Context context = mContext;
338 if (animAttr >= 0) {
339 AttributeCache.Entry ent = getCachedAnimations(lp);
340 if (ent != null) {
341 context = ent.context;
342 anim = ent.array.getResourceId(animAttr, 0);
343 }
344 }
345 if (anim != 0) {
346 return AnimationUtils.loadAnimation(context, anim);
347 }
348 return null;
349 }
350
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700351 Animation loadAnimationRes(WindowManager.LayoutParams lp, int resId) {
352 Context context = mContext;
353 if (resId >= 0) {
354 AttributeCache.Entry ent = getCachedAnimations(lp);
355 if (ent != null) {
356 context = ent.context;
357 }
358 return AnimationUtils.loadAnimation(context, resId);
359 }
360 return null;
361 }
362
363 private Animation loadAnimationRes(String packageName, int resId) {
Craig Mautner164d4bb2012-11-26 13:51:23 -0800364 int anim = 0;
365 Context context = mContext;
366 if (resId >= 0) {
367 AttributeCache.Entry ent = getCachedAnimations(packageName, resId);
368 if (ent != null) {
369 context = ent.context;
370 anim = resId;
371 }
372 }
373 if (anim != 0) {
374 return AnimationUtils.loadAnimation(context, anim);
375 }
376 return null;
377 }
378
Craig Mautner164d4bb2012-11-26 13:51:23 -0800379 /**
380 * Compute the pivot point for an animation that is scaling from a small
381 * rect on screen to a larger rect. The pivot point varies depending on
382 * the distance between the inner and outer edges on both sides. This
383 * function computes the pivot point for one dimension.
384 * @param startPos Offset from left/top edge of outer rectangle to
385 * left/top edge of inner rectangle.
386 * @param finalScale The scaling factor between the size of the outer
387 * and inner rectangles.
388 */
389 private static float computePivot(int startPos, float finalScale) {
390 final float denom = finalScale-1;
391 if (Math.abs(denom) < .0001f) {
392 return startPos;
393 }
394 return -startPos / denom;
395 }
396
397 private Animation createScaleUpAnimationLocked(int transit, boolean enter,
398 int appWidth, int appHeight) {
399 Animation a = null;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800400 if (enter) {
401 // Entering app zooms out from the center of the initial rect.
402 float scaleW = mNextAppTransitionStartWidth / (float) appWidth;
403 float scaleH = mNextAppTransitionStartHeight / (float) appHeight;
404 Animation scale = new ScaleAnimation(scaleW, 1, scaleH, 1,
405 computePivot(mNextAppTransitionStartX, scaleW),
406 computePivot(mNextAppTransitionStartY, scaleH));
Craig Mautner321bdf52012-12-18 09:53:24 -0800407 scale.setInterpolator(mDecelerateInterpolator);
408
Craig Mautner164d4bb2012-11-26 13:51:23 -0800409 Animation alpha = new AlphaAnimation(0, 1);
Winson Chunga4ccb862014-08-22 15:26:27 -0700410 alpha.setInterpolator(mThumbnailFadeOutInterpolator);
Craig Mautner321bdf52012-12-18 09:53:24 -0800411
412 AnimationSet set = new AnimationSet(false);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800413 set.addAnimation(scale);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800414 set.addAnimation(alpha);
415 set.setDetachWallpaper(true);
416 a = set;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800417 } else if (transit == TRANSIT_WALLPAPER_INTRA_OPEN ||
418 transit == TRANSIT_WALLPAPER_INTRA_CLOSE) {
Craig Mautner321bdf52012-12-18 09:53:24 -0800419 // If we are on top of the wallpaper, we need an animation that
420 // correctly handles the wallpaper staying static behind all of
421 // the animated elements. To do this, will just have the existing
422 // element fade out.
423 a = new AlphaAnimation(1, 0);
424 a.setDetachWallpaper(true);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800425 } else {
Craig Mautner321bdf52012-12-18 09:53:24 -0800426 // For normal animations, the exiting element just holds in place.
427 a = new AlphaAnimation(1, 1);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800428 }
Craig Mautner321bdf52012-12-18 09:53:24 -0800429
430 // Pick the desired duration. If this is an inter-activity transition,
431 // it is the standard duration for that. Otherwise we use the longer
432 // task transition duration.
433 final long duration;
434 switch (transit) {
Craig Mautner4b71aa12012-12-27 17:20:01 -0800435 case TRANSIT_ACTIVITY_OPEN:
436 case TRANSIT_ACTIVITY_CLOSE:
Craig Mautner321bdf52012-12-18 09:53:24 -0800437 duration = mConfigShortAnimTime;
438 break;
439 default:
440 duration = DEFAULT_APP_TRANSITION_DURATION;
441 break;
442 }
443 a.setDuration(duration);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800444 a.setFillAfter(true);
Craig Mautner321bdf52012-12-18 09:53:24 -0800445 a.setInterpolator(mDecelerateInterpolator);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800446 a.initialize(appWidth, appHeight, appWidth, appHeight);
447 return a;
448 }
449
Winson Chung399f6202014-03-19 10:47:20 -0700450 /**
451 * Prepares the specified animation with a standard duration, interpolator, etc.
452 */
Winson Chung5393dff2014-05-08 14:25:43 -0700453 Animation prepareThumbnailAnimationWithDuration(Animation a, int appWidth, int appHeight,
454 int duration, Interpolator interpolator) {
Winson Chunga4ccb862014-08-22 15:26:27 -0700455 if (duration > 0) {
456 a.setDuration(duration);
457 }
Winson Chung5393dff2014-05-08 14:25:43 -0700458 a.setFillAfter(true);
459 a.setInterpolator(interpolator);
460 a.initialize(appWidth, appHeight, appWidth, appHeight);
461 return a;
462 }
463
464 /**
465 * Prepares the specified animation with a standard duration, interpolator, etc.
466 */
Winson Chung399f6202014-03-19 10:47:20 -0700467 Animation prepareThumbnailAnimation(Animation a, int appWidth, int appHeight, int transit) {
Craig Mautner321bdf52012-12-18 09:53:24 -0800468 // Pick the desired duration. If this is an inter-activity transition,
469 // it is the standard duration for that. Otherwise we use the longer
470 // task transition duration.
Winson Chung5393dff2014-05-08 14:25:43 -0700471 final int duration;
Craig Mautner321bdf52012-12-18 09:53:24 -0800472 switch (transit) {
Craig Mautner4b71aa12012-12-27 17:20:01 -0800473 case TRANSIT_ACTIVITY_OPEN:
474 case TRANSIT_ACTIVITY_CLOSE:
Craig Mautner321bdf52012-12-18 09:53:24 -0800475 duration = mConfigShortAnimTime;
476 break;
477 default:
478 duration = DEFAULT_APP_TRANSITION_DURATION;
479 break;
480 }
Winson Chung5393dff2014-05-08 14:25:43 -0700481 return prepareThumbnailAnimationWithDuration(a, appWidth, appHeight, duration,
482 mDecelerateInterpolator);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800483 }
484
Winson Chung399f6202014-03-19 10:47:20 -0700485 /**
486 * Return the current thumbnail transition state.
487 */
488 int getThumbnailTransitionState(boolean enter) {
489 if (enter) {
490 if (mNextAppTransitionScaleUp) {
491 return THUMBNAIL_TRANSITION_ENTER_SCALE_UP;
492 } else {
493 return THUMBNAIL_TRANSITION_ENTER_SCALE_DOWN;
494 }
495 } else {
496 if (mNextAppTransitionScaleUp) {
497 return THUMBNAIL_TRANSITION_EXIT_SCALE_UP;
498 } else {
499 return THUMBNAIL_TRANSITION_EXIT_SCALE_DOWN;
500 }
501 }
502 }
503
504 /**
505 * This animation runs for the thumbnail that gets cross faded with the enter/exit activity
506 * when a thumbnail is specified with the activity options.
507 */
Winson Chunga4ccb862014-08-22 15:26:27 -0700508 Animation createThumbnailAspectScaleAnimationLocked(int appWidth, int appHeight,
509 int deviceWidth, int transit) {
Winson Chung399f6202014-03-19 10:47:20 -0700510 Animation a;
511 final int thumbWidthI = mNextAppTransitionThumbnail.getWidth();
512 final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
513 final int thumbHeightI = mNextAppTransitionThumbnail.getHeight();
514 final float thumbHeight = thumbHeightI > 0 ? thumbHeightI : 1;
515
Winson Chunga4ccb862014-08-22 15:26:27 -0700516 float scaleW = deviceWidth / thumbWidth;
517 float unscaledWidth = deviceWidth;
518 float unscaledHeight = thumbHeight * scaleW;
519 float unscaledStartY = mNextAppTransitionStartY - (unscaledHeight - thumbHeight) / 2f;
Winson Chung399f6202014-03-19 10:47:20 -0700520 if (mNextAppTransitionScaleUp) {
Winson Chunga4ccb862014-08-22 15:26:27 -0700521 // Animation up from the thumbnail to the full screen
522 Animation scale = new ScaleAnimation(1f, scaleW, 1f, scaleW,
523 mNextAppTransitionStartX + (thumbWidth / 2f),
524 mNextAppTransitionStartY + (thumbHeight / 2f));
525 scale.setInterpolator(mThumbnailFastOutSlowInInterpolator);
526 scale.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
Winson Chung399f6202014-03-19 10:47:20 -0700527 Animation alpha = new AlphaAnimation(1, 0);
Winson Chunga4ccb862014-08-22 15:26:27 -0700528 alpha.setInterpolator(mThumbnailFadeOutInterpolator);
529 alpha.setDuration(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION);
530 Animation translate = new TranslateAnimation(0, 0, 0, -unscaledStartY +
531 mNextAppTransitionInsets.top);
532 translate.setInterpolator(mThumbnailFastOutSlowInInterpolator);
533 translate.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
Winson Chung399f6202014-03-19 10:47:20 -0700534
535 // This AnimationSet uses the Interpolators assigned above.
536 AnimationSet set = new AnimationSet(false);
537 set.addAnimation(scale);
538 set.addAnimation(alpha);
Winson Chunga4ccb862014-08-22 15:26:27 -0700539 set.addAnimation(translate);
Winson Chung399f6202014-03-19 10:47:20 -0700540 a = set;
541 } else {
Winson Chunga4ccb862014-08-22 15:26:27 -0700542 // Animation down from the full screen to the thumbnail
543 Animation scale = new ScaleAnimation(scaleW, 1f, scaleW, 1f,
544 mNextAppTransitionStartX + (thumbWidth / 2f),
545 mNextAppTransitionStartY + (thumbHeight / 2f));
546 scale.setInterpolator(mThumbnailFastOutSlowInInterpolator);
547 scale.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
548 Animation alpha = new AlphaAnimation(0f, 1f);
549 alpha.setInterpolator(mThumbnailFadeInInterpolator);
550 alpha.setDuration(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION);
551 Animation translate = new TranslateAnimation(0, 0, -unscaledStartY +
552 mNextAppTransitionInsets.top, 0);
553 translate.setInterpolator(mThumbnailFastOutSlowInInterpolator);
554 translate.setDuration(THUMBNAIL_APP_TRANSITION_DURATION);
Winson Chung399f6202014-03-19 10:47:20 -0700555
Winson Chunga4ccb862014-08-22 15:26:27 -0700556 // This AnimationSet uses the Interpolators assigned above.
557 AnimationSet set = new AnimationSet(false);
558 set.addAnimation(scale);
559 set.addAnimation(alpha);
560 set.addAnimation(translate);
561 a = set;
562
563 }
564 return prepareThumbnailAnimationWithDuration(a, appWidth, appHeight, 0,
565 mThumbnailFastOutSlowInInterpolator);
Winson Chung399f6202014-03-19 10:47:20 -0700566 }
567
568 /**
569 * This alternate animation is created when we are doing a thumbnail transition, for the
570 * activity that is leaving, and the activity that is entering.
571 */
Winson Chunga4ccb862014-08-22 15:26:27 -0700572 Animation createAspectScaledThumbnailEnterExitAnimationLocked(int thumbTransitState,
573 int appWidth, int appHeight, int orientation, int transit, Rect containingFrame,
574 Rect contentInsets, boolean isFullScreen) {
Winson Chung399f6202014-03-19 10:47:20 -0700575 Animation a;
Winson Chung2e7f3bd2014-09-05 13:17:22 +0200576 final int thumbWidthI = mNextAppTransitionStartWidth;
Winson Chung399f6202014-03-19 10:47:20 -0700577 final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
Winson Chung2e7f3bd2014-09-05 13:17:22 +0200578 final int thumbHeightI = mNextAppTransitionStartHeight;
Winson Chung399f6202014-03-19 10:47:20 -0700579 final float thumbHeight = thumbHeightI > 0 ? thumbHeightI : 1;
580
Winson Chung2820c452014-04-15 15:34:44 -0700581 // Used for the ENTER_SCALE_UP and EXIT_SCALE_DOWN transitions
582 float scale = 1f;
583 int scaledTopDecor = 0;
584
Winson Chung399f6202014-03-19 10:47:20 -0700585 switch (thumbTransitState) {
586 case THUMBNAIL_TRANSITION_ENTER_SCALE_UP: {
Winson Chunga4ccb862014-08-22 15:26:27 -0700587 // App window scaling up to become full screen
Winson Chung2820c452014-04-15 15:34:44 -0700588 if (orientation == Configuration.ORIENTATION_PORTRAIT) {
589 // In portrait, we scale the width and clip to the top/left square
590 scale = thumbWidth / appWidth;
591 scaledTopDecor = (int) (scale * contentInsets.top);
592 int unscaledThumbHeight = (int) (thumbHeight / scale);
593 mTmpFromClipRect.set(containingFrame);
Winson Chungae084412014-05-20 14:17:22 -0700594 if (isFullScreen) {
595 mTmpFromClipRect.top = contentInsets.top;
596 }
Winson Chung2820c452014-04-15 15:34:44 -0700597 mTmpFromClipRect.bottom = (mTmpFromClipRect.top + unscaledThumbHeight);
598 mTmpToClipRect.set(containingFrame);
599 } else {
600 // In landscape, we scale the height and clip to the top/left square
601 scale = thumbHeight / (appHeight - contentInsets.top);
602 scaledTopDecor = (int) (scale * contentInsets.top);
603 int unscaledThumbWidth = (int) (thumbWidth / scale);
Winson Chungae084412014-05-20 14:17:22 -0700604 int unscaledThumbHeight = (int) (thumbHeight / scale);
Winson Chung2820c452014-04-15 15:34:44 -0700605 mTmpFromClipRect.set(containingFrame);
Winson Chungae084412014-05-20 14:17:22 -0700606 if (isFullScreen) {
607 mTmpFromClipRect.top = contentInsets.top;
608 mTmpFromClipRect.bottom = (mTmpFromClipRect.top + unscaledThumbHeight);
609 }
Winson Chung2820c452014-04-15 15:34:44 -0700610 mTmpFromClipRect.right = (mTmpFromClipRect.left + unscaledThumbWidth);
611 mTmpToClipRect.set(containingFrame);
612 }
Winson Chunga4ccb862014-08-22 15:26:27 -0700613 mNextAppTransitionInsets.set(contentInsets);
Winson Chung399f6202014-03-19 10:47:20 -0700614
615 Animation scaleAnim = new ScaleAnimation(scale, 1, scale, 1,
616 computePivot(mNextAppTransitionStartX, scale),
617 computePivot(mNextAppTransitionStartY, scale));
Winson Chung2820c452014-04-15 15:34:44 -0700618 Animation clipAnim = new ClipRectAnimation(mTmpFromClipRect, mTmpToClipRect);
Winson Chung399f6202014-03-19 10:47:20 -0700619 Animation translateAnim = new TranslateAnimation(0, 0, -scaledTopDecor, 0);
620
621 AnimationSet set = new AnimationSet(true);
Winson Chung399f6202014-03-19 10:47:20 -0700622 set.addAnimation(clipAnim);
623 set.addAnimation(scaleAnim);
624 set.addAnimation(translateAnim);
625 a = set;
626 break;
627 }
628 case THUMBNAIL_TRANSITION_EXIT_SCALE_UP: {
Winson Chunga4ccb862014-08-22 15:26:27 -0700629 // Previous app window during the scale up
Winson Chung399f6202014-03-19 10:47:20 -0700630 if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
Winson Chunga4ccb862014-08-22 15:26:27 -0700631 // Fade out the source activity if we are animating to a wallpaper
Winson Chung399f6202014-03-19 10:47:20 -0700632 // activity.
633 a = new AlphaAnimation(1, 0);
634 } else {
Winson Chung399f6202014-03-19 10:47:20 -0700635 a = new AlphaAnimation(1, 1);
636 }
637 break;
638 }
639 case THUMBNAIL_TRANSITION_ENTER_SCALE_DOWN: {
Winson Chunga4ccb862014-08-22 15:26:27 -0700640 // Target app window during the scale down
641 if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
642 // Fade in the destination activity if we are animating from a wallpaper
643 // activity.
644 a = new AlphaAnimation(0, 1);
645 } else {
646 a = new AlphaAnimation(1, 1);
647 }
Winson Chung399f6202014-03-19 10:47:20 -0700648 break;
649 }
650 case THUMBNAIL_TRANSITION_EXIT_SCALE_DOWN: {
Winson Chunga4ccb862014-08-22 15:26:27 -0700651 // App window scaling down from full screen
Winson Chung2820c452014-04-15 15:34:44 -0700652 if (orientation == Configuration.ORIENTATION_PORTRAIT) {
653 // In portrait, we scale the width and clip to the top/left square
654 scale = thumbWidth / appWidth;
655 scaledTopDecor = (int) (scale * contentInsets.top);
656 int unscaledThumbHeight = (int) (thumbHeight / scale);
657 mTmpFromClipRect.set(containingFrame);
658 mTmpToClipRect.set(containingFrame);
Winson Chungae084412014-05-20 14:17:22 -0700659 if (isFullScreen) {
660 mTmpToClipRect.top = contentInsets.top;
661 }
Winson Chung2820c452014-04-15 15:34:44 -0700662 mTmpToClipRect.bottom = (mTmpToClipRect.top + unscaledThumbHeight);
663 } else {
664 // In landscape, we scale the height and clip to the top/left square
665 scale = thumbHeight / (appHeight - contentInsets.top);
666 scaledTopDecor = (int) (scale * contentInsets.top);
667 int unscaledThumbWidth = (int) (thumbWidth / scale);
Winson Chungae084412014-05-20 14:17:22 -0700668 int unscaledThumbHeight = (int) (thumbHeight / scale);
Winson Chung2820c452014-04-15 15:34:44 -0700669 mTmpFromClipRect.set(containingFrame);
670 mTmpToClipRect.set(containingFrame);
Winson Chungae084412014-05-20 14:17:22 -0700671 if (isFullScreen) {
672 mTmpToClipRect.top = contentInsets.top;
673 mTmpToClipRect.bottom = (mTmpToClipRect.top + unscaledThumbHeight);
674 }
Winson Chung2820c452014-04-15 15:34:44 -0700675 mTmpToClipRect.right = (mTmpToClipRect.left + unscaledThumbWidth);
676 }
Winson Chunga4ccb862014-08-22 15:26:27 -0700677 mNextAppTransitionInsets.set(contentInsets);
Winson Chung399f6202014-03-19 10:47:20 -0700678
679 Animation scaleAnim = new ScaleAnimation(1, scale, 1, scale,
680 computePivot(mNextAppTransitionStartX, scale),
681 computePivot(mNextAppTransitionStartY, scale));
Winson Chung2820c452014-04-15 15:34:44 -0700682 Animation clipAnim = new ClipRectAnimation(mTmpFromClipRect, mTmpToClipRect);
Winson Chung399f6202014-03-19 10:47:20 -0700683 Animation translateAnim = new TranslateAnimation(0, 0, 0, -scaledTopDecor);
684
685 AnimationSet set = new AnimationSet(true);
Winson Chung399f6202014-03-19 10:47:20 -0700686 set.addAnimation(clipAnim);
687 set.addAnimation(scaleAnim);
688 set.addAnimation(translateAnim);
689
690 a = set;
691 a.setZAdjustment(Animation.ZORDER_TOP);
692 break;
693 }
694 default:
695 throw new RuntimeException("Invalid thumbnail transition state");
696 }
697
Winson Chungab79fce2014-11-04 16:15:22 -0800698 int duration = Math.max(THUMBNAIL_APP_TRANSITION_ALPHA_DURATION,
699 THUMBNAIL_APP_TRANSITION_DURATION);
700 return prepareThumbnailAnimationWithDuration(a, appWidth, appHeight, duration,
701 mThumbnailFastOutSlowInInterpolator);
Winson Chung399f6202014-03-19 10:47:20 -0700702 }
703
704 /**
Winson Chunga4ccb862014-08-22 15:26:27 -0700705 * This animation runs for the thumbnail that gets cross faded with the enter/exit activity
706 * when a thumbnail is specified with the activity options.
707 */
708 Animation createThumbnailScaleAnimationLocked(int appWidth, int appHeight, int transit) {
709 Animation a;
710 final int thumbWidthI = mNextAppTransitionThumbnail.getWidth();
711 final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
712 final int thumbHeightI = mNextAppTransitionThumbnail.getHeight();
713 final float thumbHeight = thumbHeightI > 0 ? thumbHeightI : 1;
714
715 if (mNextAppTransitionScaleUp) {
716 // Animation for the thumbnail zooming from its initial size to the full screen
717 float scaleW = appWidth / thumbWidth;
718 float scaleH = appHeight / thumbHeight;
719 Animation scale = new ScaleAnimation(1, scaleW, 1, scaleH,
720 computePivot(mNextAppTransitionStartX, 1 / scaleW),
721 computePivot(mNextAppTransitionStartY, 1 / scaleH));
722 scale.setInterpolator(mDecelerateInterpolator);
723
724 Animation alpha = new AlphaAnimation(1, 0);
725 alpha.setInterpolator(mThumbnailFadeOutInterpolator);
726
727 // This AnimationSet uses the Interpolators assigned above.
728 AnimationSet set = new AnimationSet(false);
729 set.addAnimation(scale);
730 set.addAnimation(alpha);
731 a = set;
732 } else {
733 // Animation for the thumbnail zooming down from the full screen to its final size
734 float scaleW = appWidth / thumbWidth;
735 float scaleH = appHeight / thumbHeight;
736 a = new ScaleAnimation(scaleW, 1, scaleH, 1,
737 computePivot(mNextAppTransitionStartX, 1 / scaleW),
738 computePivot(mNextAppTransitionStartY, 1 / scaleH));
739 }
740
741 return prepareThumbnailAnimation(a, appWidth, appHeight, transit);
742 }
743
744 /**
Winson Chung399f6202014-03-19 10:47:20 -0700745 * This animation is created when we are doing a thumbnail transition, for the activity that is
746 * leaving, and the activity that is entering.
747 */
748 Animation createThumbnailEnterExitAnimationLocked(int thumbTransitState, int appWidth,
749 int appHeight, int transit) {
750 Animation a;
751 final int thumbWidthI = mNextAppTransitionThumbnail.getWidth();
752 final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1;
753 final int thumbHeightI = mNextAppTransitionThumbnail.getHeight();
754 final float thumbHeight = thumbHeightI > 0 ? thumbHeightI : 1;
755
756 switch (thumbTransitState) {
757 case THUMBNAIL_TRANSITION_ENTER_SCALE_UP: {
758 // Entering app scales up with the thumbnail
759 float scaleW = thumbWidth / appWidth;
760 float scaleH = thumbHeight / appHeight;
761 a = new ScaleAnimation(scaleW, 1, scaleH, 1,
762 computePivot(mNextAppTransitionStartX, scaleW),
763 computePivot(mNextAppTransitionStartY, scaleH));
764 break;
765 }
766 case THUMBNAIL_TRANSITION_EXIT_SCALE_UP: {
767 // Exiting app while the thumbnail is scaling up should fade or stay in place
768 if (transit == TRANSIT_WALLPAPER_INTRA_OPEN) {
769 // Fade out while bringing up selected activity. This keeps the
770 // current activity from showing through a launching wallpaper
771 // activity.
772 a = new AlphaAnimation(1, 0);
773 } else {
774 // noop animation
775 a = new AlphaAnimation(1, 1);
776 }
777 break;
778 }
779 case THUMBNAIL_TRANSITION_ENTER_SCALE_DOWN: {
780 // Entering the other app, it should just be visible while we scale the thumbnail
781 // down above it
782 a = new AlphaAnimation(1, 1);
783 break;
784 }
785 case THUMBNAIL_TRANSITION_EXIT_SCALE_DOWN: {
786 // Exiting the current app, the app should scale down with the thumbnail
787 float scaleW = thumbWidth / appWidth;
788 float scaleH = thumbHeight / appHeight;
789 Animation scale = new ScaleAnimation(1, scaleW, 1, scaleH,
790 computePivot(mNextAppTransitionStartX, scaleW),
791 computePivot(mNextAppTransitionStartY, scaleH));
792
793 Animation alpha = new AlphaAnimation(1, 0);
794
795 AnimationSet set = new AnimationSet(true);
796 set.addAnimation(scale);
797 set.addAnimation(alpha);
798 set.setZAdjustment(Animation.ZORDER_TOP);
799 a = set;
800 break;
801 }
802 default:
803 throw new RuntimeException("Invalid thumbnail transition state");
804 }
805
806 return prepareThumbnailAnimation(a, appWidth, appHeight, transit);
807 }
808
Craig Mautner164d4bb2012-11-26 13:51:23 -0800809
810 Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter,
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700811 int appWidth, int appHeight, int orientation, Rect containingFrame, Rect contentInsets,
812 boolean isFullScreen, boolean isVoiceInteraction) {
Craig Mautner164d4bb2012-11-26 13:51:23 -0800813 Animation a;
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700814 if (isVoiceInteraction && (transit == TRANSIT_ACTIVITY_OPEN
815 || transit == TRANSIT_TASK_OPEN
816 || transit == TRANSIT_TASK_TO_FRONT)) {
817 a = loadAnimationRes(lp, enter
818 ? com.android.internal.R.anim.voice_activity_open_enter
819 : com.android.internal.R.anim.voice_activity_open_exit);
820 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
821 "applyAnimation voice:"
822 + " anim=" + a + " transit=" + transit + " isEntrance=" + enter
823 + " Callers=" + Debug.getCallers(3));
824 } else if (isVoiceInteraction && (transit == TRANSIT_ACTIVITY_CLOSE
825 || transit == TRANSIT_TASK_CLOSE
826 || transit == TRANSIT_TASK_TO_BACK)) {
827 a = loadAnimationRes(lp, enter
828 ? com.android.internal.R.anim.voice_activity_close_enter
829 : com.android.internal.R.anim.voice_activity_close_exit);
830 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
831 "applyAnimation voice:"
832 + " anim=" + a + " transit=" + transit + " isEntrance=" + enter
833 + " Callers=" + Debug.getCallers(3));
834 } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM) {
835 a = loadAnimationRes(mNextAppTransitionPackage, enter ?
Craig Mautner164d4bb2012-11-26 13:51:23 -0800836 mNextAppTransitionEnter : mNextAppTransitionExit);
837 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
838 "applyAnimation:"
839 + " anim=" + a + " nextAppTransition=ANIM_CUSTOM"
840 + " transit=" + transit + " isEntrance=" + enter
841 + " Callers=" + Debug.getCallers(3));
Winson Chung044d5292014-11-06 11:05:19 -0800842 } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE) {
843 a = loadAnimationRes(mNextAppTransitionPackage, mNextAppTransitionInPlace);
844 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
845 "applyAnimation:"
846 + " anim=" + a + " nextAppTransition=ANIM_CUSTOM_IN_PLACE"
847 + " transit=" + transit + " Callers=" + Debug.getCallers(3));
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800848 } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_SCALE_UP) {
Craig Mautner164d4bb2012-11-26 13:51:23 -0800849 a = createScaleUpAnimationLocked(transit, enter, appWidth, appHeight);
850 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
851 "applyAnimation:"
852 + " anim=" + a + " nextAppTransition=ANIM_SCALE_UP"
853 + " transit=" + transit + " isEntrance=" + enter
854 + " Callers=" + Debug.getCallers(3));
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800855 } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP ||
856 mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN) {
Craig Mautner164d4bb2012-11-26 13:51:23 -0800857 mNextAppTransitionScaleUp =
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800858 (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP);
Winson Chunga4ccb862014-08-22 15:26:27 -0700859 a = createThumbnailEnterExitAnimationLocked(getThumbnailTransitionState(enter),
860 appWidth, appHeight, transit);
861 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
862 String animName = mNextAppTransitionScaleUp ?
863 "ANIM_THUMBNAIL_SCALE_UP" : "ANIM_THUMBNAIL_SCALE_DOWN";
864 Slog.v(TAG, "applyAnimation:"
865 + " anim=" + a + " nextAppTransition=" + animName
866 + " transit=" + transit + " isEntrance=" + enter
867 + " Callers=" + Debug.getCallers(3));
868 }
869 } else if (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP ||
870 mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN) {
871 mNextAppTransitionScaleUp =
872 (mNextAppTransitionType == NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP);
873 a = createAspectScaledThumbnailEnterExitAnimationLocked(
Winson Chungfd086222014-05-13 15:49:42 -0700874 getThumbnailTransitionState(enter), appWidth, appHeight, orientation,
Winson Chungae084412014-05-20 14:17:22 -0700875 transit, containingFrame, contentInsets, isFullScreen);
Craig Mautner164d4bb2012-11-26 13:51:23 -0800876 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) {
877 String animName = mNextAppTransitionScaleUp ?
Winson Chunga4ccb862014-08-22 15:26:27 -0700878 "ANIM_THUMBNAIL_ASPECT_SCALE_UP" : "ANIM_THUMBNAIL_ASPECT_SCALE_DOWN";
Craig Mautner164d4bb2012-11-26 13:51:23 -0800879 Slog.v(TAG, "applyAnimation:"
880 + " anim=" + a + " nextAppTransition=" + animName
881 + " transit=" + transit + " isEntrance=" + enter
882 + " Callers=" + Debug.getCallers(3));
883 }
884 } else {
885 int animAttr = 0;
886 switch (transit) {
Craig Mautner4b71aa12012-12-27 17:20:01 -0800887 case TRANSIT_ACTIVITY_OPEN:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800888 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800889 ? WindowAnimation_activityOpenEnterAnimation
890 : WindowAnimation_activityOpenExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800891 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800892 case TRANSIT_ACTIVITY_CLOSE:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800893 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800894 ? WindowAnimation_activityCloseEnterAnimation
895 : WindowAnimation_activityCloseExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800896 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800897 case TRANSIT_TASK_OPEN:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800898 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800899 ? WindowAnimation_taskOpenEnterAnimation
900 : WindowAnimation_taskOpenExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800901 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800902 case TRANSIT_TASK_CLOSE:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800903 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800904 ? WindowAnimation_taskCloseEnterAnimation
905 : WindowAnimation_taskCloseExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800906 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800907 case TRANSIT_TASK_TO_FRONT:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800908 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800909 ? WindowAnimation_taskToFrontEnterAnimation
910 : WindowAnimation_taskToFrontExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800911 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800912 case TRANSIT_TASK_TO_BACK:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800913 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800914 ? WindowAnimation_taskToBackEnterAnimation
915 : WindowAnimation_taskToBackExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800916 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800917 case TRANSIT_WALLPAPER_OPEN:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800918 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800919 ? WindowAnimation_wallpaperOpenEnterAnimation
920 : WindowAnimation_wallpaperOpenExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800921 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800922 case TRANSIT_WALLPAPER_CLOSE:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800923 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800924 ? WindowAnimation_wallpaperCloseEnterAnimation
925 : WindowAnimation_wallpaperCloseExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800926 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800927 case TRANSIT_WALLPAPER_INTRA_OPEN:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800928 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800929 ? WindowAnimation_wallpaperIntraOpenEnterAnimation
930 : WindowAnimation_wallpaperIntraOpenExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800931 break;
Craig Mautner4b71aa12012-12-27 17:20:01 -0800932 case TRANSIT_WALLPAPER_INTRA_CLOSE:
Craig Mautner164d4bb2012-11-26 13:51:23 -0800933 animAttr = enter
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800934 ? WindowAnimation_wallpaperIntraCloseEnterAnimation
935 : WindowAnimation_wallpaperIntraCloseExitAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800936 break;
Craig Mautnerbb742462014-07-07 15:28:55 -0700937 case TRANSIT_TASK_OPEN_BEHIND:
938 animAttr = enter
939 ? WindowAnimation_launchTaskBehindSourceAnimation
Craig Mautner3b2cd1d2014-08-25 14:25:54 -0700940 : WindowAnimation_launchTaskBehindTargetAnimation;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800941 }
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700942 a = animAttr != 0 ? loadAnimationAttr(lp, animAttr) : null;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800943 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
944 "applyAnimation:"
945 + " anim=" + a
946 + " animAttr=0x" + Integer.toHexString(animAttr)
947 + " transit=" + transit + " isEntrance=" + enter
948 + " Callers=" + Debug.getCallers(3));
949 }
950 return a;
951 }
952
953 void postAnimationCallback() {
954 if (mNextAppTransitionCallback != null) {
955 mH.sendMessage(mH.obtainMessage(H.DO_ANIMATION_CALLBACK, mNextAppTransitionCallback));
956 mNextAppTransitionCallback = null;
957 }
958 }
959
960 void overridePendingAppTransition(String packageName, int enterAnim, int exitAnim,
961 IRemoteCallback startedCallback) {
962 if (isTransitionSet()) {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800963 mNextAppTransitionType = NEXT_TRANSIT_TYPE_CUSTOM;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800964 mNextAppTransitionPackage = packageName;
965 mNextAppTransitionThumbnail = null;
966 mNextAppTransitionEnter = enterAnim;
967 mNextAppTransitionExit = exitAnim;
968 postAnimationCallback();
969 mNextAppTransitionCallback = startedCallback;
970 } else {
971 postAnimationCallback();
972 }
973 }
974
975 void overridePendingAppTransitionScaleUp(int startX, int startY, int startWidth,
976 int startHeight) {
977 if (isTransitionSet()) {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800978 mNextAppTransitionType = NEXT_TRANSIT_TYPE_SCALE_UP;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800979 mNextAppTransitionPackage = null;
980 mNextAppTransitionThumbnail = null;
981 mNextAppTransitionStartX = startX;
982 mNextAppTransitionStartY = startY;
983 mNextAppTransitionStartWidth = startWidth;
984 mNextAppTransitionStartHeight = startHeight;
985 postAnimationCallback();
986 mNextAppTransitionCallback = null;
987 }
988 }
989
990 void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX, int startY,
991 IRemoteCallback startedCallback, boolean scaleUp) {
992 if (isTransitionSet()) {
Craig Mautner9a29a5d2012-12-27 19:03:40 -0800993 mNextAppTransitionType = scaleUp ? NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP
994 : NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN;
Craig Mautner164d4bb2012-11-26 13:51:23 -0800995 mNextAppTransitionPackage = null;
996 mNextAppTransitionThumbnail = srcThumb;
997 mNextAppTransitionScaleUp = scaleUp;
998 mNextAppTransitionStartX = startX;
999 mNextAppTransitionStartY = startY;
1000 postAnimationCallback();
1001 mNextAppTransitionCallback = startedCallback;
1002 } else {
1003 postAnimationCallback();
1004 }
1005 }
1006
Winson Chunga4ccb862014-08-22 15:26:27 -07001007 void overridePendingAppTransitionAspectScaledThumb(Bitmap srcThumb, int startX, int startY,
Winson Chung2e7f3bd2014-09-05 13:17:22 +02001008 int targetWidth, int targetHeight, IRemoteCallback startedCallback, boolean scaleUp) {
Winson Chunga4ccb862014-08-22 15:26:27 -07001009 if (isTransitionSet()) {
1010 mNextAppTransitionType = scaleUp ? NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP
1011 : NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN;
1012 mNextAppTransitionPackage = null;
1013 mNextAppTransitionThumbnail = srcThumb;
1014 mNextAppTransitionScaleUp = scaleUp;
1015 mNextAppTransitionStartX = startX;
1016 mNextAppTransitionStartY = startY;
Winson Chung2e7f3bd2014-09-05 13:17:22 +02001017 mNextAppTransitionStartWidth = targetWidth;
1018 mNextAppTransitionStartHeight = targetHeight;
Winson Chunga4ccb862014-08-22 15:26:27 -07001019 postAnimationCallback();
1020 mNextAppTransitionCallback = startedCallback;
1021 } else {
1022 postAnimationCallback();
1023 }
1024 }
1025
Winson Chung044d5292014-11-06 11:05:19 -08001026 void overrideInPlaceAppTransition(String packageName, int anim) {
1027 if (isTransitionSet()) {
1028 mNextAppTransitionType = NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE;
1029 mNextAppTransitionPackage = packageName;
1030 mNextAppTransitionInPlace = anim;
1031 } else {
1032 postAnimationCallback();
1033 }
1034 }
1035
Craig Mautner164d4bb2012-11-26 13:51:23 -08001036 @Override
1037 public String toString() {
1038 return "mNextAppTransition=0x" + Integer.toHexString(mNextAppTransition);
1039 }
1040
Craig Mautner4b71aa12012-12-27 17:20:01 -08001041 /**
1042 * Returns the human readable name of a window transition.
1043 *
1044 * @param transition The window transition.
1045 * @return The transition symbolic name.
1046 */
1047 public static String appTransitionToString(int transition) {
1048 switch (transition) {
1049 case TRANSIT_UNSET: {
1050 return "TRANSIT_UNSET";
1051 }
1052 case TRANSIT_NONE: {
1053 return "TRANSIT_NONE";
1054 }
Craig Mautner4b71aa12012-12-27 17:20:01 -08001055 case TRANSIT_ACTIVITY_OPEN: {
1056 return "TRANSIT_ACTIVITY_OPEN";
1057 }
1058 case TRANSIT_ACTIVITY_CLOSE: {
1059 return "TRANSIT_ACTIVITY_CLOSE";
1060 }
1061 case TRANSIT_TASK_OPEN: {
1062 return "TRANSIT_TASK_OPEN";
1063 }
1064 case TRANSIT_TASK_CLOSE: {
1065 return "TRANSIT_TASK_CLOSE";
1066 }
1067 case TRANSIT_TASK_TO_FRONT: {
1068 return "TRANSIT_TASK_TO_FRONT";
1069 }
1070 case TRANSIT_TASK_TO_BACK: {
1071 return "TRANSIT_TASK_TO_BACK";
1072 }
1073 case TRANSIT_WALLPAPER_CLOSE: {
1074 return "TRANSIT_WALLPAPER_CLOSE";
1075 }
1076 case TRANSIT_WALLPAPER_OPEN: {
1077 return "TRANSIT_WALLPAPER_OPEN";
1078 }
1079 case TRANSIT_WALLPAPER_INTRA_OPEN: {
1080 return "TRANSIT_WALLPAPER_INTRA_OPEN";
1081 }
1082 case TRANSIT_WALLPAPER_INTRA_CLOSE: {
1083 return "TRANSIT_WALLPAPER_INTRA_CLOSE";
1084 }
Craig Mautnerbb742462014-07-07 15:28:55 -07001085 case TRANSIT_TASK_OPEN_BEHIND: {
1086 return "TRANSIT_TASK_OPEN_BEHIND";
1087 }
Craig Mautner4b71aa12012-12-27 17:20:01 -08001088 default: {
1089 return "<UNKNOWN>";
1090 }
1091 }
1092 }
1093
Craig Mautner9a29a5d2012-12-27 19:03:40 -08001094 private String appStateToString() {
1095 switch (mAppTransitionState) {
1096 case APP_STATE_IDLE:
1097 return "APP_STATE_IDLE";
1098 case APP_STATE_READY:
1099 return "APP_STATE_READY";
1100 case APP_STATE_RUNNING:
1101 return "APP_STATE_RUNNING";
1102 case APP_STATE_TIMEOUT:
1103 return "APP_STATE_TIMEOUT";
1104 default:
1105 return "unknown state=" + mAppTransitionState;
1106 }
1107 }
1108
1109 private String transitTypeToString() {
1110 switch (mNextAppTransitionType) {
1111 case NEXT_TRANSIT_TYPE_NONE:
1112 return "NEXT_TRANSIT_TYPE_NONE";
1113 case NEXT_TRANSIT_TYPE_CUSTOM:
1114 return "NEXT_TRANSIT_TYPE_CUSTOM";
Winson Chung044d5292014-11-06 11:05:19 -08001115 case NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE:
1116 return "NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE";
Craig Mautner9a29a5d2012-12-27 19:03:40 -08001117 case NEXT_TRANSIT_TYPE_SCALE_UP:
1118 return "NEXT_TRANSIT_TYPE_SCALE_UP";
1119 case NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP:
1120 return "NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP";
1121 case NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN:
1122 return "NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN";
Winson Chunga4ccb862014-08-22 15:26:27 -07001123 case NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP:
1124 return "NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP";
1125 case NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN:
1126 return "NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN";
Craig Mautner9a29a5d2012-12-27 19:03:40 -08001127 default:
1128 return "unknown type=" + mNextAppTransitionType;
1129 }
1130 }
1131
Craig Mautner164d4bb2012-11-26 13:51:23 -08001132 @Override
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001133 public void dump(PrintWriter pw, String prefix) {
1134 pw.print(prefix); pw.println(this);
1135 pw.print(prefix); pw.print("mAppTransitionState="); pw.println(appStateToString());
Craig Mautner9a29a5d2012-12-27 19:03:40 -08001136 if (mNextAppTransitionType != NEXT_TRANSIT_TYPE_NONE) {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001137 pw.print(prefix); pw.print("mNextAppTransitionType=");
1138 pw.println(transitTypeToString());
Craig Mautner164d4bb2012-11-26 13:51:23 -08001139 }
1140 switch (mNextAppTransitionType) {
Craig Mautner9a29a5d2012-12-27 19:03:40 -08001141 case NEXT_TRANSIT_TYPE_CUSTOM:
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001142 pw.print(prefix); pw.print("mNextAppTransitionPackage=");
Craig Mautner164d4bb2012-11-26 13:51:23 -08001143 pw.println(mNextAppTransitionPackage);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001144 pw.print(prefix); pw.print("mNextAppTransitionEnter=0x");
Craig Mautner164d4bb2012-11-26 13:51:23 -08001145 pw.print(Integer.toHexString(mNextAppTransitionEnter));
1146 pw.print(" mNextAppTransitionExit=0x");
1147 pw.println(Integer.toHexString(mNextAppTransitionExit));
1148 break;
Winson Chung044d5292014-11-06 11:05:19 -08001149 case NEXT_TRANSIT_TYPE_CUSTOM_IN_PLACE:
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001150 pw.print(prefix); pw.print("mNextAppTransitionPackage=");
Winson Chung044d5292014-11-06 11:05:19 -08001151 pw.println(mNextAppTransitionPackage);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001152 pw.print(prefix); pw.print("mNextAppTransitionInPlace=0x");
Winson Chung044d5292014-11-06 11:05:19 -08001153 pw.print(Integer.toHexString(mNextAppTransitionInPlace));
1154 break;
Craig Mautner9a29a5d2012-12-27 19:03:40 -08001155 case NEXT_TRANSIT_TYPE_SCALE_UP:
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001156 pw.print(prefix); pw.print("mNextAppTransitionStartX=");
1157 pw.print(mNextAppTransitionStartX);
Craig Mautner164d4bb2012-11-26 13:51:23 -08001158 pw.print(" mNextAppTransitionStartY=");
1159 pw.println(mNextAppTransitionStartY);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001160 pw.print(prefix); pw.print("mNextAppTransitionStartWidth=");
Craig Mautner164d4bb2012-11-26 13:51:23 -08001161 pw.print(mNextAppTransitionStartWidth);
1162 pw.print(" mNextAppTransitionStartHeight=");
1163 pw.println(mNextAppTransitionStartHeight);
1164 break;
Craig Mautner9a29a5d2012-12-27 19:03:40 -08001165 case NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_UP:
1166 case NEXT_TRANSIT_TYPE_THUMBNAIL_SCALE_DOWN:
Winson Chunga4ccb862014-08-22 15:26:27 -07001167 case NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_UP:
1168 case NEXT_TRANSIT_TYPE_THUMBNAIL_ASPECT_SCALE_DOWN:
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001169 pw.print(prefix); pw.print("mNextAppTransitionThumbnail=");
Craig Mautner164d4bb2012-11-26 13:51:23 -08001170 pw.print(mNextAppTransitionThumbnail);
1171 pw.print(" mNextAppTransitionStartX=");
1172 pw.print(mNextAppTransitionStartX);
1173 pw.print(" mNextAppTransitionStartY=");
1174 pw.println(mNextAppTransitionStartY);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001175 pw.print(prefix); pw.print("mNextAppTransitionStartWidth=");
Winson Chung2e7f3bd2014-09-05 13:17:22 +02001176 pw.print(mNextAppTransitionStartWidth);
1177 pw.print(" mNextAppTransitionStartHeight=");
1178 pw.println(mNextAppTransitionStartHeight);
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001179 pw.print(prefix); pw.print("mNextAppTransitionScaleUp=");
1180 pw.println(mNextAppTransitionScaleUp);
Craig Mautner164d4bb2012-11-26 13:51:23 -08001181 break;
1182 }
1183 if (mNextAppTransitionCallback != null) {
Dianne Hackbornae6688b2015-02-11 17:02:41 -08001184 pw.print(prefix); pw.print("mNextAppTransitionCallback=");
1185 pw.println(mNextAppTransitionCallback);
Craig Mautner164d4bb2012-11-26 13:51:23 -08001186 }
1187 }
Amith Yamasani4befbec2013-07-10 16:18:01 -07001188
1189 public void setCurrentUser(int newUserId) {
1190 mCurrentUserId = newUserId;
1191 }
Craig Mautner164d4bb2012-11-26 13:51:23 -08001192}