microsoft-authentication-library-for-android icon indicating copy to clipboard operation
microsoft-authentication-library-for-android copied to clipboard

Move the getActiveBroker() invocation to background thread

Open rpdome opened this issue 1 year ago • 0 comments

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

  • Create IControllerFactory interface, make MSALControllerFactory inherits from it.
  • Make all commands take IControllerFactory instead of controller objects.

Related: https://github.com/AzureAD/microsoft-authentication-library-common-for-android/pull/2352

rpdome avatar Mar 15 '24 19:03 rpdome