Java Code Examples for org.chromium.sync.signin.AccountManagerHelper#getGoogleAccountNames()

The following examples show how to use org.chromium.sync.signin.AccountManagerHelper#getGoogleAccountNames() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OAuth2TokenService.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Called by native to list the activite account names in the OS.
 */
@VisibleForTesting
@CalledByNative
public static String[] getSystemAccountNames(Context context) {
    AccountManagerHelper accountManagerHelper = AccountManagerHelper.get(context);
    java.util.List<String> accountNames = accountManagerHelper.getGoogleAccountNames();
    return accountNames.toArray(new String[accountNames.size()]);
}
 
Example 2
Source File: ToSAckedReceiver.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Checks whether any of the current google accounts has seen the ToS in setup wizard.
 * @param context Context for the app.
 * @return Whether or not the the ToS has been seen.
 */
public static boolean checkAnyUserHasSeenToS(Context context) {
    Set<String> toSAckedAccounts =
            ContextUtils.getAppSharedPreferences().getStringSet(
                    TOS_ACKED_ACCOUNTS, null);
    if (toSAckedAccounts == null || toSAckedAccounts.isEmpty()) return false;
    AccountManagerHelper accountHelper = AccountManagerHelper.get(context);
    List<String> accountNames = accountHelper.getGoogleAccountNames();
    if (accountNames.isEmpty()) return false;
    for (int k = 0; k < accountNames.size(); k++) {
        if (toSAckedAccounts.contains(accountNames.get(k))) return true;
    }
    return false;
}
 
Example 3
Source File: OAuth2TokenService.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Called by native to list the accounts with OAuth2 refresh tokens.
 */
@CalledByNative
public static String[] getAccounts(Context context) {
    AccountManagerHelper accountManagerHelper = AccountManagerHelper.get(context);
    java.util.List<String> accountNames = accountManagerHelper.getGoogleAccountNames();
    return accountNames.toArray(new String[accountNames.size()]);
}
 
Example 4
Source File: OAuth2TokenService.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Called by native to list the accounts with OAuth2 refresh tokens.
 */
@CalledByNative
public static String[] getAccounts(Context context) {
    AccountManagerHelper accountManagerHelper = AccountManagerHelper.get(context);
    java.util.List<String> accountNames = accountManagerHelper.getGoogleAccountNames();
    return accountNames.toArray(new String[accountNames.size()]);
}