Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problème de scan avec la caméra lors d'ouverture d'une autre activité sur l'activité de scan #111

Open
abelatar opened this issue Sep 4, 2023 · 7 comments
Labels

Comments

@abelatar
Copy link

abelatar commented Sep 4, 2023

Hello @marcanpilami ,

Sur un Xcover 4S la version 2.3.3 de la bibliothèque présente un problème de prévisualisation de la caméra et de scan, elle affiche un écran noir lorsqu'une nouvelle activité est ouverte sur l'activité de numérisation par caméra et on reviens à l'écran de numérisation. J'ai testé avec la version 2.3.2, ce problème n'existait pas.

Screenshot_20230904_202412

Traces du Problème :


Buffer...ducer  E  [com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity$_31184#0](id:ee60000018c,api:0,p:-1,c:3814) disconnect: not connected (req=1)
libEGL          W  EGLNativeWindowType 0xcaddf808 disconnect failed
SurfaceControl  I  nativeRelease 
![Screenshot_20230904_202412](https://github.com/enioka-Haute-Couture/enioka_scan/assets/94049129/0487b994-f5e3-4b9b-89c1-f6c8f93d7d1e)
nativeObject s[3079004800]
                I  nativeRelease nativeObject e[3079004800]
                I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0x923aa9d / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1810 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
                I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0xdeebc0c / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
                I  nativeRelease nativeObject s[3079005152]
                I  nativeRelease nativeObject e[3079005152]
ViewRo...vity]  I  Relayout returned: old=(0,0,720,1280) new=(0,0,720,1280) req=(720,1280)8 dur=9 res=0x5 s={false 0} ch=true fn=4
SurfaceView     I  windowStopped(true) false com.enioka.scanner.camera.CameraPreviewSurfaceView{22fe3e3 V.E...... ........ 0,0-720,952} of ViewRootImpl@9279274[ScanDriverCodeActivity]
BARCODE         D  Image reader already created
SurfaceControl  I  nativeRelease nativeObject s[3344440544]
                I  nativeRelease nativeObject e[3344440544]
ViewRo...vity]  I  MSG_WINDOW_FOCUS_CHANGED 1 1
InputM...nager  D  prepareNavigationBarInfo() DecorView@3091827[MessagesActivity]
                D  getNavigationBarColor() -855310
                D  prepareNavigationBarInfo() DecorView@3091827[MessagesActivity]
                D  getNavigationBarColor() -855310
                V  Starting input: tba=com.geodis.mobicop ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
                D  startInputInner - Id : 0
                I  startInputInner - mService.startInputOrWindowGainedFocus
InputTransport  D  Input channel constructed: 'ClientS', fd=111
                D  Input channel destroyed: 'ClientS', fd=73
libEGL          W  EGLNativeWindowType 0xcae43008 disconnect failed
SurfaceControl  I  nativeRelease nativeObject s[3312795744]
                I  nativeRelease nativeObject e[3312795744]
                I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0x499ab12 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1810 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
                I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0x44c5c53 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
ViewRo...lité]  I  Relayout returned: old=(18,493,702,835) new=(18,493,702,835) req=(684,342)8 dur=12 res=0x5 s={false 0} ch=true fn=128
Buffer...ducer  E  [com.geodis.mobicop/com.geodis.mobicop.WelcomeActivity$_31184#0](id:ee600000189,api:0,p:-1,c:3814) disconnect: not connected (req=1)
libEGL          W  EGLNativeWindowType 0xcade8408 disconnect failed
SurfaceControl  I  nativeRelease nativeObject s[3920229280]
                I  nativeRelease nativeObject e[3920229280]
                I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0x97982e3 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1810 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
                I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0x14c949 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
                I  nativeRelease nativeObject s[2999804320]
                I  nativeRelease nativeObject e[2999804320]
ViewRo...vity]  I  Relayout returned: old=(0,0,720,1280) new=(0,0,720,1280) req=(720,1280)8 dur=7 res=0x5 s={false 0} ch=true fn=6
SurfaceControl  I  nativeRelease nativeObject s[2999804384]
                I  nativeRelease nativeObject e[2999804384]
ViewRo...vity]  I  stopped(true) old=false
Gralloc4        W  allocator 3.x is not supported
Scanne...ivity  I  Scanner activity is being stopped 253460638
Gralloc3        W  allocator 3.x is not supported
ViewRo...lité]  I  stopped(true) old=false
ViewRo...vity]  I  stopped(true) old=false
                I  dispatchDetachedFromWindow
InputTransport  D  Input channel destroyed: 'a611e7c', fd=77
WindowManager   E  android.view.WindowLeaked: Activity com.geodis.mobicop.WelcomeActivity has leaked window DecorView@7ca4c3f[Vérification de compatibilité] that was originally added here
                   	at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1049)
                   	at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1023)
                   	at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:450)
                   	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:114)
                   	at android.app.Dialog.show(Dialog.java:505)
                   	at android.app.ProgressDialog.show(ProgressDialog.java:225)
                   	at android.app.ProgressDialog.show(ProgressDialog.java:182)
                   	at android.app.ProgressDialog.show(ProgressDialog.java:167)
                   	at com.geodis.mobicop.WelcomeActivity.checkCompatibility(WelcomeActivity.java:365)
                   	at com.geodis.mobicop.WelcomeActivity.onSplashClick(WelcomeActivity.java:312)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:441)
                   	at android.view.View.performClick(View.java:8160)
                   	at android.widget.TextView.performClick(TextView.java:16222)
                   	at android.view.View.performClickInternal(View.java:8137)
                   	at android.view.View.access$3700(View.java:888)
                   	at android.view.View$PerformClick.run(View.java:30236)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
                E  win=Window{dac08b8 u0 com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity} destroySurfaces: appStopped=true win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=8 caller=com.android.server.wm.ActivityRecord.destroySurfaces:5251 com.android.server.wm.ActivityRecord.destroySurfaces:5232 com.android.server.wm.ActivityRecord.notifyAppStopped:5291 com.android.server.wm.ActivityRecord.activityStopped:5918 com.android.server.wm.ActivityTaskManagerService.activityStopped:2595 android.app.IActivityTaskManager$Stub.onTransact:2223 android.os.Binder.execTransactInternal:1190 
