Bug 30820 - Camera2Raw sample app crashes at launch on M devices
Summary: Camera2Raw sample app crashes at launch on M devices
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 5.2
Hardware: Macintosh Mac OS
: High normal
Target Milestone: 6.0 (C6)
Assignee: Peter Collins
URL:
Depends on:
Blocks:
 
Reported: 2015-06-04 16:15 UTC by Aaron Sky
Modified: 2015-10-09 11:24 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
VERIFIED FIXED

Description Aaron Sky 2015-06-04 16:15:27 UTC
The sample app Camera2Raw, ported on the m-samples branch in monodroid-samples is crashing on launch on device with the SIGARBT error:

>06-04 15:40:27.884 22878 22878 F DEBUG   : Abort message: '* Assertion at /Users/builder/data/lanes/1196/a0fbff93/source/mono/mono/profiler/proflog.c:674, condition ji' not met`

I am able to reproduce this failure while launching via the debugger and directly from the device. I am testing on a Nexus 6 and a Nexus 5, both running the latest Android M Preview.

Logcat: https://gist.github.com/aaronsky/af0810fcf87fbce0f9b5
Sample: https://github.com/xamarin/monodroid-samples/tree/m-samples/android-m/Camera2Raw

Environment Info
---------------
Xamarin Studio
Version 6.0 (build 764)
Installation UUID: 04ab6ac1-042f-40f7-915e-ec52c1e12fdd
Runtime:
	Mono 4.0.0 ((detached/d136b79)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000143

Xamarin.Android
Version: 5.1.99.373 (Business Edition)
Android SDK: /Users/xqa-cats/Library/Android/sdk
	Supported Android versions:
		5.0 (API level 21)
		5.1 (API level 22)
Java SDK: /usr
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Comment 1 Jonathan Pryor 2015-06-04 16:42:14 UTC
This doesn't repro for me on monodroid/master (mono 4.2 base), so this seems to have been fixed already.

One oddity -- and unrelated to the crash in comment #0 -- is that after launching the app and taking a picture, if I hit the multitasking button the app crashes:

> 06-04 16:39:51.051 25393 25393 I MonoDroid: UNHANDLED EXCEPTION:
> 06-04 16:39:51.068 25393 25393 I MonoDroid: Java.Lang.RuntimeException: Exception of type 'Java.Lang.RuntimeException' was thrown.
> 06-04 16:39:51.068 25393 25393 I MonoDroid: at Camera2Raw.Camera2RawFragment.RefCountedAutoCloseable<Android.Media.ImageReader>.Close () <0x001fc>
> 06-04 16:39:51.068 25393 25393 I MonoDroid: at Camera2Raw.Camera2RawFragment.CloseCamera () [0x00071] in /Users/Shared/Dropbox/Developer/xamarin/monodroid-samples/android-m/Camera2Raw
> /Camera2Raw/Camera2RawFragment.cs:738
> 06-04 16:39:51.068 25393 25393 I MonoDroid: at Camera2Raw.Camera2RawFragment.OnPause () [0x0001a] in /Users/Shared/Dropbox/Developer/xamarin/monodroid-samples/android-m/Camera2Raw/Cam
> era2Raw/Camera2RawFragment.cs:582
> 06-04 16:39:51.068 25393 25393 I MonoDroid: at Android.App.Fragment.n_OnPause (intptr,intptr) <IL 0x0000a, 0x00037>
> 06-04 16:39:51.068 25393 25393 I MonoDroid: at (wrapper dynamic-method) System.Object.ac2a8a6c-61fb-4d26-8d68-b50d7ea631e0 (intptr,intptr) <0x0003b>
> 06-04 16:39:51.068 25393 25393 I MonoDroid:   --- End of managed exception stack trace ---
> 06-04 16:39:51.068 25393 25393 I MonoDroid: java.lang.RuntimeException: java.lang.Exception: unclosable
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at md54a660a03056bde15f47b96a50d497f79.Camera2RawFragment.n_onPause(Native Method)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at md54a660a03056bde15f47b96a50d497f79.Camera2RawFragment.onPause(Camera2RawFragment.java:57)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.Fragment.performPause(Fragment.java:2341)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:933)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1061)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1043)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.FragmentManagerImpl.dispatchPause(FragmentManager.java:1878)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.FragmentController.dispatchPause(FragmentController.java:185)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.Activity.performPause(Activity.java:6225)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1310)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3349)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3322)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3297)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.ActivityThread.-wrap13(ActivityThread.java)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.os.Handler.dispatchMessage(Handler.java:102)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.os.Looper.loop(Looper.java:148)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at android.app.ActivityThread.main(ActivityThread.java:5401)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at java.lang.reflect.Method.invoke(Native Method)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:725)
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:615)
> 06-04 16:39:51.068 25393 25393 I MonoDroid: Caused by: java.lang.Exception: unclosable
> 06-04 16:39:51.068 25393 25393 I MonoDroid:     ... 21 more
> 06-04 16:39:51.072 25393 25481 D Mono    : GC_OLD_BRIDGE num-objects 94 num_hash_entries 94 sccs size 94 init 0.00ms df1 1.10ms sort 0.05ms dfs2 1.16ms setup-cb 0.08ms free-data 0.09ms links 0/0/0/0 dfs passes 0/0
> 06-04 16:39:51.072 25393 25481 D Mono    : GC_MINOR: (Nursery full) pause 0.74ms, total 1.94ms, bridge 0.00ms promoted 1152K major 1152K los 2420K
> 06-04 16:39:51.082 25393 25393 D AndroidRuntime: Shutting down VM
> 06-04 16:39:51.086 25393 25393 E AndroidRuntime: FATAL EXCEPTION: main

Camera2RawFragment.cs:738 is:

    mJpegImageReader.Close()

Not sure if this is an app bug, an Android M bug, or something else...
Comment 3 Peter Collins 2015-07-28 15:59:44 UTC
I swear the original assert filed here was a duplicate of something else, but I
can't seem to dig it up. Regardless, I'm not able to reproduce either crash in
Comment 0 or Comment 1. Perhaps the crash in Comment #1 was due to an issue
with preview 1 that has since been resolved.

I was however able to reproduce the NRE Ram mentioned in Comment 2 on certain Lollipop devices that didn't support capturing RAW. This crash has since been fixed in:
https://github.com/xamarin/monodroid-samples/commit/9c54a1449615ddad5cb4bef4b5a344535014bd8f
Comment 4 Abhishek 2015-10-09 06:51:12 UTC
Hi @Peter

I have checked the latest update sample with the C6 build 
XamarinStudio-5.10.0.813_388e41428fb8f2910833c87fec0e7edaccd4f436
MonoFramework-MDK-4.2.1.67.macos10.xamarin.x86_29c1622b37f0a42074bb45112fbae4463e0eec12
mono-android-6.0.0-9_79b448ed03b67e956ab7904a3a43c05421c88c55.

Now this issue is working fine on Nexus 6 (Version 6.0). Here is the screencast:
http://www.screencast.com/t/qvg7dylE

But same sample deploying on Samsung Note 3 It giving the message on the device. This device does not support capturing raw photo. Could you please let me know it the expected behavior?

Thanks!.
Comment 5 Peter Collins 2015-10-09 11:18:33 UTC
There's a hardware check to determine if the API in the sample can be used or not, so that dialog will be expected behavior for somewhat older devices.
Comment 6 Abhishek 2015-10-09 11:24:11 UTC
As Per comment 5, this is an expected behavior. And this sample is working fine on Nexus 6.

Hence closing this issue.

Thanks!