Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7cd7614 authored by Nupur Saxena's avatar Nupur Saxena Committed by Automerger Merge Worker
Browse files

Merge "Migrate and remove account from calling user in headless mode" into udc-dev am: 3d87229f

parents 1a50cb9f 3d87229f
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -21613,7 +21613,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        copyAccount(targetUser, sourceUser, accountToMigrate, callerPackage);
        if (!keepAccountMigrated) {
            removeAccount(accountToMigrate);
            removeAccount(accountToMigrate, sourceUserId);
        }
    }
@@ -21657,9 +21657,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 {