1 /* 2 * Copyright 2019 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 androidx.camera.core.impl; 18 19 20 import static androidx.camera.core.FlashState.NOT_FIRED; 21 import static androidx.camera.core.FlashState.UNAVAILABLE; 22 23 /** 24 * This class defines the enumeration constants used for querying the camera capture mode and 25 * results. 26 */ 27 public final class CameraCaptureMetaData { CameraCaptureMetaData()28 private CameraCaptureMetaData() { 29 } 30 31 /** Auto focus (AF) mode. */ 32 public enum AfMode { 33 34 /** AF mode is currently unknown. */ 35 UNKNOWN, 36 37 /** The AF routine does not control the lens. */ 38 OFF, 39 40 /** 41 * AF is triggered on demand. 42 * 43 * <p>In this mode, the lens does not move unless the auto focus trigger action is called. 44 */ 45 ON_MANUAL_AUTO, 46 47 /** 48 * AF is continually scanning. 49 * 50 * <p>In this mode, the AF algorithm modifies the lens position continually to attempt to 51 * provide a constantly-in-focus stream. 52 */ 53 ON_CONTINUOUS_AUTO 54 } 55 56 /** Auto focus (AF) state. */ 57 public enum AfState { 58 59 /** AF state is currently unknown. */ 60 UNKNOWN, 61 62 /** AF is off or not yet has been triggered. */ 63 INACTIVE, 64 65 /** AF is performing an AF scan. */ 66 SCANNING, 67 68 /** AF currently believes it is in focus. */ 69 PASSIVE_FOCUSED, 70 71 /** AF finished a passive scan without finding focus. */ 72 PASSIVE_NOT_FOCUSED, 73 74 /** AF believes it is focused correctly and has locked focus. */ 75 LOCKED_FOCUSED, 76 77 /** AF has failed to focus and has locked focus. */ 78 LOCKED_NOT_FOCUSED 79 } 80 81 /** Auto exposure (AE) state. */ 82 public enum AeState { 83 84 /** AE state is currently unknown. */ 85 UNKNOWN, 86 87 /** AE is off or has not yet been triggered. */ 88 INACTIVE, 89 90 /** AE is performing an AE search. */ 91 SEARCHING, 92 93 /** 94 * AE has a good set of control values, but flash needs to be fired for good quality still 95 * capture. 96 */ 97 FLASH_REQUIRED, 98 99 /** AE has a good set of control values for the current scene. */ 100 CONVERGED, 101 102 /** AE has been locked. */ 103 LOCKED 104 } 105 106 /** Auto white balance (AWB) state. */ 107 public enum AwbState { 108 109 /** AWB state is currently unknown. */ 110 UNKNOWN, 111 112 /** AWB is not in auto mode, or has not yet started metering. */ 113 INACTIVE, 114 115 /** AWB is performing AWB metering. */ 116 METERING, 117 118 /** AWB has a good set of control values for the current scene. */ 119 CONVERGED, 120 121 /** AWB has been locked. */ 122 LOCKED 123 } 124 125 /** AE mode. */ 126 public enum AeMode { 127 UNKNOWN, 128 OFF, 129 ON, 130 ON_AUTO_FLASH, 131 ON_ALWAYS_FLASH, 132 ON_AUTO_FLASH_REDEYE, 133 ON_EXTERNAL_FLASH 134 } 135 136 /** AWB mode. */ 137 public enum AwbMode { 138 UNKNOWN, 139 OFF, 140 AUTO, 141 INCANDESCENT, 142 FLUORESCENT, 143 WARM_FLUORESCENT, 144 DAYLIGHT, 145 CLOUDY_DAYLIGHT, 146 TWILIGHT, 147 SHADE 148 } 149 150 /** Flash state. */ 151 public enum FlashState { 152 153 /** Flash state is unknown. */ 154 UNKNOWN, 155 156 /** Flash is unavailable or not ready to fire. */ 157 NONE, 158 159 /** Flash is ready to fire. */ 160 READY, 161 162 /** Flash has been fired. */ 163 FIRED; 164 165 /** 166 * Returns the IntDef equivalent. 167 */ toFlashState()168 public @androidx.camera.core.FlashState.FlashState int toFlashState() { 169 switch (this) { 170 case NONE: 171 return UNAVAILABLE; 172 case READY: 173 return NOT_FIRED; 174 case FIRED: 175 return androidx.camera.core.FlashState.FIRED; 176 default: 177 return androidx.camera.core.FlashState.UNKNOWN; 178 } 179 } 180 } 181 } 182