Skip to content
This repository was archived by the owner on Jun 16, 2023. It is now read-only.

Fix Android camera unmount ANR or Freezes #3331

Conversation

cristianoccazinsp
Copy link
Contributor

Remove the mCamera.setPreviewDisplay call on surface destroy as it may cause ANRs or slow down the UI when unmounting.

The side effect of this is a nasty warning BufferQueue has been abandoned that can be ignored.

I will be testing this on various other devices to ensure the buffer warning is still a warning and does not cause surprise crash on different devices.

…may cause ANRs or slow down the UI when unmounting. The side effect of this is a nasty warning `BufferQueue has been abandoned` that can be ignored.
@fedeerbes
Copy link

Hi @cristianoccazinsp we're experiencing some issues on low-mid end devices related to unmount of RNCamera. #3346
I tried your solution on one of my Samsung SM-J600G devices (where the problem is reproducible) and it works. Do you think we can make this PR open to review/discussion?

@MarcoScabbiolo @fabriziobertoglio1987 sorry to tag you folks, but what do you think about this PR?

@cristianoccazinsp
Copy link
Contributor Author

I haven’t seen issues with these changes neither, but we still haven’t got enough users to test the latest update with this change, reason I’m waiting to see if another ANR pops up.

How were you able to reproduce the issue? I haven’t been able to consistently reproduce it, all I know is that it randomly happens.

@fedeerbes
Copy link

@cristianoccazinsp take a look at #3346 there I left an explanation of what we're doing. But in short we have consecutive screens, each one with an RNCamera component. If the user goes back or forth in the navigation even if we unmount the RNCamera, we get this error on some devices.

@cristianoccazinsp cristianoccazinsp marked this pull request as ready for review September 21, 2021 19:04
@MateusAndrade
Copy link
Collaborator

Do you think we can follow with this @cristianoccazinsp ? We can easily revert this if with start noticing any problem.

@cristianoccazinsp
Copy link
Contributor Author

@MateusAndrade yes, I think it is safe to merge and release. With Android nothing is ever 100% sure, so I can't guarantee that it won't fail on some devices.

@MateusAndrade MateusAndrade merged commit 9c0b87e into react-native-camera:master Sep 21, 2021
n1ru4l pushed a commit that referenced this pull request Sep 21, 2021
## [4.2.1](v4.2.0...v4.2.1) (2021-09-21)

### Bug Fixes

* Remove the `mCamera.setPreviewDisplay` call on surface destroy as it may cause ANRs or slow down the UI when unmounting.  The side effect of this is a nasty warning `BufferQueue has been abandoned` that can be ignored. ([#3331](#3331)) ([9c0b87e](9c0b87e))
@n1ru4l
Copy link
Collaborator

n1ru4l commented Sep 21, 2021

🎉 This PR is included in version 4.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@cristianoccazinsp cristianoccazinsp deleted the fix-android-unmount-anr branch October 15, 2021 20:07
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants