• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
28 namespace android {
29 
30 enum {
31     PORT_LIST_UPDATE = IBinder::FIRST_CALL_TRANSACTION,
32     PATCH_LIST_UPDATE
33 };
34 
35 class BpAudioPolicyServiceClient : public BpInterface<IAudioPolicyServiceClient>
36 {
37 public:
BpAudioPolicyServiceClient(const sp<IBinder> & impl)38     BpAudioPolicyServiceClient(const sp<IBinder>& impl)
39         : BpInterface<IAudioPolicyServiceClient>(impl)
40     {
41     }
42 
onAudioPortListUpdate()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 
onAudioPatchListUpdate()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 
58 IMPLEMENT_META_INTERFACE(AudioPolicyServiceClient, "android.media.IAudioPolicyServiceClient");
59 
60 // ----------------------------------------------------------------------
61 
onTransact(uint32_t code,const Parcel & data,Parcel * reply,uint32_t flags)62 status_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