FocusMeteringAction.Builder

public static class FocusMeteringAction.Builder
extends Object

java.lang.Object
   ↳ androidx.camera.core.FocusMeteringAction.Builder


The builder used to create the FocusMeteringAction. App must use from(MeteringPoint) or from(MeteringPoint, int) to create the FocusMeteringAction.Builder.

Summary

Public methods

FocusMeteringAction.Builder addPoint(MeteringPoint point, int mode)

Adds another MeteringPoint with specified FocusMeteringAction.MeteringMode.

FocusMeteringAction.Builder addPoint(MeteringPoint point)

Adds another MeteringPoint with default mode FocusMeteringAction.MeteringMode.AF | FocusMeteringAction.MeteringMode.AE | FocusMeteringAction.MeteringMode.AWB.

FocusMeteringAction build()

Builds the FocusMeteringAction instance.

FocusMeteringAction.Builder disableAutoCancel()

Disables the auto-cancel.

static FocusMeteringAction.Builder from(MeteringPoint meteringPoint)

Creates the Builder from a MeteringPoint with default mode FocusMeteringAction.MeteringMode.AF | FocusMeteringAction.MeteringMode.AE | FocusMeteringAction.MeteringMode.AWB.

static FocusMeteringAction.Builder from(MeteringPoint meteringPoint, int mode)

Creates the Builder from a MeteringPoint and FocusMeteringAction.MeteringMode

FocusMeteringAction.Builder setAutoCancelDuration(long duration, TimeUnit timeUnit)

Sets the auto-cancel duration.

Inherited methods

Public methods

addPoint

public FocusMeteringAction.Builder addPoint (MeteringPoint point, 
                int mode)

Adds another MeteringPoint with specified FocusMeteringAction.MeteringMode.

If more points are added than what current device supports for AF/AE/AWB, only the first region and then in order up to the number of regions supported by the device will be enabled. If it turns out no added points can be supported on the device, the returned ListenableFuture in CameraControl.startFocusAndMetering(FocusMeteringAction) will fail immediately.

Parameters
point MeteringPoint

mode int: Must be a valid FocusMeteringAction.MeteringMode, otherwise an IllegalArgumentException is thrown.

Returns
FocusMeteringAction.Builder

addPoint

public FocusMeteringAction.Builder addPoint (MeteringPoint point)

Adds another MeteringPoint with default mode FocusMeteringAction.MeteringMode.AF | FocusMeteringAction.MeteringMode.AE | FocusMeteringAction.MeteringMode.AWB.

If more points are added than what current device supports for AF/AE/AWB, only the first region and then in order up to the number of regions supported by the device will be enabled. If it turns out no added points can be supported on the device, the returned ListenableFuture in CameraControl.startFocusAndMetering(FocusMeteringAction) will fail immediately.

Parameters
point MeteringPoint

Returns
FocusMeteringAction.Builder

build

public FocusMeteringAction build ()

Builds the FocusMeteringAction instance.

Returns
FocusMeteringAction

disableAutoCancel

public FocusMeteringAction.Builder disableAutoCancel ()

Disables the auto-cancel.

Returns
FocusMeteringAction.Builder

from

public static FocusMeteringAction.Builder from (MeteringPoint meteringPoint)

Creates the Builder from a MeteringPoint with default mode FocusMeteringAction.MeteringMode.AF | FocusMeteringAction.MeteringMode.AE | FocusMeteringAction.MeteringMode.AWB.

Parameters
meteringPoint MeteringPoint

Returns
FocusMeteringAction.Builder

from

public static FocusMeteringAction.Builder from (MeteringPoint meteringPoint, 
                int mode)

Creates the Builder from a MeteringPoint and FocusMeteringAction.MeteringMode

Parameters
meteringPoint MeteringPoint

mode int

Returns
FocusMeteringAction.Builder

setAutoCancelDuration

public FocusMeteringAction.Builder setAutoCancelDuration (long duration, 
                TimeUnit timeUnit)

Sets the auto-cancel duration. After set, CameraControl.cancelFocusAndMetering() will be called in specified duration. By default, auto-cancel is enabled with 5 seconds duration. The duration must be greater than or equal to 1 otherwise it will throw a IllegalArgumentException.

Parameters
duration long

Value is 1 or greater.

timeUnit TimeUnit

Returns
FocusMeteringAction.Builder