use of android.hardware.camera2.CameraAccessException in project android_frameworks_base by AOSPA.
the class CameraDeviceImpl method createCaptureSession.
@Override
public void createCaptureSession(List<Surface> outputs, CameraCaptureSession.StateCallback callback, Handler handler) throws CameraAccessException {
List<OutputConfiguration> outConfigurations = new ArrayList<>(outputs.size());
for (Surface surface : outputs) {
outConfigurations.add(new OutputConfiguration(surface));
}
createCaptureSessionInternal(null, outConfigurations, callback, handler, /*isConstrainedHighSpeed*/
false);
}
use of android.hardware.camera2.CameraAccessException in project android_frameworks_base by AOSPA.
the class CameraDeviceImpl method finishDeferredConfig.
public void finishDeferredConfig(List<OutputConfiguration> deferredConfigs) throws CameraAccessException {
if (deferredConfigs == null || deferredConfigs.size() == 0) {
throw new IllegalArgumentException("deferred config is null or empty");
}
synchronized (mInterfaceLock) {
for (OutputConfiguration config : deferredConfigs) {
int streamId = -1;
for (int i = 0; i < mConfiguredOutputs.size(); i++) {
// createReprocessableCaptureSessionByConfigurations() do a copy of the configs.
if (config.equals(mConfiguredOutputs.valueAt(i))) {
streamId = mConfiguredOutputs.keyAt(i);
break;
}
}
if (streamId == -1) {
throw new IllegalArgumentException("Deferred config is not part of this " + "session");
}
if (config.getSurface() == null) {
throw new IllegalArgumentException("The deferred config for stream " + streamId + " must have a non-null surface");
}
mRemoteDevice.setDeferredConfiguration(streamId, config);
}
}
}
use of android.hardware.camera2.CameraAccessException in project android_frameworks_base by AOSPA.
the class Camera2Focuser method startAutoFocusFullActiveLocked.
private void startAutoFocusFullActiveLocked() throws CameraAccessException {
// Create request builders, the af regions are automatically updated.
mRepeatingBuilder = createRequestBuilder();
CaptureRequest.Builder requestBuilder = createRequestBuilder();
mAutoFocus.setActiveAutoFocus(mRepeatingBuilder, requestBuilder);
if (mRepeatingBuilder.get(CaptureRequest.CONTROL_AF_TRIGGER) != CaptureRequest.CONTROL_AF_TRIGGER_IDLE) {
throw new AssertionError("Wrong trigger set in repeating request");
}
if (requestBuilder.get(CaptureRequest.CONTROL_AF_TRIGGER) != CaptureRequest.CONTROL_AF_TRIGGER_START) {
throw new AssertionError("Wrong trigger set in queued request");
}
mAutoFocus.resetState();
CaptureCallback listener = createCaptureListener();
mSession.setRepeatingRequest(mRepeatingBuilder.build(), listener, mHandler);
mSession.capture(requestBuilder.build(), listener, mHandler);
}
use of android.hardware.camera2.CameraAccessException in project android_frameworks_base by AOSPA.
the class CameraTestUtils method getSupportedSizeForFormat.
/**
* Get the available output sizes for the user-defined {@code format}.
*
* <p>Note that implementation-defined/hidden formats are not supported.</p>
*/
public static Size[] getSupportedSizeForFormat(int format, String cameraId, CameraManager cameraManager) throws CameraAccessException {
CameraCharacteristics properties = cameraManager.getCameraCharacteristics(cameraId);
assertNotNull("Can't get camera characteristics!", properties);
if (VERBOSE) {
Log.v(TAG, "get camera characteristics for camera: " + cameraId);
}
StreamConfigurationMap configMap = properties.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
Size[] availableSizes = configMap.getOutputSizes(format);
assertArrayNotEmpty(availableSizes, "availableSizes should not be empty for format: " + format);
Size[] highResAvailableSizes = configMap.getHighResolutionOutputSizes(format);
if (highResAvailableSizes != null && highResAvailableSizes.length > 0) {
Size[] allSizes = new Size[availableSizes.length + highResAvailableSizes.length];
System.arraycopy(availableSizes, 0, allSizes, 0, availableSizes.length);
System.arraycopy(highResAvailableSizes, 0, allSizes, availableSizes.length, highResAvailableSizes.length);
availableSizes = allSizes;
}
if (VERBOSE)
Log.v(TAG, "Supported sizes are: " + Arrays.deepToString(availableSizes));
return availableSizes;
}
use of android.hardware.camera2.CameraAccessException in project android_frameworks_base by DirtyUnicorns.
the class CameraUtilsUncheckedThrowTest method testUncheckedThrow.
@SmallTest
public void testUncheckedThrow() {
try {
UncheckedThrow.throwAnyException(new CameraAccessException(CameraAccessException.CAMERA_DISCONNECTED));
Assert.fail("unreachable");
fakeNeverThrowsCameraAccess();
} catch (CameraAccessException e) {
}
}
Aggregations