fix: synchronize token refresh to mitigate race condition
Description
synchronized{} is used to mitigate race conditions between multiple threads of Account Manager trying to refresh the token simultaneously by BearerAuthInterceptor and also Notes app (via InputStreamBinder) in OidcTokenRefresher.
If there's a valid authState available, it'll be used. Otherwise, a new access token will be requested.
The fix is based on upstream's implementation. https://github.com/bitfireAT/davx5-ose/pull/1547
Screenshots
Technical details
Tests
Issues
https://gitlab.e.foundation/e/os/backlog/-/issues/3559
DAVx5 issue: https://github.com/bitfireAT/davx5-ose/issues/1541
10 commandments of code review
Edited by Fahim M. Choudhury