1 /* 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 20 #include <android/media/IAudioManagerNative.h> 21 #include <audiomanager/AudioManager.h> 22 #include <utils/Errors.h> 23 #include <binder/IInterface.h> 24 #include <binder/PersistableBundle.h> 25 #include <hardware/power.h> 26 #include <system/audio.h> 27 28 namespace android { 29 30 // ---------------------------------------------------------------------------- 31 // TODO(b/309532236) replace this class with AIDL generated parcelable 32 class IAudioManager : public IInterface 33 { 34 public: 35 // These transaction IDs must be kept in sync with the method order from 36 // IAudioService.aidl. 37 enum { 38 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, 49 }; 50 51 DECLARE_META_INTERFACE(AudioManager) 52 53 virtual sp<media::IAudioManagerNative> getNativeInterface() = 0; 54 55 // The parcels created by these methods must be kept in sync with the 56 // corresponding methods from IAudioService.aidl and objects it imports. 57 virtual audio_unique_id_t trackPlayer(player_type_t playerType, audio_usage_t usage, 58 audio_content_type_t content, const sp<IBinder>& player, 59 audio_session_t sessionId) = 0; 60 /*oneway*/ virtual status_t playerAttributes(audio_unique_id_t piid, audio_usage_t usage, 61 audio_content_type_t content)= 0; 62 /*oneway*/ virtual status_t playerEvent(audio_unique_id_t piid, player_state_t event, 63 const std::vector<audio_port_handle_t>& eventIds) = 0; 64 /*oneway*/ virtual status_t releasePlayer(audio_unique_id_t piid) = 0; 65 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; 67 /*oneway*/ virtual status_t releaseRecorder(audio_unique_id_t riid) = 0; 68 /*oneway*/ virtual status_t playerSessionId(audio_unique_id_t piid, audio_session_t sessionId) = 0; 69 /*oneway*/ virtual status_t portEvent(audio_port_handle_t portId, player_state_t event, 70 const std::unique_ptr<os::PersistableBundle>& extras) = 0; 71 virtual status_t permissionUpdateBarrier() = 0; 72 }; 73 74 // ---------------------------------------------------------------------------- 75 76 }; // namespace android 77 78 #endif // ANDROID_IAUDIOMANAGER_H 79