Currently, when an account with USER_MANAGED_NOT_VISIBLE is chosen
in ChooseAccountActivity, its visibility doesn't get updated.
However, it is supposed to be updated to USER_MANAGED_VISIBLE.

Bug: 62067445
Test: manual
Change-Id: I2fb942a96d07dff06a53bc48a16ff337c50f3a26
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 5852297..7fac666 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -4446,11 +4446,12 @@
     }
 
     private void startChooseAccountActivityWithAccounts(
-        IAccountManagerResponse response, Account[] accounts) {
+        IAccountManagerResponse response, Account[] accounts, String callingPackage) {
         Intent intent = new Intent(mContext, ChooseAccountActivity.class);
         intent.putExtra(AccountManager.KEY_ACCOUNTS, accounts);
         intent.putExtra(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE,
                 new AccountManagerResponse(response));
+        intent.putExtra(AccountManager.KEY_ANDROID_PACKAGE_NAME, callingPackage);
 
         mContext.startActivityAsUser(intent, UserHandle.of(UserHandle.getCallingUserId()));
     }
@@ -4461,7 +4462,7 @@
         String callingPackage) {
 
         if (needToStartChooseAccountActivity(accounts, callingPackage)) {
-            startChooseAccountActivityWithAccounts(response, accounts);
+            startChooseAccountActivityWithAccounts(response, accounts, callingPackage);
             return;
         }
         if (accounts.length == 1) {