I'm trying to capture an image using the Camera2 api, with a specific exposure time. everything looks fine when it's set to small values like 1/8000 of a second or 1/10. The problem comes when I try to set it to values like 5 seconds or 30, it seems like the camera limits the exposure time to about 1 second... even if the SENSOR_INFO_EXPOSURE_TIME_RANGE is:
from 13181 to 48369980540(48 seconds).
When I get the exposure time from the CaptureResult I get the value I put in, instead of the real exposure time.
I know that my camera can take pictures with higher exposure since my stock camera limit is 30 seconds.
That's the code I tried:
final CaptureRequest.Builder captureBuilder =
mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_STILL_CAPTURE);
captureBuilder.addTarget(mImageReader.getSurface());
captureBuilder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF);
captureBuilder.set(CaptureRequest.SENSOR_SENSITIVITY, 100);
captureBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME, 10000000000L);//10 seconds
// 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());
Long expo = result.get(CaptureResult.SENSOR_EXPOSURE_TIME);
unlockFocus();
}
};
mCaptureSession.stopRepeating();
mCaptureSession.abortCaptures();
mCaptureSession.capture(captureBuilder.build(), CaptureCallback, null);