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 <audiomanager/AudioManager.h> 21 #include <utils/Errors.h> 22 #include <binder/IInterface.h> 23 #include <binder/PersistableBundle.h> 24 #include <hardware/power.h> 25 #include <system/audio.h> 26 27 namespace android { 28 29 // ---------------------------------------------------------------------------- 30 31 class IAudioManager : public IInterface 32 { 33 public: 34 // These transaction IDs must be kept in sync with the method order from 35 // IAudioService.aidl. 36 enum { 37 TRACK_PLAYER = IBinder::FIRST_CALL_TRANSACTION, 38 PLAYER_ATTRIBUTES = IBinder::FIRST_CALL_TRANSACTION + 1, 39 PLAYER_EVENT = IBinder::FIRST_CALL_TRANSACTION + 2, 40 RELEASE_PLAYER = IBinder::FIRST_CALL_TRANSACTION + 3, 41 TRACK_RECORDER = IBinder::FIRST_CALL_TRANSACTION + 4, 42 RECORDER_EVENT = IBinder::FIRST_CALL_TRANSACTION + 5, 43 RELEASE_RECORDER = IBinder::FIRST_CALL_TRANSACTION + 6, 44 PLAYER_SESSION_ID = IBinder::FIRST_CALL_TRANSACTION + 7, 45 PORT_EVENT = IBinder::FIRST_CALL_TRANSACTION + 8, 46 }; 47 48 DECLARE_META_INTERFACE(AudioManager) 49 50 // The parcels created by these methods must be kept in sync with the 51 // corresponding methods from IAudioService.aidl and objects it imports. 52 virtual audio_unique_id_t trackPlayer(player_type_t playerType, audio_usage_t usage, 53 audio_content_type_t content, const sp<IBinder>& player, 54 audio_session_t sessionId) = 0; 55 /*oneway*/ virtual status_t playerAttributes(audio_unique_id_t piid, audio_usage_t usage, 56 audio_content_type_t content)= 0; 57 /*oneway*/ virtual status_t playerEvent(audio_unique_id_t piid, player_state_t event, 58 audio_port_handle_t eventId) = 0; 59 /*oneway*/ virtual status_t releasePlayer(audio_unique_id_t piid) = 0; 60 virtual audio_unique_id_t trackRecorder(const sp<IBinder>& recorder) = 0; 61 /*oneway*/ virtual status_t recorderEvent(audio_unique_id_t riid, recorder_state_t event) = 0; 62 /*oneway*/ virtual status_t releaseRecorder(audio_unique_id_t riid) = 0; 63 /*oneway*/ virtual status_t playerSessionId(audio_unique_id_t piid, audio_session_t sessionId) = 0; 64 /*oneway*/ virtual status_t portEvent(audio_port_handle_t portId, player_state_t event, 65 const std::unique_ptr<os::PersistableBundle>& extras) = 0; 66 }; 67 68 // ---------------------------------------------------------------------------- 69 70 }; // namespace android 71 72 #endif // ANDROID_IAUDIOMANAGER_H 73