Camera2在三星8上冻结

时间:2017-12-27 22:42:52

标签: android android-camera2

我已经为我的数据科学学位的最终论文开发了一个应用程序的问题。问题在于它不能在我全新的Samsung8上工作,而它在我之前的手机HTC上工作。虽然我可以看到问题所在,但我不知道如何正确解决问题。我将从下面的手机中转储logcat输出,以及来自guilty文件的代码snippits。



--------- beginning of main
12-26 13:26:20.829 21890 21890 D InputTransport: Input channel constructed: fd=87
12-26 13:26:20.829 21890 21890 D InputTransport: Input channel destroyed: fd=83
12-26 13:26:20.853 21890 21909 D OpenGLRenderer: endAllActiveAnimators on 0x7bac793400 (RippleDrawable) with handle 0x7bac9e6160
12-26 13:26:20.853 21890 21890 D ViewRootImpl@a565c5e[PictureActivity]: mHardwareRenderer.destroy()#1
12-26 13:26:20.856 21890 21890 D ViewRootImpl@a565c5e[PictureActivity]: Relayout returned: oldFrame=[0,0][1080,2220] newFrame=[0,0][1080,2220] result=0x5 surface={isValid=false 0} surfaceGenerationChanged=true
12-26 13:26:25.068 21890 21890 D ViewRootImpl@21abbe6[Camera2Activity]: ViewPostImeInputStage processPointer 0
12-26 13:26:25.159 21890 21890 D ViewRootImpl@21abbe6[Camera2Activity]: ViewPostImeInputStage processPointer 1
12-26 13:26:25.676 21890 21890 W System.err: android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList:270: Camera 1: Got error Function not implemented (-38) after trying to submit capture request
12-26 13:26:25.677 21890 21890 W System.err: 	at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:634)
12-26 13:26:25.678 21890 21890 W System.err: 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86)
12-26 13:26:25.678 21890 21890 W System.err: 	at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:865)
12-26 13:26:25.678 21890 21890 W System.err: 	at android.hardware.camera2.impl.CameraDeviceImpl.capture(CameraDeviceImpl.java:754)
12-26 13:26:25.678 21890 21890 W System.err: 	at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:179)
12-26 13:26:25.678 21890 21890 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.captureStillPicture(Camera2Fragment.java:869)
12-26 13:26:25.679 21890 21890 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.lockFocus(Camera2Fragment.java:803)
12-26 13:26:25.679 21890 21890 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.takePicture(Camera2Fragment.java:790)
12-26 13:26:25.679 21890 21890 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.onClick(Camera2Fragment.java:913)
12-26 13:26:25.679 21890 21890 W System.err: 	at android.view.View.performClick(View.java:6261)
12-26 13:26:25.679 21890 21890 W System.err: 	at android.view.View$PerformClick.run(View.java:23748)
12-26 13:26:25.679 21890 21890 W System.err: 	at android.os.Handler.handleCallback(Handler.java:751)
12-26 13:26:25.679 21890 21890 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:95)
12-26 13:26:25.679 21890 21890 W System.err: 	at android.os.Looper.loop(Looper.java:154)
12-26 13:26:25.679 21890 21890 W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6776)
12-26 13:26:25.680 21890 21890 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
12-26 13:26:25.680 21890 21890 W System.err: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
12-26 13:26:25.680 21890 21890 W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
12-26 13:26:25.681 21890 21890 W System.err: Caused by: android.os.ServiceSpecificException: submitRequestList:270: Camera 1: Got error Function not implemented (-38) after trying to submit capture request
12-26 13:26:25.681 21890 21890 W System.err: 	at android.os.Parcel.readException(Parcel.java:1707)
12-26 13:26:25.681 21890 21890 W System.err: 	at android.os.Parcel.readException(Parcel.java:1646)
12-26 13:26:25.681 21890 21890 W System.err: 	at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.submitRequestList(ICameraDeviceUser.java:318)
12-26 13:26:25.681 21890 21890 W System.err: 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84)
12-26 13:26:25.681 21890 21890 W System.err: 	... 16 more
12-26 13:26:25.689 21890 21890 W System.err: android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList:270: Camera 1: Got error Function not implemented (-38) after trying to submit capture request
12-26 13:26:25.689 21890 21890 W System.err: 	at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:634)
12-26 13:26:25.690 21890 21890 W System.err: 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:86)
12-26 13:26:25.690 21890 21890 W System.err: 	at android.hardware.camera2.impl.CameraDeviceImpl.submitCaptureRequest(CameraDeviceImpl.java:865)
12-26 13:26:25.690 21890 21890 W System.err: 	at android.hardware.camera2.impl.CameraDeviceImpl.capture(CameraDeviceImpl.java:754)
12-26 13:26:25.690 21890 21890 W System.err: 	at android.hardware.camera2.impl.CameraCaptureSessionImpl.capture(CameraCaptureSessionImpl.java:179)
12-26 13:26:25.690 21890 21890 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.lockFocus(Camera2Fragment.java:805)
12-26 13:26:25.690 21890 21890 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.takePicture(Camera2Fragment.java:790)
12-26 13:26:25.691 21890 21890 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.onClick(Camera2Fragment.java:913)
12-26 13:26:25.691 21890 21890 W System.err: 	at android.view.View.performClick(View.java:6261)
12-26 13:26:25.691 21890 21890 W System.err: 	at android.view.View$PerformClick.run(View.java:23748)
12-26 13:26:25.691 21890 21890 W System.err: 	at android.os.Handler.handleCallback(Handler.java:751)
12-26 13:26:25.691 21890 21890 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:95)
12-26 13:26:25.691 21890 21890 W System.err: 	at android.os.Looper.loop(Looper.java:154)
12-26 13:26:25.691 21890 21890 W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6776)
12-26 13:26:25.691 21890 21890 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
12-26 13:26:25.692 21890 21890 W System.err: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
12-26 13:26:25.692 21890 21890 W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
12-26 13:26:25.692 21890 21890 W System.err: Caused by: android.os.ServiceSpecificException: submitRequestList:270: Camera 1: Got error Function not implemented (-38) after trying to submit capture request
12-26 13:26:25.693 21890 21890 W System.err: 	at android.os.Parcel.readException(Parcel.java:1707)
12-26 13:26:25.693 21890 21890 W System.err: 	at android.os.Parcel.readException(Parcel.java:1646)
12-26 13:26:25.693 21890 21890 W System.err: 	at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.submitRequestList(ICameraDeviceUser.java:318)
12-26 13:26:25.693 21890 21890 W System.err: 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.submitRequestList(ICameraDeviceUserWrapper.java:84)
12-26 13:26:25.693 21890 21890 W System.err: 	... 15 more
12-26 13:26:25.695 21890 21890 I Choreographer: Skipped 31 frames!  The application may be doing too much work on its main thread.
12-26 13:26:25.697 21890 21998 W System.err: android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): createDefaultRequest:742: Camera 1: Error creating default request for template 2: Function not implemented (-38)
12-26 13:26:25.697 21890 21998 W System.err: 	at android.hardware.camera2.CameraManager.throwAsPublicException(CameraManager.java:634)
12-26 13:26:25.697 21890 21998 W System.err: 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.createDefaultRequest(ICameraDeviceUserWrapper.java:159)
12-26 13:26:25.698 21890 21998 W System.err: 	at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureRequest(CameraDeviceImpl.java:665)
12-26 13:26:25.698 21890 21998 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.captureStillPicture(Camera2Fragment.java:843)
12-26 13:26:25.698 21890 21998 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment.access$800(Camera2Fragment.java:79)
12-26 13:26:25.698 21890 21998 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment$4.process(Camera2Fragment.java:307)
12-26 13:26:25.698 21890 21998 W System.err: 	at com.example.joachim.faceapp.Camera2Fragment$4.onCaptureProgressed(Camera2Fragment.java:348)
12-26 13:26:25.698 21890 21998 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
12-26 13:26:25.698 21890 21998 W System.err: 	at android.hardware.camera2.dispatch.InvokeDispatcher.dispatch(InvokeDispatcher.java:39)
12-26 13:26:25.698 21890 21998 W System.err: 	at android.hardware.camera2.dispatch.HandlerDispatcher$1.run(HandlerDispatcher.java:65)
12-26 13:26:25.699 21890 21998 W System.err: 	at android.os.Handler.handleCallback(Handler.java:751)
12-26 13:26:25.699 21890 21998 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:95)
12-26 13:26:25.700 21890 21998 W System.err: 	at android.os.Looper.loop(Looper.java:154)
12-26 13:26:25.700 21890 21998 W System.err: 	at android.os.HandlerThread.run(HandlerThread.java:61)
12-26 13:26:25.701 21890 21998 W System.err: Caused by: android.os.ServiceSpecificException: createDefaultRequest:742: Camera 1: Error creating default request for template 2: Function not implemented (-38)
12-26 13:26:25.701 21890 21998 W System.err: 	at android.os.Parcel.readException(Parcel.java:1707)
12-26 13:26:25.701 21890 21998 W System.err: 	at android.os.Parcel.readException(Parcel.java:1646)
12-26 13:26:25.701 21890 21998 W System.err: 	at android.hardware.camera2.ICameraDeviceUser$Stub$Proxy.createDefaultRequest(ICameraDeviceUser.java:503)
12-26 13:26:25.701 21890 21998 W System.err: 	at android.hardware.camera2.impl.ICameraDeviceUserWrapper.createDefaultRequest(ICameraDeviceUserWrapper.java:157)
12-26 13:26:25.701 21890 21998 W System.err: 	... 12 more




