Migrate and remove account from calling user in headless mode
Bug: http://b/271260154
Change-Id: I36bcc1829a0afbfe1bcaafa24a22a9d64c21e9aa
(cherry picked from commit 64d90cd773)
This commit is contained in:
@@ -21602,7 +21602,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
}
|
||||
copyAccount(targetUser, sourceUser, accountToMigrate, callerPackage);
|
||||
if (!keepAccountMigrated) {
|
||||
removeAccount(accountToMigrate);
|
||||
removeAccount(accountToMigrate, sourceUserId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21646,9 +21646,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
.write();
|
||||
}
|
||||
|
||||
private void removeAccount(Account account) {
|
||||
final AccountManager accountManager =
|
||||
mContext.getSystemService(AccountManager.class);
|
||||
private void removeAccount(Account account, @UserIdInt int sourceUserId) {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user