title: Android camera crash, repeating images, native nav buttons messed up
body: <p>I have a bar-code scanning Cordova (webview) app, and after a certain point, if I restart the barcode-scanning camera, I get a crazy crash that bricks my phone until I give the entire phone a full restart:</p>
  
  <p><img src="https://cl.ly/image/0Y2U2y3m3x3b/Image%202014-11-24%20at%207.20.54%20PM.png" alt=""></p>
  
  <p>Stats:</p>
  
  <p>Nexus 5
  Android 4.4.4
  Kernel 3.4.0-gd59db4e</p>
  
  <p>I'm using the zbar scanning lib, which uses OpenCV. </p>
  
  <p>Here's the catlog right around the time that things go haywire; once I start getting "Failed to get_buf", the repeating image effect kicks in and I have to restart my phone.</p>
  
  <p><code>
  D/mm-camera(199): module_faceproc_port_event_func:667] FD_STREAMON for stream 10004
  I/mm-camera(199): cpp_module_handle_streamon_event:1983, identity=0x10004, stream-on done
  I/mm-camera(199): isp_streamon: E, session_id = 1, stream_id = 4, stream_type = 5
  I/mm-camera(199): wb_set_params: param_id is not supported in this module
  I/mm-camera(199): wb_set_params: param_id is not supported in this module
  I/mm-camera(199): wb_set_params: param_id is not supported in this module
  D/mm-camera(199): module_faceproc_port_event_func:825] MCT_EVENT_MODULE_ISP_OUTPUT_DIM stream info 1920x1080 identity 10004 10003
  I/mm-camera(199): isp_ch_util_streamon: session_id = 1, channel_id = 3, already active.
  I/mm-camera(199): ispif_streamon: session_id = 1, active_streams = 3
  I/mm-camera(199): mct_pipeline_process_set: Stream on/off returned
  D/mm-camera-intf(186): mm_stream_qbuf: Starting poll on stream 0xb7f4c4cc type :5
  D/mm-camera-intf(186): mm_stream_qbuf: Started poll on stream 0xb7f4c4cc type :5
  D/mm-camera-intf(186): mm_stream_qbuf: Starting poll on stream 0xb7f4bda4 type :1
  D/mm-camera-intf(186): mm_stream_qbuf: Started poll on stream 0xb7f4bda4 type :1
  D/mm-camera(199): module_faceproc_client_schedule_mode:1808] apply 3 report 2 new_mode 0
  E/mm-camera-sensor(199): port_sensor_handle_upstream_module_event:1244 Reset previously set LED state!
  I/AEC_PORT(199): aec_port_proc_downstream_event: Received LED state timeout. Reset LED state!
  D/mm-camera(199): module_faceproc_client_schedule_mode:1808] apply 0 report 3 new_mode 0
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 1689470 CurPosition: 36
  D/mm-camera(199): module_faceproc_client_schedule_mode:1808] apply 1 report 0 new_mode 0
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 634118 CurPosition: 33
  D/dalvikvm(3354): GC_FOR_ALLOC freed 3373K, 35% free 17228K/26472K, paused 13ms, total 13ms
  I/dalvikvm-heap(3354): Grow heap (frag case) to 19.818MB for 3110416-byte allocation
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 602020 CurPosition: 30
  D/dalvikvm(3354): GC_FOR_ALLOC freed 0K, 24% free 20265K/26472K, paused 14ms, total 14ms
  D/dalvikvm(3354): GC_FOR_ALLOC freed 3037K, 35% free 17227K/26472K, paused 14ms, total 14ms
  I/dalvikvm-heap(3354): Grow heap (frag case) to 19.818MB for 3110416-byte allocation
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 552162 CurPosition: 27
  D/dalvikvm(3354): GC_FOR_ALLOC freed 0K, 24% free 20265K/26472K, paused 15ms, total 15ms
  E/mm-camera(199): cpp_module_process_frame_control:1458 failed: wrong queue for mct_type = 2 frame 8 exp 16
  E/mm-camera(199): cpp_module_process_frame_control:1458 failed: wrong queue for mct_type = 2 frame 8 exp 16
  E/mm-camera(199): cpp_module_process_frame_control:1458 failed: wrong queue for mct_type = 2 frame 8 exp 16
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 524040 CurPosition: 31
  D/dalvikvm(3354): GC_FOR_ALLOC freed 3037K, 35% free 17227K/26472K, paused 13ms, total 14ms
  I/dalvikvm-heap(3354): Grow heap (frag case) to 19.818MB for 3110416-byte allocation
  D/dalvikvm(3354): GC_FOR_ALLOC freed 0K, 24% free 20265K/26472K, paused 17ms, total 17ms
  E/mm-camera(199): cpp_module_process_frame_control:1458 failed: wrong queue for mct_type = 2 frame 9 exp 17
  E/mm-camera(199): cpp_module_process_frame_control:1458 failed: wrong queue for mct_type = 2 frame 9 exp 17
  E/mm-camera(199): cpp_module_process_frame_control:1458 failed: wrong queue for mct_type = 2 frame 9 exp 17
  D/dalvikvm(3354): GC_FOR_ALLOC freed 3037K, 35% free 17227K/26472K, paused 12ms, total 12ms
  I/dalvikvm-heap(3354): Grow heap (frag case) to 19.818MB for 3110416-byte allocation
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 328800 CurPosition: 33
  D/dalvikvm(3354): GC_FOR_ALLOC freed 0K, 24% free 20265K/26472K, paused 21ms, total 21ms
  D/dalvikvm(3354): GC_FOR_ALLOC freed 3037K, 35% free 17227K/26472K, paused 13ms, total 13ms
  I/dalvikvm-heap(3354): Grow heap (frag case) to 19.818MB for 3110416-byte allocation
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 370341 CurPosition: 35
  D/dalvikvm(3354): GC_FOR_ALLOC freed 0K, 24% free 20265K/26472K, paused 16ms, total 16ms
  D/dalvikvm(3354): GC_FOR_ALLOC freed 3037K, 35% free 17227K/26472K, paused 14ms, total 14ms
  I/dalvikvm-heap(3354): Grow heap (frag case) to 19.818MB for 3110416-byte allocation
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 398033 CurPosition: 37
  D/dalvikvm(3354): GC_FOR_ALLOC freed 0K, 24% free 20265K/26472K, paused 16ms, total 16ms
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 397856 CurPosition: 39
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 424101 CurPosition: 41
  D/mm-camera-intf(186): mm_stream_read_msm_frame: Stoping poll on stream 0xb7f4bda4 type :1
  D/mm-camera-intf(186): mm_stream_read_msm_frame: Stopped poll on stream 0xb7f4bda4 type :1
  D/mm-camera-intf(186): mm_stream_read_msm_frame: Stoping poll on stream 0xb7f4c4cc type :5
  D/mm-camera-intf(186): mm_stream_read_msm_frame: Stopped poll on stream 0xb7f4c4cc type :5
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 440796 CurPosition: 43
  I/mm-camera(199): af_util_cur_pos_after_lens_move: After move: FV: 438574 CurPosition: 41
  I/mm-camera(199): af_util_update_focus_status: AF Status already updated to output!Return!
  I/mm-camera(199): af_util_update_focus_status: AF Status already updated to output!Return!
  E/mm-camera(199): mct_stream_metadata_bus_msg:Failed to get_buf
  E/mm-camera(199): mct_stream_metadata_bus_msg:1259: NULL ptr
  D/mm-camera-intf(186): mm_stream_read_msm_frame: Stoping poll on stream 0xb7f4af54 type :8
  D/mm-camera-intf(186): mm_stream_read_msm_frame: Stopped poll on stream 0xb7f4af54 type :8
  E/mm-camera(199): mct_stream_metadata_bus_msg:Failed to get_buf
  E/mm-camera(199): mct_stream_metadata_bus_msg:1259: NULL ptr
  E/mm-camera(199): mct_stream_metadata_bus_msg:Failed to get_buf
  E/mm-camera(199): mct_stream_metadata_bus_msg:1259: NULL ptr
  E/mm-camera(199): mct_stream_metadata_bus_msg:Failed to get_buf
  E/mm-camera(199): mct_stream_metadata_bus_msg:1259: NULL ptr
  </code></p>
  
  <p>Any ideas?</p>