1page.title=3A Modes and State Transition 2@jd:body 3 4<!-- 5 Copyright 2013 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18--> 19<div id="qv-wrapper"> 20 <div id="qv"> 21 <h2>In this document</h2> 22 <ol id="auto-toc"> 23 </ol> 24 </div> 25</div> 26 27<p> 28 While the actual 3A algorithms are up to the HAL implementation, a high-level 29 state machine description is defined by the HAL interface to allow the HAL 30 device and the framework to communicate about the current state of 3A and 31 trigger 3A events.</p> 32<p>When the device is opened, all the individual 3A states must be STATE_INACTIVE. 33 Stream configuration does not reset 3A. For example, locked focus must be 34 maintained across the configure() call.</p> 35<p>Triggering a 3A action involves simply setting the relevant trigger entry in the 36 settings for the next request to indicate start of trigger. For example, the 37 trigger for starting an autofocus scan is setting the entry 38 ANDROID_CONTROL_AF_TRIGGER to ANDROID_CONTROL_AF_TRIGGER_START for one request; 39 and cancelling an autofocus scan is triggered by setting 40 ANDROID_CONTROL_AF_TRIGGER to ANDROID_CONTRL_AF_TRIGGER_CANCEL. Otherwise, the 41 entry will not exist or be set to ANDROID_CONTROL_AF_TRIGGER_IDLE. Each request 42 with a trigger entry set to a non-IDLE value will be treated as an independent 43 triggering event.</p> 44<p>At the top level, 3A is controlled by the ANDROID_CONTROL_MODE setting. It 45 selects between no 3A (ANDROID_CONTROL_MODE_OFF), normal AUTO mode 46 (ANDROID_CONTROL_MODE_AUTO), and using the scene mode setting 47 (ANDROID_CONTROL_USE_SCENE_MODE):</p> 48<ul> 49 <li>In OFF mode, each of the individual Auto-focus(AF), auto-exposure (AE), and 50 auto-whitebalance (AWB) modes are effectively OFF, and none of the capture 51 controls may be overridden by the 3A routines.</li> 52 <li>In AUTO mode, AF, AE, and AWB modes all run their own independent algorithms, 53 and have their own mode, state, and trigger metadata entries, as listed in the 54 next section.</li> 55 <li>In USE_SCENE_MODE, the value of the ANDROID_CONTROL_SCENE_MODE entry must be 56 used to determine the behavior of 3A routines. In SCENE_MODEs other than 57 FACE_PRIORITY, the HAL must override the values of 58 ANDROID_CONTROL_AE/AWB/AF_MODE to be the mode it prefers for the selected 59 SCENE_MODE. For example, the HAL may prefer SCENE_MODE_NIGHT to use 60 CONTINUOUS_FOCUS AF mode. Any user selection of AE/AWB/AF_MODE when scene must 61 be ignored for these scene modes.</li> 62 <li>For SCENE_MODE_FACE_PRIORITY, the AE/AWB/AFMODE controls work as in 63 ANDROID_CONTROL_MODE_AUTO, but the 3A routines must bias toward metering and 64 focusing on any detected faces in the scene.</li> 65</ul> 66<h2 id="auto-focus">Auto-focus settings and result entries</h2> 67<p>Main metadata entries:<br/> 68 ANDROID_CONTROL_AF_MODE: Control for selecting the current autofocus mode. Set 69 by the framework in the request settings.<br/> 70 AF_MODE_OFF: AF is disabled; the framework/app directly controls lens position.<br/> 71 AF_MODE_AUTO: Single-sweep autofocus. No lens movement unless AF is triggered.<br/> 72 AF_MODE_MACRO: Single-sweep up-close autofocus. No lens movement unless AF is 73 triggered.<br/> 74 AF_MODE_CONTINUOUS_VIDEO: Smooth continuous focusing, for recording video. 75 Triggering immediately locks focus in current position. Canceling resumes 76 cotinuous focusing.<br/> 77 AF_MODE_CONTINUOUS_PICTURE: Fast continuous focusing, for zero-shutter-lag still 78 capture. Triggering locks focus once currently active sweep concludes. Canceling 79 resumes continuous focusing.<br/> 80 AF_MODE_EDOF: Advanced extended depth of field focusing. There is no autofocus 81 scan, so triggering one or canceling one has no effect. Images are focused 82 automatically by the HAL.<br/> 83 ANDROID_CONTROL_AF_STATE: Dynamic metadata describing the current AF algorithm 84 state, reported by the HAL in the result metadata.<br/> 85 AF_STATE_INACTIVE: No focusing has been done, or algorithm was reset. Lens is 86 not moving. Always the state for MODE_OFF or MODE_EDOF. When the device is 87 opened, it must start in this state.<br/> 88 AF_STATE_PASSIVE_SCAN: A continuous focus algorithm is currently scanning for 89 good focus. The lens is moving.<br/> 90 AF_STATE_PASSIVE_FOCUSED: A continuous focus algorithm believes it is well 91 focused. The lens is not moving. The HAL may spontaneously leave this state.<br/> 92 AF_STATE_PASSIVE_UNFOCUSED: A continuous focus algorithm believes it is not well 93 focused. The lens is not moving. The HAL may spontaneously leave this state.<br/> 94 AF_STATE_ACTIVE_SCAN: A scan triggered by the user is underway.<br/> 95 AF_STATE_FOCUSED_LOCKED: The AF algorithm believes it is focused. The lens is 96 not moving.<br/> 97 AF_STATE_NOT_FOCUSED_LOCKED: The AF algorithm has been unable to focus. The lens 98 is not moving.<br/> 99 ANDROID_CONTROL_AFTRIGGER: Control for starting an autofocus scan, the meaning 100 of which depends on mode and state. Set by the framework in the request 101 settings.<br/> 102 AF_TRIGGER_IDLE: No current trigger.<br/> 103 AF_TRIGGER_START: Trigger start of AF scan. Effect depends on mode and state.<br/> 104 AF_TRIGGER_CANCEL: Cancel current AF scan if any, and reset algorithm to 105 default.<br/> 106 Additional metadata entries:<br/> 107 ANDROID_CONTROL_AF_REGIONS: Control for selecting the regions of the field of 108 view (FOV) that should be used to determine good focus. This applies to all AF 109 modes that scan for focus. Set by the framework in the request settings.</p> 110<h2 id="auto-exposure">Auto-exposure settings and result entries</h2> 111<p>Main metadata entries:<br/> 112 ANDROID_CONTROL_AE_MODE: Control for selecting the current auto-exposure mode. 113 Set by the framework in the request settings.<br/> 114 AE_MODE_OFF: Autoexposure is disabled; the user controls exposure, gain, frame 115 duration, and flash.<br/> 116 AE_MODE_ON: Standard autoexposure, with flash control disabled. User may set 117 flash to fire or to torch mode.<br/> 118 AE_MODE_ON_AUTO_FLASH: Standard autoexposure, with flash on at HAL's discretion 119 for precapture and still capture. User control of flash disabled.<br/> 120 AE_MODE_ON_ALWAYS_FLASH: Standard autoexposure, with flash always fired for 121 capture, and at HAL's discretion for precapture. User control of flash disabled.<br/> 122 AE_MODE_ON_AUTO_FLASH_REDEYE: Standard autoexposure, with flash on at HAL's 123 discretion for precapture and still capture. Use a flash burst at end of 124 precapture sequence to reduce redeye in the final picture. User control of flash 125 disabled.<br/> 126 ANDROID_CONTROL_AE_STATE: Dynamic metadata describing the current AE algorithm 127 state, reported by the HAL in the result metadata.<br/> 128 AE_STATE_INACTIVE: Initial AE state after mode switch. When the device is 129 opened, it must start in this state.<br/> 130 AE_STATE_SEARCHING: AE is not converged to a good value and is adjusting 131 exposure parameters.<br/> 132 AE_STATE_CONVERGED: AE has found good exposure values for the current scene, and 133 the exposure parameters are not changing. HAL may spontaneously leave this state 134 to search for a better solution.<br/> 135 AE_STATE_LOCKED: AE has been locked with the AE_LOCK control. Exposure values 136 are not changing.<br/> 137 AE_STATE_FLASH_REQUIRED: The HAL has converged exposure but believes flash is 138 required for a sufficiently bright picture. Used for determining if a 139 zero-shutter-lag frame can be used.<br/> 140 AE_STATE_PRECAPTURE: The HAL is in the middle of a precapture sequence. 141 Depending on AE mode, this mode may involve firing the flash for metering or a 142 burst of flash pulses for redeye reduction.<br/> 143 ANDROID_CONTROL_AE_PRECAPTURE_TRIGGER: Control for starting a metering sequence 144 before capturing a high-quality image. Set by the framework in the request 145 settings.<br/> 146 PRECAPTURE_TRIGGER_IDLE: No current trigger.<br/> 147 PRECAPTURE_TRIGGER_START: Start a precapture sequence. The HAL should use the 148 subsequent requests to measure good exposure/white balance for an upcoming 149 high-resolution capture.<br/> 150 Additional metadata entries:<br/> 151 ANDROID_CONTROL_AE_LOCK: Control for locking AE controls to their current 152 values.<br/> 153 ANDROID_CONTROL_AE_EXPOSURE_COMPENSATION: Control for adjusting AE algorithm 154 target brightness point.<br/> 155 ANDROID_CONTROL_AE_TARGET_FPS_RANGE: Control for selecting the target frame rate 156 range for the AE algorithm. The AE routine cannot change the frame rate to be 157 outside these bounds.<br/> 158 ANDROID_CONTROL_AE_REGIONS: Control for selecting the regions of the FOV that 159 should be used to determine good exposure levels. This applies to all AE modes 160 besides OFF.</p> 161<h2 id="auto-wb">Auto-whitebalance settings and result entries</h2> 162<p>Main metadata entries:<br/> 163 ANDROID_CONTROL_AWB_MODE: Control for selecting the current white-balance mode.<br/> 164 AWB_MODE_OFF: Auto-whitebalance is disabled. User controls color matrix.<br/> 165 AWB_MODE_AUTO: Automatic white balance is enabled; 3A controls color transform, 166 possibly using more complex transforms than a simple matrix.<br/> 167 AWB_MODE_INCANDESCENT: Fixed white balance settings good for indoor incandescent 168 (tungsten) lighting, roughly 2700K.<br/> 169 AWB_MODE_FLUORESCENT: Fixed white balance settings good for fluorescent 170 lighting, roughly 5000K.<br/> 171 AWB_MODE_WARM_FLUORESCENT: Fixed white balance settings good for fluorescent 172 lighting, roughly 3000K.<br/> 173 AWB_MODE_DAYLIGHT: Fixed white balance settings good for daylight, roughly 174 5500K.<br/> 175 AWB_MODE_CLOUDY_DAYLIGHT: Fixed white balance settings good for clouded 176 daylight, roughly 6500K.<br/> 177 AWB_MODE_TWILIGHT: Fixed white balance settings good for near-sunset/sunrise, 178 roughly 15000K.<br/> 179 AWB_MODE_SHADE: Fixed white balance settings good for areas indirectly lit by 180 the sun, roughly 7500K.<br/> 181 ANDROID_CONTROL_AWB_STATE: Dynamic metadata describing the current AWB algorithm 182 state, reported by the HAL in the result metadata.<br/> 183 AWB_STATE_INACTIVE: Initial AWB state after mode switch. When the device is 184 opened, it must start in this state.<br/> 185 AWB_STATE_SEARCHING: AWB is not converged to a good value and is changing color 186 adjustment parameters.<br/> 187 AWB_STATE_CONVERGED: AWB has found good color adjustment values for the current 188 scene, and the parameters are not changing. HAL may spontaneously leave this 189 state to search for a better solution.<br/> 190 AWB_STATE_LOCKED: AWB has been locked with the AWB_LOCK control. Color 191 adjustment values are not changing.<br/> 192 Additional metadata entries:<br/> 193 ANDROID_CONTROL_AWB_LOCK: Control for locking AWB color adjustments to their 194 current values.<br/> 195 ANDROID_CONTROL_AWB_REGIONS: Control for selecting the regions of the FOV that 196 should be used to determine good color balance. This applies only to 197 auto-whitebalance mode.</p> 198<h2 id="state-transition">General state machine transition notes</h2> 199<p>Switching between AF, AE, or AWB modes always resets the algorithm's state to 200 INACTIVE. Similarly, switching between CONTROL_MODE or CONTROL_SCENE_MODE if 201 CONTROL_MODE == USE_SCENE_MODE resets all the algorithm states to INACTIVE.<br/> 202 The tables below are per-mode.</p> 203<h2 id="af-state">AF state machines</h2> 204<table> 205 <tr> 206 <td><strong>mode = AF_MODE_OFF or AF_MODE_EDOF</strong></td> 207 <td></td> 208 <td></td> 209 <td></td> 210 </tr> 211 <tr> 212 <th>State</th> 213 <th>Transformation cause</th> 214 <th>New state</th> 215 <th>Notes</th> 216 </tr> 217 <tr> 218 <td>INACTIVE</td> 219 <td></td> 220 <td></td> 221 <td>AF is disabled</td> 222 </tr> 223 <tr> 224 <td><strong>mode = AF_MODE_AUTO or AF_MODE_MACRO</strong></td> 225 <td></td> 226 <td></td> 227 <td></td> 228 </tr> 229 <tr> 230 <th>State</th> 231 <th>Transformation cause</th> 232 <th>New state</th> 233 <th>Notes</th> 234 </tr> 235 <tr> 236 <td>INACTIVE</td> 237 <td>AF_TRIGGER</td> 238 <td>ACTIVE_SCAN</td> 239 <td>Start AF sweep 240 Lens now moving</td> 241 </tr> 242 <tr> 243 <td>ACTIVE_SCAN</td> 244 <td>AF sweep done</td> 245 <td>FOCUSED_LOCKED</td> 246 <td>If AF successful 247 Lens now locked</td> 248 </tr> 249 <tr> 250 <td>ACTIVE_SCAN</td> 251 <td>AF sweep done</td> 252 <td>NOT_FOCUSED_LOCKED</td> 253 <td>If AF successful 254 Lens now locked</td> 255 </tr> 256 <tr> 257 <td>ACTIVE_SCAN</td> 258 <td>AF_CANCEL</td> 259 <td>INACTIVE</td> 260 <td>Cancel/reset AF 261 Lens now locked</td> 262 </tr> 263 <tr> 264 <td>FOCUSED_LOCKED</td> 265 <td>AF_CANCEL</td> 266 <td>INACTIVE</td> 267 <td>Cancel/reset AF</td> 268 </tr> 269 <tr> 270 <td>FOCUSED_LOCKED</td> 271 <td>AF_TRIGGER</td> 272 <td>ACTIVE_SCAN</td> 273 <td>Start new sweep 274 Lens now moving</td> 275 </tr> 276 <tr> 277 <td>NOT_FOCUSED_LOCKED</td> 278 <td>AF_CANCEL</td> 279 <td>INACTIVE</td> 280 <td>Cancel/reset AF</td> 281 </tr> 282 <tr> 283 <td>NOT_FOCUSED_LOCKED</td> 284 <td>AF_TRIGGER</td> 285 <td>ACTIVE_SCAN</td> 286 <td>Start new sweep 287 Lens now moving</td> 288 </tr> 289 <tr> 290 <td>All states</td> 291 <td>mode change</td> 292 <td>INACTIVE</td> 293 <td></td> 294 </tr> 295 <tr> 296 <td><strong>mode = AF_MODE_CONTINUOUS_VIDEO</strong></td> 297 <td></td> 298 <td></td> 299 <td></td> 300 </tr> 301 <tr> 302 <th>State</th> 303 <th>Transformation cause</th> 304 <th>New state</th> 305 <th>Notes</th> 306 </tr> 307 <tr> 308 <td>INACTIVE</td> 309 <td>HAL initiates new scan</td> 310 <td>PASSIVE_SCAN</td> 311 <td>Start AF sweep 312 Lens now moving</td> 313 </tr> 314 <tr> 315 <td>INACTIVE</td> 316 <td>AF_TRIGGER</td> 317 <td>NOT_FOCUSED_LOCKED</td> 318 <td>AF state query 319 Lens now locked</td> 320 </tr> 321 <tr> 322 <td>PASSIVE_SCAN</td> 323 <td>HAL completes current scan</td> 324 <td>PASSIVE_FOCUSED</td> 325 <td>End AF scan 326 Lens now locked </td> 327 </tr> 328 <tr> 329 <td>PASSIVE_SCAN</td> 330 <td>AF_TRIGGER</td> 331 <td>FOCUSED_LOCKED</td> 332 <td>Immediate transformation 333 if focus is good 334 Lens now locked</td> 335 </tr> 336 <tr> 337 <td>PASSIVE_SCAN</td> 338 <td>AF_TRIGGER</td> 339 <td>NOT_FOCUSED_LOCKED</td> 340 <td>Immediate transformation 341 if focus is bad 342 Lens now locked</td> 343 </tr> 344 <tr> 345 <td>PASSIVE_SCAN</td> 346 <td>AF_CANCEL</td> 347 <td>INACTIVE</td> 348 <td>Reset lens position 349 Lens now locked</td> 350 </tr> 351 <tr> 352 <td>PASSIVE_FOCUSED</td> 353 <td>HAL initiates new scan</td> 354 <td>PASSIVE_SCAN</td> 355 <td>Start AF scan 356 Lens now moving</td> 357 </tr> 358 <tr> 359 <td>PASSIVE_FOCUSED</td> 360 <td>AF_TRIGGER</td> 361 <td>FOCUSED_LOCKED</td> 362 <td>Immediate transformation 363 if focus is good 364 Lens now locked</td> 365 </tr> 366 <tr> 367 <td>PASSIVE_FOCUSED</td> 368 <td>AF_TRIGGER</td> 369 <td>NOT_FOCUSED_LOCKED</td> 370 <td>Immediate transformation 371 if focus is bad 372 Lens now locked</td> 373 </tr> 374 <tr> 375 <td>FOCUSED_LOCKED</td> 376 <td>AF_TRIGGER</td> 377 <td>FOCUSED_LOCKED</td> 378 <td>No effect</td> 379 </tr> 380 <tr> 381 <td>FOCUSED_LOCKED</td> 382 <td>AF_CANCEL</td> 383 <td>INACTIVE</td> 384 <td>Restart AF scan</td> 385 </tr> 386 <tr> 387 <td>NOT_FOCUSED_LOCKED</td> 388 <td>AF_TRIGGER</td> 389 <td>NOT_FOCUSED_LOCKED</td> 390 <td>No effect</td> 391 </tr> 392 <tr> 393 <td>NOT_FOCUSED_LOCKED</td> 394 <td>AF_CANCEL</td> 395 <td>INACTIVE</td> 396 <td>Restart AF scan</td> 397 </tr> 398 <tr> 399 <td><strong>mode = AF_MODE_CONTINUOUS_PICTURE</strong></td> 400 <td></td> 401 <td></td> 402 <td></td> 403 </tr> 404 <tr> 405 <th>State</th> 406 <th>Transformation cause</th> 407 <th>New state</th> 408 <th>Notes</th> 409 </tr> 410 <tr> 411 <td>INACTIVE</td> 412 <td>HAL initiates new scan</td> 413 <td>PASSIVE_SCAN</td> 414 <td>Start AF scan 415 Lens now moving</td> 416 </tr> 417 <tr> 418 <td>INACTIVE</td> 419 <td>AF_TRIGGER</td> 420 <td>NOT_FOCUSED_LOCKED</td> 421 <td>AF state query 422 Lens now locked</td> 423 </tr> 424 <tr> 425 <td>PASSIVE_SCAN</td> 426 <td>HAL completes current scan</td> 427 <td>PASSIVE_FOCUSED</td> 428 <td>End AF scan 429 Lens now locked</td> 430 </tr> 431 <tr> 432 <td>PASSIVE_SCAN</td> 433 <td>AF_TRIGGER</td> 434 <td>FOCUSED_LOCKED</td> 435 <td>Eventual transformation once focus good 436 Lens now locked</td> 437 </tr> 438 <tr> 439 <td>PASSIVE_SCAN</td> 440 <td>AF_TRIGGER</td> 441 <td>NOT_FOCUSED_LOCKED</td> 442 <td>Eventual transformation if cannot focus 443 Lens now locked</td> 444 </tr> 445 <tr> 446 <td>PASSIVE_SCAN</td> 447 <td>AF_CANCEL</td> 448 <td>INACTIVE</td> 449 <td>Reset lens position 450 Lens now locked</td> 451 </tr> 452 <tr> 453 <td>PASSIVE_FOCUSED</td> 454 <td>HAL initiates new scan</td> 455 <td>PASSIVE_SCAN</td> 456 <td>Start AF scan 457 Lens now moving</td> 458 </tr> 459 <tr> 460 <td>PASSIVE_FOCUSED</td> 461 <td>AF_TRIGGER</td> 462 <td>FOCUSED_LOCKED</td> 463 <td>Immediate transformation if focus is good 464 Lens now locked</td> 465 </tr> 466 <tr> 467 <td>PASSIVE_FOCUSED</td> 468 <td>AF_TRIGGER</td> 469 <td>NOT_FOCUSED_LOCKED</td> 470 <td>Immediate transformation if focus is bad 471 Lens now locked</td> 472 </tr> 473 <tr> 474 <td>FOCUSED_LOCKED</td> 475 <td>AF_TRIGGER</td> 476 <td>FOCUSED_LOCKED</td> 477 <td>No effect</td> 478 </tr> 479 <tr> 480 <td>FOCUSED_LOCKED</td> 481 <td>AF_CANCEL</td> 482 <td>INACTIVE</td> 483 <td>Restart AF scan</td> 484 </tr> 485 <tr> 486 <td>NOT_FOCUSED_LOCKED</td> 487 <td>AF_TRIGGER</td> 488 <td>NOT_FOCUSED_LOCKED</td> 489 <td>No effect</td> 490 </tr> 491 <tr> 492 <td>NOT_FOCUSED_LOCKED</td> 493 <td>AF_CANCEL</td> 494 <td>INACTIVE</td> 495 <td>Restart AF scan</td> 496 </tr> 497</table> 498<h2 id="ae-wb">AE and AWB state machines</h2> 499<p>The AE and AWB state machines are mostly identical. AE has additional 500 FLASH_REQUIRED and PRECAPTURE states. So rows below that refer to those two 501 states should be ignored for the AWB state machine.</p> 502<table> 503 <tr> 504 <td><strong>mode = AE_MODE_OFF / AWB mode not AUTO</strong></td> 505 <td></td> 506 <td></td> 507 <td></td> 508 </tr> 509 <tr> 510 <th>State</th> 511 <th>Transformation cause</th> 512 <th>New state</th> 513 <th>Notes</th> 514 </tr> 515 <tr> 516 <td>INACTIVE</td> 517 <td></td> 518 <td></td> 519 <td>AE/AWB disabled</td> 520 </tr> 521 <tr> 522 <td><strong>mode = AE_MODE_ON_* / AWB_MODE_AUTO</strong></td> 523 <td></td> 524 <td></td> 525 <td></td> 526 </tr> 527 <tr> 528 <th>State</th> 529 <th>Transformation cause</th> 530 <th>New state</th> 531 <th>Notes</th> 532 </tr> 533 <tr> 534 <td>INACTIVE</td> 535 <td>HAL initiates AE/AWB scan</td> 536 <td>SEARCHING</td> 537 <td></td> 538 </tr> 539 <tr> 540 <td>INACTIVE</td> 541 <td>AE/AWB_LOCK on</td> 542 <td>LOCKED</td> 543 <td>Values locked</td> 544 </tr> 545 <tr> 546 <td>SEARCHING</td> 547 <td>HAL finishes AE/AWB scan</td> 548 <td>CONVERGED</td> 549 <td>Good values, not changing</td> 550 </tr> 551 <tr> 552 <td>SEARCHING</td> 553 <td>HAL finishes AE scan</td> 554 <td>FLASH_REQUIRED</td> 555 <td>Converged but too dark without flash</td> 556 </tr> 557 <tr> 558 <td>SEARCHING</td> 559 <td>AE/AWB_LOCK on</td> 560 <td>LOCKED</td> 561 <td>Values locked</td> 562 </tr> 563 <tr> 564 <td>CONVERGED</td> 565 <td>HAL initiates AE/AWB scan</td> 566 <td>SEARCHING</td> 567 <td>Values locked</td> 568 </tr> 569 <tr> 570 <td>CONVERGED</td> 571 <td>AE/AWB_LOCK on</td> 572 <td>LOCKED</td> 573 <td>Values locked</td> 574 </tr> 575 <tr> 576 <td>FLASH_REQUIRED</td> 577 <td>HAL initiates AE/AWB scan</td> 578 <td>SEARCHING</td> 579 <td>Values locked</td> 580 </tr> 581 <tr> 582 <td>FLASH_REQUIRED</td> 583 <td>AE/AWB_LOCK on</td> 584 <td>LOCKED</td> 585 <td>Values locked</td> 586 </tr> 587 <tr> 588 <td>LOCKED</td> 589 <td>AE/AWB_LOCK off</td> 590 <td>SEARCHING</td> 591 <td>Values not good after unlock</td> 592 </tr> 593 <tr> 594 <td>LOCKED</td> 595 <td>AE/AWB_LOCK off</td> 596 <td>CONVERGED</td> 597 <td>Values good after unlock</td> 598 </tr> 599 <tr> 600 <td>LOCKED</td> 601 <td>AE_LOCK off</td> 602 <td>FLASH_REQUIRED</td> 603 <td>Exposure good, but too dark</td> 604 </tr> 605 <tr> 606 <td>All AE states</td> 607 <td>PRECAPTURE_START</td> 608 <td>PRECAPTURE</td> 609 <td>Start precapture sequence</td> 610 </tr> 611 <tr> 612 <td>PRECAPTURE</td> 613 <td>Sequence done, AE_LOCK off</td> 614 <td>CONVERGED</td> 615 <td>Ready for high-quality capture</td> 616 </tr> 617 <tr> 618 <td>PRECAPTURE</td> 619 <td>Sequence done, AE_LOCK on</td> 620 <td>LOCKED</td> 621 <td>Ready for high-quality capture</td> 622 </tr> 623</table> 624<h2 id="manual-control">Enabling manual control</h2> 625<p>Several controls are also involved in configuring the device 3A blocks to allow 626 for direct application control.</p> 627<p>The HAL model for 3A control is that for each request, the HAL inspects the 628 state of the 3A control fields. If any 3A routine is enabled, then that routine 629 overrides the control variables that relate to that routine, and these override 630 values are then available in the result metadata for that capture. So for 631 example, if auto-exposure is enabled in a request, the HAL should overwrite the 632 exposure, gain, and frame duration fields (and potentially the flash fields, 633 depending on AE mode) of the request. The list of relevant controls is:</p> 634<table> 635 <tr> 636 <th>Control name</th> 637 <th>Unit</th> 638 <th>Notes</th> 639 </tr> 640 <tr> 641 <td>android.control.mode</td> 642 <td>enum: OFF, AUTO, USE_SCENE_MODE</td> 643 <td>High-level 3A control. When set to OFF, all 3A control by the HAL is disabled. The application must set the fields for capture parameters itself. 644 When set to AUTO, the individual algorithm controls in android.control.* are in effect, such as android.control.afMode. 645 When set to USE_SCENE_MODE, the individual controls in android.control.* are mostly disabled, and the HAL implements one of the scene mode settings (such as ACTION, SUNSET, or PARTY) as it wishes.</td> 646 </tr> 647 <tr> 648 <td>android.control.afMode</td> 649 <td>enum</td> 650 <td>OFF means manual control of lens focusing through android.lens.focusDistance.</td> 651 </tr> 652 <tr> 653 <td>android.control.aeMode</td> 654 <td>enum</td> 655 <td>OFF means manual control of exposure/gain/frame duration through android.sensor.exposureTime / .sensitivity / .frameDuration</td> 656 </tr> 657 <tr> 658 <td>android.control.awbMode</td> 659 <td>enum</td> 660 <td>OFF means manual control of white balance. </td> 661 </tr> 662</table> 663