Skip to content
Commit 302822b2 authored by Sergii Piatakov's avatar Sergii Piatakov
Browse files

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: default avatarSergii Piatakov <sergii.piatakov@globallogic.com>
parent 0a2c4f34
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment