Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8ad9856 authored by Raj Goparaju's avatar Raj Goparaju Committed by Android (Google) Code Review
Browse files

Merge changes from topic "feature_dynamicVolSupport"

* changes:
  Adding VTS tests for IAudioControl#registerModuleChangeCallback
  Add default implementation for dynamic volume config feature
  Adding support for dynamic audio gain config
parents 40f4b105 a8bf907f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -46,4 +46,6 @@ interface IAudioControl {
  oneway void onAudioFocusChangeWithMetaData(in android.hardware.audio.common.PlaybackTrackMetadata playbackMetaData, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
  oneway void setAudioDeviceGainsChanged(in android.hardware.automotive.audiocontrol.Reasons[] reasons, in android.hardware.automotive.audiocontrol.AudioGainConfigInfo[] gains);
  oneway void registerGainCallback(in android.hardware.automotive.audiocontrol.IAudioGainCallback callback);
  void setModuleChangeCallback(in android.hardware.automotive.audiocontrol.IModuleChangeCallback callback);
  void clearModuleChangeCallback();
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 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.
 */
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL file. Do not edit it manually. There are
// two cases:
// 1). this is a frozen version file - do not edit this in any case.
// 2). this is a 'current' file. If you make a backwards compatible change to
//     the interface (from the latest frozen version), the build system will
//     prompt you to update this file with `m <name>-update-api`.
//
// You must not make a backward incompatible change to any AIDL file built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.hardware.automotive.audiocontrol;
@VintfStability
interface IModuleChangeCallback {
  oneway void onAudioPortsChanged(in android.media.audio.common.AudioPort[] audioPorts);
}
+23 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.hardware.automotive.audiocontrol.AudioGainConfigInfo;
import android.hardware.automotive.audiocontrol.DuckingInfo;
import android.hardware.automotive.audiocontrol.IAudioGainCallback;
import android.hardware.automotive.audiocontrol.IFocusListener;
import android.hardware.automotive.audiocontrol.IModuleChangeCallback;
import android.hardware.automotive.audiocontrol.MutingInfo;
import android.hardware.automotive.audiocontrol.Reasons;

@@ -183,4 +184,26 @@ interface IAudioControl {
     *                 interface.
     */
    oneway void registerGainCallback(in IAudioGainCallback callback);

    /**
     * Sets callback with HAL for notifying changes to hardware module (that is:
     * {@link android.hardware.audio.core.IModule}) configurations.
     *
     * @param callback The {@link android.hardware.automotive.audiocontrol.IModuleChangeCallback}
     *                 interface to use use when new updates are available for
     *                 {@link android.hardware.audio.core.IModule} configs
     * @throws EX_UNSUPPORTED_OPERATION if dynamic audio configs are not supported.
     * @throws EX_ILLEGAL_STATE if a callback already exists
     * @throws EX_ILLEGAL_ARGUMENT if the passed callback is (@code null}
     */
    void setModuleChangeCallback(in IModuleChangeCallback callback);

    /**
     * Clears module change callback
     *
     * If no callback is registered previously, then this call should be a no-op.
     *
     * @throws EX_UNSUPPORTED_OPERATION if dynamic audio configs are not supported.
     */
    void clearModuleChangeCallback();
}
+61 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 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 android.hardware.automotive.audiocontrol;

import android.media.audio.common.AudioPort;

/**
 * Interface definition for asynchronous changes to audio configs defined
 * for a hardware {@link android.hardware.audio.core.IModule}.
 */
@VintfStability
oneway interface IModuleChangeCallback {
    /**
     * Used to indicate that one or more {@link android.media.audio.common.AudioPort}
     * configs have changed. Implementations MUST return at least one AudioPort.
     *
     * Notes for AudioPort:
     * 1. For V3, the support will be limited to configurable AudioGain stages - per
     *    car audio framework support.
     * 2. For automotive 'bus' devices, the expected settings are
     *     AudioDevice {
     *        AudioDeviceDescription {type: IN/OUT_DEVICE, connection: CONNECTION_BUS}
     *        AudioDeviceAddress {id: string}}
     *
     * Notes for AudioGain:
     * 1. Car audio framework only supports AudioGainMode::JOINT. Any other mode
     *    selection will be ignored.
     *    See {@link android.media.audio.common.AudioGainMode}
     * 2. Implementations MUST ensure that the gain stages are identical for buses
     *    that map to the same volume group. Any inconsistencies will result in
     *    inferior volume-change experience to the users.
     * 3. Implementations MUST ensure that the new gain stages are subset (do not
     *    exceed) of the gain stage definitions provided to audio policy. If they
     *    exceed, it can result in failure when setting value over the range
     *    allowed by the audio policy.
     *
     * Other notes:
     * 1. In case of AudioControl  service restart or resume, the implementations MUST
     *    issue an immediate callback following registration.
     * 2. In case of client restart, the AudioControl service MUST clear all stale
     *    callbacks.
     *
     * @param audioPorts list of {@link android.media.audio.common.AudioPort} that
     *                   are updated
     */
    void onAudioPortsChanged(in AudioPort[] audioPorts);
}
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ cc_binary {
        "android.hardware.audio.common@7.0-enums",
        "android.hardware.audio.common-V1-ndk",
        "android.frameworks.automotive.powerpolicy-V1-ndk",
        "android.hardware.automotive.audiocontrol-V2-ndk",
        "android.hardware.automotive.audiocontrol-V3-ndk",
        "libbase",
        "libbinder_ndk",
        "libcutils",
Loading