ViewRo...lité]  I  dispatchDetachedFromWindow
InputTransport  D  Input channel destroyed: '4f2af7d', fd=85
AudioC...ities  W  Unsupported mime audio/x-ima
VideoC...ities  W  Unsupported mime video/mp43
                W  Unsupported mime video/wvc1
                W  Unsupported mime video/x-ms-wmv
AudioC...ities  W  Unsupported mime audio/x-ms-wma
VideoC...ities  W  Unsupported mime video/x-ms-wmv7
                W  Unsupported mime video/x-ms-wmv8
AudioC...ities  W  Unsupported mime audio/x-ima
                W  Unsupported mime audio/mpeg-L1
                W  Unsupported mime audio/mpeg-L2
VideoC...ities  W  Unsupported mime video/wvc1
                W  Unsupported mime video/wvc1
                W  Unsupported mime video/avc-wfd
                W  Unrecognized profile/level 1/32 for video/mp4v-es
                W  Unrecognized profile/level 32768/2 for video/mp4v-es
                W  Unrecognized profile/level 32768/64 for video/mp4v-es
cr_VAUtil       W  Unknown level: 2 for profile 1 of codec video/avc
                W  Unknown level: 2 for profile 65536 of codec video/avc
                W  Unknown level: 2 for profile 2 of codec video/avc
                W  Unknown level: 2 for profile 8 of codec video/avc
                W  Unknown level: 2 for profile 524288 of codec video/avc
Buffer...ducer  E  [SurfaceView - com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity@22fe3e3@0#0](id:ee60000018d,api:4,p:3866,c:3814) dequeueBuffer: BufferQueue has been abandoned
Camera...lobal  I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_ACTIVE for client com.geodis.mobicop API Level 2
Buffer...ducer  E  [SurfaceView - com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity@22fe3e3@0#0](id:ee60000018d,api:4,p:3866,c:3814) queueBuffer: BufferQueue has been abandoned
BARCODE         D  Capture session has nothing to process 173916233
Camera...lobal  I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_IDLE for client com.geodis.mobicop API Level 2
ViewRo...vity]  I  ViewPostIme pointer 0
                I  ViewPostIme pointer 1
Messag...ivity  D  clickNext() called with: v = [androidx.appcompat.widget.AppCompatButton{876f728 VFED..C.. ...P.... 4,4-676,100 #7f080084 app:id/btn_next}]
ViewRo...vity]  I  ViewPostIme pointer 0
                I  ViewPostIme pointer 1
Messag...ivity  D  clickFinish() called with: v = [androidx.appcompat.widget.AppCompatButton{faebb7d VFED..C.. ...P.... 344,4-676,100 #7f080083 app:id/btn_finish}]
ViewRo...vity]  I  stopped(false) old=true
Scanne...ivity  D  Scanner activity is starting 253460638
ViewRo...vity]  I  stopped(false) old=false
Scanne...ivity  I  Scanner activity is resuming 253460638
                I  Resuming scanner activity in camera mode
                I  Giving up on laser, going to camera
BARCODE         D  Capture session is getting active 173916233
ViewRo...vity]  I  MSG_WINDOW_FOCUS_CHANGED 0 1
SurfaceView     I  onWindowVisibilityChanged(0) false com.enioka.scanner.camera.CameraPreviewSurfaceView{22fe3e3 V.E...... ........ 0,0-720,952} of ViewRootImpl@9279274[ScanDriverCodeActivity]
SurfaceControl  I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0xdeebc0c / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
ViewRo...vity]  I  Relayout returned: old=(0,0,720,1280) new=(0,0,720,1280) req=(720,1280)0 dur=14 res=0x7 s={true 3403580416} ch=true fn=-1
SurfaceView     I  windowStopped(false) true com.enioka.scanner.camera.CameraPreviewSurfaceView{22fe3e3 V.E...... ........ 0,0-720,952} of ViewRootImpl@9279274[ScanDriverCodeActivity]
                I  surfaceCreated 1 #1 com.enioka.scanner.camera.CameraPreviewSurfaceView{22fe3e3 V.E...... ........ 0,0-720,952}
BARCODE         D  Preview surface created, camera will be initialized soon 173916233
                D  INFO_SUPPORTED_HARDWARE_LEVEL LIMITED
                I  Camera supports flash: true
                D  Reusing previously chosen resolution
                I  Camera uses preview resolution: 1440*1080
                D  Capture session has nothing to process 173916233
                I  Camera uses FPS range: [8, 30]
                I  Using AF mode: CONTROL_AF_MODE_CONTINUOUS_PICTURE
                I  Supported autofocus zones: 1
                I  Using AB mode: CONTROL_AE_ANTIBANDING_MODE_AUTO
                I  Selected camera id: 0
Camera...lobal  I  postSingleTorchUpdate device: camera id 0 status 0
SurfaceView     I  surfaceChanged (1440,1080) 1 #1 com.enioka.scanner.camera.CameraPreviewSurfaceView{22fe3e3 V.E...... ........ 0,0-720,952}
BARCODE         I  surface changed 173916233
ViewRo...vity]  I  [DP] dp(1) 1 android.view.SurfaceView.updateSurface:1311 android.view.SurfaceView.setWindowStopped:343 android.view.SurfaceView.surfaceCreated:1835 
                I  [DP] pdf(0) 1 android.view.SurfaceView.notifyDrawFinished:577 android.view.SurfaceView.performDrawFinished:564 android.view.SurfaceView.lambda$TWz4D2u33ZlAmRtgKzbqqDue3iM:0 
                I  [DP] rdf()
                I  updateBoundsLayer: shouldReparent = true t = android.view.SurfaceControl$Transaction@2e0b33b sc = Surface(name=Bounds for - com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity@1)/@0xaea7a58 frame = 1
                I  [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:10957 android.view.ViewRootImpl.performTraversals:3845 android.view.ViewRootImpl.doTraversal:2618 
                I  [DP] pd() Asnyc report
SurfaceView     I  setParentSpaceRectangle: useBLAST = false position = Rect(0, 160 - 720, 1112) frameNumber = 1 t = android.view.SurfaceControl$Transaction@90e80a4
                I  applySurfaceTransforms: t = android.view.SurfaceControl$Transaction@90e80a4 surfaceControl = Surface(name=SurfaceView - com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity@22fe3e3@1)/@0xf2d17b1 frame = 1
                I  applySurfaceTransforms: postScaleX = 0.5 postScaleY = 0.88148147
ViewRo...vity]  I  [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4668 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938 
                I  [DP] rdf()
Scanne...ivity  D  Status changed: CONNECTED --- Scanner connecté
BARCODE         D  Capture session is getting active 173916233
SurfaceControl  I  nativeRelease nativeObject s[2999807232]
                I  nativeRelease nativeObject e[2999807232]
                I  nativeRelease nativeObject s[3020372896]
                I  nativeRelease nativeObject e[3020372896]
Camera...lobal  I  onTorchModeUnavailable
BARCODE         D  Trying to open camera from CameraManager 173916233
Camera...lobal  I  postSingleTorchUpdate device: camera id 0 status 1
                I  postSingleTorchUpdate device: camera id 0 status 1
Camera...ssion  E  Session 0: Exception while stopping repeating: 
                   android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): cancelRequest:554: Camera 0: Error clearing streaming request: Function not implemented (-38)
                   	at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1340)
                   	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:99)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1259)
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:578)
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:789)
                   	at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.os.HandlerThread.run(HandlerThread.java:67)
                   Caused by: android.os.ServiceSpecificException: cancelRequest:554: Camera 0: Error clearing streaming request: Function not implemented (-38) (code 10)
                   	at android.os.Parcel.createExceptionOrNull(Parcel.java:2400)
                   	at android.os.Parcel.createException(Parcel.java:2370)
                   	at android.os.Parcel.readException(Parcel.java:2353)
                   	at android.os.Parcel.readException(Parcel.java:2295)
                   	at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:750)
                   	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:97)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1259) 
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:578) 
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:789) 
                   	at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245) 
                   	at android.os.Handler.handleCallback(Handler.java:938) 
                   	at android.os.Handler.dispatchMessage(Handler.java:99) 
                   	at android.os.Looper.loop(Looper.java:246) 
                   	at android.os.HandlerThread.run(HandlerThread.java:67) 
