这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@povidalo
Copy link
Contributor

@povidalo povidalo commented Nov 16, 2021

Had issue on Samsung s5 mini with custom Android 9.0 firmware (Lineage OS based). Legacy camera.
termux-camera-photo command resulted in an empty file (see the logcat error below).

Looks like this fix should (at least partially) cover some of these issues:
#124
#435

UPD: also noticed that not all the resources were cleaned up after the shot is taken, looks like that is why pkill com.termux.api worked as a workaround in some cases in those issues. Added a second commit to fix this.

Error looked like this:
android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - configured surface is abandoned.
at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:731)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86)
at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:1047)
at android.hardware.camera2.impl.CameraDeviceImpl.capture(CameraDeviceImpl.java:914)
at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:173)
at com.termux.api.PhotoAPI.saveImage(PhotoAPI.java:186)
at com.termux.api.PhotoAPI$3.onConfigured(PhotoAPI.java:170)
at android.hardware.camera2.impl.CallbackProxies$SessionStateCallbackProxy.lambda$onConfigured$0(CallbackProxies.java:53)
at android.hardware.camera2.impl.-$$Lambda$CallbackProxies$SessionStateCallbackProxy$soW0qC12Osypoky6AfL3P2-TeDw.run(Unknown Source:4)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at com.termux.api.PhotoAPI.takePicture(PhotoAPI.java:85)
at com.termux.api.PhotoAPI.lambda$onReceive$0(PhotoAPI.java:49)
at com.termux.api.-$$Lambda$PhotoAPI$TVeyrywhoGcxn5rY6HAcKkOPTo0.writeResult(Unknown Source:8)
at com.termux.api.util.ResultReturner.lambda$returnData$0(ResultReturner.java:133)
at com.termux.api.util.-$$Lambda$ResultReturner$oCU8JqHW5HLMrNZa40ThjAWcwzo.run(Unknown Source:8)
at java.lang.Thread.run(Thread.java:764)
Caused by: android.os.ServiceSpecificException: submitRequestList - configured surface is abandoned. (code -22)
at android.hardware.camera2.legacy.LegacyCameraDevice.submitRequestList(LegacyCameraDevice.java:446)
at android.hardware.camera2.legacy.CameraDeviceUserShim.submitRequestList(CameraDeviceUserShim.java:458)
at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84)
... 16 more

@povidalo povidalo marked this pull request as draft November 19, 2021 16:22
@povidalo povidalo marked this pull request as ready for review November 19, 2021 16:22
@Grimler91
Copy link
Member

Thanks for the PR, great that the camera issues get some attention :)

Tested on samsung galaxy s7 running LOS, works well there as well. Would perhaps if someone could verify that it works on a non-samsung, non-LOS device as well, I'll give it a few more days and then merge it even if it hasn't gotten anymore testers

@Alisa900
Copy link

Tested on Samsung Galaxy J5 2016 running the factory firmware (7.1.1), works well.

@Grimler91 Grimler91 merged commit a5f7d14 into termux:master Dec 5, 2021
@Anonymous2716
Copy link

Anonymous2716 commented May 14, 2022

I am on non Samsung phone . android 9 . I can take picture only with the front camera ( works most of the time but not always ) . the back camera creates a empty file. Also I have seen reddit posts on this same issue. I will post logcats later if I have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants