Search in sources :

Example 1 with TimeoutRuntimeException

use of com.android.ex.camera2.exceptions.TimeoutRuntimeException in project android_frameworks_base by ResurrectionRemix.

the class Camera2SurfaceViewTestCase method waitForAnyResultValue.

/**
     * Wait for any expected result key values available in a certain number of results.
     *
     * <p>
     * Check the result immediately if numFramesWait is 0.
     * </p>
     *
     * @param listener The capture listener to get capture result.
     * @param resultKey The capture result key associated with the result value.
     * @param expectedValues The list of result value need to be waited for,
     * return immediately if the list is empty.
     * @param numResultsWait Number of frame to wait before times out.
     * @throws TimeoutRuntimeException If more than numResultsWait results are.
     * seen before the result matching myRequest arrives, or each individual wait
     * for result times out after {@value #WAIT_FOR_RESULT_TIMEOUT_MS}ms.
     */
protected static <T> void waitForAnyResultValue(SimpleCaptureCallback listener, CaptureResult.Key<T> resultKey, List<T> expectedValues, int numResultsWait) {
    if (numResultsWait < 0 || listener == null || expectedValues == null) {
        throw new IllegalArgumentException("Input must be non-negative number and listener/expectedValues " + "must be non-null");
    }
    int i = 0;
    CaptureResult result;
    do {
        result = listener.getCaptureResult(WAIT_FOR_RESULT_TIMEOUT_MS);
        T value = result.get(resultKey);
        for (T expectedValue : expectedValues) {
            if (VERBOSE) {
                Log.v(TAG, "Current result value for key " + resultKey.getName() + " is: " + value.toString());
            }
            if (value.equals(expectedValue)) {
                return;
            }
        }
    } while (i++ < numResultsWait);
    throw new TimeoutRuntimeException("Unable to get the expected result value " + expectedValues + " for key " + resultKey.getName() + " after waiting for " + numResultsWait + " results");
}
Also used : CaptureResult(android.hardware.camera2.CaptureResult) TimeoutRuntimeException(com.android.ex.camera2.exceptions.TimeoutRuntimeException)

Example 2 with TimeoutRuntimeException

use of com.android.ex.camera2.exceptions.TimeoutRuntimeException in project android_frameworks_base by AOSPA.

the class Camera2SurfaceViewTestCase method waitForAnyResultValue.

/**
     * Wait for any expected result key values available in a certain number of results.
     *
     * <p>
     * Check the result immediately if numFramesWait is 0.
     * </p>
     *
     * @param listener The capture listener to get capture result.
     * @param resultKey The capture result key associated with the result value.
     * @param expectedValues The list of result value need to be waited for,
     * return immediately if the list is empty.
     * @param numResultsWait Number of frame to wait before times out.
     * @throws TimeoutRuntimeException If more than numResultsWait results are.
     * seen before the result matching myRequest arrives, or each individual wait
     * for result times out after {@value #WAIT_FOR_RESULT_TIMEOUT_MS}ms.
     */
protected static <T> void waitForAnyResultValue(SimpleCaptureCallback listener, CaptureResult.Key<T> resultKey, List<T> expectedValues, int numResultsWait) {
    if (numResultsWait < 0 || listener == null || expectedValues == null) {
        throw new IllegalArgumentException("Input must be non-negative number and listener/expectedValues " + "must be non-null");
    }
    int i = 0;
    CaptureResult result;
    do {
        result = listener.getCaptureResult(WAIT_FOR_RESULT_TIMEOUT_MS);
        T value = result.get(resultKey);
        for (T expectedValue : expectedValues) {
            if (VERBOSE) {
                Log.v(TAG, "Current result value for key " + resultKey.getName() + " is: " + value.toString());
            }
            if (value.equals(expectedValue)) {
                return;
            }
        }
    } while (i++ < numResultsWait);
    throw new TimeoutRuntimeException("Unable to get the expected result value " + expectedValues + " for key " + resultKey.getName() + " after waiting for " + numResultsWait + " results");
}
Also used : CaptureResult(android.hardware.camera2.CaptureResult) TimeoutRuntimeException(com.android.ex.camera2.exceptions.TimeoutRuntimeException)

Example 3 with TimeoutRuntimeException

use of com.android.ex.camera2.exceptions.TimeoutRuntimeException in project platform_frameworks_base by android.

the class Camera2SurfaceViewTestCase method waitForAnyResultValue.

/**
     * Wait for any expected result key values available in a certain number of results.
     *
     * <p>
     * Check the result immediately if numFramesWait is 0.
     * </p>
     *
     * @param listener The capture listener to get capture result.
     * @param resultKey The capture result key associated with the result value.
     * @param expectedValues The list of result value need to be waited for,
     * return immediately if the list is empty.
     * @param numResultsWait Number of frame to wait before times out.
     * @throws TimeoutRuntimeException If more than numResultsWait results are.
     * seen before the result matching myRequest arrives, or each individual wait
     * for result times out after {@value #WAIT_FOR_RESULT_TIMEOUT_MS}ms.
     */
