Android framework review (3) Relationship between binder utilization and IBinder BpRefbase IInterface, ibinderbprefbase
Status_t AudioSystem: setStreamVolumeIndex (audio_stream_type_t stream, int index, audio_devices_t device ){
Const sp <IAudioPolicyService> & aps = AudioSystem: get_audio_policy_service ();//
If (aps = 0) return PERMISSION_DENIED;
Return aps-> setStreamVolumeIndex (stream, index, device); // (1)
}
Virtual status_t setStreamVolumeIndex (audio_stream_type_t stream, int index, audio_devices_t device ){
Parcel data, reply;
Data. writeInterfaceToken (IAudioPolicyService: getInterfaceDescriptor ());
Data. writeInt32 (static_cast <uint32_t> (stream ));
Data. writeInt32 (index );
Data. writeInt32 (static_cast <uint32_t> (device ));
Remote ()-> transact (SET_STREAM_VOLUME, data, & reply); // (2)
Return static_cast <status_t> (reply. readInt32 ());
}
I am tracking the volume settings. The problem is that from (1) to (2), I don't know how to trace it,
Grep-r setStreamVolumeIndex. We found AudioPolicyService, which also contains the setStreamVolumeIndex function, which seems to be called here.
The log print will surely come here, but how can the code come here? This requires us to understand the binder principle.
For example, the relationship graph between IBinder BpRefbase IInterface interfaces.
With this figure, we can't see how the binder is implemented, but we can roughly use it.
Use setStreamVolumeIndex to analyze the data flow.
For example:
One key point is AudioPolicyService. How is it transmitted to mRemote in aps? It is transmitted through the rewritten interface_cast.
An error occurred while printing ibinder_hook in android sendBroadcast logs ???
Just change your phone.