Mike Billau created CB-5052: ------------------------------- Summary: Andorid's media capture doesn't use ThreadPool Key: CB-5052 URL: https://issues.apache.org/jira/browse/CB-5052 Project: Apache Cordova Issue Type: Bug Components: Android, Plugin Media Capture Environment: Windows 7 Reporter: Mike Billau
From: http://stackoverflow.com/questions/19282318/phongap-capture-plugin-crashes-android Taking a picture with media-capture plugin will crash the app when the plugin returns from the camera app. Reproduced with Nexus 7 on 4.2, I used the simple Full Example from the docs. Got this in logcat: {noformat} I/ActivityManager( 476): Displayed com.google.android.gallery3d/com.android.camera.CameraActivity: +1s80ms W/IInputConnectionWrapper(31792): showStatusIcon on inactive InputConnection V/CAM_PhotoModule(29129): Preview size is 960x720 V/CAM_PhotoModule(29129): onShutterButtonClick: mCameraState=1 E/NvOmxCamera( 128): OMX_ERRORTYPE android::NvOmxCamera::getCameraStereoMode(NvxComponent*, NvOmxCameraUserStereoMode&): Error: invalid NVX mode 0. E/NvOmxCamera( 128): OMX_ERRORTYPE android::NvOmxCamera::getCameraStereoModeAndCaptureInfo(NvxComponent*, NvOmxCameraUserStereoMode&, NVX_STEREOCAPTUREINFO&): getCameraStereoMode failed with 0x00000000 D/NvOsDebugPrintf( 128): NvMMLiteJPEGEncSetAttribute: Incorrect value 0 for stereo capture type E/NvOmxCameraSettings( 128): OMX_ERRORTYPE android::programStereoInfo(OMX_HANDLETYPE, const NVX_STEREOCAPTUREINFO&, android::NvxWrappers*): pNvxWrappers->OMX_SetConfigIL failed with 0x80001005 V/CAM_PhotoModule(29129): mShutterToRawCallbackTime = 1381355622457ms V/CAM_PhotoModule(29129): mShutterLag = 422ms D/dalvikvm(29129): GC_FOR_ALLOC freed 679K, 15% free 12222K/14236K, paused 27ms, total 28ms I/dalvikvm-heap(29129): Grow heap (frag case) to 13.063MB for 1036816-byte allocation D/NvOsDebugPrintf( 128): Tryproc: INBuffer-Values of Width and Height 1280 960 D/dalvikvm(29129): GC_FOR_ALLOC freed 1K, 14% free 13233K/15252K, paused 33ms, total 33ms V/CAM_PhotoModule(29129): mShutterToPostViewCallbackTime = 88ms V/CAM_PhotoModule(29129): mShutterToRawCallbackTime = 109ms V/CAM_PhotoModule(29129): mPictureDisplayedToJpegCallbackTime = 25ms D/CameraStorage(29129): External storage state=mounted V/CAM_PhotoModule(29129): mJpegCallbackFinishTime = 2ms I/MPL-storeload( 476): mpl state size = 5512 E/MPL-storeload( 476): calData from inv_save_mpl_states, size=2 I/MPL-storeload( 476): cal data size to write = 5512 I/MPL-storeload( 476): Bytes written = 5512 V/CAM_PhotoModule(29129): stopPreview D/ ( 128): Camera fd close (MI1040) E/NvOmxCamera( 128): Already called release() I/CameraClient( 128): Destroying camera 0 W/NvOmxCamera( 128): Already called release() D/MediaProvider(27296): object removed 2270 W/AudioFlinger( 128): session id 453 not found for pid 128 W/AudioFlinger( 128): session id 454 not found for pid 128 D/CordovaActivity(31792): Request code = 1 D/AndroidRuntime(31792): Shutting down VM W/dalvikvm(31792): threadid=1: thread exiting with uncaught exception (group=0x410ee930) E/AndroidRuntime(31792): FATAL EXCEPTION: main E/AndroidRuntime(31792): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=null} to activity {io.cordova.hellocordova/io.cordova.hellocordova.HelloCordova}: java.lang.IllegalStateException: Do not perform IO operations on the UI thread. Use Cordova Interface.getThreadPool() instead. E/AndroidRuntime(31792): at android.app.ActivityThread.deliverResults(ActivityThread.java:3319) E/AndroidRuntime(31792): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3362) E/AndroidRuntime(31792): at android.app.ActivityThread.access$1100(ActivityThread.java:141) E/AndroidRuntime(31792): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1282) E/AndroidRuntime(31792): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime(31792): at android.os.Looper.loop(Looper.java:137) E/AndroidRuntime(31792): at android.app.ActivityThread.main(ActivityThread.java:5041) E/AndroidRuntime(31792): at java.lang.reflect.Method.invokeNative(Native Method) E/AndroidRuntime(31792): at java.lang.reflect.Method.invoke(Method.java:511) E/AndroidRuntime(31792): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) E/AndroidRuntime(31792): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) E/AndroidRuntime(31792): at dalvik.system.NativeStart.main(Native Method) E/AndroidRuntime(31792): Caused by: java.lang.IllegalStateException: Do not perform IO operations on the UI thread. Use CordovaInterface.getThreadPool() instead. E/AndroidRuntime(31792): at org.apache.cordova.CordovaResourceApi.assertBackgroundThread(CordovaResourceApi.java:351) E/AndroidRuntime(31792): at org.apache.cordova.CordovaResourceApi.mapUriToFile(CordovaResourceApi.java:130) E/AndroidRuntime(31792): at org.apache.cordova.mediacapture.Capture.createMediaFile(Capture.java:378) E/AndroidRuntime(31792): at org.apache.cordova.mediacapture.Capture.onActivityResult(Capture.java:309) E/AndroidRuntime(31792): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:915) E/AndroidRuntime(31792): at android.app.Activity.dispatchActivityResult(Activity.java:5293) E/AndroidRuntime(31792): at android.app.ActivityThread.deliverResults(ActivityThread.java:3315) E/AndroidRuntime(31792): ... 11 more W/ActivityManager( 476): Force finishing activity io.cordova.hellocordova/.HelloCordova D/dalvikvm( 476): GC_EXPLICIT freed 946K, 31% free 18202K/26088K, paused 8ms+7ms, total 115ms D/dalvikvm(27296): GC_CONCURRENT freed 307K, 8% free 7791K/8440K, paused 3ms+6ms, total 50ms W/ActivityManager( 476): Activity pause timeout for ActivityRecord{42431bc0 u0 io.cordova.hellocordova/.HelloCordova} V/StateManager(29129): destroy W/ActivityManager( 476): Activity destroy timeout for ActivityRecord{42431bc0 u0 io.cordova.hellocordova/.HelloCordova} I/qtaguid (25775): Failed write_ctrl(u 74) res=-1 errno=22 I/qtaguid (25775): Untagging socket 74 failed errno=-22 W/NetworkManagementSocketTagger(25775): untagSocket(74) failed with errno -22 D/dalvikvm( 476): GC_EXPLICIT freed 259K, 31% free 18181K/26088K, paused 5ms+7ms, total 83ms I/Process (31792): Sending signal. PID: 31792 SIG: 9 I/WindowState( 476): WIN DEATH: Window{4183ecb0 u0 io.cordova.hellocordova/io.cordova.hellocordova.HelloCordova} I/ActivityManager( 476): Process io.cordova.hellocordova (pid 31792) has died. {noformat} -- This message was sent by Atlassian JIRA (v6.1#6144)