Update services info before returning authenticators

Added RegisteredServicesCache.updateServices method which allows callers
to request an update to services for which package has been updated.

Added a call to updateServices in getAuthenticatorTypesInternal

Test: Manually tested update flow on test authenticator with an artificial
      delay in broadcast handling
Bug: 30979262
Change-Id: I499b2ee0be53fed01201c56068d929b6d621a78e
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 9108acf..c9bbb76 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -934,6 +934,7 @@
      * Should only be called inside of a clearCallingIdentity block.
      */
     private AuthenticatorDescription[] getAuthenticatorTypesInternal(int userId) {
+        mAuthenticatorCache.updateServices(userId);
         Collection<AccountAuthenticatorCache.ServiceInfo<AuthenticatorDescription>>
                 authenticatorCollection = mAuthenticatorCache.getAllServices(userId);
         AuthenticatorDescription[] types =
@@ -947,8 +948,6 @@
         return types;
     }
 
-
-
     private boolean isCrossUser(int callingUid, int userId) {
         return (userId != UserHandle.getCallingUserId()
                 && callingUid != Process.myUid()