There is setAutoExposureLock() method in the old camera api.
And also it is possible to lock the exposure like this in camera2:
builder.set(CaptureRequest.CONTROL_AE_LOCK, true);
How to do this in CameraX? Right now I'm using ImageCapture.Builder to take a picture. Quick internet search didn't give me the answer.