2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.hardware.camera2;
19 import android.hardware.camera2.impl.CameraMetadataNative;
20 import android.hardware.camera2.impl.CaptureResultExtras;
22 import java.util.ArrayList;
23 import java.util.Collections;
24 import java.util.List;
27 * <p>The total assembled results of a single image capture from the image sensor.</p>
29 * <p>Contains the final configuration for the capture hardware (sensor, lens,
30 * flash), the processing pipeline, the control algorithms, and the output
33 * <p>A {@code TotalCaptureResult} is produced by a {@link CameraDevice} after processing a
34 * {@link CaptureRequest}. All properties listed for capture requests can also
35 * be queried on the capture result, to determine the final values used for
36 * capture. The result also includes additional metadata about the state of the
37 * camera device during the capture.</p>
39 * <p>All properties returned by {@link CameraCharacteristics#getAvailableCaptureResultKeys()}
40 * are available (that is {@link CaptureResult#get} will return non-{@code null}, if and only if
41 * that key that was enabled by the request. A few keys such as
42 * {@link CaptureResult#STATISTICS_FACES} are disabled by default unless enabled with a switch (such
43 * as {@link CaptureRequest#STATISTICS_FACE_DETECT_MODE}). Refer to each key documentation on
44 * a case-by-case basis.</p>
46 * <p>{@link TotalCaptureResult} objects are immutable.</p>
48 * @see CameraDevice.CaptureCallback#onCaptureCompleted
50 public final class TotalCaptureResult extends CaptureResult {
52 private final List<CaptureResult> mPartialResults;
55 * Takes ownership of the passed-in camera metadata and the partial results
57 * @param partials a list of partial results; {@code null} will be substituted for an empty list
60 public TotalCaptureResult(CameraMetadataNative results, CaptureRequest parent,
61 CaptureResultExtras extras, List<CaptureResult> partials) {
62 super(results, parent, extras);
64 if (partials == null) {
65 mPartialResults = new ArrayList<>();
67 mPartialResults = partials;
72 * Creates a request-less result.
74 * <p><strong>For testing only.</strong></p>
77 public TotalCaptureResult(CameraMetadataNative results, int sequenceId) {
78 super(results, sequenceId);
80 mPartialResults = new ArrayList<>();
84 * Get the read-only list of partial results that compose this total result.
86 * <p>The list is returned is unmodifiable; attempting to modify it will result in a
87 * {@code UnsupportedOperationException} being thrown.</p>
89 * <p>The list size will be inclusive between {@code 0} and
90 * {@link CameraCharacteristics#REQUEST_PARTIAL_RESULT_COUNT}, with elements in ascending order
91 * of when {@link CameraCaptureSession.CaptureCallback#onCaptureProgressed} was invoked.</p>
93 * @return unmodifiable list of partial results
95 public List<CaptureResult> getPartialResults() {
96 return Collections.unmodifiableList(mPartialResults);