PduPersister.java 文件源码

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

项目:darksms 作者:
/**
 * For a given address type, extract the recipients from the headers.
 *
 * @param addressType can be PduHeaders.FROM or PduHeaders.TO
 * @param recipients a HashSet that is loaded with the recipients from the FROM or TO headers
 * @param addressMap a HashMap of the addresses from the ADDRESS_FIELDS header
 * @param excludeMyNumber if true, the number of this phone will be excluded from recipients
 */
private void loadRecipients(int addressType, HashSet<String> recipients,
        HashMap<Integer, EncodedStringValue[]> addressMap, boolean excludeMyNumber) {
    EncodedStringValue[] array = addressMap.get(addressType);
    if (array == null) {
        return;
    }
    // If the TO recipients is only a single address, then we can skip loadRecipients when
    // we're excluding our own number because we know that address is our own.
    if (excludeMyNumber && array.length == 1) {
        return;
    }
    String myNumber = excludeMyNumber ? mTelephonyManager.getLine1Number() : null;
    for (EncodedStringValue v : array) {
        if (v != null) {
            String number = v.getString();
            if ((myNumber == null || !PhoneNumberUtils.compare(number, myNumber)) &&
                    !recipients.contains(number)) {
                // Only add numbers which aren't my own number.
                recipients.add(number);
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号