private static Account[] getPasswordAccessibleAccounts(
            final AccountManager manager, final Account[] candidates)
            throws AuthenticatorConflictException {
        final List<Account> accessible = new ArrayList<>(
                candidates.length);
        boolean exceptionThrown = false;
        for (Account account : candidates) {
            try {
                manager.getPassword(account);
                accessible.add(account);
            } catch (SecurityException ignored) {
                exceptionThrown = true;
            }
        }
        if (accessible.isEmpty() && exceptionThrown) {
            throw new AuthenticatorConflictException();
        }
        return accessible.toArray(new Account[accessible.size()]);
    }
Get default account where password can be retrieved

@param context
@return password accessible account or null if none
app/src/main/java/com/github/pockethub/android/accounts/AccountUtils.java