Switch to BlockedNumberProvider in N SDK

1. ID in BlockedNumberProvider is of type "long" rather than "int".
2. BlockedNumberProvider doesn't include countryIso, so we need to
   calculate it when needed.
3. ag/850887 will remove STRIPPED_PHONE_NUMBER column and notify
   changes to content.
4. Remove unused code.

Bug: 26453530
Change-Id: I09194052b7d5000d20263efaf622250d4c264ae4
diff --git a/src/com/android/contacts/callblocking/BlockNumberDialogFragment.java b/src/com/android/contacts/callblocking/BlockNumberDialogFragment.java
index 80ad1f7..c9b5314 100644
--- a/src/com/android/contacts/callblocking/BlockNumberDialogFragment.java
+++ b/src/com/android/contacts/callblocking/BlockNumberDialogFragment.java
@@ -82,7 +82,7 @@
     private Callback mCallback;
 
     public static void show(
-            Integer blockId,
+            Long blockId,
             String number,
             String countryIso,
             String displayNumber,
@@ -97,7 +97,7 @@
     }
 
     private static BlockNumberDialogFragment newInstance(
-            Integer blockId,
+            Long blockId,
             String number,
             String countryIso,
             String displayNumber,
diff --git a/src/com/android/contacts/callblocking/BlockedNumbersAdapter.java b/src/com/android/contacts/callblocking/BlockedNumbersAdapter.java
index 2e31f71..db76737 100644
--- a/src/com/android/contacts/callblocking/BlockedNumbersAdapter.java
+++ b/src/com/android/contacts/callblocking/BlockedNumbersAdapter.java
@@ -19,13 +19,13 @@
 import android.app.FragmentManager;
 import android.content.Context;
 import android.database.Cursor;
+import android.provider.BlockedNumberContract.BlockedNumbers;
 import android.telephony.PhoneNumberUtils;
 import android.view.View;
 
 import com.android.contacts.common.ContactPhotoManager;
 import com.android.contacts.common.GeoUtil;
 import com.android.contacts.R;
-import com.android.contacts.callblocking.FilteredNumberContract.FilteredNumberColumns;
 
 public class BlockedNumbersAdapter extends NumbersAdapter {
     private BlockedNumbersAdapter(
@@ -48,10 +48,10 @@
     @Override
     public void bindView(View view, final Context context, Cursor cursor) {
         super.bindView(view, context, cursor);
-        final Integer id = cursor.getInt(cursor.getColumnIndex(FilteredNumberColumns._ID));
-        final String countryIso = cursor.getString(cursor.getColumnIndex(
-                FilteredNumberColumns.COUNTRY_ISO));
-        final String number = cursor.getString(cursor.getColumnIndex(FilteredNumberColumns.NUMBER));
+        final Long id = cursor.getLong(cursor.getColumnIndex(BlockedNumbers.COLUMN_ID));
+        final String countryIso = GeoUtil.getCurrentCountryIso(context);
+        final String number = cursor.getString(
+                cursor.getColumnIndex(BlockedNumbers.COLUMN_ORIGINAL_NUMBER));
 
         final View deleteButton = view.findViewById(R.id.delete_button);
         deleteButton.setOnClickListener(new View.OnClickListener() {
diff --git a/src/com/android/contacts/callblocking/BlockedNumbersFragment.java b/src/com/android/contacts/callblocking/BlockedNumbersFragment.java
index fbdfa00..6680cca 100644
--- a/src/com/android/contacts/callblocking/BlockedNumbersFragment.java
+++ b/src/com/android/contacts/callblocking/BlockedNumbersFragment.java
@@ -24,6 +24,7 @@
 import android.database.Cursor;
 import android.graphics.drawable.ColorDrawable;
 import android.os.Bundle;
+import android.provider.BlockedNumberContract.BlockedNumbers;
 import android.support.v4.app.ActivityCompat;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
@@ -141,16 +142,12 @@
     @Override
     public Loader<Cursor> onCreateLoader(int id, Bundle args) {
         final String[] projection = {
-            FilteredNumberContract.FilteredNumberColumns._ID,
-            FilteredNumberContract.FilteredNumberColumns.COUNTRY_ISO,
-            FilteredNumberContract.FilteredNumberColumns.NUMBER,
-            FilteredNumberContract.FilteredNumberColumns.NORMALIZED_NUMBER
+            BlockedNumbers.COLUMN_ID,
+            BlockedNumbers.COLUMN_ORIGINAL_NUMBER,
+            BlockedNumbers.COLUMN_E164_NUMBER
         };
-        final String selection = FilteredNumberContract.FilteredNumberColumns.TYPE
-                + "=" + FilteredNumberContract.FilteredNumberTypes.BLOCKED_NUMBER;
         final CursorLoader cursorLoader = new CursorLoader(
-                getContext(), FilteredNumberContract.FilteredNumber.CONTENT_URI, projection,
-                selection, null, null);
+                getContext(), BlockedNumbers.CONTENT_URI, projection, null, null, null);
         return cursorLoader;
     }
 
diff --git a/src/com/android/contacts/callblocking/FilteredNumberAsyncQueryHandler.java b/src/com/android/contacts/callblocking/FilteredNumberAsyncQueryHandler.java
index 51f6991..f7f67eb 100644
--- a/src/com/android/contacts/callblocking/FilteredNumberAsyncQueryHandler.java
+++ b/src/com/android/contacts/callblocking/FilteredNumberAsyncQueryHandler.java
@@ -24,14 +24,10 @@
 import android.database.DatabaseUtils;
 import android.database.sqlite.SQLiteDatabaseCorruptException;
 import android.net.Uri;
+import android.provider.BlockedNumberContract.BlockedNumbers;
 import android.telephony.PhoneNumberUtils;
 import android.text.TextUtils;
 
-import com.android.contacts.callblocking.FilteredNumberContract.FilteredNumber;
-import com.android.contacts.callblocking.FilteredNumberContract.FilteredNumberColumns;
-import com.android.contacts.callblocking.FilteredNumberContract.FilteredNumberSources;
-import com.android.contacts.callblocking.FilteredNumberContract.FilteredNumberTypes;
-
 public class FilteredNumberAsyncQueryHandler extends AsyncQueryHandler {
     private static final int NO_TOKEN = 0;
 
@@ -58,7 +54,7 @@
          * Invoked after querying if a number is blocked.
          * @param id The ID of the row if blocked, null otherwise.
          */
-        void onCheckComplete(Integer id);
+        void onCheckComplete(Long id);
     }
 
     public interface OnBlockNumberListener {
@@ -78,14 +74,6 @@
         void onUnblockComplete(int rows, ContentValues values);
     }
 
-    public interface OnHasBlockedNumbersListener {
-        /**
-         * @param hasBlockedNumbers {@code true} if any blocked numbers are stored.
-         *     {@code false} otherwise.
-         */
-        void onHasBlockedNumbers(boolean hasBlockedNumbers);
-    }
-
     @Override
     protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
         if (cookie != null) {
@@ -114,27 +102,6 @@
         }
     }
 
-    public final void incrementFilteredCount(Integer id) {
-        startUpdate(NO_TOKEN, null,
-                ContentUris.withAppendedId(FilteredNumber.CONTENT_URI_INCREMENT_FILTERED_COUNT, id),
-                null, null, null);
-    }
-
-    public final void hasBlockedNumbers(final OnHasBlockedNumbersListener listener) {
-        startQuery(NO_TOKEN,
-                new Listener() {
-                    @Override
-                    protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
-                        listener.onHasBlockedNumbers(cursor != null && cursor.getCount() > 0);
-                    }
-                },
-                FilteredNumber.CONTENT_URI,
-                new String[]{ FilteredNumberColumns._ID },
-                FilteredNumberColumns.TYPE + "=" + FilteredNumberTypes.BLOCKED_NUMBER,
-                null,
-                null);
-    }
-
     /**
      * Check if this number has been blocked.
      *
@@ -157,18 +124,13 @@
                             return;
                         }
                         cursor.moveToFirst();
-                        if (cursor.getInt(cursor.getColumnIndex(FilteredNumberColumns.TYPE))
-                                != FilteredNumberTypes.BLOCKED_NUMBER) {
-                            listener.onCheckComplete(null);
-                            return;
-                        }
-                        listener.onCheckComplete(
-                                cursor.getInt(cursor.getColumnIndex(FilteredNumberColumns._ID)));
+                        listener.onCheckComplete(cursor.getLong(
+                                        cursor.getColumnIndex(BlockedNumbers.COLUMN_ID)));
                     }
                 },
-                FilteredNumber.CONTENT_URI,
-                new String[]{ FilteredNumberColumns._ID, FilteredNumberColumns.TYPE },
-                FilteredNumberColumns.NORMALIZED_NUMBER + " = ?",
+                BlockedNumbers.CONTENT_URI,
+                new String[]{ BlockedNumbers.COLUMN_ID},
+                BlockedNumbers.COLUMN_E164_NUMBER + " = ?",
                 new String[]{ normalizedNumber },
                 null);
 
@@ -192,11 +154,8 @@
             normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso);
         }
         ContentValues v = new ContentValues();
-        v.put(FilteredNumberColumns.NORMALIZED_NUMBER, normalizedNumber);
-        v.put(FilteredNumberColumns.NUMBER, number);
-        v.put(FilteredNumberColumns.COUNTRY_ISO, countryIso);
-        v.put(FilteredNumberColumns.TYPE, FilteredNumberTypes.BLOCKED_NUMBER);
-        v.put(FilteredNumberColumns.SOURCE, FilteredNumberSources.USER);
+        v.put(BlockedNumbers.COLUMN_ORIGINAL_NUMBER, number);
+        v.put(BlockedNumbers.COLUMN_E164_NUMBER, normalizedNumber);
         blockNumber(listener, v);
     }
 
@@ -213,7 +172,7 @@
                             listener.onBlockComplete(uri);
                         }
                     }
-                }, FilteredNumber.CONTENT_URI, values);
+                }, BlockedNumbers.CONTENT_URI, values);
     }
 
     /**
@@ -225,7 +184,7 @@
         if (id == null) {
             throw new IllegalArgumentException("Null id passed into unblock");
         }
-        unblock(listener, ContentUris.withAppendedId(FilteredNumber.CONTENT_URI, id));
+        unblock(listener, ContentUris.withAppendedId(BlockedNumbers.CONTENT_URI, id));
     }
 
     /**
@@ -246,7 +205,7 @@
                 cursor.moveToFirst();
                 final ContentValues values = new ContentValues();
                 DatabaseUtils.cursorRowToContentValues(cursor, values);
-                values.remove(FilteredNumberColumns._ID);
+                values.remove(BlockedNumbers.COLUMN_ID);
 
                 startDelete(NO_TOKEN, new Listener() {
                     @Override
diff --git a/src/com/android/contacts/callblocking/FilteredNumberContract.java b/src/com/android/contacts/callblocking/FilteredNumberContract.java
deleted file mode 100644
index 9f66240..0000000
--- a/src/com/android/contacts/callblocking/FilteredNumberContract.java
+++ /dev/null
@@ -1,162 +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.contacts.callblocking;
-
-import android.net.Uri;
-import android.provider.BaseColumns;
-
-/**
- * <p>
- * The contract between the filtered number provider and applications. Contains
- * definitions for the supported URIs and columns.
- * </p>
- */
-public final class FilteredNumberContract {
-
-    /** The authority for the filtered numbers provider
-     *  Contacts should use this authority from GoogleDialer. */
-    public static final String AUTHORITY =
-            "com.google.android.dialer.provider.filterednumberprovider";
-
-    /** A content:// style uri to the authority for the filtered numbers provider */
-    public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY);
-
-    /** The type of filtering to be applied, e.g. block the number or whitelist the number. */
-    public interface FilteredNumberTypes {
-        int UNDEFINED = 0;
-        /**
-         * Dialer will disconnect the call without sending the caller to voicemail.
-         */
-        int BLOCKED_NUMBER = 1;
-    }
-
-    /** The original source of the filtered number, e.g. the user manually added it. */
-    public interface FilteredNumberSources {
-        int UNDEFINED = 0;
-        /**
-         * The user manually added this number through Dialer (e.g. from the call log or InCallUI).
-         */
-        int USER = 1;
-    }
-
-    public interface FilteredNumberColumns {
-        // TYPE: INTEGER
-        String _ID = "_id";
-        /**
-         * Represents the number to be filtered, normalized to compare phone numbers for equality.
-         *
-         * TYPE: TEXT
-         */
-        String NORMALIZED_NUMBER = "normalized_number";
-        /**
-         * Represents the number to be filtered, for formatting and
-         * used with country iso for contact lookups.
-         *
-         * TYPE: TEXT
-         */
-        String NUMBER = "number";
-        /**
-         * The country code representing the country detected when
-         * the phone number was added to the database.
-         * Most numbers don't have the country code, so a best guess is provided by
-         * the country detector system. The country iso is also needed in order to format
-         * phone numbers correctly.
-         *
-         * TYPE: TEXT
-         */
-        String COUNTRY_ISO = "country_iso";
-        /**
-         * The number of times the number has been filtered by Dialer.
-         * When this number is incremented, LAST_TIME_FILTERED should also be updated to
-         * the current time.
-         *
-         * TYPE: INTEGER
-         */
-        String TIMES_FILTERED = "times_filtered";
-        /**
-         * Set to the current time when the phone number is filtered.
-         * When this is updated, TIMES_FILTERED should also be incremented.
-         *
-         * TYPE: LONG
-         */
-        String LAST_TIME_FILTERED = "last_time_filtered";
-        // TYPE: LONG
-        String CREATION_TIME = "creation_time";
-        /**
-         * Indicates the type of filtering to be applied.
-         *
-         * TYPE: INTEGER
-         * See {@link FilteredNumberTypes}
-         */
-        String TYPE = "type";
-        /**
-         * Integer representing the original source of the filtered number.
-         *
-         * TYPE: INTEGER
-         * See {@link FilteredNumberSources}
-         */
-        String SOURCE = "source";
-    }
-
-    /**
-     * <p>
-     * Constants for the table of filtered numbers.
-     * </p>
-     * <h3>Operations</h3>
-     * <dl>
-     * <dt><b>Insert</b></dt>
-     * <dd>Required fields: NUMBER, NORMALIZED_NUMBER, TYPE, SOURCE.
-     * A default value will be used for the other fields if left null.</dd>
-     * <dt><b>Update</b></dt>
-     * <dt><b>Delete</b></dt>
-     * <dt><b>Query</b></dt>
-     * <dd>{@link #CONTENT_URI} can be used for any query, append an ID to
-     * retrieve a specific filtered number entry.</dd>
-     * </dl>
-     */
-    public static class FilteredNumber implements BaseColumns {
-
-        public static final String FILTERED_NUMBERS_TABLE = "filtered_numbers_table";
-        public static final String FILTERED_NUMBERS_INCREMENT_FILTERED_COUNT =
-                "filtered_numbers_increment_filtered_count";
-
-        public static final Uri CONTENT_URI = Uri.withAppendedPath(
-                AUTHORITY_URI,
-                FILTERED_NUMBERS_TABLE);
-
-        public static final Uri CONTENT_URI_INCREMENT_FILTERED_COUNT = Uri.withAppendedPath(
-                AUTHORITY_URI,
-                FILTERED_NUMBERS_INCREMENT_FILTERED_COUNT);
-
-        /**
-         * This utility class cannot be instantiated.
-         */
-        private FilteredNumber () {}
-
-        /**
-         * The MIME type of {@link #CONTENT_URI} providing a directory of
-         * filtered numbers.
-         */
-        public static final String CONTENT_TYPE = "vnd.android.cursor.dir/filtered_numbers_table";
-
-        /**
-         * The MIME type of a {@link #CONTENT_URI} single filtered number.
-         */
-        public static final String CONTENT_ITEM_TYPE =
-                "vnd.android.cursor.item/filtered_numbers_table";
-    }
-}
\ No newline at end of file
diff --git a/src/com/android/contacts/callblocking/OnListFragmentScrolledListener.java b/src/com/android/contacts/callblocking/OnListFragmentScrolledListener.java
deleted file mode 100644
index 819bcde..0000000
--- a/src/com/android/contacts/callblocking/OnListFragmentScrolledListener.java
+++ /dev/null
@@ -1,24 +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.contacts.callblocking;
-
-/*
- * Interface to provide callback to activity when a child fragment is scrolled
- */
-public interface OnListFragmentScrolledListener {
-    void onListFragmentScrollStateChange(int scrollState);
-}
diff --git a/src/com/android/contacts/callblocking/SearchAdapter.java b/src/com/android/contacts/callblocking/SearchAdapter.java
index ca5908f..27ca89a 100644
--- a/src/com/android/contacts/callblocking/SearchAdapter.java
+++ b/src/com/android/contacts/callblocking/SearchAdapter.java
@@ -20,12 +20,10 @@
 import android.content.res.Resources;
 import android.database.Cursor;
 import android.telephony.PhoneNumberUtils;
-import android.text.BidiFormatter;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.ViewGroup;
 
-import com.android.contacts.callblocking.FilteredNumberAsyncQueryHandler;
 import com.android.contacts.common.CallUtil;
 import com.android.contacts.common.GeoUtil;
 import com.android.contacts.common.list.ContactListItemView;
@@ -40,18 +38,14 @@
     private String mCountryIso;
 
     public final static int SHORTCUT_INVALID = -1;
-    public final static int SHORTCUT_DIRECT_CALL = 0;
     public final static int SHORTCUT_CREATE_NEW_CONTACT = 1;
     public final static int SHORTCUT_ADD_TO_EXISTING_CONTACT = 2;
-    public final static int SHORTCUT_SEND_SMS_MESSAGE = 3;
-    public final static int SHORTCUT_MAKE_VIDEO_CALL = 4;
     public final static int SHORTCUT_BLOCK_NUMBER = 5;
 
     public final static int SHORTCUT_COUNT = 6;
 
     private final boolean[] mShortcutEnabled = new boolean[SHORTCUT_COUNT];
 
-    private final BidiFormatter mBidiFormatter = BidiFormatter.getInstance();
     private boolean mVideoCallingEnabled = false;
 
     protected boolean mIsQuerySipAddress;
@@ -236,7 +230,7 @@
         return false;
     }
 
-    public void setViewBlocked(ContactListItemView view, Integer id) {
+    public void setViewBlocked(ContactListItemView view, Long id) {
         view.setTag(R.id.block_id, id);
         final int textColor = mResources.getColor(R.color.blocked_number_block_color);
         view.getDataView().setTextColor(textColor);
@@ -265,7 +259,7 @@
         final FilteredNumberAsyncQueryHandler.OnCheckBlockedListener onCheckListener =
                 new FilteredNumberAsyncQueryHandler.OnCheckBlockedListener() {
                     @Override
-                    public void onCheckComplete(Integer id) {
+                    public void onCheckComplete(Long id) {
                         if (id != null) {
                             setViewBlocked(view, id);
                         }
diff --git a/src/com/android/contacts/callblocking/SearchFragment.java b/src/com/android/contacts/callblocking/SearchFragment.java
index a175812..d50ccf5 100644
--- a/src/com/android/contacts/callblocking/SearchFragment.java
+++ b/src/com/android/contacts/callblocking/SearchFragment.java
@@ -1,8 +1,5 @@
 package com.android.contacts.callblocking;
 
-import android.animation.Animator;
-import android.animation.AnimatorInflater;
-import android.animation.AnimatorListenerAdapter;
 import android.app.Activity;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
@@ -53,11 +50,7 @@
 
     public static final int PERMISSION_REQUEST_CODE = 1;
     private static final int SEARCH_DIRECTORY_RESULT_LIMIT = 5;
-    // copied from packages/apps/InCallUI/src/com/android/incallui/Call.java
-    public static final int INITIATION_REMOTE_DIRECTORY = 4;
-    public static final int INITIATION_REGULAR_SEARCH = 6;
 
-    private OnListFragmentScrolledListener mActivityScrollListener;
     private View.OnTouchListener mActivityOnTouchListener;
     private FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler;
     private EditText mSearchView;
@@ -90,7 +83,6 @@
      * Stores the untouched user-entered string that is used to populate the add to contacts
      * intent.
      */
-    private String mAddToContactNumber;
     private int mActionBarHeight;
     private int mShadowHeight;
     private int mPaddingTop;
@@ -190,13 +182,6 @@
         setDarkTheme(false);
         setPhotoPosition(ContactListItemView.getDefaultPhotoPosition(false /* opposite */));
         setUseCallableUri(true);
-
-        try {
-            mActivityScrollListener = (OnListFragmentScrolledListener) activity;
-        } catch (ClassCastException e) {
-            Log.d(TAG, activity.toString() + " doesn't implement OnListFragmentScrolledListener. " +
-                    "Ignoring.");
-        }
     }
 
     @Override
@@ -236,9 +221,6 @@
         listView.setOnScrollListener(new OnScrollListener() {
             @Override
             public void onScrollStateChanged(AbsListView view, int scrollState) {
-                if (mActivityScrollListener != null) {
-                    mActivityScrollListener.onListFragmentScrollStateChange(scrollState);
-                }
             }
 
             @Override
@@ -260,26 +242,6 @@
     }
 
     @Override
-    public Animator onCreateAnimator(int transit, boolean enter, int nextAnim) {
-        Animator animator = null;
-        if (nextAnim != 0) {
-            animator = AnimatorInflater.loadAnimator(getActivity(), nextAnim);
-        }
-        if (animator != null) {
-            final View view = getView();
-            final int oldLayerType = view.getLayerType();
-            view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
-            animator.addListener(new AnimatorListenerAdapter() {
-                @Override
-                public void onAnimationEnd(Animator animation) {
-                    view.setLayerType(oldLayerType, null);
-                }
-            });
-        }
-        return animator;
-    }
-
-    @Override
     protected void setSearchMode(boolean flag) {
         super.setSearchMode(flag);
         // This hides the "All contacts with phone numbers" header in the search fragment
@@ -289,10 +251,6 @@
         }
     }
 
-    public void setAddToContactNumber(String addToContactNumber) {
-        mAddToContactNumber = addToContactNumber;
-    }
-
     @Override
     protected ContactEntryListAdapter createListAdapter() {
         SearchAdapter adapter = new SearchAdapter(getActivity());
@@ -353,7 +311,7 @@
         final int adapterPosition = position - getListView().getHeaderViewsCount();
         final SearchAdapter adapter = (SearchAdapter) getAdapter();
         final int shortcutType = adapter.getShortcutTypeFromPosition(adapterPosition);
-        final Integer blockId = (Integer) view.getTag(R.id.block_id);
+        final Long blockId = (Long) view.getTag(R.id.block_id);
         final String number;
         switch (shortcutType) {
             case SearchAdapter.SHORTCUT_INVALID:
@@ -376,7 +334,7 @@
         final String countryIso = GeoUtil.getCurrentCountryIso(getContext());
         final OnCheckBlockedListener onCheckListener = new OnCheckBlockedListener() {
             @Override
-            public void onCheckComplete(Integer id) {
+            public void onCheckComplete(Long id) {
                 if (id == null) {
                     BlockNumberDialogFragment.show(
                             id,
@@ -497,11 +455,6 @@
     }
 
     @Override
-    protected int getCallInitiationType(boolean isRemoteDirectory) {
-        return isRemoteDirectory ? INITIATION_REMOTE_DIRECTORY : INITIATION_REGULAR_SEARCH;
-    }
-
-    @Override
     public void onFilterNumberSuccess() {
         goBack();
     }
@@ -525,7 +478,7 @@
         getAdapter().notifyDataSetChanged();
     }
 
-    private void blockContactNumber(final String number, final Integer blockId) {
+    private void blockContactNumber(final String number, final Long blockId) {
         if (blockId != null) {
             Toast.makeText(getContext(), ContactDisplayUtils.getTtsSpannedPhoneNumber(
                             getResources(), R.string.alreadyBlocked, number),
@@ -533,10 +486,10 @@
             return;
         }
 
-        com.android.contacts.callblocking.BlockNumberDialogFragment.show(
+        BlockNumberDialogFragment.show(
                 blockId,
                 number,
-                com.android.contacts.common.GeoUtil.getCurrentCountryIso(getContext()),
+                GeoUtil.getCurrentCountryIso(getContext()),
                 number,
                 R.id.blocked_numbers_activity_container,
                 getFragmentManager(),
diff --git a/src/com/android/contacts/callblocking/ViewNumbersToImportAdapter.java b/src/com/android/contacts/callblocking/ViewNumbersToImportAdapter.java
index c5a14a6..224e085 100644
--- a/src/com/android/contacts/callblocking/ViewNumbersToImportAdapter.java
+++ b/src/com/android/contacts/callblocking/ViewNumbersToImportAdapter.java
@@ -24,9 +24,6 @@
 import com.android.contacts.common.ContactPhotoManager;
 import com.android.contacts.common.GeoUtil;
 import com.android.contacts.R;
-import com.android.contacts.callblocking.ContactInfoHelper;
-import com.android.contacts.callblocking.FilteredNumbersUtil;
-import com.android.contacts.callblocking.NumbersAdapter;
 
 public class ViewNumbersToImportAdapter extends NumbersAdapter {
 
diff --git a/src/com/android/contacts/callblocking/ViewNumbersToImportFragment.java b/src/com/android/contacts/callblocking/ViewNumbersToImportFragment.java
index d75ade5..f756195 100644
--- a/src/com/android/contacts/callblocking/ViewNumbersToImportFragment.java
+++ b/src/com/android/contacts/callblocking/ViewNumbersToImportFragment.java
@@ -22,24 +22,17 @@
 import android.content.CursorLoader;
 import android.content.Loader;
 import android.database.Cursor;
-import android.os.AsyncTask;
 import android.os.Bundle;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
-import android.provider.ContactsContract.Contacts;
 import android.support.v7.app.ActionBar;
 import android.support.v7.app.AppCompatActivity;
-import android.text.TextUtils;
-import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
 import com.android.contacts.R;
-import com.android.contacts.callblocking.FilteredNumberContract;
-import com.android.contacts.callblocking.FilteredNumbersUtil;
 import com.android.contacts.callblocking.FilteredNumbersUtil.ImportSendToVoicemailContactsListener;
 
-
 public class ViewNumbersToImportFragment extends ListFragment
         implements LoaderManager.LoaderCallbacks<Cursor>,
         View.OnClickListener {