public class

ForwardingCameraControl

extends java.lang.Object

implements CameraControlInternal

 java.lang.Object

↳androidx.camera.core.impl.ForwardingCameraControl

Subclasses:

VirtualCameraControl, RestrictedCameraControl

Gradle dependencies

compile group: 'androidx.camera', name: 'camera-core', version: '1.5.0-alpha01'

  • groupId: androidx.camera
  • artifactId: camera-core
  • version: 1.5.0-alpha01

Artifact androidx.camera:camera-core:1.5.0-alpha01 it located at Google repository (https://maven.google.com/)

Overview

A CameraControlInternal that forwards all the calls into the given CameraControlInternal.

Summary

Constructors
publicForwardingCameraControl(CameraControlInternal cameraControlInternal)

Create an instance that will forward all calls to the supplied CameraControlInternal instance.

Methods
public voidaddInteropConfig(Config config)

public voidaddZslConfig(SessionConfig.Builder sessionConfigBuilder)

public <any>cancelFocusAndMetering()

public voidclearInteropConfig()

public voiddecrementVideoUsage()

public <any>enableTorch(boolean torch)

public intgetFlashMode()

public CameraControlInternalgetImplementation()

public ConfiggetInteropConfig()

public RectgetSensorRect()

public SessionConfiggetSessionConfig()

public voidincrementVideoUsage()

public booleanisInVideoUsage()

public booleanisZslDisabledByByUserCaseConfig()

public <any>setExposureCompensationIndex(int value)

public voidsetFlashMode(int flashMode)

public <any>setLinearZoom(float linearZoom)

public voidsetScreenFlash(ImageCapture.ScreenFlash screenFlash)

public <any>setZoomRatio(float ratio)

public voidsetZslDisabledByUserCaseConfig(boolean disabled)

public <any>startFocusAndMetering(FocusMeteringAction action)

public <any>submitStillCaptureRequests(java.util.List<CaptureConfig> captureConfigs, int captureMode, int flashType)

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public ForwardingCameraControl(CameraControlInternal cameraControlInternal)

Create an instance that will forward all calls to the supplied CameraControlInternal instance.

Methods

public <any> enableTorch(boolean torch)

public <any> startFocusAndMetering(FocusMeteringAction action)

public <any> cancelFocusAndMetering()

public <any> setZoomRatio(float ratio)

public <any> setLinearZoom(float linearZoom)

public <any> setExposureCompensationIndex(int value)

public int getFlashMode()

public void setFlashMode(int flashMode)

public void setScreenFlash(ImageCapture.ScreenFlash screenFlash)

public void addZslConfig(SessionConfig.Builder sessionConfigBuilder)

public void setZslDisabledByUserCaseConfig(boolean disabled)

public boolean isZslDisabledByByUserCaseConfig()

public <any> submitStillCaptureRequests(java.util.List<CaptureConfig> captureConfigs, int captureMode, int flashType)

public SessionConfig getSessionConfig()

public Rect getSensorRect()

public void addInteropConfig(Config config)

public void clearInteropConfig()

public Config getInteropConfig()

public CameraControlInternal getImplementation()

public void incrementVideoUsage()

public void decrementVideoUsage()

public boolean isInVideoUsage()

Source

/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.camera.core.impl;

import android.graphics.Rect;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.camera.core.FocusMeteringAction;
import androidx.camera.core.FocusMeteringResult;
import androidx.camera.core.ImageCapture;

import com.google.common.util.concurrent.ListenableFuture;

import java.util.List;

/**
 * A {@link CameraControlInternal} that forwards all the calls into the given
 * {@link CameraControlInternal}.
 */
public class ForwardingCameraControl implements CameraControlInternal {
    private final CameraControlInternal mCameraControlInternal;

    /**
     * Create an instance that will forward all calls to the supplied {@link CameraControlInternal}
     * instance.
     */
    public ForwardingCameraControl(@NonNull CameraControlInternal cameraControlInternal) {
        mCameraControlInternal = cameraControlInternal;
    }

    @NonNull
    @Override
    public ListenableFuture<Void> enableTorch(boolean torch) {
        return mCameraControlInternal.enableTorch(torch);
    }

    @NonNull
    @Override
    public ListenableFuture<FocusMeteringResult> startFocusAndMetering(
            @NonNull FocusMeteringAction action) {
        return mCameraControlInternal.startFocusAndMetering(action);
    }

    @NonNull
    @Override
    public ListenableFuture<Void> cancelFocusAndMetering() {
        return mCameraControlInternal.cancelFocusAndMetering();
    }

    @NonNull
    @Override
    public ListenableFuture<Void> setZoomRatio(float ratio) {
        return mCameraControlInternal.setZoomRatio(ratio);
    }

    @NonNull
    @Override
    public ListenableFuture<Void> setLinearZoom(float linearZoom) {
        return mCameraControlInternal.setLinearZoom(linearZoom);
    }

    @NonNull
    @Override
    public ListenableFuture<Integer> setExposureCompensationIndex(int value) {
        return mCameraControlInternal.setExposureCompensationIndex(value);
    }

    @Override
    @ImageCapture.FlashMode
    public int getFlashMode() {
        return mCameraControlInternal.getFlashMode();
    }

    @Override
    public void setFlashMode(@ImageCapture.FlashMode int flashMode) {
        mCameraControlInternal.setFlashMode(flashMode);
    }

    @Override
    public void setScreenFlash(@Nullable ImageCapture.ScreenFlash screenFlash) {
        mCameraControlInternal.setScreenFlash(screenFlash);
    }

    @Override
    public void addZslConfig(@NonNull SessionConfig.Builder sessionConfigBuilder) {
        mCameraControlInternal.addZslConfig(sessionConfigBuilder);
    }

    @Override
    public void setZslDisabledByUserCaseConfig(boolean disabled) {
        mCameraControlInternal.setZslDisabledByUserCaseConfig(disabled);
    }

    @Override
    public boolean isZslDisabledByByUserCaseConfig() {
        return mCameraControlInternal.isZslDisabledByByUserCaseConfig();
    }

    @NonNull
    @Override
    public ListenableFuture<List<Void>> submitStillCaptureRequests(
            @NonNull List<CaptureConfig> captureConfigs,
            @ImageCapture.CaptureMode int captureMode,
            @ImageCapture.FlashType int flashType) {
        return mCameraControlInternal.submitStillCaptureRequests(
                captureConfigs,
                captureMode,
                flashType);
    }

    @NonNull
    @Override
    public SessionConfig getSessionConfig() {
        return mCameraControlInternal.getSessionConfig();
    }

    @NonNull
    @Override
    public Rect getSensorRect() {
        return mCameraControlInternal.getSensorRect();
    }

    @Override
    public void addInteropConfig(@NonNull Config config) {
        mCameraControlInternal.addInteropConfig(config);
    }

    @Override
    public void clearInteropConfig() {
        mCameraControlInternal.clearInteropConfig();
    }

    @NonNull
    @Override
    public Config getInteropConfig() {
        return mCameraControlInternal.getInteropConfig();
    }

    @NonNull
    @Override
    public CameraControlInternal getImplementation() {
        return mCameraControlInternal.getImplementation();
    }

    @Override
    public void incrementVideoUsage() {
        mCameraControlInternal.incrementVideoUsage();
    }

    @Override
    public void decrementVideoUsage() {
        mCameraControlInternal.decrementVideoUsage();
    }

    @VisibleForTesting
    @Override
    public boolean isInVideoUsage() {
        return mCameraControlInternal.isInVideoUsage();
    }
}