fix broadcast receivers overflow for system_server
Every time when user is switched the `UsbSettingsManager` creates a new
instance of settings object for the new user. It leads to creating
several receivers and subscribing to some broadcast messages. Then
system is switched on other user, settings for the old user are removed
from the internal container, but receivers are not unsubscribed. As a
result, the number of receivers for the `system_server` process is
continuously increased and may exceed the allowed limit.
It is proposed to explicitly unscribe receivers before remove settings.
Test: flash a DUT with user build and then run:
> run cts -m CtsDevicePolicyManagerTestCases
at least two times, check that DUT is not in the recovery mode;
or switch user ~1000 times:
$ adb shell am switch-user 0
$ adb shell am switch-user 10
and check that logcat doesn't contain a line:
E SystemServiceManager: java.lang.IllegalStateException: \
Too many receivers, total of 1000, registered
Change-Id: I4bb9feb408ce7c321a56d0e573c45c8794ed6860
Signed-off-by: Sergii Piatakov <sergii.piatakov@globallogic.com>
Loading
Please register or sign in to comment