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:
@@ -31,6 +31,7 @@ import android.graphics.Region.Op;
|
||||
import android.opengl.GLUtils;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.renderscript.Matrix4f;
|
||||
import android.service.wallpaper.WallpaperService;
|
||||
import android.util.Log;
|
||||
@@ -310,8 +311,6 @@ public class ImageWallpaper extends WallpaperService {
|
||||
Log.d(TAG, "onSurfaceRedrawNeeded");
|
||||
}
|
||||
super.onSurfaceRedrawNeeded(holder);
|
||||
|
||||
mLastSurfaceHeight = mLastSurfaceWidth = -1;
|
||||
drawFrame();
|
||||
}
|
||||
|
||||
@@ -325,6 +324,7 @@ public class ImageWallpaper extends WallpaperService {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_VIEW, "drawWallpaper");
|
||||
DisplayInfo displayInfo = getDefaultDisplayInfo();
|
||||
int newRotation = displayInfo.rotation;
|
||||
|
||||
@@ -419,6 +419,7 @@ public class ImageWallpaper extends WallpaperService {
|
||||
drawWallpaperWithCanvas(sh, availw, availh, xPixels, yPixels);
|
||||
}
|
||||
} finally {
|
||||
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
|
||||
if (FIXED_SIZED_SURFACE && !mIsHwAccelerated) {
|
||||
// If the surface is fixed-size, we should only need to
|
||||
// draw it once and then we'll let the window manager
|
||||
|
||||
@@ -826,7 +826,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
|
||||
boolean useThumbnailTransition = (runningTask != null) && !isHomeStackVisible && hasRecentTasks;
|
||||
|
||||
// Update the launch state that we need in updateHeaderBarLayout()
|
||||
launchState.launchedFromHome = !useThumbnailTransition;
|
||||
launchState.launchedFromHome = !useThumbnailTransition && !mLaunchedWhileDocking;
|
||||
launchState.launchedFromApp = useThumbnailTransition || mLaunchedWhileDocking;
|
||||
launchState.launchedViaDockGesture = mLaunchedWhileDocking;
|
||||
launchState.launchedViaDragGesture = mDraggingInRecents;
|
||||
|
||||
@@ -276,12 +276,13 @@ public class TaskStackAnimationHelper {
|
||||
tv.onStartFrontTaskEnterAnimation(mStackView.mScreenPinningEnabled);
|
||||
}
|
||||
} else if (launchState.launchedViaDockGesture) {
|
||||
// Animate the tasks up
|
||||
// Animate the tasks up - add some delay to match the divider animation
|
||||
AnimationProps taskAnimation = new AnimationProps()
|
||||
.setDuration(AnimationProps.BOUNDS, dockGestureAnimDuration +
|
||||
(taskIndexFromBack * DOUBLE_FRAME_OFFSET_MS))
|
||||
.setInterpolator(AnimationProps.BOUNDS,
|
||||
ENTER_WHILE_DOCKING_INTERPOLATOR)
|
||||
.setStartDelay(AnimationProps.BOUNDS, 48)
|
||||
.setListener(postAnimationTrigger.decrementOnAnimationEnd());
|
||||
postAnimationTrigger.increment();
|
||||
mStackView.updateTaskViewToTransform(tv, mTmpTransform, taskAnimation);
|
||||
|
||||
@@ -1075,11 +1075,13 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
||||
mAnimateAfterRecentsDrawn = false;
|
||||
updateDockSide();
|
||||
|
||||
// Delay switching resizing mode because this might cause jank in recents animation
|
||||
// that's long than this animation.
|
||||
stopDragging(getCurrentPosition(), mSnapAlgorithm.getMiddleTarget(),
|
||||
mLongPressEntraceAnimDuration, Interpolators.FAST_OUT_SLOW_IN,
|
||||
200 /* endDelay */);
|
||||
post(() -> {
|
||||
// Delay switching resizing mode because this might cause jank in recents animation
|
||||
// that's longer than this animation.
|
||||
stopDragging(getCurrentPosition(), mSnapAlgorithm.getMiddleTarget(),
|
||||
mLongPressEntraceAnimDuration, Interpolators.FAST_OUT_SLOW_IN,
|
||||
200 /* endDelay */);
|
||||
});
|
||||
}
|
||||
if (mGrowAfterRecentsDrawn) {
|
||||
mGrowAfterRecentsDrawn = false;
|
||||
|
||||
Reference in New Issue
Block a user