Camera...lobal  I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.geodis.mobicop API Level 2
                I  postSingleTorchUpdate device: camera id 0 status 0
                I  postSingleTorchUpdate device: camera id 0 status 0
BARCODE         V  CameraDevice.StateCallback.onDisconnected 173916233
.geodis.mobico  W  Long monitor contention with owner CameraBackground (25971) at void android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating()(CameraDeviceImpl.java:1270) waiters=0 in void android.hardware.camera2.impl.CameraDeviceImpl.onDeviceIdle() for 544ms
Camera...lobal  I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_OPEN for client com.geodis.mobicop API Level 2
BARCODE         V  CameraDevice.StateCallback.onClosed 173916233
                D   * Background camera thread is closing
                D  Stopping background thread handler 173916233
                D   * Closing analyzers
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Camera scanner view has finished releasing all camera resources 173916233
                I  Capture session has closed 12116996
MessageQueue    W  Handler (android.os.Handler) {34a7ded} sending message to a Handler on a dead thread
                   java.lang.IllegalStateException: Handler (android.os.Handler) {34a7ded} sending message to a Handler on a dead thread
                   	at android.os.MessageQueue.enqueueMessage(MessageQueue.java:560)
                   	at android.os.Handler.enqueueMessage(Handler.java:778)
                   	at android.os.Handler.sendMessageAtTime(Handler.java:727)
                   	at android.os.Handler.sendMessageDelayed(Handler.java:697)
                   	at android.os.Handler.post(Handler.java:427)
                   	at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2163)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.setRemoteDevice(CameraDeviceImpl.java:312)
                   	at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:734)
                   	at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:895)
                   	at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:823)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.openCamera(CameraBarcodeScanViewV2.java:280)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.lambda$6PHodskDk4Q6UmexosXlEBZZev4(Unknown Source:0)
                   	at com.enioka.scanner.camera.-$$Lambda$CameraBarcodeScanViewV2$6PHodskDk4Q6UmexosXlEBZZev4.run(Unknown Source:2)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
                W  Handler (android.os.Handler) {34a7ded} sending message to a Handler on a dead thread
                   java.lang.IllegalStateException: Handler (android.os.Handler) {34a7ded} sending message to a Handler on a dead thread
                   	at android.os.MessageQueue.enqueueMessage(MessageQueue.java:560)
                   	at android.os.Handler.enqueueMessage(Handler.java:778)
                   	at android.os.Handler.sendMessageAtTime(Handler.java:727)
                   	at android.os.Handler.sendMessageDelayed(Handler.java:697)
                   	at android.os.Handler.post(Handler.java:427)
                   	at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2163)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.setRemoteDevice(CameraDeviceImpl.java:313)
                   	at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:734)
                   	at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:895)
                   	at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:823)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.openCamera(CameraBarcodeScanViewV2.java:280)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.lambda$6PHodskDk4Q6UmexosXlEBZZev4(Unknown Source:0)
                   	at com.enioka.scanner.camera.-$$Lambda$CameraBarcodeScanViewV2$6PHodskDk4Q6UmexosXlEBZZev4.run(Unknown Source:2)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
BARCODE         D  Camera device not ready yet
ViewRo...vity]  I  MSG_WINDOW_FOCUS_CHANGED 1 1
InputM...nager  D  prepareNavigationBarInfo() DecorView@c2ac9b[ScanDriverCodeActivity]
                D  getNavigationBarColor() -855310
                D  prepareNavigationBarInfo() DecorView@c2ac9b[ScanDriverCodeActivity]
                D  getNavigationBarColor() -855310
                V  Starting input: tba=com.geodis.mobicop ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
                D  startInputInner - Id : 0
                I  startInputInner - mService.startInputOrWindowGainedFocus
InputTransport  D  Input channel constructed: 'ClientS', fd=100
                D  Input channel destroyed: 'ClientS', fd=111
Choreographer   I  Skipped 35 frames!  The application may be doing too much work on its main thread.
ViewRo...vity]  I  stopped(true) old=false
SurfaceControl  I  nativeRelease nativeObject s[2989577568]
                I  nativeRelease nativeObject e[2989577568]
Buffer...ducer  E  [com.geodis.mobicop/com.geodis.mobicop.MessagesActivity$_31184#0](id:ee60000018f,api:0,p:-1,c:3814) disconnect: not connected (req=1)
libEGL          W  EGLNativeWindowType 0xcae48408 disconnect failed
ViewRo...vity]  I  dispatchDetachedFromWindow
InputTransport  D  Input channel destroyed: '2e77260', fd=171
Camera...lobal  I  onTorchModeChanged

@abelatar
Copy link
Author

Le problème persiste sur la version 2.3.7 voici les straces :

