Add Camera2 white balance lock and tap-to-meter APIs - #2170
Open
bratta-dk wants to merge 3 commits into
Open
Conversation
pedroSG94
reviewed
Aug 3, 2026
| */ | ||
| fun enableWhiteBalanceLock(): Boolean { | ||
| val builderInputSurface = this.builderInputSurface ?: return false | ||
| builderInputSurface.set(CaptureRequest.CONTROL_AWB_LOCK, true) |
Owner
There was a problem hiding this comment.
need check if it is available before set the value. Similar to enableExposureLock method
Owner
|
Hello, Thank you for the PR. |
Expose AWB lock and AE/AWB tap metering through Camera2ApiManager, Camera2Source, and Camera2Base to complement existing exposure lock.
zero-size, METERING_WEIGHT_DONT_CARE rect before re-applying the auto mode.
bratta-dk
force-pushed
the
feature/metering
branch
from
August 3, 2026 14:54
35ae045 to
06ff113
Compare
bratta-dk
commented
Aug 3, 2026
Comment on lines
+415
to
+418
| if (maxRegionsAwb > 0) { | ||
| val clearRect = MeteringRectangle(0, 0, 0, 0, MeteringRectangle.METERING_WEIGHT_DONT_CARE) | ||
| builderInputSurface.set(CaptureRequest.CONTROL_AWB_REGIONS, arrayOf(clearRect)) | ||
| } |
Author
There was a problem hiding this comment.
I added the rect clearing code similar to the auto-focus fix.
bratta-dk
commented
Aug 3, 2026
Comment on lines
+464
to
+467
| if (maxRegionsAe > 0) { | ||
| val clearRect = MeteringRectangle(0, 0, 0, 0, MeteringRectangle.METERING_WEIGHT_DONT_CARE) | ||
| builderInputSurface.set(CaptureRequest.CONTROL_AE_REGIONS, arrayOf(clearRect)) | ||
| } |
Author
There was a problem hiding this comment.
Same here, I added the rect clearing code similar to the auto-focus fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enableWhiteBalanceLock()/disableWhiteBalanceLock()/isWhiteBalanceLockEnabled().tapToMeterExposure(view, event)/tapToMeterWhiteBalance(view, event).Camera2ApiManager,Camera2Source, andCamera2Base(all Camera2 stream classes inherit viaCamera2Base).Motivation
Upstream 2.8.0 added exposure lock (
enableExposureLock()/disableExposureLock()), but there is no equivalent for white balance lock or tap-to-meter for AE/AWB regions. These are standard Camera2 capabilities used by live streaming apps that need manual exposure/WB control during broadcast (e.g. lock color after calibration, tap a region to meter before locking).API
enableWhiteBalanceLock()CONTROL_AWB_LOCKdisableWhiteBalanceLock()isWhiteBalanceLockEnabled()tapToMeterExposure(view, event)tapToMeterWhiteBalance(view, event)Naming follows existing upstream conventions:
enableExposureLock()/disableExposureLock()/isExposureLockEnabled().tapToFocus()withtapToMeter*prefix to distinguish metering from focus.Implementation notes
CaptureRequest.CONTROL_AWB_LOCK, same pattern as existing exposure lock.MeteringRectangle(same size astapToFocus). Returnsfalseif the device reports zero AE/AWB regions.isWhiteBalanceLockEnabledonCamera2ApiManager, consistent withisExposureLockEnabled.