Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a9716fa authored by Winson Chung's avatar Winson Chung Committed by Colin Cross
Browse files

Make Pip usage of FrameCallbackScheduler an actual class

Bug: 175330528
Test: Builds with new dynamic-animation library
Change-Id: I1632bd87a0f02940317a38a87b074d303f80b8c7
Merged-In: I1632bd87a0f02940317a38a87b074d303f80b8c7
(cherry picked from commit c6c60307)
parent 9144eaf1
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.Context;
import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Debug;
import android.os.Looper;
import android.util.Log;
import android.view.Choreographer;

@@ -94,8 +95,18 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,

    private ThreadLocal<AnimationHandler> mSfAnimationHandlerThreadLocal =
            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());
                    }

                    @Override
                    public boolean isCurrentThread() {
                        return Looper.myLooper() == initialLooper;
                    }
                };
                AnimationHandler handler = new AnimationHandler(scheduler);
                return handler;
            });