INFO =>         I  ScannerActivityStatus changed: CONNECTED --- Scanner connecté
ViewRo...vity]  D  MSG_WINDOW_FOCUS_CHANGED 1 1
InputM...nager  D  prepareNavigationBarInfo() DecorView@6f174f7[ScanDriverCodeActivity]
                D  getNavigationBarColor() -855310
                D  prepareNavigationBarInfo() DecorView@6f174f7[ScanDriverCodeActivity]
                D  getNavigationBarColor() -855310
                V  Starting input: tba=com.geodis.mobicop ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
                D  startInputInner - Id : 0
                I  startInputInner - mService.startInputOrWindowGainedFocus
InputTransport  D  Input channel destroyed: 'ClientS', fd=92
Camera...lobal  I  onTorchModeUnavailable
BARCODE         D  Trying to open camera from CameraManager 84459909
Camera...lobal  I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_IDLE for client com.geodis.mobicop API Level 2
AndroidRuntime  D  Shutting down VM
                E  FATAL EXCEPTION: main
                   Process: com.geodis.mobicop:acra, PID: 13186
                   java.lang.ClassCastException: android.os.BinderProxy cannot be cast to com.enioka.scanner.service.ScannerService$LocalBinder
                   	at com.geodis.mobicop.common.Mobicop$1.onServiceConnected(Mobicop.java:81)
                   	at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067)
                   	at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099)
                   	at android.os.Handler.handleCallback(Handler.java:883)
                   	at android.os.Handler.dispatchMessage(Handler.java:100)
                   	at android.os.Looper.loop(Looper.java:237)
                   	at android.app.ActivityThread.main(ActivityThread.java:7860)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
Camera...lobal  I  postSingleTorchUpdate device: camera id 0 status 1
                I  postSingleTorchUpdate device: camera id 0 status 1
                I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.geodis.mobicop API Level 2
                I  postSingleTorchUpdate device: camera id 0 status 0
                I  postSingleTorchUpdate device: camera id 0 status 0
                I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_OPEN for client com.geodis.mobicop API Level 2
BARCODE         D  Image reader already created
Camera...ssion  E  Session 0: Exception while stopping repeating: 
                   android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): cancelRequest:473: Camera device no longer alive
                   	at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1127)
                   	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:97)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1151)
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:526)
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:737)
                   	at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:244)
                   	at android.os.Handler.handleCallback(Handler.java:883)
                   	at android.os.Handler.dispatchMessage(Handler.java:100)
                   	at android.os.Looper.loop(Looper.java:237)
                   	at android.os.HandlerThread.run(HandlerThread.java:67)
                   Caused by: android.os.ServiceSpecificException: cancelRequest:473: Camera device no longer alive (code 4)
                   	at android.os.Parcel.createException(Parcel.java:2102)
                   	at android.os.Parcel.readException(Parcel.java:2056)
                   	at android.os.Parcel.readException(Parcel.java:2004)
                   	at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:676)
                   	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:95)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1151) 
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:526) 
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:737) 
                   	at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:244) 
                   	at android.os.Handler.handleCallback(Handler.java:883) 
                   	at android.os.Handler.dispatchMessage(Handler.java:100) 
                   	at android.os.Looper.loop(Looper.java:237) 
                   	at android.os.HandlerThread.run(HandlerThread.java:67) 
Choreographer   I  Skipped 35 frames!  The application may be doing too much work on its main thread.
.geodis.mobico  W  Long monitor contention with owner CameraBackground (13107) at void android.hardware.camera2.impl.CameraCaptureSessionImpl.close()(CameraCaptureSessionImpl.java:505) waiters=0 in void android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks.onDeviceError(int, android.hardware.camera2.impl.CaptureResultExtras) for 416ms
BARCODE         V  CameraDevice.StateCallback.onDisconnected 84459909
                V  CameraDevice.StateCallback.onOpened 84459909
                D  Image reader already created
                V  CameraDevice.StateCallback.onClosed 84459909
                D   * Background camera thread is closing
                D  Stopping background thread handler 84459909
                D   * Closing analyzers

@abelatar
Copy link
Author

abelatar commented Oct 2, 2023

Hello @marcanpilami

Il y a encore ce problème:

vity]  I  Relayout returned: old=(0,0,720,1280) new=(0,0,720,1280) req=(720,1280)8 dur=11 res=0x5 s={false 0} ch=true fn=7
SurfaceControl  I  nativeRelease nativeObject s[3661104096]
                I  nativeRelease nativeObject e[3661104096]
ViewRo...vity]  I  stopped(true) old=false
Scanne...ivity  I  Scanner activity is being stopped 255049012
ViewRo...lité]  I  stopped(true) old=false
ViewRo...vity]  I  stopped(true) old=false
                I  dispatchDetachedFromWindow
InputTransport  D  Input channel destroyed: '7951db1', fd=74
WindowManager   E  android.view.WindowLeaked: Activity com.geodis.mobicop.WelcomeActivity has leaked window DecorView@86d4319[Vérification de compatibilité] that was originally added here
                   	at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1049)
                   	at android.view.ViewRootImpl.<init>(ViewRootImpl.java:1023)
                   	at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:450)
                   	at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:114)
                   	at android.app.Dialog.show(Dialog.java:505)
                   	at android.app.ProgressDialog.show(ProgressDialog.java:225)
                   	at android.app.ProgressDialog.show(ProgressDialog.java:182)
                   	at android.app.ProgressDialog.show(ProgressDialog.java:167)
                   	at com.geodis.mobicop.WelcomeActivity.checkCompatibility(WelcomeActivity.java:364)
                   	at com.geodis.mobicop.WelcomeActivity.onSplashClick(WelcomeActivity.java:312)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:441)
                   	at android.view.View.performClick(View.java:8160)
                   	at android.widget.TextView.performClick(TextView.java:16222)
                   	at android.view.View.performClickInternal(View.java:8137)
                   	at android.view.View.access$3700(View.java:888)
                   	at android.view.View$PerformClick.run(View.java:30236)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
                E  win=Window{7a01433 u0 com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity} destroySurfaces: appStopped=true win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=8 caller=com.android.server.wm.ActivityRecord.destroySurfaces:5251 com.android.server.wm.ActivityRecord.destroySurfaces:5232 com.android.server.wm.ActivityRecord.notifyAppStopped:5291 com.android.server.wm.ActivityRecord.activityStopped:5918 com.android.server.wm.ActivityTaskManagerService.activityStopped:2595 android.app.IActivityTaskManager$Stub.onTransact:2223 android.os.Binder.execTransactInternal:1190 
