Replace consumeNextDraw with SurfaceSyncer

Test: Builds
Bug: 200284684
Change-Id: I46e9cd89fd6b7c767bb867205400197b305e86a8
This commit is contained in:
chaviw
2022-03-18 16:20:42 -05:00
parent a66bbdab86
commit 29b8135260

View File

@@ -36,6 +36,7 @@ import android.view.MotionEvent;
import android.view.SurfaceControl;
import android.view.View;
import android.view.ViewRootImpl;
import android.window.SurfaceSyncer;
import androidx.annotation.Nullable;
@@ -476,6 +477,7 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
tx.setScale(dragSurface, scale, scale);
tx.setAlpha(dragSurface, alpha);
tx.apply();
tx.close();
}
});
mReturnAnimator.addListener(new AnimatorListenerAdapter() {
@@ -499,12 +501,14 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
maybeOnDragEnd();
// Synchronize removing the drag surface with the next draw after calling
// maybeOnDragEnd()
viewRoot.consumeNextDraw((transaction) -> {
transaction.remove(dragSurface);
transaction.apply();
tx.close();
});
viewRoot.getView().invalidate();
SurfaceControl.Transaction transaction = new SurfaceControl.Transaction();
transaction.remove(dragSurface);
SurfaceSyncer syncer = new SurfaceSyncer();
int syncId = syncer.setupSync(transaction::close);
syncer.addToSync(syncId, viewRoot.getView());
syncer.addTransactionToSync(syncId, transaction);
syncer.markSyncReady(syncId);
mReturnAnimator = null;
}
});