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