Titanium JIRA Archive
Appcelerator Community (AC)

[AC-5890] Android: Camera activity crashes app on some devices

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionCannot Reproduce
Resolution Date2018-11-28T22:33:16.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, camera
ReporterMichael Gangolf
AssigneeShak Hossain
Created2018-09-16T11:21:17.000+0000
Updated2018-11-28T22:33:16.000+0000

Description

Attachments

FileDateSize
test_camera.zip2018-09-20T05:35:07.000+0000710410
ti_camera_issue.mp42018-09-18T16:22:01.000+00002775275
ti_camera_issue2.mp42018-09-20T15:24:44.000+00006341178

Comments

  1. Sharif AbuDarda 2018-09-17

    Hello, I have tried to reproduce the issue in Nokia 6 Android 8.1.0. I wasn't able to reproduce the crash. The camera overlay opens fine. Is this only happening for your HTC A9? any other device this is reproducible? Thanks.
  2. Michael Gangolf 2018-09-18

    I've updated the example with a simple button to re-open the camera and added a video of my device (sorry for the rotation, it's a recording from the device with scrcpy and it rotates the screen). I've tested it on a Samsung A5 (2017) and a Moto G2 without a problem. But as you can see in the 100 comments in the old thread its happening on other devices (e.g. a Nexus 5x, Moto E, Moto G3), too. I'll try to get some other devices to record a log.
  3. Michael Gangolf 2018-09-18

    Oh and I don't even need to take a picture! I can just go back (back arrow in the Android menu) after the camera is opened and it will restart the app. So as soon as the camera is opened my app is closed. So if I add a log to the MediaModule.java the last thing I see is: activity.runOnUiThread(resultHandler); in launchNativeCamera the onResult in the CameraResultHandler is never reached. A normal camera route looks like this in the log
       [3695,3695] run
       [51,3746] resultHandler
       [10768,14514] onResult 1
       [5,14519] validateFile
       [18,14537] decode
       [13,14550] checkAndDeleteDuplicate 240107
       [114,14664] validateFile
       [0,14664] decode
       [18,14682] copyFile
       [38,14720] save file
       
  4. Sharif AbuDarda 2018-09-18

    Hello, Attach a full sample project that can be imported and run on the studio. Thanks.
  5. Michael Gangolf 2018-09-20

    Project add. Keep in mind: the log above was done in a custom SDK where I added a log in every function that is called when opening the Camera. So it won't be visibile in the test app!
  6. Rakhi Mitro 2018-09-20

    [~michael], We are unable to reproduce the issue using your sample test project. Can you please check the sample code from [here](https://gist.github.com/rakhimonimitro/20ee61c0571608a7ffee887bd2517349) and let us know how it goes?
  7. Michael Gangolf 2018-09-20

    Hi [~rmitro], same with this example: compiled, installed: working fine for 4 images (image is shown in the background) then I've closed the app and reopened it took 2 more images and then it restarts and just shows the red background without the image (like a normal app start) {noformat} [WARN] IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection [ERROR] TiMedia: (main) [39493,39493] Camera preview is not open, unable to hide [INFO] Adreno: QUALCOMM build : 6933d31, I73c5708217 [INFO] Adreno: Build Date : 12/28/16 [INFO] Adreno: OpenGL ES Shader Compiler Version: XE031.09.00.04 [INFO] Adreno: Local Branch : [INFO] Adreno: Remote Branch : quic/LA.BR.1.3.6_rb1.11 [INFO] Adreno: Remote Branch : NONE [INFO] Adreno: Reconstruct Branch : NOTHING [INFO] Choreographer: Skipped 36 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 37 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 36 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 72 frames! The application may be doing too much work on its main thread. [WARN] InputMethodManager: com.miga.testcamera spent 1594ms to start processing msg:100 [WARN] IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection [INFO] Choreographer: Skipped 53 frames! The application may be doing too much work on its main thread. [ERROR] TiMedia: (main) [11484,50977] Camera preview is not open, unable to hide [INFO] Adreno: QUALCOMM build : 6933d31, I73c5708217 [INFO] Adreno: Build Date : 12/28/16 [INFO] Adreno: OpenGL ES Shader Compiler Version: XE031.09.00.04 [INFO] Adreno: Local Branch : [INFO] Adreno: Remote Branch : quic/LA.BR.1.3.6_rb1.11 [INFO] Adreno: Remote Branch : NONE [INFO] Adreno: Reconstruct Branch : NOTHING [WARN] art: Suspending all threads took: 6.290ms [INFO] art: Background partial concurrent mark sweep GC freed 266(8KB) AllocSpace objects, 1(38MB) LOS objects, 23% free, 52MB/68MB, paused 7.126ms total 54.943ms [INFO] Choreographer: Skipped 38 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 41 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 31 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 72 frames! The application may be doing too much work on its main thread. [WARN] InputMethodManager: com.miga.testcamera spent 1408ms to start processing msg:100 [WARN] IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection [INFO] Choreographer: Skipped 39 frames! The application may be doing too much work on its main thread. [ERROR] TiMedia: (main) [17680,68657] Camera preview is not open, unable to hide [INFO] Adreno: QUALCOMM build : 6933d31, I73c5708217 [INFO] Adreno: Build Date : 12/28/16 [INFO] Adreno: OpenGL ES Shader Compiler Version: XE031.09.00.04 [INFO] Adreno: Local Branch : [INFO] Adreno: Remote Branch : quic/LA.BR.1.3.6_rb1.11 [INFO] Adreno: Remote Branch : NONE [INFO] Adreno: Reconstruct Branch : NOTHING [WARN] art: Suspending all threads took: 5.511ms [INFO] art: Background sticky concurrent mark sweep GC freed 409(53KB) AllocSpace objects, 4(80KB) LOS objects, 0% free, 90MB/90MB, paused 7.380ms total 30.791ms [INFO] Choreographer: Skipped 39 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 41 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 31 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 34 frames! The application may be doing too much work on its main thread. [WARN] InputMethodManager: com.miga.testcamera spent 806ms to start processing msg:100 [WARN] IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection [INFO] Choreographer: Skipped 41 frames! The application may be doing too much work on its main thread. [ERROR] TiMedia: (main) [9678,78335] Camera preview is not open, unable to hide [INFO] Adreno: QUALCOMM build : 6933d31, I73c5708217 [INFO] Adreno: Build Date : 12/28/16 [INFO] Adreno: OpenGL ES Shader Compiler Version: XE031.09.00.04 [INFO] Adreno: Local Branch : [INFO] Adreno: Remote Branch : quic/LA.BR.1.3.6_rb1.11 [INFO] Adreno: Remote Branch : NONE [INFO] Adreno: Reconstruct Branch : NOTHING [INFO] art: Do partial code cache collection, code=21KB, data=30KB [INFO] art: After code cache collection, code=21KB, data=30KB [INFO] art: Increasing code cache capacity to 128KB [INFO] Choreographer: Skipped 41 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 35 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 69 frames! The application may be doing too much work on its main thread. [WARN] InputMethodManager: com.miga.testcamera spent 1300ms to start processing msg:100 [WARN] IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection [INFO] Choreographer: Skipped 31 frames! The application may be doing too much work on its main thread. [ERROR] TiMedia: (main) [8108,86443] Camera preview is not open, unable to hide [INFO] Adreno: QUALCOMM build : 6933d31, I73c5708217 [INFO] Adreno: Build Date : 12/28/16 [INFO] Adreno: OpenGL ES Shader Compiler Version: XE031.09.00.04 [INFO] Adreno: Local Branch : [INFO] Adreno: Remote Branch : quic/LA.BR.1.3.6_rb1.11 [INFO] Adreno: Remote Branch : NONE [INFO] Adreno: Reconstruct Branch : NOTHING [DEBUG] TiBaseActivity: (main) [2066,88509] onBackPressed: exit [DEBUG] Window: Window is closed normally. [INFO] Choreographer: Skipped 30 frames! The application may be doing too much work on its main thread. [INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null [WARN] TiApplication: (main) [281,281] Registering module with name already in use. [INFO] TiApplication: (main) [196,477] Analytics have been disabled [INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.miga.testcamera.Test_cameraActivity@58268ef [DEBUG] Window: Checkpoint: postWindowCreated() [INFO] Adreno: QUALCOMM build : 6933d31, I73c5708217 [INFO] Adreno: Build Date : 12/28/16 [INFO] Adreno: OpenGL ES Shader Compiler Version: XE031.09.00.04 [INFO] Adreno: Local Branch : [INFO] Adreno: Remote Branch : quic/LA.BR.1.3.6_rb1.11 [INFO] Adreno: Remote Branch : NONE [INFO] Adreno: Reconstruct Branch : NOTHING [WARN] IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection [ERROR] TiMedia: (main) [6826,6826] Camera preview is not open, unable to hide [INFO] Adreno: QUALCOMM build : 6933d31, I73c5708217 [INFO] Adreno: Build Date : 12/28/16 [INFO] Adreno: OpenGL ES Shader Compiler Version: XE031.09.00.04 [INFO] Adreno: Local Branch : [INFO] Adreno: Remote Branch : quic/LA.BR.1.3.6_rb1.11 [INFO] Adreno: Remote Branch : NONE [INFO] Adreno: Reconstruct Branch : NOTHING [INFO] Choreographer: Skipped 36 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 46 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 30 frames! The application may be doing too much work on its main thread. [INFO] Choreographer: Skipped 69 frames! The application may be doing too much work on its main thread. [WARN] InputMethodManager: com.miga.testcamera spent 1545ms to start processing msg:100 [WARN] IInputConnectionWrapper: reportFullscreenMode on inexistent InputConnection [INFO] Choreographer: Skipped 49 frames! The application may be doing too much work on its main thread. {noformat} also added a new video. The app restart is not required, it sometimes happens right away when I start the app for the first time, sometimes only after a few switching of apps.
  8. Rakhi Mitro 2018-09-23

    Hello, Thanks for your feedback. Did you test using the sample code provided by us? I tested this issue and try to closed the app and reopened it took 4/5 more images and then it works as expected. Can you please share your environment details ? I am using SDK 7.4.0.GA and Huawei Y9 2018(Android 8) for testing.
  9. Michael Gangolf 2018-09-23

    As you hopefully saw in the last video I was testing your code. My details:
       Operating System
         Name                        = Fedora
         Version                     = 28
         Architecture                = 64bit
         # CPUs                      = 12
         Memory                      = 15.3GB
       
       Node.js
         Node.js Version             = 8.11.4
         npm Version                 = 5.6.0
       
       Appcelerator CLI
         Installer                   = 4.2.13
         Core Package                = 7.0.6
       
       Titanium CLI
         CLI Version                 = 5.1.1
         node-appc Version           = 0.2.44
       
       Java Development Kit
         Version                     = 1.8.0_172
         Java Home                   = /usr/java/latest
       
       
    HTC A9, 7.0
  10. Sharif AbuDarda 2018-09-23

    Hello [~michael], I tested the sample code provided by [~rmitro], I wasn't able to reproduce the issue as you described. For me, and Rakhi the app works as expected before and after closing and reopening the app. I am able to see the same behavior after the app reopens. Each time after taking the image the image is shown in the window. No red screen (like the first open). I am testing on Nokia 6 (Android 8.1.0). Can you confirm this on any Android 8 version? We need to make sure this is happing in lower version than Android 8. Thanks.

JSON Source