Search in sources :

Example 1 with Parameters

use of android.hardware.Camera.Parameters in project UltimateAndroid by cymcsg.

the class CameraPreviewInput method setRenderSizeToCameraSize.

private void setRenderSizeToCameraSize() {
    Parameters params = camera.getParameters();
    Size previewSize = params.getPreviewSize();
    setRenderSize(previewSize.width, previewSize.height);
}
Also used : Parameters(android.hardware.Camera.Parameters) Size(android.hardware.Camera.Size)

Example 2 with Parameters

use of android.hardware.Camera.Parameters in project UltimateAndroid by cymcsg.

the class CameraPreviewInput method setRenderSizeToCameraSize.

private void setRenderSizeToCameraSize() {
    Parameters params = camera.getParameters();
    Size previewSize = params.getPreviewSize();
    setRenderSize(previewSize.width, previewSize.height);
}
Also used : Parameters(android.hardware.Camera.Parameters) Size(android.hardware.Camera.Size)

Example 3 with Parameters

use of android.hardware.Camera.Parameters in project android_frameworks_base by ParanoidAndroid.

the class CameraFunctionalTest method testFunctionalCameraFlashModes.

/**
     * Functional test iterating on the various flash modes (on, off, auto, torch)
     */
@LargeTest
public void testFunctionalCameraFlashModes() throws Exception {
    try {
        SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
        Parameters params = mCameraTestHelper.getCameraParameters();
        List<String> supportedFlashModes = params.getSupportedFlashModes();
        assertNotNull("No flash modes supported", supportedFlashModes);
        for (int i = 0; i < supportedFlashModes.size(); i++) {
            runOnLooper(new Runnable() {

                @Override
                public void run() {
                    mCameraTestHelper.setupCameraTest();
                }
            });
            Log.v(TAG, "Setting flash mode to " + supportedFlashModes.get(i));
            params.setFlashMode(supportedFlashModes.get(i));
            mCameraTestHelper.setParameters(params);
            mCameraTestHelper.startCameraPreview(surfaceHolder);
            mCameraTestHelper.capturePhoto();
        }
        mCameraTestHelper.cleanupTestImages();
    } catch (Exception e) {
        Log.e(TAG, e.toString());
        fail("Camera flash mode test Exception");
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) Parameters(android.hardware.Camera.Parameters) IOException(java.io.IOException) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 4 with Parameters

use of android.hardware.Camera.Parameters in project android_frameworks_base by ParanoidAndroid.

the class CameraFunctionalTest method testFunctionalCameraWhiteBalance.

/**
     * Functional test iterating on the various white balances (auto, daylight, cloudy, etc.)
     */
@LargeTest
public void testFunctionalCameraWhiteBalance() throws Exception {
    try {
        SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
        Parameters params = mCameraTestHelper.getCameraParameters();
        List<String> supportedWhiteBalance = params.getSupportedWhiteBalance();
        assertNotNull("No white balance modes supported", supportedWhiteBalance);
        for (int i = 0; i < supportedWhiteBalance.size(); i++) {
            runOnLooper(new Runnable() {

                @Override
                public void run() {
                    mCameraTestHelper.setupCameraTest();
                }
            });
            Log.v(TAG, "Setting white balance to: " + supportedWhiteBalance.get(i));
            params.setWhiteBalance(supportedWhiteBalance.get(i));
            mCameraTestHelper.setParameters(params);
            mCameraTestHelper.startCameraPreview(surfaceHolder);
            mCameraTestHelper.capturePhoto();
        }
        mCameraTestHelper.cleanupTestImages();
    } catch (Exception e) {
        Log.e(TAG, e.toString());
        fail("Camera focus modes test Exception");
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) Parameters(android.hardware.Camera.Parameters) IOException(java.io.IOException) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Example 5 with Parameters

use of android.hardware.Camera.Parameters in project android_frameworks_base by ParanoidAndroid.

the class CameraFunctionalTest method testFunctionalCameraExposureCompensation.

/**
     * Functional test iterating on the range of supported exposure compensation levels
     */
@LargeTest
public void testFunctionalCameraExposureCompensation() throws Exception {
    try {
        SurfaceHolder surfaceHolder = MediaFrameworkTest.mSurfaceView.getHolder();
        Parameters params = mCameraTestHelper.getCameraParameters();
        int min = params.getMinExposureCompensation();
        int max = params.getMaxExposureCompensation();
        assertFalse("Adjusting exposure not supported", (max == 0 && min == 0));
        float step = params.getExposureCompensationStep();
        int stepsPerEV = (int) Math.round(Math.pow((double) step, -1));
        // only get integer values for exposure compensation
        for (int i = min; i <= max; i += stepsPerEV) {
            runOnLooper(new Runnable() {

                @Override
                public void run() {
                    mCameraTestHelper.setupCameraTest();
                }
            });
            Log.v(TAG, "Setting exposure compensation index to " + i);
            params.setExposureCompensation(i);
            mCameraTestHelper.setParameters(params);
            mCameraTestHelper.startCameraPreview(surfaceHolder);
            mCameraTestHelper.capturePhoto();
        }
        mCameraTestHelper.cleanupTestImages();
    } catch (Exception e) {
        Log.e(TAG, e.toString());
        fail("Camera exposure compensation test Exception");
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) Parameters(android.hardware.Camera.Parameters) IOException(java.io.IOException) LargeTest(android.test.suitebuilder.annotation.LargeTest)

Aggregations

Parameters (android.hardware.Camera.Parameters)72 LargeTest (android.test.suitebuilder.annotation.LargeTest)36 SurfaceHolder (android.view.SurfaceHolder)36 Camera (android.hardware.Camera)16 CameraCharacteristics (android.hardware.camera2.CameraCharacteristics)15 Rect (android.graphics.Rect)10 CaptureRequest (android.hardware.camera2.CaptureRequest)10 CameraMetadataNative (android.hardware.camera2.impl.CameraMetadataNative)10 Size (android.util.Size)10 IOException (java.io.IOException)10 ZoomData (android.hardware.camera2.legacy.ParameterUtils.ZoomData)5 MeteringRectangle (android.hardware.camera2.params.MeteringRectangle)5 Location (android.location.Location)5 Range (android.util.Range)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 Size (android.hardware.Camera.Size)4 SuppressLint (android.annotation.SuppressLint)1 TargetApi (android.annotation.TargetApi)1 Point (android.graphics.Point)1