Merge "Fix UI issues in call logs when spam is not enabled."
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index c763b7f..36726e4 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -481,13 +481,11 @@
 
         final String number = c.getString(CallLogQuery.NUMBER);
         final String countryIso = c.getString(CallLogQuery.COUNTRY_ISO);
-
-        mFilteredNumberAsyncQueryHandler.isBlockedNumber(
+        final CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
+        boolean success = mFilteredNumberAsyncQueryHandler.isBlockedNumber(
                 new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() {
                     @Override
                     public void onCheckComplete(Integer id) {
-                        final CallLogListItemViewHolder views =
-                                (CallLogListItemViewHolder) viewHolder;
                         views.blockId = id;
                         if (mExtendedCallInfoService == null) {
                             loadDataAndRender(views);
@@ -504,6 +502,9 @@
                         }
                     }
                 }, number, countryIso);
+        if (!success) {
+            loadDataAndRender(views);
+        }
     }
 
     private void loadDataAndRender(CallLogListItemViewHolder views) {
diff --git a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java
index e3f8c59..52ef49a 100644
--- a/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java
+++ b/src/com/android/dialer/database/FilteredNumberAsyncQueryHandler.java
@@ -151,7 +151,6 @@
             final OnCheckBlockedListener listener, String number, String countryIso) {
         final String e164Number = PhoneNumberUtils.formatNumberToE164(number, countryIso);
         if (TextUtils.isEmpty(e164Number)) {
-            listener.onCheckComplete(null);
             return false;
         }
 
diff --git a/src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java b/src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java
deleted file mode 100644
index c605804..0000000
--- a/src/com/android/dialer/service/ExtendedBlockingButtonRenderer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.dialer.service;
-
-import android.support.annotation.Nullable;
-import android.view.View;
-import android.view.ViewStub;
-import android.widget.QuickContactBadge;
-import android.widget.TextView;
-
-import java.util.List;
-
-/**
- * Interface responsible for rendering spam buttons.
- */
-public interface ExtendedBlockingButtonRenderer {
-
-    final class ViewHolderInfo {
-
-        public final List<View> completeListItemViews;
-        public final List<View> extendedBlockedViews;
-        public final List<View> blockedNumberViews;
-        public final String phoneNumber;
-        public final String countryIso;
-        public final String nameOrNumber;
-        public final String displayNumber;
-        /**
-         * Whether the type of call is missed, voicemail, etc. An example of this is
-         * {@link android.provider.CallLog.Calls#VOICEMAIL_TYPE}.
-         */
-        public final int callType;
-
-        public ViewHolderInfo(
-                /* All existing views amongst the list item actions, even if invisible */
-                List<View> completeListItemViews,
-                /* Views that should be seen if the number is in the blacklist */
-                List<View> extendedBlockedViews,
-                /* Views that should be seen if the number is in the extended blacklist */
-                List<View> blockedNumberViews,
-                String phoneNumber,
-                String countryIso,
-                String nameOrNumber,
-                String displayNumber,
-                int callType) {
-
-            this.completeListItemViews = completeListItemViews;
-            this.extendedBlockedViews = extendedBlockedViews;
-            this.blockedNumberViews = blockedNumberViews;
-            this.phoneNumber = phoneNumber;
-            this.countryIso = countryIso;
-            this.nameOrNumber = nameOrNumber;
-            this.displayNumber = displayNumber;
-            this.callType = callType;
-        }
-    }
-
-    interface Listener {
-        void onBlockedNumber(String number, @Nullable String countryIso);
-        void onUnblockedNumber(String number, @Nullable String countryIso);
-    }
-
-    /**
-     * Renders buttons for a phone number.
-     */
-    void render(ViewStub viewStub);
-
-    void setViewHolderInfo(ViewHolderInfo info);
-
-    /**
-     * Updates the photo and label for the given phone number and country iso.
-     *
-     * @param number Phone number for which the rendering occurs.
-     * @param countryIso Two-letter country code.
-     * @param badge {@link QuickContactBadge} in which the photo should be rendered.
-     * @param view Textview that will hold the new label.
-     */
-    void updatePhotoAndLabelIfNecessary(
-            String number, String countryIso, QuickContactBadge badge, TextView view);
-}
diff --git a/src/com/android/dialerbind/ObjectFactory.java b/src/com/android/dialerbind/ObjectFactory.java
index 4703347..342f39c 100644
--- a/src/com/android/dialerbind/ObjectFactory.java
+++ b/src/com/android/dialerbind/ObjectFactory.java
@@ -26,7 +26,6 @@
 import com.android.dialer.list.RegularSearchFragment;
 import com.android.dialer.logging.Logger;
 import com.android.dialer.service.CachedNumberLookupService;
-import com.android.dialer.service.ExtendedBlockingButtonRenderer;
 import com.android.dialer.service.ExtendedCallInfoService;
 import com.android.dialer.voicemail.VoicemailPlaybackPresenter;
 
@@ -61,12 +60,6 @@
     }
 
     @Nullable
-    public static ExtendedBlockingButtonRenderer newExtendedBlockingButtonRenderer(
-            Context context, ExtendedBlockingButtonRenderer.Listener listener) {
-        return null;
-    }
-
-    @Nullable
     public static ExtendedCallInfoService newExtendedCallInfoService(Context context) {
         return null;
     }