Galaxy S4 turn on camera flash cause onPictureTake

2019-07-04 02:54发布

问题:

I got a very annoyed bug on Galaxy S4 (other device works fine): when I turn on flash light, I can't take a picture because onPictureTaken isn't called. Here is my try:

  private void changeFlashMode(boolean isFlashOn) {
    if (mCamera != null) {          
        // assume I 've already checked support flash mode
        Camera.Parameters camParameters = mCamera.getParameters();
        camParameters.setFlashMode(isFlashOn ? Parameters.FLASH_MODE_ON : Parameters.FLASH_MODE_OFF);
        mCamera.setParameters(camParameters);
        startCameraPreview();        
    }
}

From debug, I can see it called to this line:

mCamera.takePicture(null, null, null, this);

and then nothing happened, onPictureTaken isn't called.

Could you please provide me an example?