ViewRo...lité]  I  dispatchDetachedFromWindow
InputTransport  D  Input channel destroyed: '265e6c7', fd=87
Buffer...ducer  E  [SurfaceView - com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity@ef90b3a@0#0](id:ee80000014a,api:4,p:3864,c:3816) dequeueBuffer: BufferQueue has been abandoned
BARCODE         D  Capture session has nothing to process 58261751
AudioC...ities  W  Unsupported mime audio/x-ima
VideoC...ities  W  Unsupported mime video/mp43
                W  Unsupported mime video/wvc1
                W  Unsupported mime video/x-ms-wmv
AudioC...ities  W  Unsupported mime audio/x-ms-wma
VideoC...ities  W  Unsupported mime video/x-ms-wmv7
                W  Unsupported mime video/x-ms-wmv8
AudioC...ities  W  Unsupported mime audio/x-ima
                W  Unsupported mime audio/mpeg-L1
                W  Unsupported mime audio/mpeg-L2
VideoC...ities  W  Unsupported mime video/wvc1
                W  Unsupported mime video/wvc1
                W  Unsupported mime video/avc-wfd
                W  Unrecognized profile/level 1/32 for video/mp4v-es
                W  Unrecognized profile/level 32768/2 for video/mp4v-es
                W  Unrecognized profile/level 32768/64 for video/mp4v-es
ViewRo...vity]  I  ViewPostIme pointer 0
                I  ViewPostIme pointer 1
Messag...ivity  D  clickNext() called with: v = [androidx.appcompat.widget.AppCompatButton{7fa89c1 VFED..C.. ...P.... 4,4-676,100 #7f080084 app:id/btn_next}]
ViewRo...vity]  I  ViewPostIme pointer 0
                I  ViewPostIme pointer 1
Messag...ivity  D  clickFinish() called with: v = [androidx.appcompat.widget.AppCompatButton{87cb1f2 VFED..C.. ...P.... 344,4-676,100 #7f080083 app:id/btn_finish}]
ViewRo...vity]  I  stopped(false) old=true
Scanne...ivity  D  Scanner activity is starting 255049012
ViewRo...vity]  I  stopped(false) old=false
Scanne...ivity  I  Scanner activity is resuming 255049012
                I  Resuming scanner activity in camera mode
                I  Giving up on laser, going to camera
BARCODE         D  Capture session is getting active 58261751
ViewRo...vity]  I  MSG_WINDOW_FOCUS_CHANGED 0 1
SurfaceView     I  onWindowVisibilityChanged(0) false com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
SurfaceControl  I  assignNativeObject: nativeObject = 0 Surface(name=null)/@0x7a493c7 / android.view.SurfaceControl.readFromParcel:1117 android.view.IWindowSession$Stub$Proxy.relayout:1820 android.view.ViewRootImpl.relayoutWindow:9005 android.view.ViewRootImpl.performTraversals:3360 android.view.ViewRootImpl.doTraversal:2618 android.view.ViewRootImpl$TraversalRunnable.run:9971 android.view.Choreographer$CallbackRecord.run:1010 android.view.Choreographer.doCallbacks:809 android.view.Choreographer.doFrame:744 android.view.Choreographer$FrameDisplayEventReceiver.run:995 
ViewRo...vity]  I  Relayout returned: old=(0,0,720,1280) new=(0,0,720,1280) req=(720,1280)0 dur=13 res=0x7 s={true 3991920640} ch=true fn=-1
SurfaceView     I  windowStopped(false) true com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
                I  surfaceCreated 1 #1 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952}
BARCODE         D  Preview surface created, camera will be initialized soon 58261751
                D  INFO_SUPPORTED_HARDWARE_LEVEL LIMITED
                I  Camera supports flash: true
                D  Reusing previously chosen resolution
                I  Camera uses preview resolution: 1440*1080
                I  Camera uses FPS range: [8, 30]
                I  Using AF mode: CONTROL_AF_MODE_CONTINUOUS_PICTURE
                I  Supported autofocus zones: 1
                I  Using AB mode: CONTROL_AE_ANTIBANDING_MODE_AUTO
                I  Selected camera id: 0
Camera...lobal  I  postSingleTorchUpdate device: camera id 0 status 0
SurfaceView     I  surfaceChanged (1440,1080) 1 #1 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952}
BARCODE         I  surface changed 58261751
ViewRo...vity]  I  [DP] dp(1) 1 android.view.SurfaceView.updateSurface:1311 android.view.SurfaceView.setWindowStopped:343 android.view.SurfaceView.surfaceCreated:1835 
BARCODE         D  Capture session has nothing to process 58261751
ViewRo...vity]  I  [DP] pdf(0) 1 android.view.SurfaceView.notifyDrawFinished:577 android.view.SurfaceView.performDrawFinished:564 android.view.SurfaceView.lambda$TWz4D2u33ZlAmRtgKzbqqDue3iM:0 
                I  [DP] rdf()
                I  updateBoundsLayer: shouldReparent = true t = android.view.SurfaceControl$Transaction@9648dd8 sc = Surface(name=Bounds for - com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity@1)/@0x186531 frame = 1
                I  [DP] dp(1) 1 android.view.ViewRootImpl.reportNextDraw:10957 android.view.ViewRootImpl.performTraversals:3845 android.view.ViewRootImpl.doTraversal:2618 
                I  [DP] pd() Asnyc report
SurfaceView     I  setParentSpaceRectangle: useBLAST = false position = Rect(0, 160 - 720, 1112) frameNumber = 1 t = android.view.SurfaceControl$Transaction@1da34bf
                I  applySurfaceTransforms: t = android.view.SurfaceControl$Transaction@1da34bf surfaceControl = Surface(name=SurfaceView - com.geodis.mobicop/com.geodis.mobicop.ScanDriverCodeActivity@ef90b3a@1)/@0xe1e3416 frame = 1
                I  applySurfaceTransforms: postScaleX = 0.5 postScaleY = 0.88148147
