Workaround system peculiarity to fix #2134509
* Our AccountManager listener was getting unregistered due to the way
ApplicationContext caches AccountManager in a static member
* The result was that AccountManager registers its listeners against the
FIRST context it is instantiated with! Future calls will all obtain
this pre-initialized AccountManager.
* In this case, AccountSetupOptions was the first caller (to create the
AccountManager Account for Exchange)
* The subsequent call to register a listener therefore had its registration
tied to the context of AccountSetupOptions, and was therefore leaked
when AccountSetupOptions finished!
* This caused a chain of problems - the leaked receiver, an Exception in
AccountManager when trying to ping the listener in an expired context,
and eventually the bug referenced above, which became a P1 issue
1 file changed