public abstract class

CameraThreadConfig

extends java.lang.Object

 java.lang.Object

↳androidx.camera.core.impl.CameraThreadConfig

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

Configuration options for threads used by the camera stack implementation.

Summary

Constructors
publicCameraThreadConfig()

Methods
public static CameraThreadConfigcreate(java.util.concurrent.Executor cameraExecutor, Handler schedulerHandler)

Creates a thread configuration given an executor and a scheduling handler.

public abstract java.util.concurrent.ExecutorgetCameraExecutor()

Returns the executor used to run all camera-related tasks.

public abstract HandlergetSchedulerHandler()

Returns the handler used for scheduling future tasks (such as with a delay).

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

Constructors

public CameraThreadConfig()

Methods

public static CameraThreadConfig create(java.util.concurrent.Executor cameraExecutor, Handler schedulerHandler)

Creates a thread configuration given an executor and a scheduling handler.

Parameters:

cameraExecutor: Executor used to run all camera-related tasks.
schedulerHandler: Handler used for scheduling future tasks (such as with a delay) and for legacy APIs that require a handler. Tasks that are scheduled with this handler should always be executed by cameraExecutor. No business logic should be executed directly by this handler.

Returns:

the camera thread configuration.

public abstract java.util.concurrent.Executor getCameraExecutor()

Returns the executor used to run all camera-related tasks.

public abstract Handler getSchedulerHandler()

Returns the handler used for scheduling future tasks (such as with a delay).

This scheduler may also be used for legacy APIs which require a Handler. Tasks that are scheduled with this handler should always be executed by cameraExecutor. No business logic should be executed directly by this handler.

Source

/*
 * Copyright 2020 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.os.Handler;

import androidx.annotation.NonNull;

import com.google.auto.value.AutoValue;

import java.util.concurrent.Executor;

/**
 * Configuration options for threads used by the camera stack implementation.
 */
@AutoValue
public abstract class CameraThreadConfig {

    /**
     * Creates a thread configuration given an executor and a scheduling handler.
     * @param cameraExecutor Executor used to run all camera-related tasks.
     * @param schedulerHandler Handler used for scheduling future tasks (such as with a delay)
     *                          and for legacy APIs that require a handler. Tasks that are
     *                          scheduled with this handler should always be executed by
     *                          cameraExecutor. No business logic should be executed directly by
     *                          this handler.
     * @return the camera thread configuration.
     */
    @NonNull
    public static CameraThreadConfig create(@NonNull Executor cameraExecutor,
            @NonNull Handler schedulerHandler) {
        return new AutoValue_CameraThreadConfig(cameraExecutor, schedulerHandler);
    }

    /**
     * Returns the executor used to run all camera-related tasks.
     */
    @NonNull
    public abstract Executor getCameraExecutor();

    /**
     * Returns the handler used for scheduling future tasks (such as with a delay).
     *
     * <p>This scheduler may also be used for legacy APIs which require a {@link Handler}. Tasks
     * that are scheduled with this handler should always be executed by cameraExecutor. No
     * business logic should be executed directly by this handler.
     */
    @NonNull
    public abstract Handler getSchedulerHandler();
}