Waiting until post draw before calling finish on the recent transition

Bug: 77695434
Change-Id: I7c3c668de7c3986760f26890fa062dee0ddb3805
This commit is contained in:
Sunny Goyal 2018-04-10 16:07:02 -07:00
parent eeb084cb4b
commit fceb82d4a7
2 changed files with 14 additions and 6 deletions

Binary file not shown.

View File

@ -31,6 +31,7 @@ import android.annotation.TargetApi;
import android.app.ActivityManager.RunningTaskInfo; import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Point; import android.graphics.Point;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Build; import android.os.Build;
@ -73,6 +74,7 @@ import com.android.systemui.shared.system.LatencyTrackerCompat;
import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat; import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import com.android.systemui.shared.system.TransactionCompat; import com.android.systemui.shared.system.TransactionCompat;
import com.android.systemui.shared.system.WindowCallbacksCompat;
import com.android.systemui.shared.system.WindowManagerWrapper; import com.android.systemui.shared.system.WindowManagerWrapper;
import java.util.StringJoiner; import java.util.StringJoiner;
@ -645,24 +647,30 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
synchronized (mRecentsAnimationWrapper) { synchronized (mRecentsAnimationWrapper) {
if (mRecentsAnimationWrapper.controller != null) { if (mRecentsAnimationWrapper.controller != null) {
TransactionCompat transaction = new TransactionCompat();
for (RemoteAnimationTargetCompat app : mRecentsAnimationWrapper.targets) { for (RemoteAnimationTargetCompat app : mRecentsAnimationWrapper.targets) {
if (app.mode == MODE_CLOSING) { if (app.mode == MODE_CLOSING) {
// Update the screenshot of the task // Update the screenshot of the task
ThumbnailData thumbnail = ThumbnailData thumbnail =
mRecentsAnimationWrapper.controller.screenshotTask(app.taskId); mRecentsAnimationWrapper.controller.screenshotTask(app.taskId);
TaskView taskView = mRecentsView.updateThumbnail(app.taskId, thumbnail); final TaskView taskView =
mRecentsView.updateThumbnail(app.taskId, thumbnail);
if (taskView != null) { if (taskView != null) {
taskView.setAlpha(1); taskView.setAlpha(1);
// Defer finishing the animation until the next launcher frame with the // Defer finishing the animation until the next launcher frame with the
// new thumbnail // new thumbnail
mActivityControlHelper.executeOnNextDraw(mActivity, taskView, finishTransitionPosted = new WindowCallbacksCompat(taskView) {
finishTransitionRunnable);
finishTransitionPosted = true; @Override
public void onPostDraw(Canvas canvas) {
finishTransitionRunnable.run();
detach();
}
}.attach();
break;
} }
} }
} }
transaction.apply();
} }
} }
if (!finishTransitionPosted) { if (!finishTransitionPosted) {