FileDocCategorySizeDatePackage
LegacyExceptionUtils.javaAPI DocAndroid 5.1 API2666Thu Mar 12 22:22:10 GMT 2015android.hardware.camera2.legacy

LegacyExceptionUtils

public class LegacyExceptionUtils extends Object
Utility class containing exception handling used solely by the compatibility mode shim.

Fields Summary
private static final String
TAG
Constructors Summary
private LegacyExceptionUtils()

        throw new AssertionError();
    
Methods Summary
public static intthrowOnError(int errorFlag)
Throw error codes used by legacy device methods as exceptions.

Non-negative return values are passed through, negative return values are thrown as exceptions.

param
errorFlag error to throw as an exception.
throws
{@link BufferQueueAbandonedException} for {@link CameraBinderDecorator#ENODEV}.
throws
{@link UnsupportedOperationException} for an unknown negative error code.
return
{@code errorFlag} if the value was non-negative, throws otherwise.

        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;