ChooseTypeAndAccountActivity.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:TPlayer 作者:
/**
 * Return a set of account types specified by the intent as well as supported by the
 * AccountManager.
 */
private Set<String> getReleventAccountTypes(final Intent intent) {
    // An account type is relevant iff it is allowed by the caller and supported by the account
    // manager.
    Set<String> setOfRelevantAccountTypes;
    final String[] allowedAccountTypes =
            intent.getStringArrayExtra(EXTRA_ALLOWABLE_ACCOUNT_TYPES_STRING_ARRAY);
    AuthenticatorDescription[] descs = VAccountManager.get().getAuthenticatorTypes();
    Set<String> supportedAccountTypes = new HashSet<String>(descs.length);
    for (AuthenticatorDescription desc : descs) {
        supportedAccountTypes.add(desc.type);
    }
    if (allowedAccountTypes != null) {
        setOfRelevantAccountTypes = new HashSet<>();
        Collections.addAll(setOfRelevantAccountTypes, allowedAccountTypes);
        setOfRelevantAccountTypes.retainAll(supportedAccountTypes);
    } else {
        setOfRelevantAccountTypes = supportedAccountTypes;
    }
    return setOfRelevantAccountTypes;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号