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

Hang problem in CameraActivity #29

Open
brok85 opened this issue Jan 14, 2016 · 2 comments
Open

Hang problem in CameraActivity #29

brok85 opened this issue Jan 14, 2016 · 2 comments

Comments

@brok85
Copy link

brok85 commented Jan 14, 2016

Dear StickerCamera Developers,
I am implementing a hang-bug detection tool and I am analyzing StickerCamera (master version downloaded today) with it. I found that the main thread of StickerCamera, frequently calls:

        com.stickercamera.app.camera.ui.CameraActivity$SurfaceCallback.surfaceCreated

at line 422 which correspond to:

        android.hardware.Camera.open

and frequently calls:

        com.stickercamera.app.camera.ui.CameraActivity.initCamera

at code line 492, which correspond to

       android.hardware.Camera.startPreview.

In my experiments, the execution of those functions on the main thread may be the main cause of the eye-detectable delays (i.e., hang-bug) experienced with StickerCamera while taking pictures.

Moving work off the main thread leads to higher responsiveness of the app.The android development guide in the explanation of the "android.hardware.Camera.open" method, suggests indeed "Caution: On some devices, this method may take a long time to complete. It is best to call this method from a worker thread (possibly using AsyncTask) to avoid blocking the main application UI thread." Also, startPreview could probably be moved off the main thread to improve responsiveness of the app.

Do you think that it is possible to move off the main thread those functions to improve responsiveness?

Did you know about these two problems with your code?

Thanks for any information,
I hope I can help improve StickerCamera.

@Skykai521
Copy link
Owner

Thank you for your reporting,There are some problems with StickerCamera in camera feature,If you can fix this,please send me a pull request,Thanks!

@brok85
Copy link
Author

brok85 commented May 4, 2016

Hi,
sorry for the late reply. I will try to fix those problems soon and send you a pull request accordingly.

In the meaning time, I have found also another possible cause of hang-bugs. In particular, the following API is frequently called by the main thread while using StickerCamera:

com.common.util.ImageUtils.decodeBitmapWithSize(ImageUtils.java:130)->android.graphics.BitmapFactory.decodeFile

I think that also in this case we can fix the hang-bug by moving this API execution to a background task. What do you think?

Thanks for any information,
I hope to help improving StickerCamera

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants