Android framework review (3) Relationship between binder utilization and IBinder BpRefbase IInterface, ibinderbprefbase

Source: Internet
Author: User

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.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.