Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
478 views
in Technique[技术] by (71.8m points)

error handling - android: I get no stacktrace, phone just hangs

My phone crashes after i pause my camera app, then switching back and take a picture. This only happens on my Samsung Galaxy S, on my Huwai device it totally works. I have found the lines of code which lead to the error. Unfortunately those lines are quite useful, so I can't strip them:

public void surfaceDestroyed(SurfaceHolder holder) { // <14>
        Log.d(TAG,"surfaceDestroyed()");
        if(this.camera != null){
            camera.stopPreview();
            // the next two lines lead to the error after switching back to the app and taking a picure
            camera.release();
            this.camera = null;
        }
    }

Unfortunately I don't get a stacktrace. All I get is:

12-17 12:45:01.609: ERROR/SecCamera(10857): cancelAutofocus() end, 0, 2
12-17 12:45:01.613: ERROR/SecCamera(10857): stopPreview()
12-17 12:45:01.613: ERROR/SecCamera(10857): fimc_v4l2_streamoff()
12-17 12:45:01.644: ERROR/CameraHardwareSec(10857): stopPreview() end
12-17 12:45:01.644: INFO/ShotSingle(10857): ShotSingle::takePicture end
12-17 12:45:01.644: DEBUG/SecCamera(10857): passed fmt = 1498831189 found pixel format[3]: YUV 4:2:2 packed, CbYCrY
12-17 12:45:01.695: WARN/CameraService(10857): width(800), height(480), format:jpeg
12-17 12:45:02.433: ERROR/SecCamera(10857): fimc_v4l2_streamoff()
12-17 12:45:02.793: INFO/DEBUG(2359): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-17 12:45:02.793: INFO/DEBUG(2359): Build fingerprint: 'samsung/GT-I9000/GT-I9000/GT-I9000:2.2/FROYO/NEJP5:user/release-keys'
12-17 12:45:02.793: INFO/DEBUG(2359): pid: 10857, tid: 11062  >>> /system/bin/mediaserver <<<
12-17 12:45:02.793: INFO/DEBUG(2359): signal 11 (SIGSEGV), fault addr 40b06000
12-17 12:45:02.797: INFO/DEBUG(2359):  r0 40b06000  r1 41043a40  r2 00024780  r3 00000000
12-17 12:45:02.797: INFO/DEBUG(2359):  r4 0002c5c0  r5 0000001c  r6 40d2c000  r7 00280a00
12-17 12:45:02.801: INFO/DEBUG(2359):  r8 00100000  r9 a811c479  10 40c2c000  fp 0002cbe0
12-17 12:45:02.801: INFO/DEBUG(2359):  ip a7913644  sp 40d2be60  lr a790d12b  pc afd0f4a8  cpsr 20000010
12-17 12:45:02.805: INFO/DEBUG(2359):  d0  643a64696f72646e  d1  6472656767756265
12-17 12:45:02.808: INFO/DEBUG(2359):  d2  6c8d6b716a8c6871  d3  678c6a71688d6a71
12-17 12:45:02.808: INFO/DEBUG(2359):  d4  668d6871698d6872  d5  678d6671648d6771
12-17 12:45:02.808: INFO/DEBUG(2359):  d6  648d6771668d6571  d7  638d6371658d6672
12-17 12:45:02.812: INFO/DEBUG(2359):  d8  0000000000000000  d9  0000000000000000
12-17 12:45:02.816: INFO/DEBUG(2359):  d10 0000000000000000  d11 0000000000000000
12-17 12:45:02.816: INFO/DEBUG(2359):  d12 0000000000000000  d13 0000000000000000
12-17 12:45:02.816: INFO/DEBUG(2359):  d14 0000000000000000  d15 0000000000000000
12-17 12:45:02.820: INFO/DEBUG(2359):  d16 417cd6d008000000  d17 3fe0000000000000
12-17 12:45:02.820: INFO/DEBUG(2359):  d18 3fe0000000000000  d19 3fe0000001312d00
12-17 12:45:02.824: INFO/DEBUG(2359):  d20 3f1153cbde08ad39  d21 bebbb90e9e9bc9e2
12-17 12:45:02.824: INFO/DEBUG(2359):  d22 3ff0000000000000  d23 3feb70bba144e0a7
12-17 12:45:02.828: INFO/DEBUG(2359):  d24 3e66376972bea4d0  d25 0000000000000000
12-17 12:45:02.828: INFO/DEBUG(2359):  d26 0000000000000000  d27 0000000000000000
12-17 12:45:02.832: INFO/DEBUG(2359):  d28 0000000000000000  d29 0000000000000000
12-17 12:45:02.836: INFO/DEBUG(2359):  d30 0000000000000000  d31 0000000000000000
12-17 12:45:02.836: INFO/DEBUG(2359):  scr 20000010
12-17 12:45:03.187: INFO/DEBUG(2359):          #00  pc 0000f4a8  /system/lib/libc.so
12-17 12:45:03.187: INFO/DEBUG(2359):          #01  pc 0000d128  /system/lib/libcamera.so
12-17 12:45:03.187: INFO/DEBUG(2359):          #02  pc 0000d2b2  /system/lib/libcamera.so
12-17 12:45:03.191: INFO/DEBUG(2359):          #03  pc 0001c4e0  /system/lib/libutils.so
12-17 12:45:03.191: INFO/DEBUG(2359):          #04  pc 000111b0  /system/lib/libc.so
12-17 12:45:03.191: INFO/DEBUG(2359):          #05  pc 00010ca0  /system/lib/libc.so
12-17 12:45:03.191: INFO/DEBUG(2359): code around pc:
12-17 12:45:03.191: INFO/DEBUG(2359): afd0f488 3a000009 f5d1f080 f5d1f0c0 f5d1f100 
12-17 12:45:03.191: INFO/DEBUG(2359): afd0f498 f421020d f421420d f5d1f100 e2522040 
12-17 12:45:03.191: INFO/DEBUG(2359): afd0f4a8 f400022d f400422d 2afffff8 e2822040 
12-17 12:45:03.191: INFO/DEBUG(2359): afd0f4b8 e2522020 3a000003 f421020d e2522020 
12-17 12:45:03.191: INFO/DEBUG(2359): afd0f4c8 f400022d 2afffffb e2822020 e3120010 
12-17 12:45:03.191: INFO/DEBUG(2359): code around lr:
12-17 12:45:03.191: INFO/DEBUG(2359): a790d108 fdd6f7f9 b1664607 f8d16a61 f85ee000 
12-17 12:45:03.195: INFO/DEBUG(2359): a790d118 19485c0c fe5ef7fd f8d419f1 f7f920b4 
12-17 12:45:03.195: INFO/DEBUG(2359): a790d128 f8d4ea9e ad0a3090 4628a910 f7fd9300 
12-17 12:45:03.195: INFO/DEBUG(2359): a790d138 2080ff5d f8d44629 f8dd2098 47e0c000 
12-17 12:45:03.195: INFO/DEBUG(2359): a790d148 f7fd4628 f8d4ff6f f012209c d0510f40 
12-17 12:45:03.195: INFO/DEBUG(2359): stack:
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be20  a791384c  /system/lib/libcamera.so
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be24  a79135f8  /system/lib/libcamera.so
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be28  a791384c  /system/lib/libcamera.so
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be2c  00000000  
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be30  00000000  
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be34  a790937f  /system/lib/libcamera.so
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be38  00000013  
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be3c  80e0a329  /system/lib/libseccameraadaptor.so
12-17 12:45:03.195: INFO/DEBUG(2359):     40d2be40  40d2c000  /dev/video0
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be44  40d2be94  
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be48  00000000  
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be4c  4eec80bd  
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be50  00000000  
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be54  0002c5c0  [heap]
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be58  df002777  
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be5c  e3a070ad  
12-17 12:45:03.199: INFO/DEBUG(2359): #00 40d2be60  40a6f000  /dev/ashmem/MemoryHeapBase (deleted)
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be64  a790d12b  /system/lib/libcamera.so
12-17 12:45:03.199: INFO/DEBUG(2359): #01 40d2be68  0003d9d0  [heap]
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be6c  00000000  
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be70  00000000  
12-17 12:45:03.199: INFO/DEBUG(2359):     40d2be74  afd10560  /system/lib/libc.so
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be78  00000000  
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be7c  afd10560  /system/lib/libc.so
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be80  afd4372c  /system/lib/libc.so
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be84  afd43768  /system/lib/libc.so
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be88  0002cbd8  [heap]
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be8c  0002cc10  [heap]
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be90  00100000  
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be94  42884a00  
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be98  00000600  
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2be9c  00000a00  
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2bea0  00780000  
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2bea4  0003e804  [heap]
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2bea8  0003d9d0  [heap]
12-17 12:45:03.203: INFO/DEBUG(2359):     40d2beac  001422e2  
12-17 12:45:03.207: INFO/DEBUG(2359):     40d2beb0  0002c5c0  [heap]
12-17 12:45:03.207: INFO/DEBUG(2359):     40d2beb4  0002cbf8  [heap]
12-17 12:45:03.207: INFO/DEBUG(2359):     40d2beb8  0002c5c0  [heap]
12-17 12:45:03.207: INFO/DEBUG(2359):     40d2bebc  a790d2b1  /system/lib/libcamera.so
12-17 12:45:03.207: INFO/DEBUG(2359):     40d2bec0  00000000  
12-17 12:45:03.207: INFO/DEBUG(2359):     40d2bec4  a790d2b7  /system/lib/libcamera.so
12-17 12:45:03.715: WARN/PowerManagerService(2474): Timer 0x3->0x3|0x3
12-17 12:45:04.543: INFO/DEBUG(2359): dumpmesg > /data/log/dumpstate_app_native.log
12-17 12:45:05.492: INFO/BootReceiver(2474): Copying /data/tombstones/tombstone_08 to DropBox (SYSTEM_TOMBSTONE)
12-17 12:45:05.586: INFO/dumpstate(11064): begin
12-17 12:45:06.562: INFO/dalvikvm(2474): threadid=3: reacting to signal 3
12-17 12:45:06.687: INFO/dalvikvm(2474): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:06.765: INFO/dalvikvm(2551): threadid=3: reacting to signal 3
12-17 12:45:06.773: INFO/dalvikvm(2551): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:06.966: INFO/dalvikvm(2559): threadid=3: reacting to signal 3
12-17 12:45:07.160: INFO/dalvikvm(2560): threadid=3: reacting to signal 3
12-17 12:45:07.199: INFO/dalvikvm(2960): threadid=3: reacting to signal 3
12-17 12:45:07.403: INFO/dalvikvm(3479): threadid=3: reacting to signal 3
12-17 12:45:07.519: INFO/dalvikvm(2560): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:07.551: INFO/dalvikvm(3871): threadid=3: reacting to signal 3
12-17 12:45:07.578: ERROR/dalvikvm(3871): Failed to write stack traces to /data/anr/traces.txt (182 of 3588): Interrupted system call
12-17 12:45:07.617: INFO/dalvikvm(3479): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:07.629: INFO/dalvikvm(2559): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:07.754: INFO/dalvikvm(5446): threadid=3: reacting to signal 3
12-17 12:45:07.769: INFO/dalvikvm(5446): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:07.937: INFO/dalvikvm(9448): threadid=3: reacting to signal 3
12-17 12:45:07.961: INFO/dalvikvm(9448): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:08.139: INFO/dalvikvm(9873): threadid=3: reacting to signal 3
12-17 12:45:08.152: INFO/dalvikvm(9873): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:08.238: INFO/dalvikvm(9907): threadid=3: reacting to signal 3
12-17 12:45:08.250: INFO/dalvikvm(9907): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:08.437: INFO/dalvikvm(10061): threadid=3: reacting to signal 3
12-17 12:45:08.488: INFO/dalvikvm(10365): threadid=3: reacting to signal 3
12-17 12:45:08.504: INFO/dalvikvm(10414): threadid=3: reacting to signal 3
12-17 12:45:08.504: INFO/dalvikvm(10499): threadid=3: reacting to signal 3
12-17 12:45:08.512: INFO/dalvikvm(10658): threadid=3: reacting to signal 3
12-17 12:45:08.512: INFO/dalvikvm(10672): threadid=3: reacting to signal 3
12-17 12:45:08.590: INFO/dalvikvm(10658): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:08.594: ERROR/dalvikvm(10672): Failed to write stack traces to /data/anr/traces.txt (1797 of 2305): Unknown error: 0
12-17 12:45:08.605: INFO/dalvikvm(10682): threadid=3: reacting to signal 3
12-17 12:45:08.613: ERROR/dalvikvm(10499): Failed to write stack traces to /data/anr/traces.txt (-1 of 3362): Math result not representable
12-17 12:45:08.613: ERROR/dalvikvm(10365): Failed to write stack traces to /data/anr/traces.txt (-1 of 2832): Math result not representable
12-17 12:45:08.625: INFO/dalvikvm(10731): threadid=3: reacting to signal 3
12-17 12:45:08.633: INFO/dalvikvm(10751): threadid=3: reacting to signal 3
12-17 12:45:08.640: INFO/dalvikvm(10770): threadid=3: reacting to signal 3
12-17 12:45:08.660: INFO/dalvikvm(10751): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:08.664: INFO/dalvikvm(10682): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:08.695: INFO/dalvikvm(10848): threadid=3: reacting to signal 3
12-17 12:45:08.707: INFO/dalvikvm(10061): Wrote stack traces to '/data/anr/traces.txt'
12-17 12:45:08.897: INFO/dalvikvm(10924): threadid=3: reacting to signal 3
12-17 12:45:08.957: ERROR/dalvikvm(2960): Failed to write stack t

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I finally (after hours, almost days of debugging) solved this, by removing the preview view and re-instantiating it:

    @Override
    protected void onResume() {
        super.onResume();
        mSurfaceViewContainer.removeAllViews();
        mSurfaceView = new SurfaceView(mSurfaceViewContainer.getContext());
        mSurfaceViewContainer.addView(mSurfaceView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

        SurfaceHolder previewHolder = mSurfaceView.getHolder();
        previewHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
        previewHolder.addCallback(mSurfaceHolderCallback);
    }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...