Skip to content

Resume frame callback on host resume#47264

Closed
s77rt wants to merge 1 commit intofacebook:mainfrom
s77rt:ScheduleDispatchFrameCallback-resume
Closed

Resume frame callback on host resume#47264
s77rt wants to merge 1 commit intofacebook:mainfrom
s77rt:ScheduleDispatchFrameCallback-resume

Conversation

@s77rt
Copy link
Copy Markdown
Contributor

@s77rt s77rt commented Oct 28, 2024

Summary:

When the app goes into background the frame callback is ignored by setting the mShouldStop flag to true


However this flag is never reset even after the app is back on foreground. This made the AndroidEventBeat not ticking in as much as expected causing events not being dispatched in time. In our case the onLayout was not being dispatched unless we tap on screen invoking a manual tick.

Changelog:

[ANDROID] [FIXED] - Fix Frame Callback not being called after Host Resume

Test Plan:

  1. Add log line __android_log_print(ANDROID_LOG_DEBUG, "s77rt", "AndroidEventBeat::tick"); in packages/react-native/ReactAndroid/src/main/jni/react/fabric/AndroidEventBeat.cpp (tick method)
  2. Open RN-Tester
  3. Verify AndroidEventBeat::tick is logged for every frame
  4. Put app into background
  5. Verify no AndroidEventBeat::tick is logged
  6. Open app again
  7. Verify AndroidEventBeat::tick is logged for every frame
Before After
Screen.Recording.2024-10-28.at.9.02.05.PM-1.mov
Screen.Recording.2024-10-28.at.9.02.54.PM-1.mov
Screen.Recording.2024-10-28.at.9.25.54.PM-1.mov
Screen.Recording.2024-10-28.at.9.29.45.PM-1.mov

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 28, 2024
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 28, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Oct 29, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@javache merged this pull request in e8f8ee3.

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @s77rt in e8f8ee3

When will my fix make it into a release? | How to file a pick request?

@s77rt
Copy link
Copy Markdown
Contributor Author

s77rt commented Oct 29, 2024

@javache @NickGerleman Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants