小窗口更新失败粘合剂交​​易 [英] failed binder transaction on widget update

查看:137
本文介绍了小窗口更新失败粘合剂交​​易的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新的插件一个位图(整个部件只有一个ImageView的),像这样

i am updating one bitmap in widget (the whole widget is only one ImageView) like this

remoteViews.setImageViewBitmap(...)

和在某些罕见的情况(它的发生3次,6个月,每天使用的),我得到!失败粘结剂交易!!!。然后,只有手机重启解决了这个问题。 uninstaling和重新安装,没有帮助,只有重启。

and in some rare situations (it happend 3 times in 6 months of every day use) i get "!!! FAILED BINDER TRANSACTION !!!". then, only phone reboot solves this problem. uninstaling and installing again, does not help, only reboot.

我检查了图标的大小,它是只有56千字节,所以它的IPC内存限制的夹缝之中。当我删除setImageViewBitmap(...)的窗口小部件的工作了,但该位不会被更新。所以这个问题是在该位图本身。这是什么原因粘合剂交易失败时bitmal是这个小?

i checked the icon's size and it is only 56 kilobytes, so it fits within the IPC memory limit. when i remove setImageViewBitmap(...) the widget works again, but the bitmap is not updated. so the problem is in the bitmap itself. what could cause this binder transaction fail when the bitmal is this small?

现在,我通过保存图标/数据,我只发送URI窗口小部件解决了这个。但我想知道,哪里是一个问题,当我显然不打IPC内存限制?

for now, i solved this by saving the icon to /data and i am sending only the URI to widget. but i would like to know, where can be a problem, when i am clearly not hitting the IPC memory limit?

编辑: 我忘了提,它的发生在Android 2.3.5和2.3.7也

i forget to mention, it happend on android 2.3.5 and also 2.3.7

推荐答案

看来,我们无法分析更多的则1 MB的意图。

It seems we can not parse more then 1 mb in an intent.

该粘合剂的交易失败,因为它太大了。   在远程过程调用,参数和调用的返回值传送存储在活页夹事务缓冲区地块对象。如果参数或者返回值过大,以适应在交易缓冲区中,然后调用将失败, TransactionTooLargeException 将被抛出。

The Binder transaction failed because it was too large. During a remote procedure call, the arguments and the return value of the call are transferred as Parcel objects stored in the Binder transaction buffer. If the arguments or the return value are too large to fit in the transaction buffer, then the call will fail and TransactionTooLargeException will be thrown.

活页夹事务缓冲器具有有限的固定大小,目前的1Mb,其由所有的交易中的过程进展共享。因此,这个异常可以当有许多交易正在进行中,即使大部分的个人交易是大小适中的抛出。

The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.

有两种可能的结果时,远程过程调用抛出TransactionTooLargeException。无论是客户端无法发送其请求服务(最有可能的,如果参数过大,以适应在交易缓冲区),或服务无法发送它的响应返回给客户端(最有可能的,如果返回值是过大而无法在交易缓冲区)。这是不可能的,告诉这些结果的实际发生。客户应该假设发生了部分失败。

There are two possible outcomes when a remote procedure call throws TransactionTooLargeException. Either the client was unable to send its request to the service (most likely if the arguments were too large to fit in the transaction buffer), or the service was unable to send its response back to the client (most likely if the return value was too large to fit in the transaction buffer). It is not possible to tell which of these outcomes actually occurred. The client should assume that a partial failure occurred.

的关键是避免TransactionTooLargeException是保持所有交易相对较小。尽量减少创建包裹的参数,远程过程调用的返回值所需的内存量。避免传输字符串或大位图的巨大阵列。如果可能的话,尽量大的请求分解成更小的碎片。

The key to avoiding TransactionTooLargeException is to keep all transactions relatively small. Try to minimize the amount of memory needed to create a Parcel for the arguments and the return value of the remote procedure call. Avoid transferring huge arrays of strings or large bitmaps. If possible, try to break up big requests into smaller pieces.

如果您正在实施一项服务,它可以帮助强加给客户端可以进行查询,规模和复杂性约束上。例如,如果结果集可能变大,那么就不允许客户端请求超过几个记录的时间。而不是返回所有可用数据,一次全部或者,先返回的基本信息,使客户要求提供更多的信息,以后根据需要。

If you are implementing a service, it may help to impose size or complexity contraints on the queries that clients can perform. For example, if the result set could become large, then don't allow the client to request more than a few records at a time. Alternately, instead of returning all of the available data all at once, return the essential information first and make the client ask for additional information later as needed.

这篇关于小窗口更新失败粘合剂交​​易的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