Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 342125e7 authored by Rohit Yengisetty's avatar Rohit Yengisetty
Browse files

Add spam information to encoded lookup uri

Removing redundant definiton of CallerMetaData. Defer to the
one included within ContactsCommon.

Change-Id: I9a49defbb69c7736237826c4f06bb5ff04782ddd
Issue-Id: OPO-736
parent 0b65194a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -363,6 +363,8 @@ public class ContactInfoHelper {
                    contactBuilder.setInfoProviderName(response.mProviderName);
                    contactBuilder.setPhotoUrl(response.mPhotoUrl);
                    contactBuilder.setName(ContactBuilder.Name.createDisplayName(response.mName));
                    contactBuilder.setIsSpam(response.mIsSpam);
                    contactBuilder.setSpamCount(response.mSpamCount);

                    contactInfo.lookupUri = contactBuilder.build().lookupUri;
                    info = contactInfo;
+0 −17
Original line number Diff line number Diff line
package com.android.dialer.lookup;

/**
 * Common strings used in conjunction with a CallerInfoService
 */
public class CallerMetaData {

    public static final String SPAM_COUNT = "CALLER_META_DATA_SPAM_COUNT";
    // tag for storing concise location of a caller (eg: [<city>, <Country>])
    public static final String SUCCINCT_LOCATION = "CALLER_META_DATA_SUCCINCT_LOCATION";
    public static final String INFO_PROVIDER = "CALLER_META_DATA_INFO_PROVIDER";
    public static final String PHOTO_URL = "CALLER_META_DATA_PHOTO_URL";

    // mimetype for the name of service that helped identify the caller
    public static final String MIMETYPE_SERVICE_IDENTIFIER =
            "com.cyanogen.ambient/callerinfoservice/identifier";
}
+12 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ import android.util.Log;

import com.android.contacts.common.util.Constants;
import com.android.dialer.calllog.ContactInfo;
import com.android.dialer.lookup.CallerMetaData;
import com.android.contacts.common.util.CallerMetaData;
import com.android.dialer.R;

import java.sql.Struct;
@@ -84,6 +84,7 @@ public class ContactBuilder {
    private boolean mIsBusiness;

    private int mSpamCount;
    private boolean mIsSpam;
    private String mInfoProviderName;
    private String mSuccinctLocation;

@@ -151,6 +152,7 @@ public class ContactBuilder {
                    }
                }

                mIsSpam = contact.optBoolean(CallerMetaData.IS_SPAM, false);
                mSpamCount = contact.optInt(CallerMetaData.SPAM_COUNT, 0);
                mInfoProviderName = contact.optString(CallerMetaData.INFO_PROVIDER, null);
                mSuccinctLocation = contact.optString(CallerMetaData.SUCCINCT_LOCATION, null);
@@ -168,10 +170,18 @@ public class ContactBuilder {
        mSpamCount = spamCount;
    }

    public void setIsSpam(boolean isSpam) {
        mIsSpam = isSpam;
    }

    public int getSpamCount() {
        return mSpamCount;
    }

    public boolean isSpamContact() {
        return mIsSpam;
    }

    public void setInfoProviderName(String infoProviderName) {
        mInfoProviderName = infoProviderName;
    }
@@ -327,6 +337,7 @@ public class ContactBuilder {
            }

            // add spam count and attribution
            contact.put(CallerMetaData.IS_SPAM, isSpamContact());
            contact.put(CallerMetaData.SPAM_COUNT, getSpamCount());
            contact.put(CallerMetaData.INFO_PROVIDER, getInfoProviderName());
            contact.put(CallerMetaData.SUCCINCT_LOCATION, getSuccinctLocation());