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

Commit 38ce803a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add IAudioManagerNative" into main

parents 615f29fa 35e1ef32
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -60,6 +60,7 @@ aidl_interface {
    double_loadable: true,
    double_loadable: true,
    local_include_dir: "aidl",
    local_include_dir: "aidl",
    srcs: [
    srcs: [
        "aidl/android/media/IAudioManagerNative.aidl",
        "aidl/android/media/InterpolatorConfig.aidl",
        "aidl/android/media/InterpolatorConfig.aidl",
        "aidl/android/media/InterpolatorType.aidl",
        "aidl/android/media/InterpolatorType.aidl",
        "aidl/android/media/MicrophoneInfoFw.aidl",
        "aidl/android/media/MicrophoneInfoFw.aidl",
+48 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2024 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.media;

/**
 * Native accessible interface for AudioService.
 * Note this interface has a mix of oneway and non-oneway methods. This is intentional for certain
 * calls intended to come from audioserver.
 * {@hide}
 */
interface IAudioManagerNative {
    enum HardeningType {
        // Restricted due to OP_CONTROL_AUDIO_PARTIAL
        // This OP is more permissive than OP_CONTROL_AUDIO, which allows apps in a foreground state
        // not associated with FGS to access audio
        PARTIAL,
        // Restricted due to OP_CONTROL_AUDIO
        FULL,
    }

    /**
     * audioserver is muting playback due to hardening.
     * Calls which aren't from uid 1041 are dropped.
     * @param uid - the uid whose playback is restricted
     * @param type - the level of playback restriction which was hit (full or partial)
     * @param bypassed - true if the client should be muted but was exempted (for example due to a
     * certain audio usage to prevent regressions)
     */
    oneway void playbackHardeningEvent(in int uid, in HardeningType type, in boolean bypassed);

    /**
     * Block until AudioService synchronizes pending permission state with audioserver.
     */
    void permissionUpdateBarrier();
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -286,7 +286,7 @@ status_t AudioRecord::set(
    if (binder != nullptr) {
    if (binder != nullptr) {
        // Barrier to ensure runtime permission update propagates to audioflinger
        // Barrier to ensure runtime permission update propagates to audioflinger
        // Must be client-side
        // Must be client-side
        interface_cast<IAudioManager>(binder)->permissionUpdateBarrier();
        interface_cast<IAudioManager>(binder)->getNativeInterface()->permissionUpdateBarrier();
    }
    }


    mSelectedDeviceId = selectedDeviceId;
    mSelectedDeviceId = selectedDeviceId;