ViewRo...vity]  I  [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$performDraw$1$ViewRootImpl:4668 android.view.-$$Lambda$ViewRootImpl$DJd0VUYJgsebcnSohO6h8zc_ONI.run:6 android.os.Handler.handleCallback:938 
                I  [DP] rdf()
Scanne...ivity  D  Status changed: CONNECTED --- Scanner connecté
Camera...-JV-0  W  did not register callback to request 1
BARCODE         D  Capture session is getting active 58261751
SurfaceControl  I  nativeRelease nativeObject s[3161790272]
                I  nativeRelease nativeObject e[3161790272]
                I  nativeRelease nativeObject s[3224717984]
                I  nativeRelease nativeObject e[3224717984]
Camera...lobal  I  onTorchModeUnavailable
BARCODE         D  Trying to open camera from CameraManager 58261751
Camera...lobal  I  postSingleTorchUpdate device: camera id 0 status 1
                I  postSingleTorchUpdate device: camera id 0 status 1
                I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_CLOSED for client com.geodis.mobicop API Level 2
Camera...ssion  E  Session 0: Exception while stopping repeating: 
                   android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): cancelRequest:554: Camera 0: Error clearing streaming request: Function not implemented (-38)
                   	at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:1340)
                   	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:99)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1259)
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:578)
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:789)
                   	at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.os.HandlerThread.run(HandlerThread.java:67)
                   Caused by: android.os.ServiceSpecificException: cancelRequest:554: Camera 0: Error clearing streaming request: Function not implemented (-38) (code 10)
                   	at android.os.Parcel.createExceptionOrNull(Parcel.java:2400)
                   	at android.os.Parcel.createException(Parcel.java:2370)
                   	at android.os.Parcel.readException(Parcel.java:2353)
                   	at android.os.Parcel.readException(Parcel.java:2295)
                   	at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.cancelRequest(ICameraDeviceUser.java:750)
                   	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.cancelRequest(ICameraDeviceUserWrapper.java:97)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating(CameraDeviceImpl.java:1259) 
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl.close(CameraCaptureSessionImpl.java:578) 
                   	at android.hardware.camera2.impl.CameraCaptureSessionImpl$2.onDisconnected(CameraCaptureSessionImpl.java:789) 
                   	at android.hardware.camera2.impl.CameraDeviceImpl$7.run(CameraDeviceImpl.java:245) 
                   	at android.os.Handler.handleCallback(Handler.java:938) 
                   	at android.os.Handler.dispatchMessage(Handler.java:99) 
                   	at android.os.Looper.loop(Looper.java:246) 
                   	at android.os.HandlerThread.run(HandlerThread.java:67) 
Camera...lobal  I  postSingleTorchUpdate device: camera id 0 status 0
BARCODE         V  CameraDevice.StateCallback.onDisconnected 58261751
.geodis.mobico  W  Long monitor contention with owner CameraBackground (3148) at void android.hardware.camera2.impl.CameraDeviceImpl.stopRepeating()(CameraDeviceImpl.java:1270) waiters=0 in void android.hardware.camera2.impl.CameraDeviceImpl.onDeviceIdle() for 335ms
Camera...lobal  I  postSingleTorchUpdate device: camera id 0 status 0
                I  Camera 0 facing CAMERA_FACING_BACK state now CAMERA_STATE_OPEN for client com.geodis.mobicop API Level 2
BARCODE         V  CameraDevice.StateCallback.onClosed 58261751
                D   * Background camera thread is closing
                D  Stopping background thread handler 58261751
                D   * Closing analyzers
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Frame analyser is closing
                I  Camera scanner view has finished releasing all camera resources 58261751
MessageQueue    W  Handler (android.os.Handler) {f5d236d} sending message to a Handler on a dead thread
                   java.lang.IllegalStateException: Handler (android.os.Handler) {f5d236d} sending message to a Handler on a dead thread
                   	at android.os.MessageQueue.enqueueMessage(MessageQueue.java:560)
                   	at android.os.Handler.enqueueMessage(Handler.java:778)
                   	at android.os.Handler.sendMessageAtTime(Handler.java:727)
                   	at android.os.Handler.sendMessageDelayed(Handler.java:697)
                   	at android.os.Handler.post(Handler.java:427)
                   	at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2163)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.setRemoteDevice(CameraDeviceImpl.java:312)
                   	at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:734)
                   	at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:895)
                   	at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:823)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.openCamera(CameraBarcodeScanViewV2.java:280)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.lambda$6PHodskDk4Q6UmexosXlEBZZev4(Unknown Source:0)
                   	at com.enioka.scanner.camera.-$$Lambda$CameraBarcodeScanViewV2$6PHodskDk4Q6UmexosXlEBZZev4.run(Unknown Source:2)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
BARCODE         I  Capture session has closed 223948851
MessageQueue    W  Handler (android.os.Handler) {f5d236d} sending message to a Handler on a dead thread
                   java.lang.IllegalStateException: Handler (android.os.Handler) {f5d236d} sending message to a Handler on a dead thread
                   	at android.os.MessageQueue.enqueueMessage(MessageQueue.java:560)
                   	at android.os.Handler.enqueueMessage(Handler.java:778)
                   	at android.os.Handler.sendMessageAtTime(Handler.java:727)
                   	at android.os.Handler.sendMessageDelayed(Handler.java:697)
                   	at android.os.Handler.post(Handler.java:427)
                   	at android.hardware.camera2.impl.CameraDeviceImpl$CameraHandlerExecutor.execute(CameraDeviceImpl.java:2163)
                   	at android.hardware.camera2.impl.CameraDeviceImpl.setRemoteDevice(CameraDeviceImpl.java:313)
                   	at android.hardware.camera2.CameraManager.openCameraDeviceUserAsync(CameraManager.java:734)
                   	at android.hardware.camera2.CameraManager.openCameraForUid(CameraManager.java:895)
                   	at android.hardware.camera2.CameraManager.openCamera(CameraManager.java:823)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.openCamera(CameraBarcodeScanViewV2.java:280)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.lambda$6PHodskDk4Q6UmexosXlEBZZev4(Unknown Source:0)
                   	at com.enioka.scanner.camera.-$$Lambda$CameraBarcodeScanViewV2$6PHodskDk4Q6UmexosXlEBZZev4.run(Unknown Source:2)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
BARCODE         D  Camera device not ready yet
ViewRo...vity]  I  MSG_WINDOW_FOCUS_CHANGED 1 1
InputM...nager  D  prepareNavigationBarInfo() DecorView@3e94c59[ScanDriverCodeActivity]
                D  getNavigationBarColor() -855310
                D  prepareNavigationBarInfo() DecorView@3e94c59[ScanDriverCodeActivity]
                D  getNavigationBarColor() -855310
                V  Starting input: tba=com.geodis.mobicop ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
                D  startInputInner - Id : 0
                I  startInputInner - mService.startInputOrWindowGainedFocus
