Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(android): revert sInForeground impl #3543

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,6 @@ public void onResume() {
listener.onInstanceResume();
}
}
ChoreographerUtils.onResume();
}

@Override
Expand All @@ -415,7 +414,6 @@ public void onPause() {
listener.onInstancePause();
}
}
ChoreographerUtils.onPause();
}

@MainThread
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ public class ChoreographerUtils {

public static final String DO_FRAME = "frameUpdate";
private static boolean sEnablePostFrame = false;
private static boolean sInForeground = true;
private static HashMap<Integer, ArrayList<Integer>> sListeners = null;

private static void handleDoFrameCallback() {
Expand All @@ -44,27 +43,14 @@ private static void handleDoFrameCallback() {

private static void doPostFrame() {
Choreographer.FrameCallback frameCallback = frameTimeNanos -> {
if (sEnablePostFrame && sInForeground) {
if (sEnablePostFrame) {
handleDoFrameCallback();
doPostFrame();
}
};
Choreographer.getInstance().postFrameCallback(frameCallback);
}

@MainThread
public static void onResume() {
sInForeground = true;
if (sEnablePostFrame) {
doPostFrame();
}
}

@MainThread
public static void onPause() {
sInForeground = false;
}

/**
* Register frame callback listener, should call in ui thread.
*
Expand Down