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);
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],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```"]]