InputTransport  D  Input channel constructed: 'ClientS', fd=92
                D  Input channel destroyed: 'ClientS', fd=207
ViewRo...vity]  I  stopped(true) old=false
SurfaceControl  I  nativeRelease nativeObject s[3161790400]
                I  nativeRelease nativeObject e[3161790400]
Buffer...ducer  E  [com.geodis.mobicop/com.geodis.mobicop.MessagesActivity$_1683#0](id:ee80000014c,api:0,p:-1,c:3816) disconnect: not connected (req=1)
libEGL          W  EGLNativeWindowType 0xf0fe5808 disconnect failed
ViewRo...vity]  I  dispatchDetachedFromWindow
InputTransport  D  Input channel destroyed: '21f01b9', fd=177

@marcanpilami
Copy link
Collaborator

A tentative fix was pushed in version .11. Could you please retest?

@abelatar
Copy link
Author

abelatar commented Oct 6, 2023

Hello @marcanpilami ,
Sur cette version, l'application s'arrête complètement avec une exception liée à la caméra. Voici les traces d'erreur :

      E  FATAL EXCEPTION: main
                   Process: com.geodis.mobicop, PID: 2269
                   java.lang.IllegalStateException: cannot acquire camera semaphore - it may be locked by another activity/fragment
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.acquire(CameraBarcodeScanViewV2.java:805)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.openCamera(CameraBarcodeScanViewV2.java:272)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.lambda$6PHodskDk4Q6UmexosXlEBZZev4(Unknown Source:0)
                   	at com.enioka.scanner.camera.-$$Lambda$CameraBarcodeScanViewV2$6PHodskDk4Q6UmexosXlEBZZev4.run(Unknown Source:2)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
---------------------------- PROCESS STARTED (4411) for package com.geodis.mobicop ----------------------------
ScannerService  I  Starting scanner service
                I  ScannerService is receiving a new bind request - onBind
                I  (re)starting provider discovery!
LaserScanner    I  Starting provider discovery
                I  There are 7 scanner provider(s) available before filtering duplicates
                D  Trying to instantiate provider com.enioka.scanner.sdk.zebra.dw.ZebraDwProvider - not BT - 0
                D  Provider ZebraDwProvider was successfully instantiated
                D  Trying to instantiate provider com.enioka.scanner.sdk.athesi.SPA43LTE.AthesiHHTProvider - not BT - 0
                D  Provider AthesiHHTProvider was successfully instantiated
                D  Trying to instantiate provider com.enioka.scanner.sdk.athesi.RD50TE.AthesiE5LProvider - not BT - 0
                D  Provider AthesiE5LProvider was successfully instantiated
                D  Trying to instantiate provider com.enioka.scanner.sdk.bluebird.BluebirdProvider - not BT - 0
                D  Provider BluebirdProvider was successfully instantiated
                D  Trying to instantiate provider com.enioka.scanner.sdk.honeywelloss.integrated.HoneywellOssIntegratedScannerProvider - not BT - 0
                D  Provider HoneywellOssIntegratedProvider was successfully instantiated
                D  Trying to instantiate provider com.enioka.scanner.sdk.proglove.ProgloveProvider - BT     - 0
                D  Provider ProgloveProvider was successfully instantiated
                D  Trying to instantiate provider com.enioka.scanner.bt.manager.SerialBtScannerProvider - BT     - 0
                D  Provider BtSppSdk was successfully instantiated
BtSppSdk        I  	SPP SDK compatible provider found: com.enioka.scanner.sdk.generalscan.GsSppScannerProvider
                I  	SPP SDK compatible provider found: com.enioka.scanner.sdk.zebraoss.ZebraOssSppScannerProvider
                I  	SPP SDK compatible provider found: com.enioka.scanner.sdk.zebraoss.ZebraOssAttScannerProvider
                I  	SPP SDK compatible provider found: com.enioka.scanner.sdk.honeywelloss.spp.HoneywellOssSppScannerProvider
LaserScanner    I  Provider discovery done
ScannerService  D  Status changed: SERVICE_PROVIDER_SEARCH_OVER --- ScannerService a terminé la découverte de providers de scanner
                I  (re)starting scanner search!
LaserScanner    I  Starting scanner search
                D  Provider BluebirdProvider accepted
                D  Provider ZebraDwProvider accepted
                D  Provider AthesiHHTProvider accepted
                D  Provider HoneywellOssIntegratedProvider accepted
                D  Provider BtSppSdk skipped because bluetooth option is disabled
                D  Provider AthesiE5LProvider accepted
                D  Provider ProgloveProvider skipped because bluetooth option is disabled
                I  There are 5 providers which are going to be invoked for fresh laser scanners
                I  	ZebraDwProvider
                I  	HoneywellOssIntegratedProvider
                I  	BluebirdProvider
                I  	AthesiHHTProvider
                I  	AthesiE5LProvider
                I  Starting search on provider ZebraDwProvider
                I  Starting search on provider HoneywellOssIntegratedProvider
                I  Starting search on provider BluebirdProvider
                I  Scanner provider ZebraDwProvider reports it is not compatible with the device and will be disabled
                I  Starting search on provider AthesiHHTProvider
                I  Scanner provider AthesiHHTProvider reports it is not compatible with the device and will be disabled
                I  Starting search on provider AthesiE5LProvider
                I  Scanner provider AthesiE5LProvider reports it is not compatible with the device and will be disabled
                I  Scanner provider BluebirdProvider reports it is not compatible with the device and will be disabled
                I  Scanner provider HoneywellOssIntegratedProvider reports it is not compatible with the device and will be disabled
ScannerService  D  Status changed: CONNECTING --- Scanner en cours de connexion
                D  Progress on connection of scanner null from ZebraDwProvider: No ZebraDwProvider scanners available.
                D  Status changed: CONNECTING --- Scanner en cours de connexion
                D  Progress on connection of scanner null from AthesiE5LProvider: No AthesiE5LProvider scanners available.
                D  Status changed: CONNECTING --- Scanner en cours de connexion
                D  Progress on connection of scanner null from AthesiHHTProvider: No AthesiHHTProvider scanners available.
                D  Status changed: CONNECTING --- Scanner en cours de connexion
                D  Progress on connection of scanner null from BluebirdProvider: No BluebirdProvider scanners available.
                D  Status changed: CONNECTING --- Scanner en cours de connexion
                D  Progress on connection of scanner null from HoneywellOssIntegratedProvider: No HoneywellOssIntegratedProvider scanners available.
                I  0 scanners from the different SDKs have reported for duty. Waiting for the initialization of 0 scanners.
                I  All found scanners have now ended their initialization (or failed to do so)
                D  Status changed: SERVICE_SDK_SEARCH_OVER --- Tous les fournisseurs de scanners matériels ont répondu
