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

Commit 0576b970 authored by Anthony Lee's avatar Anthony Lee Committed by Android (Google) Code Review
Browse files

Merge "Fix HTTP request to a report bad caller ID entry in the call log (1/2)" into lmp-dev

parents bb8cc37e 55733814
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -758,7 +758,11 @@ public class CallLogAdapter extends GroupingListAdapter
        final PhoneCallDetails details;

        views.reported = info.isBadData;
        views.isExternal = mContactInfoHelper.isExternal(info.sourceType);

        // The entry can only be reported as invalid if it has a valid ID and the source of the
        // entry supports marking entries as invalid.
        views.canBeReportedAsInvalid = mContactInfoHelper.canReportAsInvalid(info.sourceType,
                info.objectId);

        // Restore expansion state of the row on rebind.  Inflate the actions ViewStub if required,
        // and set its visibility state accordingly.
@@ -1023,7 +1027,7 @@ public class CallLogAdapter extends GroupingListAdapter
                            views.rowId, views.callIds, null)
            );

            if (views.isExternal && !views.reported) {
            if (views.canBeReportedAsInvalid && !views.reported) {
                views.reportButtonView.setVisibility(View.VISIBLE);
            } else {
                views.reportButtonView.setVisibility(View.GONE);
+3 −2
Original line number Diff line number Diff line
@@ -108,9 +108,10 @@ public final class CallLogListItemViews {
    public boolean reported;

    /**
     * Whether or not the contact info came from a source other than the android contacts provider.
     * Whether or not the contact info can be marked as invalid from the source where
     * it was obtained.
     */
    public boolean isExternal;
    public boolean canBeReportedAsInvalid;

    private CallLogListItemViews(QuickContactBadge quickContactView, View primaryActionView,
            PhoneCallDetailsViews phoneCallDetailsViews, View callLogEntryView,
+3 −1
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public class ContactInfo {
    /** The high-res photo for the contact, if available. */
    public Uri photoUri;
    public boolean isBadData;
    public String objectId;

    public static ContactInfo EMPTY = new ContactInfo();

@@ -73,6 +74,7 @@ public class ContactInfo {
        if (!TextUtils.equals(normalizedNumber, other.normalizedNumber)) return false;
        if (photoId != other.photoId) return false;
        if (!UriUtils.areEqual(photoUri, other.photoUri)) return false;
        if (!TextUtils.equals(objectId, other.objectId)) return false;
        return true;
    }

@@ -81,6 +83,6 @@ public class ContactInfo {
        return Objects.toStringHelper(this).add("lookupUri", lookupUri).add("name", name).add(
                "type", type).add("label", label).add("number", number).add("formattedNumber",
                formattedNumber).add("normalizedNumber", normalizedNumber).add("photoId", photoId)
                .add("photoUri", photoUri).toString();
                .add("photoUri", photoUri).add("objectId", objectId).toString();
    }
}
+9 −6
Original line number Diff line number Diff line
@@ -294,14 +294,17 @@ public class ContactInfoHelper {
    }

    /**
     * Given a contact's sourceType, return true if the contact came from an
     * external source.
     * This function looks at a contact's source and determines if the user can
     * mark caller ids from this source as invalid.
     *
     * @param sourceType sourceType of the contact. This is usually populated by
     *        {@link #mCachedNumberLookupService}.
     * @param sourceType The source type to be checked
     * @param objectId The ID of the Contact object.
     * @return true if contacts from this source can be marked with an invalid caller id
     */
    public boolean isExternal(int sourceType) {
    public boolean canReportAsInvalid(int sourceType, String objectId) {
        return mCachedNumberLookupService != null
                && mCachedNumberLookupService.isExternal(sourceType);
                && mCachedNumberLookupService.canReportAsInvalid(sourceType, objectId);
    }


}
+1 −2
Original line number Diff line number Diff line
@@ -34,8 +34,7 @@ public interface CachedNumberLookupService {
    public boolean isCacheUri(String uri);

    public boolean isBusiness(int sourceType);

    public boolean isExternal(int sourceType);
    public boolean canReportAsInvalid(int sourceType, String objectId);

    public boolean addPhoto(Context context, String number, byte[] photo);