这是嫌犯。



private void captureStillPicture() {
        try {
            final Activity activity = getActivity();
            if (null == activity || null == mCameraDevice) {
                return;
            }
            // This is the CaptureRequest.Builder that we use to take a picture.
            final CaptureRequest.Builder captureBuilder =
                    mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
            captureBuilder.addTarget(mImageReader.getSurface());

            // Use the same AE and AF modes as the preview.
            captureBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                    CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);

            // Orientation
            int rotation = activity.getWindowManager().getDefaultDisplay().getRotation();
            captureBuilder.set(CaptureRequest.JPEG_ORIENTATION, getOrientation(rotation));

            CameraCaptureSession.CaptureCallback CaptureCallback
                    = new CameraCaptureSession.CaptureCallback() {

                @Override
                public void onCaptureCompleted(@NonNull CameraCaptureSession session,
                                               @NonNull CaptureRequest request,
                                               @NonNull TotalCaptureResult result) {
                    showToast("Saved: " + mFile);
                    Log.d(TAG, mFile.toString());
                    unlockFocus();
                }
            };

            mCaptureSession.stopRepeating();
            mCaptureSession.abortCaptures();
            mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);
        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
    
    
    




如果有人可以帮助我,请。我有办法在功能状态下展示应用程序,但我很想知道这是否是我可以在新手机上修复的问题。

0 个答案:

没有答案