Scanne...ivity  D  Scanner activity is created 257718817
                I  Using camera version: com.enioka.scanner.camera.CameraBarcodeScanViewV2
                D  Scanner activity is starting 257718817
                I  Scanner activity is resuming 257718817
                I  Resuming scanner activity in camera mode
                I  Giving up on laser, going to camera
                I  Scanner activity is being paused 257718817
                D  Service is connected to activity
ScannerService  D  Registering new client: com.geodis.mobicop.ScanDriverCodeActivity@f5c7a21 257718817
                D  Notifying late clients that providers are already discovered
                D  Notifying late clients that scanners are already connected
Scanne...ivity  I  Activity can now use all received scanners (0)
                I  Giving up on laser, going to camera
                D  Status changed: CONNECTED --- Scanner connecté
SurfaceView     I  onWindowVisibilityChanged(0) true com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ......I. 0,0-0,0} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
                I  windowStopped(false) true com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ......I. 0,0-0,0} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
                I  surfaceCreated 1 #8 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ......ID 0,0-720,952}
                I  surfaceChanged (720,952) 1 #8 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ......ID 0,0-720,952}
Scanne...ivity  D  Status changed: CONNECTED --- Scanner connecté
SurfaceView     I  surfaceChanged (1440,1080) 1 #5 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ......I. 0,0-720,952}
                I  onWindowVisibilityChanged(8) false com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
                I  surfaceDestroyed callback.size 1 #2 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952}
                I  windowStopped(true) false com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
Scanne...ivity  I  Scanner activity is being stopped 257718817
                D  Scanner activity is starting 257718817
                I  Scanner activity is resuming 257718817
                I  Resuming scanner activity in camera mode
                I  Giving up on laser, going to camera
SurfaceView     I  onWindowVisibilityChanged(0) false com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
                I  windowStopped(false) true com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952} of ViewRootImpl@65139cf[ScanDriverCodeActivity]
                I  surfaceCreated 1 #1 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952}
                I  surfaceChanged (1440,1080) 1 #1 com.enioka.scanner.camera.CameraPreviewSurfaceView{ef90b3a V.E...... ........ 0,0-720,952}
Scanne...ivity  D  Status changed: CONNECTED --- Scanner connecté
AndroidRuntime  E  FATAL EXCEPTION: main
                   Process: com.geodis.mobicop, PID: 4411
                   java.lang.IllegalStateException: cannot acquire camera semaphore - it may be locked by another activity/fragment
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.acquire(CameraBarcodeScanViewV2.java:805)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.openCamera(CameraBarcodeScanViewV2.java:272)
                   	at com.enioka.scanner.camera.CameraBarcodeScanViewV2.lambda$6PHodskDk4Q6UmexosXlEBZZev4(Unknown Source:0)
                   	at com.enioka.scanner.camera.-$$Lambda$CameraBarcodeScanViewV2$6PHodskDk4Q6UmexosXlEBZZev4.run(Unknown Source:2)
                   	at android.os.Handler.handleCallback(Handler.java:938)
                   	at android.os.Handler.dispatchMessage(Handler.java:99)
                   	at android.os.Looper.loop(Looper.java:246)
                   	at android.app.ActivityThread.main(ActivityThread.java:8645)
                   	at java.lang.reflect.Method.invoke(Native Method)
                   	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
                   	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
---------------------------- PROCESS ENDED (4411) for package com.geodis.mobicop ----------------------------

@DaSpood
Copy link
Collaborator

DaSpood commented Oct 6, 2023

Hello @abelatar , cette erreur ne doit se produire que lorsque plusieurs appels a openCamera() (donc surfaceCreated()) sont effectués, donc plusieurs instances de la camera sont ouvertes dans la meme application sans être fermées entre chaque appel.

La camera se ferme en cas d'erreur, d'appel a surfaceDestroyed(), ou d'appel a la fonction cleanUp() de la vue camera, elle meme appelable par la fonction disconnect() du scanner camera.

N'y a-t-il bien qu'une seule instance en simultanée de la vue ou du scanner camera dans l'application ?

Je n'arrive pas a reproduire le bug sur le XCover ou le TC25

DaSpood added a commit that referenced this issue Oct 6, 2023
* Added Zebra DW provider
* Fixed #112 : worked around camera lifecycle.
* Fixed DW provider start/stop API
* Fixed incomplete CameraV2 image
* Activity: Fixed LED button always present in default layout
* Closes #113 - Zebra DW provider now creates its own profile.
* Fixed API version
* Fixed API 24 call
* Fixed #124: IntentProvider service test
* Fixed #124: ZebraDwProvider compatibility test
* Add <queries> tag to manifest for DW package
* Tentative fix for #111 - camera init/close is now locked globally
* Fixed #113 remark - DW profile switching.

---------

Co-authored-by: Marc-Antoine Gouillart <[email protected]>
@abelatar
Copy link
Author

abelatar commented Oct 6, 2023

Hello @DaSpood @marcanpilami ,
J'ai supprimé la contrainte de mode caméra pour les téléphones autres que le TC27, et cela fonctionne correctement. Voici le code associé :
this.goToCamera = deviceName == null || !deviceName.equalsIgnoreCase(Mobicop.TC27);

Dois-je retirer ce code de toutes mes activités ? Est-ce désormais la bibliothèque qui décide si on passe en mode scanner ou caméra sur les versions récentes ?

@DaSpood
Copy link
Collaborator

DaSpood commented Oct 6, 2023

Hello @abelatar

Actuellement, la bibliothèque passe automatiquement en mode camera si aucun autre scanner n'est disponible, et passe en mode "classique" si au moins un scanner est disponible.

Le champ goToCamera est set a true lors de l'appel a la fonction initCamera(), qui est appelée soit manuellement, soit automatiquement a la fin de la recherche de scanners si aucun scanner n'est disponible.

@DaSpood DaSpood added the bug label Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants