1c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent/* 2c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** 3c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** Copyright 2009, The Android Open Source Project 4c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** 5c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** Licensed under the Apache License, Version 2.0 (the "License"); 6c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** you may not use this file except in compliance with the License. 7c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** You may obtain a copy of the License at 8c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** 9c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** http://www.apache.org/licenses/LICENSE-2.0 10c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** 11c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** Unless required by applicable law or agreed to in writing, software 12c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** distributed under the License is distributed on an "AS IS" BASIS, 13c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** See the License for the specific language governing permissions and 15c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent** limitations under the License. 16c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent*/ 17c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 18c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#define LOG_TAG "IAudioPolicyService" 19c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <utils/Log.h> 20c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 21c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <stdint.h> 22c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <sys/types.h> 23c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 24c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <binder/Parcel.h> 25c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 26c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent#include <media/IAudioPolicyService.h> 27c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 2864760240f931714858a59c1579f07264d7182ba2Dima Zavin#include <system/audio.h> 29fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin 30c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentnamespace android { 31c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 32c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentenum { 33c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent SET_DEVICE_CONNECTION_STATE = IBinder::FIRST_CALL_TRANSACTION, 34c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent GET_DEVICE_CONNECTION_STATE, 35c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent SET_PHONE_STATE, 360b07b8085d7b837b4dd5f09e0c8c39408f6bdbf7Glenn Kasten SET_RINGER_MODE, // reserved, no longer used 37c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent SET_FORCE_USE, 38c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent GET_FORCE_USE, 39c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent GET_OUTPUT, 40c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent START_OUTPUT, 41c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent STOP_OUTPUT, 42c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent RELEASE_OUTPUT, 43c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent GET_INPUT, 44c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent START_INPUT, 45c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent STOP_INPUT, 46c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent RELEASE_INPUT, 47c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent INIT_STREAM_VOLUME, 48c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent SET_STREAM_VOLUME, 49de070137f11d346fba77605bd76a44c040a618fcEric Laurent GET_STREAM_VOLUME, 50de070137f11d346fba77605bd76a44c040a618fcEric Laurent GET_STRATEGY_FOR_STREAM, 51de070137f11d346fba77605bd76a44c040a618fcEric Laurent GET_OUTPUT_FOR_EFFECT, 52de070137f11d346fba77605bd76a44c040a618fcEric Laurent REGISTER_EFFECT, 53eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent UNREGISTER_EFFECT, 546b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten IS_STREAM_ACTIVE, 55e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi IS_SOURCE_ACTIVE, 566b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten GET_DEVICES_FOR_STREAM, 57db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent QUERY_DEFAULT_PRE_PROCESSING, 58e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi SET_EFFECT_ENABLED, 59e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi IS_STREAM_ACTIVE_REMOTELY 60c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; 61c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 62c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass BpAudioPolicyService : public BpInterface<IAudioPolicyService> 63c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{ 64c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic: 65c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent BpAudioPolicyService(const sp<IBinder>& impl) 66c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent : BpInterface<IAudioPolicyService>(impl) 67c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 68c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 69c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 70c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t setDeviceConnectionState( 71fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device, 72fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_dev_state_t state, 73c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address) 74c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 75c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 76c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 77c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(device)); 78c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(state)); 79c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeCString(device_address); 80c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_DEVICE_CONNECTION_STATE, data, &reply); 81c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 82c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 83c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 84fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual audio_policy_dev_state_t getDeviceConnectionState( 85fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device, 86c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address) 87c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 88c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 89c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 90c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(device)); 91c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeCString(device_address); 92c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_DEVICE_CONNECTION_STATE, data, &reply); 93fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin return static_cast <audio_policy_dev_state_t>(reply.readInt32()); 94c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 95c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 96f78aee70d15daf4690de7e7b4983ee68b0d1381dGlenn Kasten virtual status_t setPhoneState(audio_mode_t state) 97c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 98c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 99c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 100c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(state); 101c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_PHONE_STATE, data, &reply); 102c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 103c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 104c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 105fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) 106c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 107c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 108c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 109c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(usage)); 110c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(config)); 111c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_FORCE_USE, data, &reply); 112c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 113c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 114c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 115fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) 116c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 117c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 118c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 119c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(usage)); 120c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_FORCE_USE, data, &reply); 121fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin return static_cast <audio_policy_forced_cfg_t> (reply.readInt32()); 122c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 123c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 124c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual audio_io_handle_t getOutput( 125fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 126c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate, 12758f30210ea540b6ce5aa6a46330cd3499483cb97Glenn Kasten audio_format_t format, 128254af180475346b6186b49c297f340c9c4817511Glenn Kasten audio_channel_mask_t channelMask, 1290ca3cf94c0dfc173ad7886ae162c4b67067539f6Eric Laurent audio_output_flags_t flags) 130c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 131c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 132c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 133c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 134c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(samplingRate); 135c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(format)); 136254af180475346b6186b49c297f340c9c4817511Glenn Kasten data.writeInt32(channelMask); 137c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(flags)); 138c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_OUTPUT, data, &reply); 139fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent return static_cast <audio_io_handle_t> (reply.readInt32()); 140c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 141c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 142de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t startOutput(audio_io_handle_t output, 143fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 144de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session) 145c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 146c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 147c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 148fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(output); 149fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten data.writeInt32((int32_t) stream); 150de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(session); 151c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(START_OUTPUT, data, &reply); 152c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 153c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 154c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 155de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t stopOutput(audio_io_handle_t output, 156fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 157de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session) 158c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 159c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 160c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 161fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(output); 162fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten data.writeInt32((int32_t) stream); 163de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(session); 164c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(STOP_OUTPUT, data, &reply); 165c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 166c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 167c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 168c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual void releaseOutput(audio_io_handle_t output) 169c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 170c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 171c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 172fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(output); 173c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(RELEASE_OUTPUT, data, &reply); 174c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 175c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 176c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual audio_io_handle_t getInput( 177eba51fb3a361f67a6a64d5a16eba6084fe27d60eGlenn Kasten audio_source_t inputSource, 178c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate, 17958f30210ea540b6ce5aa6a46330cd3499483cb97Glenn Kasten audio_format_t format, 180254af180475346b6186b49c297f340c9c4817511Glenn Kasten audio_channel_mask_t channelMask, 1817c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent int audioSession) 182c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 183c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 184c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 185eba51fb3a361f67a6a64d5a16eba6084fe27d60eGlenn Kasten data.writeInt32((int32_t) inputSource); 186c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(samplingRate); 187c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(format)); 188254af180475346b6186b49c297f340c9c4817511Glenn Kasten data.writeInt32(channelMask); 1897c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent data.writeInt32(audioSession); 190c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_INPUT, data, &reply); 191fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent return static_cast <audio_io_handle_t> (reply.readInt32()); 192c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 193c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 194c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t startInput(audio_io_handle_t input) 195c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 196c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 197c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 198fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(input); 199c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(START_INPUT, data, &reply); 200c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 201c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 202c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 203c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t stopInput(audio_io_handle_t input) 204c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 205c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 206c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 207fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(input); 208c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(STOP_INPUT, data, &reply); 209c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 210c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 211c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 212c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual void releaseInput(audio_io_handle_t input) 213c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 214c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 215c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 216fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(input); 217c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(RELEASE_INPUT, data, &reply); 218c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 219c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 220fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual status_t initStreamVolume(audio_stream_type_t stream, 221c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMin, 222c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMax) 223c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 224c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 225c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 226c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 227c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(indexMin); 228c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(indexMax); 229c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(INIT_STREAM_VOLUME, data, &reply); 230c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 231c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 232c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 23383844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, 23483844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent int index, 23583844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device) 236c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 237c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 238c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 239c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 240c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(index); 24183844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent data.writeInt32(static_cast <uint32_t>(device)); 242c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_STREAM_VOLUME, data, &reply); 243c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 244c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 245c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 24683844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, 24783844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent int *index, 24883844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device) 249c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 250c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 251c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 252c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 25383844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent data.writeInt32(static_cast <uint32_t>(device)); 25483844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent 255c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_STREAM_VOLUME, data, &reply); 256c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int lIndex = reply.readInt32(); 257c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent if (index) *index = lIndex; 258c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 259c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 260de070137f11d346fba77605bd76a44c040a618fcEric Laurent 261fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual uint32_t getStrategyForStream(audio_stream_type_t stream) 262de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 263de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 264de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 265de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 266de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(GET_STRATEGY_FOR_STREAM, data, &reply); 267de070137f11d346fba77605bd76a44c040a618fcEric Laurent return reply.readInt32(); 268de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 269de070137f11d346fba77605bd76a44c040a618fcEric Laurent 2706374252107fd6539397598195ea6defd5870fafbEric Laurent virtual audio_devices_t getDevicesForStream(audio_stream_type_t stream) 2716b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten { 2726b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten Parcel data, reply; 2736b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 2746b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten data.writeInt32(static_cast <uint32_t>(stream)); 2756b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten remote()->transact(GET_DEVICES_FOR_STREAM, data, &reply); 2766374252107fd6539397598195ea6defd5870fafbEric Laurent return (audio_devices_t) reply.readInt32(); 2776b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten } 2786b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten 27958e5aa34f01d663654d8bafad65db1dda42161ffGlenn Kasten virtual audio_io_handle_t getOutputForEffect(const effect_descriptor_t *desc) 280de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 281de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 282de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 283de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.write(desc, sizeof(effect_descriptor_t)); 284de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(GET_OUTPUT_FOR_EFFECT, data, &reply); 285de070137f11d346fba77605bd76a44c040a618fcEric Laurent return static_cast <audio_io_handle_t> (reply.readInt32()); 286de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 287de070137f11d346fba77605bd76a44c040a618fcEric Laurent 28858e5aa34f01d663654d8bafad65db1dda42161ffGlenn Kasten virtual status_t registerEffect(const effect_descriptor_t *desc, 2897c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audio_io_handle_t io, 290de070137f11d346fba77605bd76a44c040a618fcEric Laurent uint32_t strategy, 291de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session, 292de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id) 293de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 294de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 295de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 296de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.write(desc, sizeof(effect_descriptor_t)); 2977c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent data.writeInt32(io); 298de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(strategy); 299de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(session); 300de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(id); 301de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(REGISTER_EFFECT, data, &reply); 302de070137f11d346fba77605bd76a44c040a618fcEric Laurent return static_cast <status_t> (reply.readInt32()); 303de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 304de070137f11d346fba77605bd76a44c040a618fcEric Laurent 305de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t unregisterEffect(int id) 306de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 307de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 308de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 309de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(id); 310de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(UNREGISTER_EFFECT, data, &reply); 311de070137f11d346fba77605bd76a44c040a618fcEric Laurent return static_cast <status_t> (reply.readInt32()); 312de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 313de070137f11d346fba77605bd76a44c040a618fcEric Laurent 314db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent virtual status_t setEffectEnabled(int id, bool enabled) 315db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent { 316db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent Parcel data, reply; 317db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 318db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent data.writeInt32(id); 319db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent data.writeInt32(enabled); 320db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent remote()->transact(SET_EFFECT_ENABLED, data, &reply); 321db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent return static_cast <status_t> (reply.readInt32()); 322db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent } 323db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent 324fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const 325eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent { 326eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent Parcel data, reply; 327eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 328fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten data.writeInt32((int32_t) stream); 329eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent data.writeInt32(inPastMs); 330eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent remote()->transact(IS_STREAM_ACTIVE, data, &reply); 331eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent return reply.readInt32(); 332eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent } 33357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent 334e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi virtual bool isStreamActiveRemotely(audio_stream_type_t stream, uint32_t inPastMs) const 335e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi { 336e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi Parcel data, reply; 337e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 338e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi data.writeInt32((int32_t) stream); 339e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi data.writeInt32(inPastMs); 340e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi remote()->transact(IS_STREAM_ACTIVE_REMOTELY, data, &reply); 341e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi return reply.readInt32(); 342e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi } 343e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi 344e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi virtual bool isSourceActive(audio_source_t source) const 345e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi { 346e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi Parcel data, reply; 347e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 348e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi data.writeInt32((int32_t) source); 349e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi remote()->transact(IS_SOURCE_ACTIVE, data, &reply); 350e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi return reply.readInt32(); 351e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi } 352e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi 35357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent virtual status_t queryDefaultPreProcessing(int audioSession, 35457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent effect_descriptor_t *descriptors, 35557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t *count) 35657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent { 35757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (descriptors == NULL || count == NULL) { 35857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return BAD_VALUE; 35957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 36057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent Parcel data, reply; 36157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 36257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent data.writeInt32(audioSession); 36357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent data.writeInt32(*count); 36457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent status_t status = remote()->transact(QUERY_DEFAULT_PRE_PROCESSING, data, &reply); 36557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (status != NO_ERROR) { 36657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return status; 36757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 36857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent status = static_cast <status_t> (reply.readInt32()); 36957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t retCount = reply.readInt32(); 37057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (retCount != 0) { 37157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t numDesc = (retCount < *count) ? retCount : *count; 37257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply.read(descriptors, sizeof(effect_descriptor_t) * numDesc); 37357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 37457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent *count = retCount; 37557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return status; 37657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 377c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; 378c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 379c2f1f07084818942352c6bbfb36af9b6b330eb4eEric LaurentIMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService"); 380c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 381c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ---------------------------------------------------------------------- 382c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 383c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 384c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentstatus_t BnAudioPolicyService::onTransact( 385c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) 386c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{ 387e53b9ead781c36e96d6b6f012ddffc93a3d80f0dGlenn Kasten switch (code) { 388c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_DEVICE_CONNECTION_STATE: { 389c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 390fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device = 391fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_devices_t>(data.readInt32()); 392fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_dev_state_t state = 393fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_policy_dev_state_t>(data.readInt32()); 394c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address = data.readCString(); 395de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device, 396de070137f11d346fba77605bd76a44c040a618fcEric Laurent state, 397de070137f11d346fba77605bd76a44c040a618fcEric Laurent device_address))); 398c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 399c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 400c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 401c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_DEVICE_CONNECTION_STATE: { 402c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 403fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device = 404fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast<audio_devices_t> (data.readInt32()); 405c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address = data.readCString(); 406de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device, 407de070137f11d346fba77605bd76a44c040a618fcEric Laurent device_address))); 408c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 409c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 410c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 411c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_PHONE_STATE: { 412c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 4138af901cdea0af7e536579dee6d56e69987035a01Glenn Kasten reply->writeInt32(static_cast <uint32_t>(setPhoneState( 4148af901cdea0af7e536579dee6d56e69987035a01Glenn Kasten (audio_mode_t) data.readInt32()))); 415c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 416c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 417c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 418c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_FORCE_USE: { 419c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 4208af901cdea0af7e536579dee6d56e69987035a01Glenn Kasten audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>( 4218af901cdea0af7e536579dee6d56e69987035a01Glenn Kasten data.readInt32()); 422fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_forced_cfg_t config = 423fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_policy_forced_cfg_t>(data.readInt32()); 424c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(setForceUse(usage, config))); 425c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 426c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 427c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 428c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_FORCE_USE: { 429c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 4308af901cdea0af7e536579dee6d56e69987035a01Glenn Kasten audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>( 4318af901cdea0af7e536579dee6d56e69987035a01Glenn Kasten data.readInt32()); 432c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(getForceUse(usage))); 433c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 434c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 435c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 436c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_OUTPUT: { 437c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 438fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 439fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 440c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate = data.readInt32(); 44158f30210ea540b6ce5aa6a46330cd3499483cb97Glenn Kasten audio_format_t format = (audio_format_t) data.readInt32(); 442254af180475346b6186b49c297f340c9c4817511Glenn Kasten audio_channel_mask_t channelMask = data.readInt32(); 4430ca3cf94c0dfc173ad7886ae162c4b67067539f6Eric Laurent audio_output_flags_t flags = 4440ca3cf94c0dfc173ad7886ae162c4b67067539f6Eric Laurent static_cast <audio_output_flags_t>(data.readInt32()); 445c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 446c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent audio_io_handle_t output = getOutput(stream, 447c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent samplingRate, 448c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent format, 449254af180475346b6186b49c297f340c9c4817511Glenn Kasten channelMask, 450c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent flags); 451fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent reply->writeInt32(static_cast <int>(output)); 452c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 453c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 454c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 455c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case START_OUTPUT: { 456c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 457fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); 458c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t stream = data.readInt32(); 459de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = data.readInt32(); 460de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <uint32_t>(startOutput(output, 461fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin (audio_stream_type_t)stream, 462de070137f11d346fba77605bd76a44c040a618fcEric Laurent session))); 463c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 464c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 465c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 466c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case STOP_OUTPUT: { 467c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 468fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); 469c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t stream = data.readInt32(); 470de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = data.readInt32(); 471de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <uint32_t>(stopOutput(output, 472fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin (audio_stream_type_t)stream, 473de070137f11d346fba77605bd76a44c040a618fcEric Laurent session))); 474c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 475c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 476c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 477c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case RELEASE_OUTPUT: { 478c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 479fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); 480c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent releaseOutput(output); 481c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 482c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 483c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 484c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_INPUT: { 485c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 486eba51fb3a361f67a6a64d5a16eba6084fe27d60eGlenn Kasten audio_source_t inputSource = (audio_source_t) data.readInt32(); 487c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate = data.readInt32(); 48858f30210ea540b6ce5aa6a46330cd3499483cb97Glenn Kasten audio_format_t format = (audio_format_t) data.readInt32(); 489254af180475346b6186b49c297f340c9c4817511Glenn Kasten audio_channel_mask_t channelMask = data.readInt32(); 4907c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent int audioSession = data.readInt32(); 491c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent audio_io_handle_t input = getInput(inputSource, 492c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent samplingRate, 493c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent format, 494254af180475346b6186b49c297f340c9c4817511Glenn Kasten channelMask, 4957c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audioSession); 496fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent reply->writeInt32(static_cast <int>(input)); 497c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 498c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 499c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 500c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case START_INPUT: { 501c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 502fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); 503c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(startInput(input))); 504c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 505c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 506c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 507c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case STOP_INPUT: { 508c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 509fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); 510c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(stopInput(input))); 511c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 512c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 513c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 514c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case RELEASE_INPUT: { 515c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 516fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); 517c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent releaseInput(input); 518c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 519c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 520c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 521c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case INIT_STREAM_VOLUME: { 522c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 523fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 524fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 525c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMin = data.readInt32(); 526c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMax = data.readInt32(); 527c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(initStreamVolume(stream, indexMin,indexMax))); 528c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 529c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 530c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 531c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_STREAM_VOLUME: { 532c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 533fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 534fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 535c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int index = data.readInt32(); 53683844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); 53783844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent reply->writeInt32(static_cast <uint32_t>(setStreamVolumeIndex(stream, 53883844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent index, 53983844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent device))); 540c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 541c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 542c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 543c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_STREAM_VOLUME: { 544c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 545fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 546fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 54783844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); 548c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int index; 54983844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent status_t status = getStreamVolumeIndex(stream, &index, device); 550c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(index); 551c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(status)); 552c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 553c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 554c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 555de070137f11d346fba77605bd76a44c040a618fcEric Laurent case GET_STRATEGY_FOR_STREAM: { 556de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 557fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 558fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 559de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(getStrategyForStream(stream)); 560de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 561de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 562de070137f11d346fba77605bd76a44c040a618fcEric Laurent 5636b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten case GET_DEVICES_FOR_STREAM: { 5646b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten CHECK_INTERFACE(IAudioPolicyService, data, reply); 565fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 566fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 5676b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten reply->writeInt32(static_cast <int>(getDevicesForStream(stream))); 5686b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten return NO_ERROR; 5696b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten } break; 5706b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten 571de070137f11d346fba77605bd76a44c040a618fcEric Laurent case GET_OUTPUT_FOR_EFFECT: { 572de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 573de070137f11d346fba77605bd76a44c040a618fcEric Laurent effect_descriptor_t desc; 574de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.read(&desc, sizeof(effect_descriptor_t)); 575de070137f11d346fba77605bd76a44c040a618fcEric Laurent audio_io_handle_t output = getOutputForEffect(&desc); 576de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <int>(output)); 577de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 578de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 579de070137f11d346fba77605bd76a44c040a618fcEric Laurent 580de070137f11d346fba77605bd76a44c040a618fcEric Laurent case REGISTER_EFFECT: { 581de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 582de070137f11d346fba77605bd76a44c040a618fcEric Laurent effect_descriptor_t desc; 583de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.read(&desc, sizeof(effect_descriptor_t)); 5847c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audio_io_handle_t io = data.readInt32(); 585de070137f11d346fba77605bd76a44c040a618fcEric Laurent uint32_t strategy = data.readInt32(); 586de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = data.readInt32(); 587de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id = data.readInt32(); 588de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <int32_t>(registerEffect(&desc, 5897c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent io, 590de070137f11d346fba77605bd76a44c040a618fcEric Laurent strategy, 591de070137f11d346fba77605bd76a44c040a618fcEric Laurent session, 592de070137f11d346fba77605bd76a44c040a618fcEric Laurent id))); 593de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 594de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 595de070137f11d346fba77605bd76a44c040a618fcEric Laurent 596de070137f11d346fba77605bd76a44c040a618fcEric Laurent case UNREGISTER_EFFECT: { 597de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 598de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id = data.readInt32(); 599de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <int32_t>(unregisterEffect(id))); 600de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 601de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 602de070137f11d346fba77605bd76a44c040a618fcEric Laurent 603db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent case SET_EFFECT_ENABLED: { 604db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 605db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent int id = data.readInt32(); 606db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent bool enabled = static_cast <bool>(data.readInt32()); 607db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent reply->writeInt32(static_cast <int32_t>(setEffectEnabled(id, enabled))); 608db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent return NO_ERROR; 609db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent } break; 610db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent 611eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent case IS_STREAM_ACTIVE: { 612eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 613fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); 614eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent uint32_t inPastMs = (uint32_t)data.readInt32(); 615fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten reply->writeInt32( isStreamActive((audio_stream_type_t) stream, inPastMs) ); 616eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent return NO_ERROR; 617eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent } break; 618eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent 619e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi case IS_STREAM_ACTIVE_REMOTELY: { 620e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi CHECK_INTERFACE(IAudioPolicyService, data, reply); 621e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); 622e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi uint32_t inPastMs = (uint32_t)data.readInt32(); 623e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi reply->writeInt32( isStreamActiveRemotely((audio_stream_type_t) stream, inPastMs) ); 624e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi return NO_ERROR; 625e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi } break; 626e336f9113bdd35119866a3c3f8008ca01c576660Jean-Michel Trivi 627e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi case IS_SOURCE_ACTIVE: { 628e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi CHECK_INTERFACE(IAudioPolicyService, data, reply); 629e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi audio_source_t source = (audio_source_t) data.readInt32(); 630e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi reply->writeInt32( isSourceActive(source)); 631e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi return NO_ERROR; 632e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi } 633e3f641fd9348bf7f4c07f6cc707347fccea1439cJean-Michel Trivi 63457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent case QUERY_DEFAULT_PRE_PROCESSING: { 63557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 63657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent int audioSession = data.readInt32(); 63757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t count = data.readInt32(); 63857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t retCount = count; 63957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent effect_descriptor_t *descriptors = 64057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent (effect_descriptor_t *)new char[count * sizeof(effect_descriptor_t)]; 64157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent status_t status = queryDefaultPreProcessing(audioSession, descriptors, &retCount); 64257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply->writeInt32(status); 64357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (status != NO_ERROR && status != NO_MEMORY) { 64457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent retCount = 0; 64557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 64657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply->writeInt32(retCount); 64757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (retCount) { 64857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (retCount < count) { 64957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent count = retCount; 65057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 65157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply->write(descriptors, sizeof(effect_descriptor_t) * count); 65257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 65357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent delete[] descriptors; 65457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return status; 65557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 65657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent 657c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent default: 658c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return BBinder::onTransact(code, data, reply, flags); 659c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 660c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent} 661c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 662c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ---------------------------------------------------------------------------- 663c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 664c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; // namespace android 665