protected static <T> void waitForAnyResultValue(SimpleCaptureCallback listener, CaptureResult.Key<T> resultKey, List<T> expectedValues, int numResultsWait) {
    if (numResultsWait < 0 || listener == null || expectedValues == null) {
        throw new IllegalArgumentException("Input must be non-negative number and listener/expectedValues " + "must be non-null");
    }
    int i = 0;
    CaptureResult result;
    do {
        result = listener.getCaptureResult(WAIT_FOR_RESULT_TIMEOUT_MS);
        T value = result.get(resultKey);
        for (T expectedValue : expectedValues) {
            if (VERBOSE) {
                Log.v(TAG, "Current result value for key " + resultKey.getName() + " is: " + value.toString());
            }
            if (value.equals(expectedValue)) {
                return;
            }
        }
    } while (i++ < numResultsWait);
    throw new TimeoutRuntimeException("Unable to get the expected result value " + expectedValues + " for key " + resultKey.getName() + " after waiting for " + numResultsWait + " results");
}
Also used : CaptureResult(android.hardware.camera2.CaptureResult) TimeoutRuntimeException(com.android.ex.camera2.exceptions.TimeoutRuntimeException)

Example 4 with TimeoutRuntimeException

use of com.android.ex.camera2.exceptions.TimeoutRuntimeException in project android_frameworks_base by DirtyUnicorns.

the class Camera2SurfaceViewTestCase method waitForAnyResultValue.

/**
     * Wait for any expected result key values available in a certain number of results.
     *
     * <p>
     * Check the result immediately if numFramesWait is 0.
     * </p>
     *
     * @param listener The capture listener to get capture result.
     * @param resultKey The capture result key associated with the result value.
     * @param expectedValues The list of result value need to be waited for,
     * return immediately if the list is empty.
     * @param numResultsWait Number of frame to wait before times out.
     * @throws TimeoutRuntimeException If more than numResultsWait results are.
     * seen before the result matching myRequest arrives, or each individual wait
     * for result times out after {@value #WAIT_FOR_RESULT_TIMEOUT_MS}ms.
     */
protected static <T> void waitForAnyResultValue(SimpleCaptureCallback listener, CaptureResult.Key<T> resultKey, List<T> expectedValues, int numResultsWait) {
    if (numResultsWait < 0 || listener == null || expectedValues == null) {
        throw new IllegalArgumentException("Input must be non-negative number and listener/expectedValues " + "must be non-null");
    }
    int i = 0;
    CaptureResult result;
    do {
        result = listener.getCaptureResult(WAIT_FOR_RESULT_TIMEOUT_MS);
        T value = result.get(resultKey);
        for (T expectedValue : expectedValues) {
            if (VERBOSE) {
                Log.v(TAG, "Current result value for key " + resultKey.getName() + " is: " + value.toString());
            }
            if (value.equals(expectedValue)) {
                return;
            }
        }
    } while (i++ < numResultsWait);
    throw new TimeoutRuntimeException("Unable to get the expected result value " + expectedValues + " for key " + resultKey.getName() + " after waiting for " + numResultsWait + " results");
}
Also used : CaptureResult(android.hardware.camera2.CaptureResult) TimeoutRuntimeException(com.android.ex.camera2.exceptions.TimeoutRuntimeException)

Example 5 with TimeoutRuntimeException

use of com.android.ex.camera2.exceptions.TimeoutRuntimeException in project android_frameworks_base by crdroidandroid.

the class Camera2SurfaceViewTestCase method waitForAnyResultValue.

/**
     * Wait for any expected result key values available in a certain number of results.
     *
     * <p>
     * Check the result immediately if numFramesWait is 0.
     * </p>
     *
     * @param listener The capture listener to get capture result.
     * @param resultKey The capture result key associated with the result value.
     * @param expectedValues The list of result value need to be waited for,
     * return immediately if the list is empty.
     * @param numResultsWait Number of frame to wait before times out.
     * @throws TimeoutRuntimeException If more than numResultsWait results are.
     * seen before the result matching myRequest arrives, or each individual wait
     * for result times out after {@value #WAIT_FOR_RESULT_TIMEOUT_MS}ms.
     */
protected static <T> void waitForAnyResultValue(SimpleCaptureCallback listener, CaptureResult.Key<T> resultKey, List<T> expectedValues, int numResultsWait) {
    if (numResultsWait < 0 || listener == null || expectedValues == null) {
        throw new IllegalArgumentException("Input must be non-negative number and listener/expectedValues " + "must be non-null");
    }
    int i = 0;
    CaptureResult result;
    do {
        result = listener.getCaptureResult(WAIT_FOR_RESULT_TIMEOUT_MS);
        T value = result.get(resultKey);
        for (T expectedValue : expectedValues) {
            if (VERBOSE) {
                Log.v(TAG, "Current result value for key " + resultKey.getName() + " is: " + value.toString());
            }
            if (value.equals(expectedValue)) {
                return;
            }
        }
    } while (i++ < numResultsWait);
    throw new TimeoutRuntimeException("Unable to get the expected result value " + expectedValues + " for key " + resultKey.getName() + " after waiting for " + numResultsWait + " results");
}
Also used : CaptureResult(android.hardware.camera2.CaptureResult) TimeoutRuntimeException(com.android.ex.camera2.exceptions.TimeoutRuntimeException)

Aggregations

CaptureResult (android.hardware.camera2.CaptureResult)5 TimeoutRuntimeException (com.android.ex.camera2.exceptions.TimeoutRuntimeException)5