IAudioPolicyService.cpp revision 83844cc2f95dc279015b47fd1e18c7cb4eabe9a1
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, 36c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent SET_RINGER_MODE, 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, 556b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten GET_DEVICES_FOR_STREAM, 56db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent QUERY_DEFAULT_PRE_PROCESSING, 57db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent SET_EFFECT_ENABLED 58c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; 59c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 60c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentclass BpAudioPolicyService : public BpInterface<IAudioPolicyService> 61c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{ 62c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentpublic: 63c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent BpAudioPolicyService(const sp<IBinder>& impl) 64c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent : BpInterface<IAudioPolicyService>(impl) 65c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 66c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 67c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 68c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t setDeviceConnectionState( 69fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device, 70fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_dev_state_t state, 71c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address) 72c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 73c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 74c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 75c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(device)); 76c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(state)); 77c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeCString(device_address); 78c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_DEVICE_CONNECTION_STATE, data, &reply); 79c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 80c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 81c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 82fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual audio_policy_dev_state_t getDeviceConnectionState( 83fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device, 84c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address) 85c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 86c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 87c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 88c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(device)); 89c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeCString(device_address); 90c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_DEVICE_CONNECTION_STATE, data, &reply); 91fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin return static_cast <audio_policy_dev_state_t>(reply.readInt32()); 92c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 93c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 94c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t setPhoneState(int state) 95c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 96c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 97c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 98c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(state); 99c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_PHONE_STATE, data, &reply); 100c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 101c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 102c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 103c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t setRingerMode(uint32_t mode, uint32_t mask) 104c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 105c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 106c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 107c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(mode); 108c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(mask); 109c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_RINGER_MODE, data, &reply); 110c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 111c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 112c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 113fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual status_t setForceUse(audio_policy_force_use_t usage, audio_policy_forced_cfg_t config) 114c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 115c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 116c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 117c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(usage)); 118c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(config)); 119c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_FORCE_USE, data, &reply); 120c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 121c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 122c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 123fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual audio_policy_forced_cfg_t getForceUse(audio_policy_force_use_t usage) 124c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 125c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 126c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 127c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(usage)); 128c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_FORCE_USE, data, &reply); 129fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin return static_cast <audio_policy_forced_cfg_t> (reply.readInt32()); 130c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 131c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 132c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual audio_io_handle_t getOutput( 133fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 134c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate, 135c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t format, 136c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t channels, 137fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_output_flags_t flags) 138c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 139c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 140c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 141c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 142c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(samplingRate); 143c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(format)); 144c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(channels); 145c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(flags)); 146c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_OUTPUT, data, &reply); 147fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent return static_cast <audio_io_handle_t> (reply.readInt32()); 148c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 149c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 150de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t startOutput(audio_io_handle_t output, 151fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 152de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session) 153c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 154c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 155c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 156fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(output); 157fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten data.writeInt32((int32_t) stream); 158de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(session); 159c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(START_OUTPUT, data, &reply); 160c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 161c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 162c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 163de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t stopOutput(audio_io_handle_t output, 164fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream, 165de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session) 166c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 167c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 168c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 169fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(output); 170fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten data.writeInt32((int32_t) stream); 171de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(session); 172c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(STOP_OUTPUT, data, &reply); 173c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 174c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 175c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 176c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual void releaseOutput(audio_io_handle_t output) 177c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 178c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 179c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 180fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(output); 181c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(RELEASE_OUTPUT, data, &reply); 182c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 183c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 184c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual audio_io_handle_t getInput( 185c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int inputSource, 186c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate, 187c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t format, 188c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t channels, 1897c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audio_in_acoustics_t acoustics, 1907c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent int audioSession) 191c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 192c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 193c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 194c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(inputSource); 195c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(samplingRate); 196c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(format)); 197c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(channels); 198c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(acoustics)); 1997c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent data.writeInt32(audioSession); 200c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_INPUT, data, &reply); 201fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent return static_cast <audio_io_handle_t> (reply.readInt32()); 202c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 203c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 204c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t startInput(audio_io_handle_t input) 205c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 206c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 207c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 208fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(input); 209c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(START_INPUT, data, &reply); 210c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 211c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 212c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 213c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual status_t stopInput(audio_io_handle_t input) 214c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 215c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 216c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 217fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(input); 218c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(STOP_INPUT, data, &reply); 219c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 220c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 221c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 222c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent virtual void releaseInput(audio_io_handle_t input) 223c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 224c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 225c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 226fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent data.writeInt32(input); 227c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(RELEASE_INPUT, data, &reply); 228c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 229c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 230fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual status_t initStreamVolume(audio_stream_type_t stream, 231c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMin, 232c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMax) 233c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 234c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 235c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 236c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 237c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(indexMin); 238c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(indexMax); 239c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(INIT_STREAM_VOLUME, data, &reply); 240c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 241c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 242c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 24383844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent virtual status_t setStreamVolumeIndex(audio_stream_type_t stream, 24483844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent int index, 24583844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device) 246c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 247c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 248c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 249c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 250c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(index); 25183844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent data.writeInt32(static_cast <uint32_t>(device)); 252c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(SET_STREAM_VOLUME, data, &reply); 253c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 254c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 255c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 25683844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent virtual status_t getStreamVolumeIndex(audio_stream_type_t stream, 25783844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent int *index, 25883844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device) 259c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent { 260c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent Parcel data, reply; 261c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 262c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 26383844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent data.writeInt32(static_cast <uint32_t>(device)); 26483844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent 265c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent remote()->transact(GET_STREAM_VOLUME, data, &reply); 266c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int lIndex = reply.readInt32(); 267c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent if (index) *index = lIndex; 268c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return static_cast <status_t> (reply.readInt32()); 269c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 270de070137f11d346fba77605bd76a44c040a618fcEric Laurent 271fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual uint32_t getStrategyForStream(audio_stream_type_t stream) 272de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 273de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 274de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 275de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(static_cast <uint32_t>(stream)); 276de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(GET_STRATEGY_FOR_STREAM, data, &reply); 277de070137f11d346fba77605bd76a44c040a618fcEric Laurent return reply.readInt32(); 278de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 279de070137f11d346fba77605bd76a44c040a618fcEric Laurent 280fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin virtual uint32_t getDevicesForStream(audio_stream_type_t stream) 2816b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten { 2826b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten Parcel data, reply; 2836b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 2846b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten data.writeInt32(static_cast <uint32_t>(stream)); 2856b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten remote()->transact(GET_DEVICES_FOR_STREAM, data, &reply); 2866b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten return (uint32_t) reply.readInt32(); 2876b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten } 2886b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten 289de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual audio_io_handle_t getOutputForEffect(effect_descriptor_t *desc) 290de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 291de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 292de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 293de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.write(desc, sizeof(effect_descriptor_t)); 294de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(GET_OUTPUT_FOR_EFFECT, data, &reply); 295de070137f11d346fba77605bd76a44c040a618fcEric Laurent return static_cast <audio_io_handle_t> (reply.readInt32()); 296de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 297de070137f11d346fba77605bd76a44c040a618fcEric Laurent 298de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t registerEffect(effect_descriptor_t *desc, 2997c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audio_io_handle_t io, 300de070137f11d346fba77605bd76a44c040a618fcEric Laurent uint32_t strategy, 301de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session, 302de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id) 303de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 304de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 305de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 306de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.write(desc, sizeof(effect_descriptor_t)); 3077c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent data.writeInt32(io); 308de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(strategy); 309de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(session); 310de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(id); 311de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(REGISTER_EFFECT, data, &reply); 312de070137f11d346fba77605bd76a44c040a618fcEric Laurent return static_cast <status_t> (reply.readInt32()); 313de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 314de070137f11d346fba77605bd76a44c040a618fcEric Laurent 315de070137f11d346fba77605bd76a44c040a618fcEric Laurent virtual status_t unregisterEffect(int id) 316de070137f11d346fba77605bd76a44c040a618fcEric Laurent { 317de070137f11d346fba77605bd76a44c040a618fcEric Laurent Parcel data, reply; 318de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 319de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.writeInt32(id); 320de070137f11d346fba77605bd76a44c040a618fcEric Laurent remote()->transact(UNREGISTER_EFFECT, data, &reply); 321de070137f11d346fba77605bd76a44c040a618fcEric Laurent return static_cast <status_t> (reply.readInt32()); 322de070137f11d346fba77605bd76a44c040a618fcEric Laurent } 323de070137f11d346fba77605bd76a44c040a618fcEric Laurent 324db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent virtual status_t setEffectEnabled(int id, bool enabled) 325db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent { 326db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent Parcel data, reply; 327db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 328db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent data.writeInt32(id); 329db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent data.writeInt32(enabled); 330db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent remote()->transact(SET_EFFECT_ENABLED, data, &reply); 331db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent return static_cast <status_t> (reply.readInt32()); 332db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent } 333db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent 334fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten virtual bool isStreamActive(audio_stream_type_t stream, uint32_t inPastMs) const 335eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent { 336eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent Parcel data, reply; 337eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 338fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten data.writeInt32((int32_t) stream); 339eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent data.writeInt32(inPastMs); 340eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent remote()->transact(IS_STREAM_ACTIVE, data, &reply); 341eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent return reply.readInt32(); 342eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent } 34357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent 34457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent virtual status_t queryDefaultPreProcessing(int audioSession, 34557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent effect_descriptor_t *descriptors, 34657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t *count) 34757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent { 34857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (descriptors == NULL || count == NULL) { 34957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return BAD_VALUE; 35057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 35157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent Parcel data, reply; 35257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent data.writeInterfaceToken(IAudioPolicyService::getInterfaceDescriptor()); 35357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent data.writeInt32(audioSession); 35457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent data.writeInt32(*count); 35557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent status_t status = remote()->transact(QUERY_DEFAULT_PRE_PROCESSING, data, &reply); 35657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (status != NO_ERROR) { 35757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return status; 35857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 35957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent status = static_cast <status_t> (reply.readInt32()); 36057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t retCount = reply.readInt32(); 36157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (retCount != 0) { 36257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t numDesc = (retCount < *count) ? retCount : *count; 36357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply.read(descriptors, sizeof(effect_descriptor_t) * numDesc); 36457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 36557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent *count = retCount; 36657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return status; 36757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 368c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; 369c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 370c2f1f07084818942352c6bbfb36af9b6b330eb4eEric LaurentIMPLEMENT_META_INTERFACE(AudioPolicyService, "android.media.IAudioPolicyService"); 371c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 372c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ---------------------------------------------------------------------- 373c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 374c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 375c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurentstatus_t BnAudioPolicyService::onTransact( 376c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) 377c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent{ 378c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent switch(code) { 379c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_DEVICE_CONNECTION_STATE: { 380c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 381fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device = 382fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_devices_t>(data.readInt32()); 383fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_dev_state_t state = 384fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_policy_dev_state_t>(data.readInt32()); 385c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address = data.readCString(); 386de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast<uint32_t> (setDeviceConnectionState(device, 387de070137f11d346fba77605bd76a44c040a618fcEric Laurent state, 388de070137f11d346fba77605bd76a44c040a618fcEric Laurent device_address))); 389c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 390c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 391c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 392c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_DEVICE_CONNECTION_STATE: { 393c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 394fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_devices_t device = 395fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast<audio_devices_t> (data.readInt32()); 396c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent const char *device_address = data.readCString(); 397de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast<uint32_t> (getDeviceConnectionState(device, 398de070137f11d346fba77605bd76a44c040a618fcEric Laurent device_address))); 399c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 400c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 401c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 402c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_PHONE_STATE: { 403c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 404c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(setPhoneState(data.readInt32()))); 405c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 406c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 407c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 408c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_RINGER_MODE: { 409c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 410c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t mode = data.readInt32(); 411c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t mask = data.readInt32(); 412c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(setRingerMode(mode, mask))); 413c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 414c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 415c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 416c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_FORCE_USE: { 417c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 418fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>(data.readInt32()); 419fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_forced_cfg_t config = 420fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_policy_forced_cfg_t>(data.readInt32()); 421c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(setForceUse(usage, config))); 422c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 423c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 424c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 425c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_FORCE_USE: { 426c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 427fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_force_use_t usage = static_cast <audio_policy_force_use_t>(data.readInt32()); 428c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(getForceUse(usage))); 429c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 430c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 431c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 432c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_OUTPUT: { 433c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 434fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 435fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 436c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate = data.readInt32(); 437c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t format = data.readInt32(); 438c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t channels = data.readInt32(); 439fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_policy_output_flags_t flags = 440fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_policy_output_flags_t>(data.readInt32()); 441c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 442c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent audio_io_handle_t output = getOutput(stream, 443c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent samplingRate, 444c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent format, 445c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent channels, 446c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent flags); 447fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent reply->writeInt32(static_cast <int>(output)); 448c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 449c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 450c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 451c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case START_OUTPUT: { 452c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 453fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); 454c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t stream = data.readInt32(); 455de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = data.readInt32(); 456de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <uint32_t>(startOutput(output, 457fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin (audio_stream_type_t)stream, 458de070137f11d346fba77605bd76a44c040a618fcEric Laurent session))); 459c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 460c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 461c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 462c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case STOP_OUTPUT: { 463c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 464fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); 465c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t stream = data.readInt32(); 466de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = data.readInt32(); 467de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <uint32_t>(stopOutput(output, 468fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin (audio_stream_type_t)stream, 469de070137f11d346fba77605bd76a44c040a618fcEric Laurent session))); 470c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 471c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 472c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 473c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case RELEASE_OUTPUT: { 474c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 475fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t output = static_cast <audio_io_handle_t>(data.readInt32()); 476c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent releaseOutput(output); 477c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 478c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 479c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 480c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_INPUT: { 481c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 482c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int inputSource = data.readInt32(); 483c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t samplingRate = data.readInt32(); 484c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t format = data.readInt32(); 485c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent uint32_t channels = data.readInt32(); 486fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_in_acoustics_t acoustics = 487fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_in_acoustics_t>(data.readInt32()); 4887c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent int audioSession = data.readInt32(); 489c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent audio_io_handle_t input = getInput(inputSource, 490c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent samplingRate, 491c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent format, 492c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent channels, 4937c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent acoustics, 4947c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audioSession); 495fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent reply->writeInt32(static_cast <int>(input)); 496c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 497c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 498c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 499c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case START_INPUT: { 500c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 501fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); 502c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(startInput(input))); 503c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 504c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 505c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 506c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case STOP_INPUT: { 507c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 508fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); 509c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(stopInput(input))); 510c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 511c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 512c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 513c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case RELEASE_INPUT: { 514c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 515fa2877b9ea48baed934b866d2ab3658b69c4c869Eric Laurent audio_io_handle_t input = static_cast <audio_io_handle_t>(data.readInt32()); 516c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent releaseInput(input); 517c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 518c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 519c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 520c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case INIT_STREAM_VOLUME: { 521c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 522fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 523fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 524c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMin = data.readInt32(); 525c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int indexMax = data.readInt32(); 526c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(initStreamVolume(stream, indexMin,indexMax))); 527c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 528c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 529c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 530c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case SET_STREAM_VOLUME: { 531c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 532fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 533fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 534c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int index = data.readInt32(); 53583844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); 53683844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent reply->writeInt32(static_cast <uint32_t>(setStreamVolumeIndex(stream, 53783844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent index, 53883844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent device))); 539c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 540c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 541c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 542c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent case GET_STREAM_VOLUME: { 543c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 544fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 545fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 54683844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent audio_devices_t device = static_cast <audio_devices_t>(data.readInt32()); 547c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent int index; 54883844cc2f95dc279015b47fd1e18c7cb4eabe9a1Eric Laurent status_t status = getStreamVolumeIndex(stream, &index, device); 549c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(index); 550c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent reply->writeInt32(static_cast <uint32_t>(status)); 551c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return NO_ERROR; 552c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } break; 553c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 554de070137f11d346fba77605bd76a44c040a618fcEric Laurent case GET_STRATEGY_FOR_STREAM: { 555de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 556fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 557fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 558de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(getStrategyForStream(stream)); 559de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 560de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 561de070137f11d346fba77605bd76a44c040a618fcEric Laurent 5626b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten case GET_DEVICES_FOR_STREAM: { 5636b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten CHECK_INTERFACE(IAudioPolicyService, data, reply); 564fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin audio_stream_type_t stream = 565fce7a473248381cc83a01855f92581077d3c9ee2Dima Zavin static_cast <audio_stream_type_t>(data.readInt32()); 5666b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten reply->writeInt32(static_cast <int>(getDevicesForStream(stream))); 5676b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten return NO_ERROR; 5686b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten } break; 5696b2718c67aa7b1a8e3b0f25a73a0d5f72c59ffc3Glenn Kasten 570de070137f11d346fba77605bd76a44c040a618fcEric Laurent case GET_OUTPUT_FOR_EFFECT: { 571de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 572de070137f11d346fba77605bd76a44c040a618fcEric Laurent effect_descriptor_t desc; 573de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.read(&desc, sizeof(effect_descriptor_t)); 574de070137f11d346fba77605bd76a44c040a618fcEric Laurent audio_io_handle_t output = getOutputForEffect(&desc); 575de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <int>(output)); 576de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 577de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 578de070137f11d346fba77605bd76a44c040a618fcEric Laurent 579de070137f11d346fba77605bd76a44c040a618fcEric Laurent case REGISTER_EFFECT: { 580de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 581de070137f11d346fba77605bd76a44c040a618fcEric Laurent effect_descriptor_t desc; 582de070137f11d346fba77605bd76a44c040a618fcEric Laurent data.read(&desc, sizeof(effect_descriptor_t)); 5837c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent audio_io_handle_t io = data.readInt32(); 584de070137f11d346fba77605bd76a44c040a618fcEric Laurent uint32_t strategy = data.readInt32(); 585de070137f11d346fba77605bd76a44c040a618fcEric Laurent int session = data.readInt32(); 586de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id = data.readInt32(); 587de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <int32_t>(registerEffect(&desc, 5887c7f10bd4fda9a084e5e7f0eb3a040dfcbf01745Eric Laurent io, 589de070137f11d346fba77605bd76a44c040a618fcEric Laurent strategy, 590de070137f11d346fba77605bd76a44c040a618fcEric Laurent session, 591de070137f11d346fba77605bd76a44c040a618fcEric Laurent id))); 592de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 593de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 594de070137f11d346fba77605bd76a44c040a618fcEric Laurent 595de070137f11d346fba77605bd76a44c040a618fcEric Laurent case UNREGISTER_EFFECT: { 596de070137f11d346fba77605bd76a44c040a618fcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 597de070137f11d346fba77605bd76a44c040a618fcEric Laurent int id = data.readInt32(); 598de070137f11d346fba77605bd76a44c040a618fcEric Laurent reply->writeInt32(static_cast <int32_t>(unregisterEffect(id))); 599de070137f11d346fba77605bd76a44c040a618fcEric Laurent return NO_ERROR; 600de070137f11d346fba77605bd76a44c040a618fcEric Laurent } break; 601de070137f11d346fba77605bd76a44c040a618fcEric Laurent 602db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent case SET_EFFECT_ENABLED: { 603db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 604db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent int id = data.readInt32(); 605db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent bool enabled = static_cast <bool>(data.readInt32()); 606db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent reply->writeInt32(static_cast <int32_t>(setEffectEnabled(id, enabled))); 607db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent return NO_ERROR; 608db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent } break; 609db7c079f284f6e91266f6653ae0ec198b1c5006eEric Laurent 610eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent case IS_STREAM_ACTIVE: { 611eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 612fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten audio_stream_type_t stream = (audio_stream_type_t) data.readInt32(); 613eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent uint32_t inPastMs = (uint32_t)data.readInt32(); 614fff6d715a8db0daf08a50634f242c40268de3d49Glenn Kasten reply->writeInt32( isStreamActive((audio_stream_type_t) stream, inPastMs) ); 615eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent return NO_ERROR; 616eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent } break; 617eda6c364c253ba97ee45a3adeb8c2b45db1f81dbEric Laurent 61857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent case QUERY_DEFAULT_PRE_PROCESSING: { 61957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent CHECK_INTERFACE(IAudioPolicyService, data, reply); 62057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent int audioSession = data.readInt32(); 62157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t count = data.readInt32(); 62257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent uint32_t retCount = count; 62357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent effect_descriptor_t *descriptors = 62457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent (effect_descriptor_t *)new char[count * sizeof(effect_descriptor_t)]; 62557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent status_t status = queryDefaultPreProcessing(audioSession, descriptors, &retCount); 62657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply->writeInt32(status); 62757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (status != NO_ERROR && status != NO_MEMORY) { 62857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent retCount = 0; 62957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 63057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply->writeInt32(retCount); 63157dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (retCount) { 63257dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent if (retCount < count) { 63357dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent count = retCount; 63457dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 63557dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent reply->write(descriptors, sizeof(effect_descriptor_t) * count); 63657dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 63757dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent delete[] descriptors; 63857dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent return status; 63957dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent } 64057dae99c9fcd6becd2b5ed0c53f277ba4d7dbcfcEric Laurent 641c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent default: 642c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent return BBinder::onTransact(code, data, reply, flags); 643c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent } 644c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent} 645c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 646c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent// ---------------------------------------------------------------------------- 647c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent 648c2f1f07084818942352c6bbfb36af9b6b330eb4eEric Laurent}; // namespace android 649