Modo de exposición automática con mejora con poca luz
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Android 15 presenta el modo de exposición automática (AE) con aumento de poca luz, un nuevo modo de exposición automática disponible para Camera 2 y la extensión de cámara del modo noche. El modo de AE con mejora de poca luz ajusta automáticamente el brillo de la transmisión de vista previa en condiciones de poca luz. Esto es diferente de la forma en que la extensión de la cámara del modo nocturno crea imágenes fijas, ya que el modo nocturno combina una ráfaga de fotos para crear una sola imagen mejorada. Si bien el modo nocturno funciona muy bien para crear una imagen fija, no puede crear una transmisión continua de fotogramas, pero el modo de AE con mejora de poca luz sí puede hacerlo. Por lo tanto, el modo de AE con mejora de poca luz habilita nuevas funciones de la cámara, como las siguientes:
Proporciona una vista previa de imagen mejorada para que los usuarios puedan encuadrar mejor sus fotos con poca luz.
Escanear códigos QR con poca luz
Si habilitas el modo de AE con mejora de poca luz, se activa automáticamente cuando hay un nivel de luz bajo y se desactiva cuando hay más luz.
Las apps pueden grabar desde la transmisión de vista previa en condiciones de poca luz para guardar un video más brillante.
Puedes usar el modo de AE con mejora de poca luz en Camera2 o a través de extensiones de cámara. En este documento, se explica cómo usar el modo de AE con poca luz con Camera2. También puedes usar el modo de AE con amplificación de poca luz con la extensión de cámara del modo nocturno si el dispositivo es compatible.
Cómo verificar la disponibilidad
Antes de usar el modo de AE con mejora de baja luminosidad, verifica que sea compatible con el dispositivo.
Si está disponible, el modo de AE con mejora de poca luz es uno de los modos de exposición que se enumeran en camera2.CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES. (el modo de mejora de poca luz tiene su propio parámetro de configuración de exposición automática, ya que otros parámetros de configuración de exposición automática no son compatibles con el brillo de vista previa que realiza el modo de AE de mejora de poca luz).
Cómo habilitar el modo de AE con mejora de poca luz
Para habilitar el modo de AE de mejora de poca luz en una sesión de Camera2, establece CaptureRequest.CONTROL_AE_MODE en ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY. Después de hacerlo, deberás confirmar que se activó el modo de AE con mejora de poca luz. Para ello, marca el campo CaptureResult.CONTROL_AE_MODE. Debes verificarlo porque el aumento de la luz baja no es compatible con todas las configuraciones de la cámara. Por ejemplo, la grabación de alta velocidad no admite el modo de AE de aumento de poca luz debido a las consideraciones de FPS. Si el modo de AE con mejora de poca luz no está activado, es posible que debas cambiar la configuración de la cámara y volver a intentarlo.
Kotlin
valcaptureRequestBuilder=camera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW)if(isLowLightBoostAvailable(cameraId)){captureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY)}// other capture request paramssession.setRepeatingRequest(captureRequestBuilder.build(),object:CaptureCallback(){@OverridefunonCaptureCompleted(session:CameraCaptureSession,request:CaptureRequest,result:TotalCaptureResult){// verify Low Light Boost AE Mode AE mode set successfullyresult.get(CaptureResult.CONTROL_AE_MODE)==CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY}},cameraHandler)
Java
CaptureRequest.BuildercaptureRequestBuilder=mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);if(isLowLightBoostAvailable(cameraId)){captureRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY);}// other capture request paramsmSession.setRepeatingRequest(captureRequestBuilder.build(),newCaptureCallback(){@OverridepublicvoidonCaptureCompleted(CameraCaptureSessionsession,CaptureRequestrequest,TotalCaptureResultresult){// verify Low Light Boost AE Mode AE mode set successfullyresult.get(CaptureResult.CONTROL_AE_MODE)==CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;}},mCameraHandler);
Monitoriza el modo de AE de mejora con poca luz
El modo de AE con mejora de poca luz aclara la transmisión de vista previa en condiciones de poca luz y no tiene ningún efecto si el entorno ya es lo suficientemente luminoso para la captura normal. Para confirmar si el modo de AE de aumento de poca luz está activo actualmente, verifica el campo CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE.
Si activaste el modo de AE con refuerzo de poca luz y está activo actualmente, el campo se establece en CameraMetadata.CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE.
Luego, puedes mostrar un ícono de luna o algún otro indicador de que la vista previa se está aclarando.
Kotlin
session.setRepeatingRequest(captureRequestBuilder.build(),object:CaptureCallback(){@OverridefunonCaptureCompleted(session:CameraCaptureSession,request:CaptureRequest,result:TotalCaptureResult){// check if Low Light Boost AE Mode is active or inactiveif(result.get(CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE)==CameraMetadata.CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE){// Low Light Boost AE Mode state is active// Show Moon Icon}else{// Low Light Boost AE Mode state is inactive or AE mode is not set// to Low Light Boost AE Mode// Hide Moon Icon}}},cameraHandler)
Java
mSession.setRepeatingRequest(captureRequestBuilder.build(),newCaptureCallback(){@OverridepublicvoidonCaptureCompleted(CameraCaptureSessionsession,CaptureRequestrequest,TotalCaptureResultresult){// check if Low Light Boost AE Mode is active or inactiveif(result.get(CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE)==CameraMetadata.CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE){// Low Light Boost AE Mode state is active// Show Moon Icon}else{// Low Light Boost AE Mode state is inactive or AE mode is not set// to Low Light Boost AE Mode// Hide Moon Icon}}},mCameraHandler);
El contenido y las muestras de código que aparecen en esta página están sujetas a las licencias que se describen en la Licencia de Contenido. Java y OpenJDK son marcas registradas de Oracle o sus afiliados.
Última actualización: 2025-07-27 (UTC)
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Falta la información que necesito","missingTheInformationINeed","thumb-down"],["Muy complicado o demasiados pasos","tooComplicatedTooManySteps","thumb-down"],["Desactualizado","outOfDate","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Problema con las muestras o los códigos","samplesCodeIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-07-27 (UTC)"],[],[],null,["# Low Light Boost Auto Exposure Mode\n\nAndroid 15 introduces *Low Light Boost Auto Exposure (AE) Mode* , a new\nauto-exposure mode available to both [Camera 2](/media/camera/camera2) and the [night mode camera\nextension](/reference/android/hardware/camera2/CameraExtensionCharacteristics#EXTENSION_NIGHT). Low Light Boost AE Mode automatically adjusts the brightness of\nthe Preview stream in low-light conditions. This is different from how the night\nmode camera extension creates still images, because night mode combines a burst\nof photos to create a single, enhanced image. While night mode works very well\nfor creating a still image, it can't create a continuous stream of frames, but\nLow Light Boost AE Mode can. Thus, Low Light Boost AE Mode enables new camera\ncapabilities, such as the following:\n\n- Providing an enhanced image preview, so users are better able to frame their low-light pictures.\n- Scanning QR codes in low light.\n\nIf you enable Low Light Boost AE Mode, it automatically turns on when there's a\nlow light level, and turns off when there's more light.\n\nApps can record off the Preview stream in low-light conditions to save a\nbrightened video.\n| **Note:** Because Low Light Boost AE Mode uses a different mechanism than night mode still capture, the two images won't look identical. Night mode still capture provides a better result when you just want to capture a single image, but Low Light Boost AE Mode is able to show you enhanced images in real time.\n\nYou can use Low Light Boost AE Mode either in [Camera2](/media/camera/camera2) or through [camera\nextensions](/media/camera/camera2/extensions-api). This document covers how to use Low Light Boost AE Mode with\nCamera2. You can also use Low Light Boost AE Mode with the Night Mode camera\nextension if it is supported by the device.\n\nCheck for availability\n----------------------\n\nBefore using Low Light Boost AE Mode, check that it's supported on the device.\nIf it's available, Low Light Boost AE Mode is one of the exposure modes listed\nin [`camera2.CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES`](/reference/android/hardware/camera2/CameraCharacteristics#CONTROL_AE_AVAILABLE_MODES). (Low Light\nBoost is its own auto exposure setting, since other auto exposure settings\naren't compatible with the preview brightening performed by Low Light Boost AE\nMode.)\n\nSo, to check if Low Light Boost AE Mode is available, call\n[`CameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES)`](/reference/android/hardware/camera2/CameraCharacteristics#get(android.hardware.camera2.CameraCharacteristics.Key%3CT%3E))\nand check if the returned modes include [`ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY`](/reference/android/hardware/camera2/CameraMetadata#CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY): \n\n### Kotlin\n\n```kotlin\nval characteristics = cameraManager.getCameraCharacteristics(cameraId)\nval autoExposureModes =\n characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES)!!\nval lowLightBoostSupported = autoExposureModes.contains(\n CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY)\n\nif (lowLightBoostSupported) {\n // Enable Low Light Boost AE Mode (next section)\n} else {\n // Proceed without Low Light Boost AE Mode\n}\n```\n\n### Java\n\n```java\nCameraCharacteristics characteristics =\n mCameraManager.getCameraCharacteristics(cameraId);\nint[] autoExposureModes =\n characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_MODES);\nboolean lowLightBoostSupported = autoExposureModes.contains(\n CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY);\n\nif (lowLightBoostSupported) {\n // Enable Low Light Boost AE Mode (next section)\n} else {\n // Proceed without Low Light Boost AE Mode\n}\n```\n\nEnable Low Light Boost AE Mode\n------------------------------\n\nTo enable Low Light Boost AE Mode in a Camera2 session, set\n[`CaptureRequest.CONTROL_AE_MODE`](/reference/android/hardware/camera2/CaptureRequest#CONTROL_AE_MODE) to\n[`ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY`](/reference/android/hardware/camera2/CameraMetadata#CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY). After you do so, you'll need to\nconfirm that Low Light Boost AE Mode was turned on; you can do this by checking\nthe [`CaptureResult.CONTROL_AE_MODE`](/reference/android/hardware/camera2/CaptureResult#CONTROL_AE_MODE) field. You need to check because Low\nLight Boost is not compatible with all camera configurations. For example,\nhigh-speed recording doesn't support Low Light Boost AE Mode, due to FPS\nconsiderations. If Low Light Boost AE Mode is not turned on, you may need to\nchange the camera configuration and try again. \n\n### Kotlin\n\n```kotlin\nval captureRequestBuilder = camera.createCaptureRequest(\n CameraDevice.TEMPLATE_PREVIEW)\nif (isLowLightBoostAvailable(cameraId)) {\n captureRequestBuilder.set(\n CaptureRequest.CONTROL_AE_MODE,\n CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY\n )\n}\n// other capture request params\n\nsession.setRepeatingRequest(\n captureRequestBuilder.build(),\n object : CaptureCallback() {\n @Override\n fun onCaptureCompleted(session: CameraCaptureSession,\n request: CaptureRequest, result: TotalCaptureResult) {\n // verify Low Light Boost AE Mode AE mode set successfully\n result.get(CaptureResult.CONTROL_AE_MODE) ==\n CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY\n }\n },\n cameraHandler\n)\n```\n\n### Java\n\n```java\nCaptureRequest.Builder captureRequestBuilder =\n mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);\nif (isLowLightBoostAvailable(cameraId)) {\n captureRequestBuilder.set(\n CaptureRequest.CONTROL_AE_MODE,\n CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY);\n}\n// other capture request params\n\nmSession.setRepeatingRequest(\n captureRequestBuilder.build(),\n new CaptureCallback() {\n @Override\n public void onCaptureCompleted(CameraCaptureSession session,\n CaptureRequest request, TotalCaptureResult result) {\n // verify Low Light Boost AE Mode AE mode set successfully\n result.get(CaptureResult.CONTROL_AE_MODE) ==\n CameraMetadata.CONTROL_AE_MODE_ON_LOW_LIGHT_BOOST_BRIGHTNESS_PRIORITY;\n }\n },\n mCameraHandler\n);\n```\n\nMonitor Low Light Boost AE Mode\n-------------------------------\n\nLow Light Boost AE Mode brightens the preview stream in low-light conditions,\nand doesn't have any effect if the environment is already bright enough for\nnormal capture. You can confirm whether Low Light Boost AE Mode is currently\nactive by checking the [`CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE`](/reference/android/hardware/camera2/CaptureResult#CONTROL_LOW_LIGHT_BOOST_STATE) field.\nIf you've turned Low Light Boost AE Mode on *and* it's currently active, the\nfield is set to\n[`CameraMetadata.CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE`](/reference/android/hardware/camera2/CameraMetadata#CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE).\nYou might then show a moon icon or some other indication that the preview is\nbeing brightened. \n\n### Kotlin\n\n```kotlin\nsession.setRepeatingRequest(\n captureRequestBuilder.build(),\n object : CaptureCallback() {\n @Override\n fun onCaptureCompleted(session: CameraCaptureSession,\n request: CaptureRequest, result: TotalCaptureResult) {\n // check if Low Light Boost AE Mode is active or inactive\n if (result.get(CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE) ==\n CameraMetadata.CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE) {\n // Low Light Boost AE Mode state is active\n // Show Moon Icon\n } else {\n // Low Light Boost AE Mode state is inactive or AE mode is not set\n // to Low Light Boost AE Mode\n // Hide Moon Icon\n }\n }\n },\n cameraHandler\n)\n```\n\n### Java\n\n```java\nmSession.setRepeatingRequest(\n captureRequestBuilder.build(),\n new CaptureCallback() {\n @Override\n public void onCaptureCompleted(CameraCaptureSession session,\n CaptureRequest request, TotalCaptureResult result) {\n // check if Low Light Boost AE Mode is active or inactive\n if (result.get(CaptureResult.CONTROL_LOW_LIGHT_BOOST_STATE) ==\n CameraMetadata.CONTROL_LOW_LIGHT_BOOST_STATE_ACTIVE) {\n // Low Light Boost AE Mode state is active\n // Show Moon Icon\n } else {\n // Low Light Boost AE Mode state is inactive or AE mode is not set\n // to Low Light Boost AE Mode\n // Hide Moon Icon\n }\n }\n },\n mCameraHandler\n);\n```"]]