Page 1 of 1

Camera already in use

Posted: 04 Feb 2017 07:36
by fagci
When I use "Take picture" action with "no user interface" option, all is ok.
But if I Send my flow to other Automagic user, he get an error, that camera already in use...

When I recreate an action, all works properly.

My device on 6 Android version, other on 4.4.2

Re: Camera already in use

Posted: 05 Feb 2017 20:26
by Martin
Hi,

Maybe one of the selected options selected on device one is not available or does not work on device two. Could you please enable Debug Log, reproduce the error on the second device and then send the log to me (menu->Manage->Log, menu->Send Log)?

Regards,
Martin

Re: Camera already in use

Posted: 06 Feb 2017 04:59
by fagci
Suppose so problem is at directory creation process, not in camera usage...
Maybe null pointer exception thrown after "Could not create directory '/storage/emulated/0'" actually?

Update: yup, getExternalStorageDir() solves it.

So, "Could not create directory" exception should be thrown first and last, I think.

Code: Select all

06.02.2017 11:53:58.687 [Camera in use test] Starting to execute flow 'Camera in use test' with Context{local{flow_name=Camera in use test,triggertime=1486356838684,trigger=Manual}}
06.02.2017 11:53:58.688 [Camera in use test] Start executing action 'Take Picture: /storage/emulated/0/picture.jpg (No user interface)'
06.02.2017 11:53:58.759 [Camera in use test] Action 'Take Picture: /storage/emulated/0/picture.jpg (No user interface)' Could not reset preview callback
06.02.2017 11:53:58.760 Could not release camera
java.lang.NullPointerException
	at ch.gridvision.ppam.androidautomagic.c.a.io$6.b(SourceFile:599)
	at ch.gridvision.ppam.androidautomagiclib.util.di$1$1.run(SourceFile:51)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5368)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
	at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
	at dalvik.system.NativeStart.main(Native Method)

06.02.2017 11:53:58.768 [Camera in use test] Action 'Take Picture: /storage/emulated/0/picture.jpg (No user interface)' Could not take picture
java.io.IOException: Could not create directory '/storage/emulated/0'
	at ch.gridvision.ppam.androidautomagic.util.di.b(SourceFile:461)
	at ch.gridvision.ppam.androidautomagic.c.a.io$6.d(SourceFile:384)
	at ch.gridvision.ppam.androidautomagic.c.a.io$6.a(SourceFile:362)
	at ch.gridvision.ppam.androidautomagiclib.util.di$1.run(SourceFile:39)
	at java.lang.Thread.run(Thread.java:841)

06.02.2017 11:53:58.781 [Camera in use test] End executing action 'Take Picture: /storage/emulated/0/picture.jpg (No user interface)' and exception Camera might be already in use
06.02.2017 11:53:58.785 [Camera in use test] Flow ends execution due to errors
06.02.2017 11:53:58.786 [Camera in use test] Error:
ch.gridvision.ppam.androidautomagiclib.util.p: Camera might be already in use
	at ch.gridvision.ppam.androidautomagic.c.a.io$6.b(SourceFile:607)
	at ch.gridvision.ppam.androidautomagiclib.util.di$1$1.run(SourceFile:51)
	at android.os.Handler.handleCallback(Handler.java:808)
	at android.os.Handler.dispatchMessage(Handler.java:103)
	at android.os.Looper.loop(Looper.java:193)
	at android.app.ActivityThread.main(ActivityThread.java:5368)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:515)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:828)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:644)
	at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
	at dalvik.system.NativeStart.main(Native Method)
Caused by: java.io.IOException: Could not create directory '/storage/emulated/0'
	at ch.gridvision.ppam.androidautomagic.util.di.b(SourceFile:461)
	at ch.gridvision.ppam.androidautomagic.c.a.io$6.d(SourceFile:384)
	at ch.gridvision.ppam.androidautomagic.c.a.io$6.a(SourceFile:362)
	at ch.gridvision.ppam.androidautomagiclib.util.di$1.run(SourceFile:39)
	at java.lang.Thread.run(Thread.java:841)

06.02.2017 11:53:58.798 [Camera in use test] Flow ended.

Re: Camera already in use

Posted: 08 Feb 2017 20:29
by Martin
Thanks for reporting! The exception handling should be better in the next update.

Regards,
Martin

Re: Camera already in use

Posted: 13 Feb 2017 12:37
by Cipsor
On my flow I had the camera taking shots on both rear and front following same trigger. I guess it was a same time action. After I rearranged the actions (first front than rear and not both at the same time), everything goes well.