I receive report about android.os.TransactionTooLargeException from my widget users:
android.os.TransactionTooLargeException
android.os.BinderProxy.transact(Native Method)
com.android.internal.appwidget.IAppWidgetService$Stub$Proxy.updateAppWidgetIds(IAppWidgetService.java:611)
android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java:378)
android.appwidget.AppWidgetManager.updateAppWidget(AppWidgetManager.java:445)
com.alonedroid.ooswitcher.animationRunnable.run(ProvidersShared.java:1804)
java.lang.Thread.run(Thread.java:841)
That exception occurs when I try to update my widget in separate thread
through AppWidgetManager.updateAppWidget(widget_id, RemoteView)
. I read from documentation about TransactionTooLargeException, and, first, i thought - it is because of size of RemoteViews instance. So I start to set more layouts inside my RemoteViews instance, but never saw this error on my device.
Did somebody faced that problem too and maybe even solve it? And how to reproduce that error to debug application?
Looking at the implementation of RemoteViews, it looks like this can happen if too many operations are done on a single RemoteViews instance.
For example calling setTextViewText 1000 times with the same parameters will add 1000 operations to the RemoteViews which will have to be transferred across processes and applied as an update.
Making sure that the same RemoteViews object is not reused for an insane amount of operations seems to fix this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With