Add timeout to removeAccount during provisioning

Bug: http://b/279192742

Change-Id: I909bf2f38b9d09addaf768fd86bd3910b0a82d2f
(cherry picked from commit 378627c451)
This commit is contained in:
Nupur Saxena
2023-05-03 13:47:15 +00:00
parent 3a9a83dad9
commit 4d6eca5b36

View File

@@ -21814,10 +21814,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
final AccountManager accountManager = mContext.createContextAsUser(
UserHandle.of(sourceUserId), /* flags= */ 0)
.getSystemService(AccountManager.class);
final AccountManagerFuture<Bundle> bundle = accountManager.removeAccount(account,
null, null /* callback */, null /* handler */);
try {
final Bundle result = bundle.getResult();
final Bundle result = accountManager.removeAccount(account,
null, null /* callback */, null /* handler */).getResult(60, TimeUnit.SECONDS);
if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT, /* default */ false)) {
Slogf.i(LOG_TAG, "Account removed from the primary user.");
} else {