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

Commit 786879b1 authored by Scott Randolph's avatar Scott Randolph
Browse files

Remove IAudioControlCallback for P

Scale back the AudioControl HAL to include only the minimum necessary
controls for automotive audio.  Specifically remove support for the car
to interact with the application level audio focus.

Test:  Build mojave
Change-Id: I718c9d7175a72b9b6e29ca3f0c23a152c7cf1a9a
parent 0d29cf99
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -9,13 +9,11 @@ hidl_interface {
    srcs: [
        "types.hal",
        "IAudioControl.hal",
        "IAudioControlCallback.hal",
    ],
    interfaces: [
        "android.hidl.base@1.0",
    ],
    types: [
        "AudioResult",
        "ContextNumber",
    ],
    gen_java: true,
+0 −11
Original line number Diff line number Diff line
@@ -16,23 +16,12 @@

package android.hardware.automotive.audiocontrol@1.0;

import IAudioControlCallback;


/**
 * Interacts with the car's audio subsystem to manage audio sources and volumes
 */
interface IAudioControl {

    /**
     * Registers the required callback object so that we can be notified when the state
     * of the car's audio system changes. This call must be made when the interface is
     * initialized.
     */
    setCallback(IAudioControlCallback notificationObject)
        generates (AudioResult result);


    /**
     * Called at startup once per context to get the mapping from ContextNumber to
     * busAddress. This lets the car tell the framework to which physical output stream
+0 −57
Original line number Diff line number Diff line
/*
 * Copyright (C) 2017 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@1.0;


/**
 * Implemented on client (framework) side to receive asynchronous updates from the car.
 */
interface IAudioControlCallback {

    /**
     * When the HAL makes this call, any apps currently playing must be asked to
     * temporarily suspend playback (via an AudioManager::AUDIOFOCUS_LOSS_TRANSIENT event).
     *
     * This is only a suggestion. Apps may be slow to react or even ignore this message
     * entirely. Enforcement, if necessary, must be done at the AudioHAL level as the
     * samples are delivered. In most instances, this is the way a car should ask for
     * quiet if it needs it for some important situation, such as warning alarms or chimes.
     */
    oneway suggestPausePlayers();


    /**
     * When the HAL makes this case, any apps currently playing must be asked to stop
     * playing (via an AudioManager::AUDIOFOCUS_LOSS event). Once stopped, the apps must
     * not resume their playback.
     *
     * It should be noted that not all apps or sound sources honor this request, but this
     * at least gives an app the chance to do the right thing.
     * Because it premanently stops media, this call is expected to be used only rarely.
     * Perhaps in the event of an E-call, where resuming music might be undesirable assuming
     * the driver is now dealing with whatever the emergency is?
     */
    oneway suggestStopPlayers();


    /**
     * Receives calls from the HAL when Android should resume normal operations. If the previous
     * action was a requestPausePlayers, then things that were paused must be told they may
     * resume.
     */
    oneway resumePlayers();
};
+0 −1
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ cc_binary {
    relative_install_path: "hw",
    srcs: [
        "AudioControl.cpp",
        "AudioControlCallback.cpp",
        "service.cpp"
    ],
    init_rc: ["android.hardware.automotive.audiocontrol@1.0-service.rc"],
+0 −9
Original line number Diff line number Diff line
@@ -36,15 +36,6 @@ AudioControl::AudioControl() {
};


// Methods from ::android::hardware::automotive::audiocontrol::V1_0::IAudioControl follow.
Return<AudioResult> AudioControl::setCallback(const sp<IAudioControlCallback>& notificationObject) {
    // Hang onto the provided callback object for future use
    callback = notificationObject;

    return AudioResult::OK;
}


Return<int32_t> AudioControl::getBusForContext(uint32_t contextNumber) {
    if (contextNumber > sContextNumberMax) {
        ALOGE("Unexpected context number %d (max expected is %d)", contextNumber, sContextCount);
Loading