In Android 13 (API 33) a new control is appeared to adjust torch brightness:
public void turnOnTorchWithStrengthLevel ( cameraId, int torchStrength)
But invoking this function during a working camera preview raises an Exception:
android.hardware.camera2.CameraAccessException: CAMERA_IN_USE (4): turnOnTorchWithStrengthLevel:2596: Torch for camera “0” is not available due to an existing camera user
The only way to use torch during preview is to adjust capture request builder with option:
builder.set(CaptureRequest.FLASH_MODE, if (isOn) CaptureRequest.FLASH_MODE_TORCH else CaptureRequest.FLASH_MODE_OFF)
But it not allows to modify flashlight brightness.