Where Android Aidl interprocess communication needs to be noted (Android.os.TransactionTooLargeException)

Source: Internet
Author: User

Transferred from: http://blog.sina.com.cn/s/blog_4e1e357d0102wau9.html

1.bus Engineering Implementation AIDL entity classes through service

2.actor works by initiating Bindservice, according to the action to start the remote (cross-process) bus on the aidl.   So the problem is, we know that the Linux system interprocess communication, the inter-process resources are isolated, two processes need to communicate, it is necessary to convert the MSG to the underlying OS system can recognize the data unit, in the Android program is Aidl+parcelbal serialization.    in order to simulate and test the performance of Aidl, I did a simple experiment, in Android, interprocess communication through binder implementation, BIND is the data carrier of communication, when the serialized data unit is too large, there will be problems, Report the Android.os.TransactionTooLargeException. The  http://developer.android.com/reference/android/os/TransactionTooLargeException.html  official documentation shows that The maximum is usually limited to 1M. That is, if the data is larger than 1M, it should be transmitted separately. Theoretically, it should be the object and string type of data-based, as long as it is not a large picture entity and so on, should generally suffice. I've done a test that serializes the serialized data of a 450k string, which takes 33 seconds.  try {StringBuilder sb = new StringBuilder (); for (int i = 0;i< 30;i++) {sb.append (new String (stringmsg));} System.out.println ("Actor time Start:" + System.currenttimemillis ()); Binder.sendmsg ("Msg from actor:" + sb.tostring ()) ;} catch (RemoteException e) {//TODO auto-generated catch Blocke.printstacktrace ();} ------ public static Buscore Corebinder = new Buscore.stub () {  @Overridepublic void sendmsg (String msg) throws R emoteexception {log.d ("","Remotebuscoreservice msg:" + msg);  system.out.println ("Buscore Time End:" + System.currenttimemillis ());}};    for remote services, you must call the Bindservice () method instead of the StartService () method.   was just checking out the next, Mark, when it was doing a framework implementation test today.

Where Android Aidl interprocess communication (android.os.TransactionTooLargeException)

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.