IAudioPolicyServiceClient.cpp revision b52c152d553556b2d227ffc943489de0c60b4b02
1/* 2 * Copyright (C) 2009 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#define LOG_TAG "IAudioPolicyServiceClient" 18#include <utils/Log.h> 19 20#include <stdint.h> 21#include <sys/types.h> 22 23#include <binder/Parcel.h> 24 25#include <media/IAudioPolicyServiceClient.h> 26#include <media/AudioSystem.h> 27 28namespace android { 29 30enum { 31 PORT_LIST_UPDATE = IBinder::FIRST_CALL_TRANSACTION, 32 PATCH_LIST_UPDATE 33}; 34 35class BpAudioPolicyServiceClient : public BpInterface<IAudioPolicyServiceClient> 36{ 37public: 38 BpAudioPolicyServiceClient(const sp<IBinder>& impl) 39 : BpInterface<IAudioPolicyServiceClient>(impl) 40 { 41 } 42 43 void onAudioPortListUpdate() 44 { 45 Parcel data, reply; 46 data.writeInterfaceToken(IAudioPolicyServiceClient::getInterfaceDescriptor()); 47 remote()->transact(PORT_LIST_UPDATE, data, &reply, IBinder::FLAG_ONEWAY); 48 } 49 50 void onAudioPatchListUpdate() 51 { 52 Parcel data, reply; 53 data.writeInterfaceToken(IAudioPolicyServiceClient::getInterfaceDescriptor()); 54 remote()->transact(PATCH_LIST_UPDATE, data, &reply, IBinder::FLAG_ONEWAY); 55 } 56}; 57 58IMPLEMENT_META_INTERFACE(AudioPolicyServiceClient, "android.media.IAudioPolicyServiceClient"); 59 60// ---------------------------------------------------------------------- 61 62status_t BnAudioPolicyServiceClient::onTransact( 63 uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) 64{ 65 switch (code) { 66 case PORT_LIST_UPDATE: { 67 CHECK_INTERFACE(IAudioPolicyServiceClient, data, reply); 68 onAudioPortListUpdate(); 69 return NO_ERROR; 70 } break; 71 case PATCH_LIST_UPDATE: { 72 CHECK_INTERFACE(IAudioPolicyServiceClient, data, reply); 73 onAudioPatchListUpdate(); 74 return NO_ERROR; 75 } break; 76 default: 77 return BBinder::onTransact(code, data, reply, flags); 78 } 79} 80 81// ---------------------------------------------------------------------------- 82 83}; // namespace android 84