Use vsync choreographer when moving PIP.
Bug: 36371375 Test: Enter PIP, move PIP Change-Id: I5956a3ed9e92a4cdd4bf0a55723b9f1574c1a86f
This commit is contained in:
@@ -37,10 +37,12 @@ import android.graphics.Rect;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Choreographer;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
|
|
||||||
import com.android.internal.os.BackgroundThread;
|
import com.android.internal.os.BackgroundThread;
|
||||||
import com.android.internal.policy.PipSnapAlgorithm;
|
import com.android.internal.policy.PipSnapAlgorithm;
|
||||||
|
import com.android.internal.view.SurfaceFlingerVsyncChoreographer;
|
||||||
import com.android.systemui.recents.misc.SystemServicesProxy;
|
import com.android.systemui.recents.misc.SystemServicesProxy;
|
||||||
import com.android.systemui.statusbar.FlingAnimationUtils;
|
import com.android.systemui.statusbar.FlingAnimationUtils;
|
||||||
|
|
||||||
@@ -72,6 +74,7 @@ public class PipMotionHelper {
|
|||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private IActivityManager mActivityManager;
|
private IActivityManager mActivityManager;
|
||||||
|
private SurfaceFlingerVsyncChoreographer mVsyncChoreographer;
|
||||||
private Handler mHandler;
|
private Handler mHandler;
|
||||||
|
|
||||||
private PipSnapAlgorithm mSnapAlgorithm;
|
private PipSnapAlgorithm mSnapAlgorithm;
|
||||||
@@ -96,6 +99,8 @@ public class PipMotionHelper {
|
|||||||
mActivityManager = activityManager;
|
mActivityManager = activityManager;
|
||||||
mSnapAlgorithm = snapAlgorithm;
|
mSnapAlgorithm = snapAlgorithm;
|
||||||
mFlingAnimationUtils = flingAnimationUtils;
|
mFlingAnimationUtils = flingAnimationUtils;
|
||||||
|
mVsyncChoreographer = new SurfaceFlingerVsyncChoreographer(mHandler, mContext.getDisplay(),
|
||||||
|
Choreographer.getInstance());
|
||||||
onConfigurationChanged();
|
onConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +399,7 @@ public class PipMotionHelper {
|
|||||||
*/
|
*/
|
||||||
private void resizePipUnchecked(Rect toBounds) {
|
private void resizePipUnchecked(Rect toBounds) {
|
||||||
if (!toBounds.equals(mBounds)) {
|
if (!toBounds.equals(mBounds)) {
|
||||||
mHandler.post(() -> {
|
mVsyncChoreographer.scheduleAtSfVsync(() -> {
|
||||||
try {
|
try {
|
||||||
mActivityManager.resizePinnedStack(toBounds, null /* tempPinnedTaskBounds */);
|
mActivityManager.resizePinnedStack(toBounds, null /* tempPinnedTaskBounds */);
|
||||||
mBounds.set(toBounds);
|
mBounds.set(toBounds);
|
||||||
|
|||||||
Reference in New Issue
Block a user