1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.camera.one.v2.core; 18 19 import android.hardware.camera2.CaptureRequest; 20 21 import com.android.camera.one.v2.camera2proxy.CaptureRequestBuilderProxy; 22 23 /** 24 * A generic request for an image to be captured from a camera device via a 25 * {@link FrameServer}. 26 * 27 * @See {@link RequestBuilder} 28 */ 29 public interface Request { 30 /** 31 * Implementations must allocate/acquire all resources necessary for this 32 * request and block until acquisition is complete. 33 * <p/> 34 * For example, a request may need to acquire/reserve space in an 35 * ImageReader to ensure that the image can be saved when the request 36 * completes. 37 * 38 * @return The a proxy to an android {@link CaptureRequest.Builder} to build 39 * the {@link CaptureRequest} to be sent. 40 * @throws InterruptedException if interrupted while blocking for resources 41 * to become available. 42 */ allocateCaptureRequest()43 public CaptureRequestBuilderProxy allocateCaptureRequest() throws InterruptedException, 44 ResourceAcquisitionFailedException; 45 46 /** 47 * @return The {@link ResponseListener} to receive events related to this 48 * request. 49 */ getResponseListener()50 public ResponseListener getResponseListener(); 51 52 /** 53 * Invoked if the associated request has been aborted before ever being 54 * submitted to the {@link android.hardware.camera2.CameraCaptureSession}.<br> 55 * Any resources acquired in {@link #allocateCaptureRequest} must be 56 * released.<br> 57 * No {@link ResponseListener} methods will be invoked if this is called.<br> 58 * Implementations must tolerate multiple calls to abort(). 59 */ abort()60 public void abort(); 61 } 62