@@ -512,7 +512,8 @@ public void onReceive(Context context, Intent intent) {
512512 int mNextAppTransitionType = ActivityOptions .ANIM_NONE ;
513513 String mNextAppTransitionPackage ;
514514 Bitmap mNextAppTransitionThumbnail ;
515- boolean mNextAppTransitionDelayed ;
515+ // Used for thumbnail transitions. True if we're scaling up, false if scaling down
516+ boolean mNextAppTransitionScaleUp ;
516517 IRemoteCallback mNextAppTransitionCallback ;
517518 int mNextAppTransitionEnter ;
518519 int mNextAppTransitionExit ;
@@ -3224,7 +3225,7 @@ private Animation createScaleUpAnimationLocked(int transit, boolean enter) {
32243225 }
32253226
32263227 private Animation createThumbnailAnimationLocked (int transit ,
3227- boolean enter , boolean thumb , boolean delayed ) {
3228+ boolean enter , boolean thumb , boolean scaleUp ) {
32283229 Animation a ;
32293230 final int thumbWidthI = mNextAppTransitionThumbnail .getWidth ();
32303231 final float thumbWidth = thumbWidthI > 0 ? thumbWidthI : 1 ;
@@ -3234,64 +3235,101 @@ private Animation createThumbnailAnimationLocked(int transit,
32343235 // it is the standard duration for that. Otherwise we use the longer
32353236 // task transition duration.
32363237 int duration ;
3237- int delayDuration = delayed ? 270 : 0 ;
32383238 switch (transit ) {
32393239 case WindowManagerPolicy .TRANSIT_ACTIVITY_OPEN :
32403240 case WindowManagerPolicy .TRANSIT_ACTIVITY_CLOSE :
32413241 duration = mContext .getResources ().getInteger (
32423242 com .android .internal .R .integer .config_shortAnimTime );
32433243 break ;
32443244 default :
3245- duration = delayed ? 250 : 300 ;
3245+ duration = 250 ;
32463246 break ;
32473247 }
32483248 // TOOD(multidisplay): For now assume all app animation is on the main screen.
32493249 DisplayInfo displayInfo = getDefaultDisplayInfo ();
32503250 if (thumb ) {
32513251 // Animation for zooming thumbnail from its initial size to
32523252 // filling the screen.
3253- float scaleW = displayInfo .appWidth /thumbWidth ;
3254- float scaleH = displayInfo .appHeight /thumbHeight ;
3255-
3256- Animation scale = new ScaleAnimation (1 , scaleW , 1 , scaleH ,
3257- computePivot (mNextAppTransitionStartX , 1 /scaleW ),
3258- computePivot (mNextAppTransitionStartY , 1 /scaleH ));
3259- AnimationSet set = new AnimationSet (true );
3260- Animation alpha = new AlphaAnimation (1 , 0 );
3261- scale .setDuration (duration );
3262- scale .setInterpolator (
3263- new DecelerateInterpolator (THUMBNAIL_ANIMATION_DECELERATE_FACTOR ));
3264- set .addAnimation (scale );
3265- alpha .setDuration (duration );
3266- set .addAnimation (alpha );
3267- set .setFillBefore (true );
3268- if (delayDuration > 0 ) {
3269- set .setStartOffset (delayDuration );
3253+ if (scaleUp ) {
3254+ float scaleW = displayInfo .appWidth / thumbWidth ;
3255+ float scaleH = displayInfo .appHeight / thumbHeight ;
3256+
3257+ Animation scale = new ScaleAnimation (1 , scaleW , 1 , scaleH ,
3258+ computePivot (mNextAppTransitionStartX , 1 / scaleW ),
3259+ computePivot (mNextAppTransitionStartY , 1 / scaleH ));
3260+ AnimationSet set = new AnimationSet (true );
3261+ Animation alpha = new AlphaAnimation (1 , 0 );
3262+ scale .setDuration (duration );
3263+ scale .setInterpolator (
3264+ new DecelerateInterpolator (THUMBNAIL_ANIMATION_DECELERATE_FACTOR ));
3265+ set .addAnimation (scale );
3266+ alpha .setDuration (duration );
3267+ set .addAnimation (alpha );
3268+ set .setFillBefore (true );
3269+ a = set ;
3270+ } else {
3271+ float scaleW = displayInfo .appWidth / thumbWidth ;
3272+ float scaleH = displayInfo .appHeight / thumbHeight ;
3273+
3274+ Animation scale = new ScaleAnimation (scaleW , 1 , scaleH , 1 ,
3275+ computePivot (mNextAppTransitionStartX , 1 / scaleW ),
3276+ computePivot (mNextAppTransitionStartY , 1 / scaleH ));
3277+ AnimationSet set = new AnimationSet (true );
3278+ Animation alpha = new AlphaAnimation (1 , 1 );
3279+ scale .setDuration (duration );
3280+ scale .setInterpolator (
3281+ new DecelerateInterpolator (THUMBNAIL_ANIMATION_DECELERATE_FACTOR ));
3282+ set .addAnimation (scale );
3283+ alpha .setDuration (duration );
3284+ set .addAnimation (alpha );
3285+ set .setFillBefore (true );
3286+
3287+ a = set ;
32703288 }
3271- a = set ;
32723289 } else if (enter ) {
32733290 // Entering app zooms out from the center of the thumbnail.
3274- float scaleW = thumbWidth / displayInfo .appWidth ;
3275- float scaleH = thumbHeight / displayInfo .appHeight ;
3276- Animation scale = new ScaleAnimation (scaleW , 1 , scaleH , 1 ,
3277- computePivot (mNextAppTransitionStartX , scaleW ),
3278- computePivot (mNextAppTransitionStartY , scaleH ));
3279- scale .setDuration (duration );
3280- scale .setInterpolator (
3281- new DecelerateInterpolator (THUMBNAIL_ANIMATION_DECELERATE_FACTOR ));
3282- scale .setFillBefore (true );
3283- if (delayDuration > 0 ) {
3284- scale .setStartOffset (delayDuration );
3291+ if (scaleUp ) {
3292+ float scaleW = thumbWidth / displayInfo .appWidth ;
3293+ float scaleH = thumbHeight / displayInfo .appHeight ;
3294+ Animation scale = new ScaleAnimation (scaleW , 1 , scaleH , 1 ,
3295+ computePivot (mNextAppTransitionStartX , scaleW ),
3296+ computePivot (mNextAppTransitionStartY , scaleH ));
3297+ scale .setDuration (duration );
3298+ scale .setInterpolator (
3299+ new DecelerateInterpolator (THUMBNAIL_ANIMATION_DECELERATE_FACTOR ));
3300+ scale .setFillBefore (true );
3301+ a = scale ;
3302+ } else {
3303+ // noop animation
3304+ a = new AlphaAnimation (1 , 1 );
3305+ a .setDuration (duration );
32853306 }
3286- a = scale ;
32873307 } else {
3288- if ( delayed ) {
3289- a = new AlphaAnimation ( 1 , 0 );
3290- a . setStartOffset ( 0 );
3291- a . setDuration ( delayDuration - 120 );
3292- a .setBackgroundColor ( 0xFF000000 );
3308+ // Exiting app
3309+ if ( scaleUp ) {
3310+ // noop animation
3311+ a = new AlphaAnimation ( 1 , 1 );
3312+ a .setDuration ( duration );
32933313 } else {
3294- a = createExitAnimationLocked (transit , duration );
3314+ float scaleW = thumbWidth / displayInfo .appWidth ;
3315+ float scaleH = thumbHeight / displayInfo .appHeight ;
3316+ Animation scale = new ScaleAnimation (1 , scaleW , 1 , scaleH ,
3317+ computePivot (mNextAppTransitionStartX , scaleW ),
3318+ computePivot (mNextAppTransitionStartY , scaleH ));
3319+ scale .setDuration (duration );
3320+ scale .setInterpolator (
3321+ new DecelerateInterpolator (THUMBNAIL_ANIMATION_DECELERATE_FACTOR ));
3322+ scale .setFillBefore (true );
3323+ AnimationSet set = new AnimationSet (true );
3324+ Animation alpha = new AlphaAnimation (1 , 0 );
3325+ set .addAnimation (scale );
3326+ alpha .setDuration (duration );
3327+ alpha .setInterpolator (new DecelerateInterpolator (
3328+ THUMBNAIL_ANIMATION_DECELERATE_FACTOR ));
3329+ set .addAnimation (alpha );
3330+ set .setFillBefore (true );
3331+ set .setZAdjustment (Animation .ZORDER_TOP );
3332+ a = set ;
32953333 }
32963334 }
32973335 a .setFillAfter (true );
@@ -3326,14 +3364,14 @@ private boolean applyAnimationLocked(AppWindowToken wtoken,
33263364 "applyAnimation: wtoken=" + wtoken
33273365 + " anim=" + a + " nextAppTransition=ANIM_SCALE_UP"
33283366 + " transit=" + transit + " Callers " + Debug .getCallers (3 ));
3329- } else if (mNextAppTransitionType == ActivityOptions .ANIM_THUMBNAIL ||
3330- mNextAppTransitionType == ActivityOptions .ANIM_THUMBNAIL_DELAYED ) {
3331- boolean delayed = (mNextAppTransitionType == ActivityOptions .ANIM_THUMBNAIL_DELAYED );
3332- a = createThumbnailAnimationLocked (transit , enter , false , delayed );
3367+ } else if (mNextAppTransitionType == ActivityOptions .ANIM_THUMBNAIL_SCALE_UP ||
3368+ mNextAppTransitionType == ActivityOptions .ANIM_THUMBNAIL_SCALE_DOWN ) {
3369+ boolean scaleUp = (mNextAppTransitionType == ActivityOptions .ANIM_THUMBNAIL_SCALE_UP );
3370+ a = createThumbnailAnimationLocked (transit , enter , false , scaleUp );
33333371 initialized = true ;
33343372
33353373 if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM ) {
3336- String animName = delayed ? "ANIM_THUMBNAIL_DELAYED " : "ANIM_THUMBNAIL " ;
3374+ String animName = scaleUp ? "ANIM_THUMBNAIL_SCALE_UP " : "ANIM_THUMBNAIL_SCALE_DOWN " ;
33373375 Slog .v (TAG , "applyAnimation: wtoken=" + wtoken
33383376 + " anim=" + a + " nextAppTransition=" + animName
33393377 + " transit=" + transit + " Callers " + Debug .getCallers (3 ));
@@ -4008,14 +4046,14 @@ public void overridePendingAppTransitionScaleUp(int startX, int startY, int star
40084046 }
40094047
40104048 public void overridePendingAppTransitionThumb (Bitmap srcThumb , int startX ,
4011- int startY , IRemoteCallback startedCallback , boolean delayed ) {
4049+ int startY , IRemoteCallback startedCallback , boolean scaleUp ) {
40124050 synchronized (mWindowMap ) {
40134051 if (mNextAppTransition != WindowManagerPolicy .TRANSIT_UNSET ) {
4014- mNextAppTransitionType = delayed
4015- ? ActivityOptions .ANIM_THUMBNAIL_DELAYED : ActivityOptions .ANIM_THUMBNAIL ;
4052+ mNextAppTransitionType = scaleUp
4053+ ? ActivityOptions .ANIM_THUMBNAIL_SCALE_UP : ActivityOptions .ANIM_THUMBNAIL_SCALE_DOWN ;
40164054 mNextAppTransitionPackage = null ;
40174055 mNextAppTransitionThumbnail = srcThumb ;
4018- mNextAppTransitionDelayed = delayed ;
4056+ mNextAppTransitionScaleUp = scaleUp ;
40194057 mNextAppTransitionStartX = startX ;
40204058 mNextAppTransitionStartY = startY ;
40214059 scheduleAnimationCallback (mNextAppTransitionCallback );
@@ -8392,7 +8430,7 @@ public int handleAppTransitionReadyLocked(WindowList windows) {
83928430 drawSurface .release ();
83938431 topOpeningApp .mAppAnimator .thumbnailLayer = topOpeningLayer ;
83948432 Animation anim = createThumbnailAnimationLocked (
8395- transit , true , true , mNextAppTransitionDelayed );
8433+ transit , true , true , mNextAppTransitionScaleUp );
83968434 topOpeningApp .mAppAnimator .thumbnailAnimation = anim ;
83978435 anim .restrictDuration (MAX_ANIMATION_DURATION );
83988436 anim .scaleCurrentDuration (mTransitionAnimationScale );
@@ -10163,15 +10201,15 @@ void dumpWindowsNoHeaderLocked(PrintWriter pw, boolean dumpAll,
1016310201 pw .print (" mNextAppTransitionStartHeight=" );
1016410202 pw .println (mNextAppTransitionStartHeight );
1016510203 break ;
10166- case ActivityOptions .ANIM_THUMBNAIL :
10167- case ActivityOptions .ANIM_THUMBNAIL_DELAYED :
10204+ case ActivityOptions .ANIM_THUMBNAIL_SCALE_UP :
10205+ case ActivityOptions .ANIM_THUMBNAIL_SCALE_DOWN :
1016810206 pw .print (" mNextAppTransitionThumbnail=" );
1016910207 pw .print (mNextAppTransitionThumbnail );
1017010208 pw .print (" mNextAppTransitionStartX=" );
1017110209 pw .print (mNextAppTransitionStartX );
1017210210 pw .print (" mNextAppTransitionStartY=" );
1017310211 pw .println (mNextAppTransitionStartY );
10174- pw .print (" mNextAppTransitionDelayed =" ); pw .println (mNextAppTransitionDelayed );
10212+ pw .print (" mNextAppTransitionScaleUp =" ); pw .println (mNextAppTransitionScaleUp );
1017510213 break ;
1017610214 }
1017710215 if (mNextAppTransitionCallback != null ) {
0 commit comments