diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2017-12-22 19:18:49 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-12-22 19:18:49 +0000 |
| commit | 6a6a0b2fc8ffa77d3d9b129aa5f1ecba1b880b03 (patch) | |
| tree | 535710feaec3bbbed0305c3aa1b4b696eddf15d8 /core/java/android | |
| parent | 14cddc465bcda7ba1ae2f97ada23c82a507abdf4 (diff) | |
| parent | 75a5570f7db6990e12100afbd3985c09fcff8d32 (diff) | |
Merge "Camera: Add support for session parameters"
Diffstat (limited to 'core/java/android')
7 files changed, 377 insertions, 19 deletions
diff --git a/core/java/android/hardware/camera2/CameraCharacteristics.java b/core/java/android/hardware/camera2/CameraCharacteristics.java index 3a3048ef1de2..57ab18e20214 100644 --- a/core/java/android/hardware/camera2/CameraCharacteristics.java +++ b/core/java/android/hardware/camera2/CameraCharacteristics.java @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.hardware.camera2.impl.CameraMetadataNative; import android.hardware.camera2.impl.PublicKey; import android.hardware.camera2.impl.SyntheticKey; +import android.hardware.camera2.params.SessionConfiguration; import android.hardware.camera2.utils.TypeReference; import android.util.Rational; @@ -169,6 +170,7 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri private final CameraMetadataNative mProperties; private List<CameraCharacteristics.Key<?>> mKeys; private List<CaptureRequest.Key<?>> mAvailableRequestKeys; + private List<CaptureRequest.Key<?>> mAvailableSessionKeys; private List<CaptureResult.Key<?>> mAvailableResultKeys; /** @@ -251,6 +253,67 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri } /** + * <p>Returns a subset of {@link #getAvailableCaptureRequestKeys} keys that the + * camera device can pass as part of the capture session initialization.</p> + * + * <p>This list includes keys that are difficult to apply per-frame and + * can result in unexpected delays when modified during the capture session + * lifetime. Typical examples include parameters that require a + * time-consuming hardware re-configuration or internal camera pipeline + * change. For performance reasons we suggest clients to pass their initial + * values as part of {@link SessionConfiguration#setSessionParameters}. Once + * the camera capture session is enabled it is also recommended to avoid + * changing them from their initial values set in + * {@link SessionConfiguration#setSessionParameters }. + * Control over session parameters can still be exerted in capture requests + * but clients should be aware and expect delays during their application. + * An example usage scenario could look like this:</p> + * <ul> + * <li>The camera client starts by quering the session parameter key list via + * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.</li> + * <li>Before triggering the capture session create sequence, a capture request + * must be built via {@link CameraDevice#createCaptureRequest } using an + * appropriate template matching the particular use case.</li> + * <li>The client should go over the list of session parameters and check + * whether some of the keys listed matches with the parameters that + * they intend to modify as part of the first capture request.</li> + * <li>If there is no such match, the capture request can be passed + * unmodified to {@link SessionConfiguration#setSessionParameters }.</li> + * <li>If matches do exist, the client should update the respective values + * and pass the request to {@link SessionConfiguration#setSessionParameters }.</li> + * <li>After the capture session initialization completes the session parameter + * key list can continue to serve as reference when posting or updating + * further requests. As mentioned above further changes to session + * parameters should ideally be avoided, if updates are necessary + * however clients could expect a delay/glitch during the + * parameter switch.</li> + * </ul> + * + * <p>The list returned is not modifiable, so any attempts to modify it will throw + * a {@code UnsupportedOperationException}.</p> + * + * <p>Each key is only listed once in the list. The order of the keys is undefined.</p> + * + * @return List of keys that can be passed during capture session initialization. In case the + * camera device doesn't support such keys the list can be null. + */ + @SuppressWarnings({"unchecked"}) + public List<CaptureRequest.Key<?>> getAvailableSessionKeys() { + if (mAvailableSessionKeys == null) { + Object crKey = CaptureRequest.Key.class; + Class<CaptureRequest.Key<?>> crKeyTyped = (Class<CaptureRequest.Key<?>>)crKey; + + int[] filterTags = get(REQUEST_AVAILABLE_SESSION_KEYS); + if (filterTags == null) { + return null; + } + mAvailableSessionKeys = + getAvailableKeyList(CaptureRequest.class, crKeyTyped, filterTags); + } + return mAvailableSessionKeys; + } + + /** * Returns the list of keys supported by this {@link CameraDevice} for querying * with a {@link CaptureRequest}. * @@ -1571,6 +1634,48 @@ public final class CameraCharacteristics extends CameraMetadata<CameraCharacteri new Key<int[]>("android.request.availableCharacteristicsKeys", int[].class); /** + * <p>A subset of the available request keys that the camera device + * can pass as part of the capture session initialization.</p> + * <p>This is a subset of android.request.availableRequestKeys which + * contains a list of keys that are difficult to apply per-frame and + * can result in unexpected delays when modified during the capture session + * lifetime. Typical examples include parameters that require a + * time-consuming hardware re-configuration or internal camera pipeline + * change. For performance reasons we advise clients to pass their initial + * values as part of {@link SessionConfiguration#setSessionParameters }. Once + * the camera capture session is enabled it is also recommended to avoid + * changing them from their initial values set in + * {@link SessionConfiguration#setSessionParameters }. + * Control over session parameters can still be exerted in capture requests + * but clients should be aware and expect delays during their application. + * An example usage scenario could look like this:</p> + * <ul> + * <li>The camera client starts by quering the session parameter key list via + * {@link android.hardware.camera2.CameraCharacteristics#getAvailableSessionKeys }.</li> + * <li>Before triggering the capture session create sequence, a capture request + * must be built via {@link CameraDevice#createCaptureRequest } using an + * appropriate template matching the particular use case.</li> + * <li>The client should go over the list of session parameters and check + * whether some of the keys listed matches with the parameters that + * they intend to modify as part of the first capture request.</li> + * <li>If there is no such match, the capture request can be passed + * unmodified to {@link SessionConfiguration#setSessionParameters }.</li> + * <li>If matches do exist, the client should update the respective values + * and pass the request to {@link SessionConfiguration#setSessionParameters }.</li> + * <li>After the capture session initialization completes the session parameter + * key list can continue to serve as reference when posting or updating + * further requests. As mentioned above further changes to session + * parameters should ideally be avoided, if updates are necessary + * however clients could expect a delay/glitch during the + * parameter switch.</li> + * </ul> + * <p>This key is available on all devices.</p> + * @hide + */ + public static final Key<int[]> REQUEST_AVAILABLE_SESSION_KEYS = + new Key<int[]>("android.request.availableSessionKeys", int[].class); + + /** * <p>The list of image formats that are supported by this * camera device for output streams.</p> * <p>All camera devices will support JPEG and YUV_420_888 formats.</p> diff --git a/core/java/android/hardware/camera2/CameraDevice.java b/core/java/android/hardware/camera2/CameraDevice.java index 55343a2904f2..87e503def4e3 100644 --- a/core/java/android/hardware/camera2/CameraDevice.java +++ b/core/java/android/hardware/camera2/CameraDevice.java @@ -26,6 +26,7 @@ import static android.hardware.camera2.ICameraDeviceUser.CONSTRAINED_HIGH_SPEED_ import android.hardware.camera2.params.InputConfiguration; import android.hardware.camera2.params.StreamConfigurationMap; import android.hardware.camera2.params.OutputConfiguration; +import android.hardware.camera2.params.SessionConfiguration; import android.os.Handler; import android.view.Surface; @@ -811,6 +812,26 @@ public abstract class CameraDevice implements AutoCloseable { throws CameraAccessException; /** + * <p>Create a new {@link CameraCaptureSession} using a {@link SessionConfiguration} helper + * object that aggregates all supported parameters.</p> + * + * @param config A session configuration (see {@link SessionConfiguration}). + * + * @throws IllegalArgumentException In case the session configuration is invalid; or the output + * configurations are empty. + * @throws CameraAccessException In case the camera device is no longer connected or has + * encountered a fatal error. + * @see #createCaptureSession(List, CameraCaptureSession.StateCallback, Handler) + * @see #createCaptureSessionByOutputConfigurations + * @see #createReprocessableCaptureSession + * @see #createConstrainedHighSpeedCaptureSession + */ + public void createCaptureSession( + SessionConfiguration config) throws CameraAccessException { + throw new UnsupportedOperationException("No default implementation"); + } + + /** * <p>Create a {@link CaptureRequest.Builder} for new capture requests, * initialized with template for a target use case. The settings are chosen * to be the best options for the specific camera device, so it is not diff --git a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java index 374789c6cf05..8b8bbc34f7d2 100644 --- a/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraCaptureSessionImpl.java @@ -800,7 +800,8 @@ public class CameraCaptureSessionImpl extends CameraCaptureSession try { // begin transition to unconfigured mDeviceImpl.configureStreamsChecked(/*inputConfig*/null, /*outputs*/null, - /*operatingMode*/ ICameraDeviceUser.NORMAL_MODE); + /*operatingMode*/ ICameraDeviceUser.NORMAL_MODE, + /*sessionParams*/ null); } catch (CameraAccessException e) { // OK: do not throw checked exceptions. Log.e(TAG, mIdString + "Exception while unconfiguring outputs: ", e); diff --git a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java index 972a2813259f..f1ffb890eecd 100644 --- a/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java +++ b/core/java/android/hardware/camera2/impl/CameraDeviceImpl.java @@ -32,6 +32,7 @@ import android.hardware.camera2.TotalCaptureResult; import android.hardware.camera2.params.InputConfiguration; import android.hardware.camera2.params.OutputConfiguration; import android.hardware.camera2.params.ReprocessFormatsMap; +import android.hardware.camera2.params.SessionConfiguration; import android.hardware.camera2.params.StreamConfigurationMap; import android.hardware.camera2.utils.SubmitInfo; import android.hardware.camera2.utils.SurfaceUtils; @@ -362,7 +363,7 @@ public class CameraDeviceImpl extends CameraDevice outputConfigs.add(new OutputConfiguration(s)); } configureStreamsChecked(/*inputConfig*/null, outputConfigs, - /*operatingMode*/ICameraDeviceUser.NORMAL_MODE); + /*operatingMode*/ICameraDeviceUser.NORMAL_MODE, /*sessionParams*/ null); } @@ -382,12 +383,13 @@ public class CameraDeviceImpl extends CameraDevice * @param outputs a list of one or more surfaces, or {@code null} to unconfigure * @param operatingMode If the stream configuration is for a normal session, * a constrained high speed session, or something else. + * @param sessionParams Session parameters. * @return whether or not the configuration was successful * * @throws CameraAccessException if there were any unexpected problems during configuration */ public boolean configureStreamsChecked(InputConfiguration inputConfig, - List<OutputConfiguration> outputs, int operatingMode) + List<OutputConfiguration> outputs, int operatingMode, CaptureRequest sessionParams) throws CameraAccessException { // Treat a null input the same an empty list if (outputs == null) { @@ -463,7 +465,11 @@ public class CameraDeviceImpl extends CameraDevice } } - mRemoteDevice.endConfigure(operatingMode); + if (sessionParams != null) { + mRemoteDevice.endConfigure(operatingMode, sessionParams.getNativeCopy()); + } else { + mRemoteDevice.endConfigure(operatingMode, null); + } success = true; } catch (IllegalArgumentException e) { @@ -499,7 +505,7 @@ public class CameraDeviceImpl extends CameraDevice outConfigurations.add(new OutputConfiguration(surface)); } createCaptureSessionInternal(null, outConfigurations, callback, handler, - /*operatingMode*/ICameraDeviceUser.NORMAL_MODE); + /*operatingMode*/ICameraDeviceUser.NORMAL_MODE, /*sessionParams*/ null); } @Override @@ -515,7 +521,7 @@ public class CameraDeviceImpl extends CameraDevice List<OutputConfiguration> currentOutputs = new ArrayList<>(outputConfigurations); createCaptureSessionInternal(null, currentOutputs, callback, handler, - /*operatingMode*/ICameraDeviceUser.NORMAL_MODE); + /*operatingMode*/ICameraDeviceUser.NORMAL_MODE, /*sessionParams*/null); } @Override @@ -535,7 +541,7 @@ public class CameraDeviceImpl extends CameraDevice outConfigurations.add(new OutputConfiguration(surface)); } createCaptureSessionInternal(inputConfig, outConfigurations, callback, handler, - /*operatingMode*/ICameraDeviceUser.NORMAL_MODE); + /*operatingMode*/ICameraDeviceUser.NORMAL_MODE, /*sessionParams*/ null); } @Override @@ -563,7 +569,8 @@ public class CameraDeviceImpl extends CameraDevice currentOutputs.add(new OutputConfiguration(output)); } createCaptureSessionInternal(inputConfig, currentOutputs, - callback, handler, /*operatingMode*/ICameraDeviceUser.NORMAL_MODE); + callback, handler, /*operatingMode*/ICameraDeviceUser.NORMAL_MODE, + /*sessionParams*/ null); } @Override @@ -574,16 +581,13 @@ public class CameraDeviceImpl extends CameraDevice throw new IllegalArgumentException( "Output surface list must not be null and the size must be no more than 2"); } - StreamConfigurationMap config = - getCharacteristics().get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); - SurfaceUtils.checkConstrainedHighSpeedSurfaces(outputs, /*fpsRange*/null, config); - List<OutputConfiguration> outConfigurations = new ArrayList<>(outputs.size()); for (Surface surface : outputs) { outConfigurations.add(new OutputConfiguration(surface)); } createCaptureSessionInternal(null, outConfigurations, callback, handler, - /*operatingMode*/ICameraDeviceUser.CONSTRAINED_HIGH_SPEED_MODE); + /*operatingMode*/ICameraDeviceUser.CONSTRAINED_HIGH_SPEED_MODE, + /*sessionParams*/ null); } @Override @@ -596,13 +600,30 @@ public class CameraDeviceImpl extends CameraDevice for (OutputConfiguration output : outputs) { currentOutputs.add(new OutputConfiguration(output)); } - createCaptureSessionInternal(inputConfig, currentOutputs, callback, handler, operatingMode); + createCaptureSessionInternal(inputConfig, currentOutputs, callback, handler, operatingMode, + /*sessionParams*/ null); + } + + @Override + public void createCaptureSession(SessionConfiguration config) + throws CameraAccessException { + if (config == null) { + throw new IllegalArgumentException("Invalid session configuration"); + } + + List<OutputConfiguration> outputConfigs = config.getOutputConfigurations(); + if (outputConfigs == null) { + throw new IllegalArgumentException("Invalid output configurations"); + } + createCaptureSessionInternal(config.getInputConfiguration(), outputConfigs, + config.getStateCallback(), config.getHandler(), config.getSessionType(), + config.getSessionParameters()); } private void createCaptureSessionInternal(InputConfiguration inputConfig, List<OutputConfiguration> outputConfigurations, CameraCaptureSession.StateCallback callback, Handler handler, - int operatingMode) throws CameraAccessException { + int operatingMode, CaptureRequest sessionParams) throws CameraAccessException { synchronized(mInterfaceLock) { if (DEBUG) { Log.d(TAG, "createCaptureSessionInternal"); @@ -630,7 +651,7 @@ public class CameraDeviceImpl extends CameraDevice try { // configure streams and then block until IDLE configureSuccess = configureStreamsChecked(inputConfig, outputConfigurations, - operatingMode); + operatingMode, sessionParams); if (configureSuccess == true && inputConfig != null) { input = mRemoteDevice.getInputSurface(); } @@ -646,6 +667,14 @@ public class CameraDeviceImpl extends CameraDevice // Fire onConfigured if configureOutputs succeeded, fire onConfigureFailed otherwise. CameraCaptureSessionCore newSession = null; if (isConstrainedHighSpeed) { + ArrayList<Surface> surfaces = new ArrayList<>(outputConfigurations.size()); + for (OutputConfiguration outConfig : outputConfigurations) { + surfaces.add(outConfig.getSurface()); + } + StreamConfigurationMap config = + getCharacteristics().get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP); + SurfaceUtils.checkConstrainedHighSpeedSurfaces(surfaces, /*fpsRange*/null, config); + newSession = new CameraConstrainedHighSpeedCaptureSessionImpl(mNextSessionId++, callback, handler, this, mDeviceHandler, configureSuccess, mCharacteristics); diff --git a/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java b/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java index 0978ff87b38b..1f4ed13ee09e 100644 --- a/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java +++ b/core/java/android/hardware/camera2/impl/ICameraDeviceUserWrapper.java @@ -106,9 +106,11 @@ public class ICameraDeviceUserWrapper { } } - public void endConfigure(int operatingMode) throws CameraAccessException { + public void endConfigure(int operatingMode, CameraMetadataNative sessionParams) + throws CameraAccessException { try { - mRemoteDevice.endConfigure(operatingMode); + mRemoteDevice.endConfigure(operatingMode, (sessionParams == null) ? + new CameraMetadataNative() : sessionParams); } catch (Throwable t) { CameraManager.throwAsPublicException(t); throw new UnsupportedOperationException("Unexpected exception", t); diff --git a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java index 119cca8d4715..eccab7500abf 100644 --- a/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java +++ b/core/java/android/hardware/camera2/legacy/CameraDeviceUserShim.java @@ -498,7 +498,7 @@ public class CameraDeviceUserShim implements ICameraDeviceUser { } @Override - public void endConfigure(int operatingMode) { + public void endConfigure(int operatingMode, CameraMetadataNative sessionParams) { if (DEBUG) { Log.d(TAG, "endConfigure called."); } diff --git a/core/java/android/hardware/camera2/params/SessionConfiguration.java b/core/java/android/hardware/camera2/params/SessionConfiguration.java new file mode 100644 index 000000000000..a79a6c17f925 --- /dev/null +++ b/core/java/android/hardware/camera2/params/SessionConfiguration.java @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package android.hardware.camera2.params; + +import android.annotation.NonNull; +import android.annotation.Nullable; +import android.annotation.IntDef; +import android.os.Handler; +import android.hardware.camera2.CameraCaptureSession; +import android.hardware.camera2.CameraCharacteristics; +import android.hardware.camera2.CameraDevice; +import android.hardware.camera2.CaptureRequest; +import android.hardware.camera2.params.InputConfiguration; +import android.hardware.camera2.params.OutputConfiguration; + +import java.util.Collections; +import java.util.List; +import java.util.ArrayList; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +import static com.android.internal.util.Preconditions.*; + +/** + * A helper class that aggregates all supported arguments for capture session initialization. + */ +public final class SessionConfiguration { + /** + * A regular session type containing instances of {@link OutputConfiguration} running + * at regular non high speed FPS ranges and optionally {@link InputConfiguration} for + * reprocessable sessions. + * + * @see CameraDevice#createCaptureSession + * @see CameraDevice#createReprocessableCaptureSession + */ + public static final int SESSION_REGULAR = CameraDevice.SESSION_OPERATION_MODE_NORMAL; + + /** + * A high speed session type that can only contain instances of {@link OutputConfiguration}. + * The outputs can run using high speed FPS ranges. Calls to {@link #setInputConfiguration} + * are not supported. + * + * @see CameraDevice#createConstrainedHighSpeedCaptureSession + */ + public static final int SESSION_HIGH_SPEED = + CameraDevice.SESSION_OPERATION_MODE_CONSTRAINED_HIGH_SPEED; + + /** + * First vendor-specific session mode + * @hide + */ + public static final int SESSION_VENDOR_START = + CameraDevice.SESSION_OPERATION_MODE_VENDOR_START; + + /** @hide */ + @Retention(RetentionPolicy.SOURCE) + @IntDef(prefix = {"SESSION_"}, value = + {SESSION_REGULAR, + SESSION_HIGH_SPEED }) + public @interface SessionMode {}; + + // Camera capture session related parameters. + private List<OutputConfiguration> mOutputConfigurations; + private CameraCaptureSession.StateCallback mStateCallback; + private int mSessionType; + private Handler mHandler = null; + private InputConfiguration mInputConfig = null; + private CaptureRequest mSessionParameters = null; + + /** + * Create a new {@link SessionConfiguration}. + * + * @param sessionType The session type. + * @param outputs A list of output configurations for the capture session. + * @param cb A state callback interface implementation. + * @param handler The handler on which the callback will be invoked. If it is + * set to null, the callback will be invoked on the current thread's + * {@link android.os.Looper looper}. + * + * @see #SESSION_REGULAR + * @see #SESSION_HIGH_SPEED + * @see CameraDevice#createCaptureSession(List, CameraCaptureSession.StateCallback, Handler) + * @see CameraDevice#createCaptureSessionByOutputConfigurations + * @see CameraDevice#createReprocessableCaptureSession + * @see CameraDevice#createConstrainedHighSpeedCaptureSession + */ + public SessionConfiguration(@SessionMode int sessionType, + @NonNull List<OutputConfiguration> outputs, + @NonNull CameraCaptureSession.StateCallback cb, @Nullable Handler handler) { + mSessionType = sessionType; + mOutputConfigurations = Collections.unmodifiableList(new ArrayList<>(outputs)); + mStateCallback = cb; + mHandler = handler; + } + + /** + * Retrieve the type of the capture session. + * + * @return The capture session type. + */ + public @SessionMode int getSessionType() { + return mSessionType; + } + + /** + * Retrieve the {@link OutputConfiguration} list for the capture session. + * + * @return A list of output configurations for the capture session. + */ + public List<OutputConfiguration> getOutputConfigurations() { + return mOutputConfigurations; + } + + /** + * Retrieve the {@link CameraCaptureSession.StateCallback} for the capture session. + * + * @return A state callback interface implementation. + */ + public CameraCaptureSession.StateCallback getStateCallback() { + return mStateCallback; + } + + /** + * Retrieve the {@link CameraCaptureSession.StateCallback} for the capture session. + * + * @return The handler on which the callback will be invoked. If it is + * set to null, the callback will be invoked on the current thread's + * {@link android.os.Looper looper}. + */ + public Handler getHandler() { + return mHandler; + } + + /** + * Sets the {@link InputConfiguration} for a reprocessable session. Input configuration are not + * supported for {@link #SESSION_HIGH_SPEED}. + * + * @param input Input configuration. + * @throws UnsupportedOperationException In case it is called for {@link #SESSION_HIGH_SPEED} + * type session configuration. + */ + public void setInputConfiguration(@NonNull InputConfiguration input) { + if (mSessionType != SESSION_HIGH_SPEED) { + mInputConfig = input; + } else { + throw new UnsupportedOperationException("Method not supported for high speed session" + + " types"); + } + } + + /** + * Retrieve the {@link InputConfiguration}. + * + * @return The capture session input configuration. + */ + public InputConfiguration getInputConfiguration() { + return mInputConfig; + } + + /** + * Sets the session wide camera parameters (see {@link CaptureRequest}). This argument can + * be set for every supported session type and will be passed to the camera device as part + * of the capture session initialization. Session parameters are a subset of the available + * capture request parameters (see {@link CameraCharacteristics#getAvailableSessionKeys}) + * and their application can introduce internal camera delays. To improve camera performance + * it is suggested to change them sparingly within the lifetime of the capture session and + * to pass their initial values as part of this method. + * + * @param params A capture request that includes the initial values for any available + * session wide capture keys. + */ + public void setSessionParameters(CaptureRequest params) { + mSessionParameters = params; + } + + /** + * Retrieve the session wide camera parameters (see {@link CaptureRequest}). + * + * @return A capture request that includes the initial values for any available + * session wide capture keys. + */ + public CaptureRequest getSessionParameters() { + return mSessionParameters; + } +} |
