Search in sources :

Example 6 with AccountManagerHelper

use of org.chromium.components.signin.AccountManagerHelper in project AndroidChromium by JackyAndroid.

the class ToSAckedReceiver method checkAnyUserHasSeenToS.

/**
     * 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) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
        return false;
    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;
}
Also used : AccountManagerHelper(org.chromium.components.signin.AccountManagerHelper)

Aggregations

AccountManagerHelper (org.chromium.components.signin.AccountManagerHelper)6 Account (android.accounts.Account)3 VisibleForTesting (org.chromium.base.VisibleForTesting)2 CalledByNative (org.chromium.base.annotations.CalledByNative)2