代码之家  ›  专栏  ›  技术社区  ›  Oleg Gryb

Android 10摄像头API崩溃,输入调度超时

  •  0
  • Oleg Gryb  · 技术社区  · 4 年前

    Android在覆盖函数中崩溃 表面粗糙 麦克默拉资源!!。停止() 打电话。我没有看到比安卓10更小的版本。我使用的摄像头API来自以下库:

    implementation 'com.google.android.gms:play-services-vision:16.2.0'
    

    代码:

       mCameraView!!.holder.addCallback(object : SurfaceHolder.Callback {
                @SuppressLint("MissingPermission")
                override fun surfaceCreated(holder: SurfaceHolder) {
    
                    try {
                        App.d(TAG, "SURF CREATED")
    
                        if (mPreview != null) {
                            val lp = mCameraView!!.layoutParams
                            lp.width = mPreview!!.mW
                            lp.height = mPreview!!.mH
                            mCameraView!!.layoutParams = lp
                        }
    
                        mCameraSource!!.start(mCameraView!!.holder)
                        if (mManual!!.isChecked) {
                            mCameraSource!!.stop()
                        }
                    } catch (ie: Exception) {
                        App.d("CAMERA SOURCE", ie.message!!)
                        if (ie.message != null) {
                            mApp?.showToast(ie.message!!, App.MTYPE.ERROR)
                        }
    
                    }
    
                }
    
                override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
                    App.d(TAG, "SURF CHANGED$width $height")
                }
    
                override fun surfaceDestroyed(holder: SurfaceHolder) {
                    mCameraSource!!.stop()
                }
            })
    

    Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago. Wait queue length: 5. Wait queue head age: 6342.0ms.)
    
     "main" prio=5 tid=1 Native
          | group="main" sCount=1 dsCount=0 flags=1 obj=0x71f1ca78 self=0x7bbd6e7c00
          | sysTid=12569 nice=-10 cgrp=default sched=0/0 handle=0x7bbec55ed0
          | state=S schedstat=( 3081390685 640907571 5236 ) utm=236 stm=72 core=6 HZ=100
          | stack=0x7ffd745000-0x7ffd747000 stackSize=8192KB
          | held mutexes=
          #00  pc 00000000000d1084  /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+4)
          #01  pc 000000000008b6b0  /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+132)
          #02  pc 00000000000590a4  /system/lib64/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+244)
          #03  pc 0000000000059f90  /system/lib64/libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*)+60)
          #04  pc 0000000000059d34  /system/lib64/libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+180)
          #05  pc 000000000004e024  /system/lib64/libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+132)
          #06  pc 000000000005a4d0  /system/lib64/libcamera_client.so (android::hardware::BpCamera::stopPreview()+228)
          #07  pc 000000000004ce5c  /system/lib64/libcamera_client.so (android::Camera::stopPreview()+168)
          #08  pc 000000000019220c  /system/lib64/libandroid_runtime.so (android_hardware_Camera_stopPreview(_JNIEnv*, _jobject*)+48)
          at android.hardware.Camera._stopPreview (Camera.java)
          at android.hardware.Camera.stopPreview (Camera.java:1027)
          at com.google.android.gms.vision.CameraSource.stop (CameraSource.java)
        - locked <0x0fbf2510> (a java.lang.Object)
          at info.gryb.gac.mobile.Scanner$startCamera$9.surfaceDestroyed (Scanner.java:782)
          at android.view.SurfaceView.updateSurface (SurfaceView.java:732)
          at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:280)
          at android.view.View.dispatchWindowVisibilityChanged (View.java:13873)
          at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1594)
          at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1594)
          at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1594)
          at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2259)
          at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1930)
          at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7988)
          at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1154)
          at android.view.Choreographer.doCallbacks (Choreographer.java:977)
          at android.view.Choreographer.doFrame (Choreographer.java:893)
          at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1139)
          at android.os.Handler.handleCallback (Handler.java:883)
          at android.os.Handler.dispatchMessage (Handler.java:100)
          at android.os.Looper.loop (Looper.java:214)
          at android.app.ActivityThread.main (ActivityThread.java:7682)
          at java.lang.reflect.Method.invoke (Method.java)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:516)
          at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:950)
    
    0 回复  |  直到 4 年前