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

Commit 5930b62e authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Make Pip usage of FrameCallbackScheduler an actual class"

parents df7fddd9 5a9716fa
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;
            });