blob: b0641b826e7d21dbfffb0d157f1133ae2ec88c0f [file] [log] [blame]
Jean-Michel Trivi0008a482016-12-26 15:58:24 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_IAUDIOMANAGER_H
18#define ANDROID_IAUDIOMANAGER_H
19
Atneya Nair5eb83602025-01-06 23:56:18 -080020#include <android/media/IAudioManagerNative.h>
Vlad Popa459fc742022-06-10 00:07:27 +020021#include <audiomanager/AudioManager.h>
Jean-Michel Trivi0008a482016-12-26 15:58:24 -080022#include <utils/Errors.h>
23#include <binder/IInterface.h>
Vlad Popa5cb98562022-06-30 15:48:16 +020024#include <binder/PersistableBundle.h>
Jean-Michel Trivi0008a482016-12-26 15:58:24 -080025#include <hardware/power.h>
26#include <system/audio.h>
27
28namespace android {
29
30// ----------------------------------------------------------------------------
Atneya Nairc54c3642024-08-17 20:30:26 -070031// TODO(b/309532236) replace this class with AIDL generated parcelable
Jean-Michel Trivi0008a482016-12-26 15:58:24 -080032class IAudioManager : public IInterface
33{
34public:
35 // These transaction IDs must be kept in sync with the method order from
36 // IAudioService.aidl.
37 enum {
Atneya Nair5eb83602025-01-06 23:56:18 -080038 GET_NATIVE_INTERFACE = IBinder::FIRST_CALL_TRANSACTION,
39 TRACK_PLAYER = IBinder::FIRST_CALL_TRANSACTION + 1,
40 PLAYER_ATTRIBUTES = IBinder::FIRST_CALL_TRANSACTION + 2,
41 PLAYER_EVENT = IBinder::FIRST_CALL_TRANSACTION + 3,
42 RELEASE_PLAYER = IBinder::FIRST_CALL_TRANSACTION + 4,
43 TRACK_RECORDER = IBinder::FIRST_CALL_TRANSACTION + 5,
44 RECORDER_EVENT = IBinder::FIRST_CALL_TRANSACTION + 6,
45 RELEASE_RECORDER = IBinder::FIRST_CALL_TRANSACTION + 7,
46 PLAYER_SESSION_ID = IBinder::FIRST_CALL_TRANSACTION + 8,
47 PORT_EVENT = IBinder::FIRST_CALL_TRANSACTION + 9,
48 PERMISSION_UPDATE_BARRIER = IBinder::FIRST_CALL_TRANSACTION + 10,
Jean-Michel Trivi0008a482016-12-26 15:58:24 -080049 };
50
51 DECLARE_META_INTERFACE(AudioManager)
52
Atneya Nair5eb83602025-01-06 23:56:18 -080053 virtual sp<media::IAudioManagerNative> getNativeInterface() = 0;
54
Jean-Michel Trivi0008a482016-12-26 15:58:24 -080055 // The parcels created by these methods must be kept in sync with the
56 // corresponding methods from IAudioService.aidl and objects it imports.
Jean-Michel Trivi63189322017-01-05 18:05:28 -080057 virtual audio_unique_id_t trackPlayer(player_type_t playerType, audio_usage_t usage,
Eric Laurentbf28ea62021-01-29 20:45:03 +010058 audio_content_type_t content, const sp<IBinder>& player,
59 audio_session_t sessionId) = 0;
Jean-Michel Trivi63189322017-01-05 18:05:28 -080060 /*oneway*/ virtual status_t playerAttributes(audio_unique_id_t piid, audio_usage_t usage,
61 audio_content_type_t content)= 0;
Oscar Azucenafae808f2020-12-22 20:40:07 +000062 /*oneway*/ virtual status_t playerEvent(audio_unique_id_t piid, player_state_t event,
Robert Wu4fcdbe72024-10-29 23:48:24 +000063 const std::vector<audio_port_handle_t>& eventIds) = 0;
Jean-Michel Trivi63189322017-01-05 18:05:28 -080064 /*oneway*/ virtual status_t releasePlayer(audio_unique_id_t piid) = 0;
Mikhail Naganovdecb6292019-04-10 16:49:02 -070065 virtual audio_unique_id_t trackRecorder(const sp<IBinder>& recorder) = 0;
66 /*oneway*/ virtual status_t recorderEvent(audio_unique_id_t riid, recorder_state_t event) = 0;
Mikhail Naganovb8bff0c2019-05-09 09:06:15 -070067 /*oneway*/ virtual status_t releaseRecorder(audio_unique_id_t riid) = 0;
Eric Laurentbf28ea62021-01-29 20:45:03 +010068 /*oneway*/ virtual status_t playerSessionId(audio_unique_id_t piid, audio_session_t sessionId) = 0;
Vlad Popa5cb98562022-06-30 15:48:16 +020069 /*oneway*/ virtual status_t portEvent(audio_port_handle_t portId, player_state_t event,
70 const std::unique_ptr<os::PersistableBundle>& extras) = 0;
Atneya Nairc54c3642024-08-17 20:30:26 -070071 virtual status_t permissionUpdateBarrier() = 0;
Jean-Michel Trivi0008a482016-12-26 15:58:24 -080072};
73
74// ----------------------------------------------------------------------------
75
76}; // namespace android
77
78#endif // ANDROID_IAUDIOMANAGER_H