Skip to content

Hang problem in CameraActivity #29

Open

Description

@brok85

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.

Activity

  1. Skykai521 commented on Jan 15, 2016

    @Skykai521
    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!

  2. brok85 commented on May 4, 2016

    @brok85
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions