Once the BrokerDiscoveryClientFactory.IS_NEW_DISCOVERY_ENABLED is set to true,
the getActiveBroker() operation could be long running (due to the first time broker discovery operation).
In order to avoid ANR issue (in MSAL), I'm moving the operation to the background thread.
This is done by making all the commands retrieve MSAL Controllers in its execute() block, which is executed by CommandDispatcher.
Changes
Create IControllerFactory interface, make MSALControllerFactory inherits from it.
Make all commands take IControllerFactory instead of controller objects.
Why?
Once the BrokerDiscoveryClientFactory.IS_NEW_DISCOVERY_ENABLED is set to true, the getActiveBroker() operation could be long running (due to the first time broker discovery operation).
In order to avoid ANR issue (in MSAL), I'm moving the operation to the background thread.
This is done by making all the commands retrieve MSAL Controllers in its execute() block, which is executed by CommandDispatcher.
Changes