public final class

Api29Impl

extends java.lang.Object

 java.lang.Object

↳androidx.camera.video.internal.compat.Api29Impl

Gradle dependencies

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

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

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

Overview

Helper class to avoid verification errors for methods introduced in Android 10.0 (API 29).

Summary

Methods
public static AudioRecordingConfigurationgetActiveRecordingConfiguration(AudioRecord audioRecord)

Returns the current active audio recording for this audio recorder.

public static booleanisClientSilenced(AudioRecordingConfiguration configuration)

Checks whether a shows that the client is silenced.

public static voidregisterAudioRecordingCallback(AudioRecord audioRecord, java.util.concurrent.Executor executor, AudioManager.AudioRecordingCallback callback)

Registers a to a AudioRecord.

public static voidunregisterAudioRecordingCallback(AudioRecord audioRecord, AudioManager.AudioRecordingCallback callback)

Unregisters a previously registered from a AudioRecord.

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

Methods

public static AudioRecordingConfiguration getActiveRecordingConfiguration(AudioRecord audioRecord)

Returns the current active audio recording for this audio recorder.

Parameters:

audioRecord:

Returns:

a valid AudioRecordingConfiguration if this recorder is active or null otherwise.

public static void registerAudioRecordingCallback(AudioRecord audioRecord, java.util.concurrent.Executor executor, AudioManager.AudioRecordingCallback callback)

Registers a to a AudioRecord.

public static void unregisterAudioRecordingCallback(AudioRecord audioRecord, AudioManager.AudioRecordingCallback callback)

Unregisters a previously registered from a AudioRecord.

public static boolean isClientSilenced(AudioRecordingConfiguration configuration)

Checks whether a shows that the client is silenced.

Source

/*
 * Copyright 2021 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.video.internal.compat;

import android.media.AudioManager;
import android.media.AudioRecord;
import android.media.AudioRecordingConfiguration;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

import java.util.concurrent.Executor;

/**
 * Helper class to avoid verification errors for methods introduced in Android 10.0 (API 29).
 */
@RequiresApi(29)
public final class Api29Impl {

    private Api29Impl() {
    }

    /**
     * Returns the current active audio recording for this audio recorder.
     *
     * @param audioRecord
     * @return a valid AudioRecordingConfiguration if this recorder is active or null otherwise.
     */
    @Nullable
    public static AudioRecordingConfiguration getActiveRecordingConfiguration(
            @NonNull AudioRecord audioRecord) {
        return audioRecord.getActiveRecordingConfiguration();
    }

    /**
     * Registers a {@link android.media.AudioManager.AudioRecordingCallback} to a
     * {@link AudioRecord}.
     */
    public static void registerAudioRecordingCallback(@NonNull AudioRecord audioRecord,
            @NonNull Executor executor,
            @NonNull AudioManager.AudioRecordingCallback callback) {
        audioRecord.registerAudioRecordingCallback(executor, callback);
    }

    /**
     * Unregisters a {@link android.media.AudioManager.AudioRecordingCallback} previously
     * registered from a {@link AudioRecord}.
     */
    public static void unregisterAudioRecordingCallback(@NonNull AudioRecord audioRecord,
            @NonNull AudioManager.AudioRecordingCallback callback) {
        audioRecord.unregisterAudioRecordingCallback(callback);
    }

    /**
     * Checks whether a {@link AudioRecordingConfiguration} shows that the client is silenced.
     */
    public static boolean isClientSilenced(@NonNull AudioRecordingConfiguration configuration) {
        return configuration.isClientSilenced();
    }
}