Throw error codes used by legacy device methods as exceptions.
Non-negative return values are passed through, negative return values are thrown as
exceptions.
switch (errorFlag) {
case CameraBinderDecorator.NO_ERROR: {
return CameraBinderDecorator.NO_ERROR;
}
case CameraBinderDecorator.ENODEV: {
throw new BufferQueueAbandonedException();
}
}
if (errorFlag < 0) {
throw new UnsupportedOperationException("Unknown error " + errorFlag);
}
return errorFlag;