Skip to content

Commit

Permalink
fix(android): revert sInForeground impl
Browse files Browse the repository at this point in the history
  • Loading branch information
siguangli2018 authored and siguangli committed Oct 10, 2023
1 parent 3523c95 commit ce62a52
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
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

0 comments on commit ce62a52

Please sign in to comment.