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

Commit 889d0aa1 authored by Eduard Dumitrescul's avatar Eduard Dumitrescul Committed by Nishith Khanna
Browse files

Get all accounts no matter the visibility

Bug: 417988098
Test: manual
Flag: EXEMPT BUGFIX
(cherry picked from commit a8819d3bdc496d3a4b5ea041434ff5d71b1f8c95)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:18eeec99a1bf4a569abb2cf03199b5c8de47c3e2
Merged-In: I51c7253b124ab524b817b17dc0aabbdb5ab12ac7
Change-Id: I51c7253b124ab524b817b17dc0aabbdb5ab12ac7
parent 5365e279
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -537,6 +537,7 @@ import com.android.server.LockGuard;
import com.android.server.SystemServerInitThreadPool;
import com.android.server.SystemService;
import com.android.server.SystemServiceManager;
import com.android.server.accounts.AccountManagerService;
import com.android.server.devicepolicy.ActiveAdmin.TrustAgentInfo;
import com.android.server.inputmethod.InputMethodManagerInternal;
import com.android.server.net.NetworkPolicyManagerInternal;
@@ -22789,22 +22790,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
    }
    private boolean hasAccountsOnAnyUser() {
        long callingIdentity = Binder.clearCallingIdentity();
        try {
            for (UserInfo user : mUserManagerInternal.getUsers(/* excludeDying= */ true)) {
                AccountManager am = mContext.createContextAsUser(
                                UserHandle.of(user.id), /* flags= */ 0)
                        .getSystemService(AccountManager.class);
                Account[] accounts = am.getAccounts();
                if (accounts.length != 0) {
                    return true;
                }
            }
            return false;
        } finally {
            Binder.restoreCallingIdentity(callingIdentity);
        }
        AccountManagerService accountManagerService = AccountManagerService.getSingleton();
        return accountManagerService.getAllAccountsForSystemProcess().length != 0;
    }
    private void setBypassDevicePolicyManagementRoleQualificationStateInternal(