Merge "Make Pip usage of FrameCallbackScheduler an actual class" am: 5930b62e2f
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1714757 Change-Id: I70cda45c5363c90501cc5ad3ff95fa820757fe44
This commit is contained in:
@@ -23,6 +23,7 @@ import android.content.Context;
|
|||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Debug;
|
import android.os.Debug;
|
||||||
|
import android.os.Looper;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.Choreographer;
|
import android.view.Choreographer;
|
||||||
|
|
||||||
@@ -94,8 +95,18 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
|
|||||||
|
|
||||||
private ThreadLocal<AnimationHandler> mSfAnimationHandlerThreadLocal =
|
private ThreadLocal<AnimationHandler> mSfAnimationHandlerThreadLocal =
|
||||||
ThreadLocal.withInitial(() -> {
|
ThreadLocal.withInitial(() -> {
|
||||||
FrameCallbackScheduler scheduler = runnable ->
|
final Looper initialLooper = Looper.myLooper();
|
||||||
|
final FrameCallbackScheduler scheduler = new FrameCallbackScheduler() {
|
||||||
|
@Override
|
||||||
|
public void postFrameCallback(@androidx.annotation.NonNull Runnable runnable) {
|
||||||
Choreographer.getSfInstance().postFrameCallback(t -> runnable.run());
|
Choreographer.getSfInstance().postFrameCallback(t -> runnable.run());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCurrentThread() {
|
||||||
|
return Looper.myLooper() == initialLooper;
|
||||||
|
}
|
||||||
|
};
|
||||||
AnimationHandler handler = new AnimationHandler(scheduler);
|
AnimationHandler handler = new AnimationHandler(scheduler);
|
||||||
return handler;
|
return handler;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user