Fix janky multi-window entry animation

- Add tracing when drawing ImageWallpaper.
- Don't force a redraw in onSurfaceRedrawNeeded. This only adds
another unnecessary draw and doesn't do anything useful.
onSurfaceRedrawNeeded is only here so the client can block.
- Delay entrance animation by one frame so wallpaper can be drawn
before the transition is starting.
- Add some delay for animating the tasks up in recents to match that
delay (it wasn't matched before at all).
- Fix an issue where launchedFromHome was wrong while docking.

Bug: 28769940
Change-Id: I2b763ed40078541328a1e04ffecf5b0a520fe019
This commit is contained in:
Jorim Jaggi
2016-05-13 18:21:48 -07:00
parent 4570df8fd5
commit c5887ea7a0
4 changed files with 13 additions and 9 deletions

View File

@@ -31,6 +31,7 @@ import android.graphics.Region.Op;
import android.opengl.GLUtils; import android.opengl.GLUtils;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.os.Trace;
import android.renderscript.Matrix4f; import android.renderscript.Matrix4f;
import android.service.wallpaper.WallpaperService; import android.service.wallpaper.WallpaperService;
import android.util.Log; import android.util.Log;
@@ -310,8 +311,6 @@ public class ImageWallpaper extends WallpaperService {
Log.d(TAG, "onSurfaceRedrawNeeded"); Log.d(TAG, "onSurfaceRedrawNeeded");
} }
super.onSurfaceRedrawNeeded(holder); super.onSurfaceRedrawNeeded(holder);
mLastSurfaceHeight = mLastSurfaceWidth = -1;
drawFrame(); drawFrame();
} }
@@ -325,6 +324,7 @@ public class ImageWallpaper extends WallpaperService {
return; return;
} }
try { try {
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "drawWallpaper");
DisplayInfo displayInfo = getDefaultDisplayInfo(); DisplayInfo displayInfo = getDefaultDisplayInfo();
int newRotation = displayInfo.rotation; int newRotation = displayInfo.rotation;
@@ -419,6 +419,7 @@ public class ImageWallpaper extends WallpaperService {
drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels); drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels);
} }
} finally { } finally {
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
if (FIXED_SIZED_SURFACE && !mIsHwAccelerated) { if (FIXED_SIZED_SURFACE && !mIsHwAccelerated) {
// If the surface is fixed-size, we should only need to // If the surface is fixed-size, we should only need to
// draw it once and then we'll let the window manager // draw it once and then we'll let the window manager

View File

@@ -826,7 +826,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
boolean useThumbnailTransition = (runningTask != null) && !isHomeStackVisible && hasRecentTasks; boolean useThumbnailTransition = (runningTask != null) && !isHomeStackVisible && hasRecentTasks;
// Update the launch state that we need in updateHeaderBarLayout() // Update the launch state that we need in updateHeaderBarLayout()
launchState.launchedFromHome = !useThumbnailTransition; launchState.launchedFromHome = !useThumbnailTransition && !mLaunchedWhileDocking;
launchState.launchedFromApp = useThumbnailTransition || mLaunchedWhileDocking; launchState.launchedFromApp = useThumbnailTransition || mLaunchedWhileDocking;
launchState.launchedViaDockGesture = mLaunchedWhileDocking; launchState.launchedViaDockGesture = mLaunchedWhileDocking;
launchState.launchedViaDragGesture = mDraggingInRecents; launchState.launchedViaDragGesture = mDraggingInRecents;

View File

@@ -276,12 +276,13 @@ public class TaskStackAnimationHelper {
tv.onStartFrontTaskEnterAnimation(mStackView.mScreenPinningEnabled); tv.onStartFrontTaskEnterAnimation(mStackView.mScreenPinningEnabled);
} }
} else if (launchState.launchedViaDockGesture) { } else if (launchState.launchedViaDockGesture) {
// Animate the tasks up // Animate the tasks up - add some delay to match the divider animation
AnimationProps taskAnimation = new AnimationProps() AnimationProps taskAnimation = new AnimationProps()
.setDuration(AnimationProps.BOUNDS, dockGestureAnimDuration + .setDuration(AnimationProps.BOUNDS, dockGestureAnimDuration +
(taskIndexFromBack * DOUBLE_FRAME_OFFSET_MS)) (taskIndexFromBack * DOUBLE_FRAME_OFFSET_MS))
.setInterpolator(AnimationProps.BOUNDS, .setInterpolator(AnimationProps.BOUNDS,
ENTER_WHILE_DOCKING_INTERPOLATOR) ENTER_WHILE_DOCKING_INTERPOLATOR)
.setStartDelay(AnimationProps.BOUNDS, 48)
.setListener(postAnimationTrigger.decrementOnAnimationEnd()); .setListener(postAnimationTrigger.decrementOnAnimationEnd());
postAnimationTrigger.increment(); postAnimationTrigger.increment();
mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation); mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);

View File

@@ -1075,11 +1075,13 @@ public class DividerView extends FrameLayout implements OnTouchListener,
mAnimateAfterRecentsDrawn = false; mAnimateAfterRecentsDrawn = false;
updateDockSide(); updateDockSide();
// Delay switching resizing mode because this might cause jank in recents animation post(() -> {
// that's long than this animation. // Delay switching resizing mode because this might cause jank in recents animation
stopDragging(getCurrentPosition(), mSnapAlgorithm.getMiddleTarget(), // that's longer than this animation.
mLongPressEntraceAnimDuration, Interpolators.FAST_OUT_SLOW_IN, stopDragging(getCurrentPosition(), mSnapAlgorithm.getMiddleTarget(),
200 /* endDelay */); mLongPressEntraceAnimDuration, Interpolators.FAST_OUT_SLOW_IN,
200 /* endDelay */);
});
} }
if (mGrowAfterRecentsDrawn) { if (mGrowAfterRecentsDrawn) {
mGrowAfterRecentsDrawn = false; mGrowAfterRecentsDrawn = false;