Android applicaton getting killed by OS with message "Too many Binders sent to SYSTEM"

369 Views Asked by At

So I am running into an issue where Android OS eventually kills my foreground process because of the amount of binders being sent to the system ("Too many Binders sent to SYSTEM"). My app, every second, checks to see what app is on screen and every 15 minutes checks some other system details like battery percentage and if the phone is plugged in. The amount of binders which can be sent is arbitrarily set to 2500. Here is the source code for Android OS. Line 54 is the limit I am speaking of. The purpose of this value is to distinguish a bad and or behaving app and fails to distinguish an app which needs to do work over long periods of time.

I have a question around this line of code on 187 "Throttling binder proxy created from uid %d in uid %d until binder proxy count drops below %d"

Is there a way for me to release binder proxies? If my count is approaching 2500, can I reduce this from within my code?

My main way to improve the amount of time my app can run before getting killed is removing calls to the underlining android server by way of getSystemService and registering to broadcast events where applicable, but eventually, the app is still killed due to the amount of binders sent to the system.

0

There are 0 best solutions below