Home > Mobile >  Android IPC, onBind () returns the type of Binder is in when to become onServiceConnected BinderProx
Android IPC, onBind () returns the type of Binder is in when to become onServiceConnected BinderProx

Time:11-19

Are studying the Binder mechanism in the Android, I want to ask is when calling the remote Service, Service in the onBind () returns the type of Binder, when is become onServiceConnected () in the BinderProxy type of object?
Saw "Android development art exploration", in the process of binding Service, ActivityThread handleBindService method callback the Service's onBind () method, and return the onBind IBinder object type (type of Binder) at this time to the AMS publishService method, a preacher callback after the ServiceConnection onServiceConnected method in the Activity, and introduced to the above said the IBinder object, but this time it's type has been changed to BinderProxy type,
I think this BinderProxy should be after they contact the SM Client, but the process where specific happen?

CodePudding user response:

Where is the great god,

CodePudding user response:

Question is very good ah, if is across processes binding service in onServiceConnection bindProxy type of object, indeed with the Binder type on the same process, I also want to know is why?

CodePudding user response:

Didn't a great god is able to answer this question, I study for a few days, found that the return of the IBinder directly call the ServiceRecord. OnBind, namely direct returned to the Service's onBind method return value, in AIDL cross-process communication, is a IXXX. The Stub, publishService behind the tracking process, did not find that convert it to BinderProxy? An article is speechless, didn't explain the problem

CodePudding user response:

The Parcel itself when reading and writing IBinder will convert
https://www.jianshu.com/p/b39ffcbcb7b7
  • Related