From a430bba3873f556ba895b172a32048030fa7f4d0 Mon Sep 17 00:00:00 2001 From: zachh Date: Fri, 17 Nov 2017 12:50:52 -0800 Subject: Automated rollback of changelist 174944384 Bug: 68942044 Test: NO PiperOrigin-RevId: 176147553 Change-Id: Ia22751f02cdd621c2095e8e476a3077db2c541fa --- .../dialer/searchfragment/list/SearchAdapter.java | 36 ---------------------- .../remote/RemoteDirectoriesCursorLoader.java | 17 ++-------- 2 files changed, 2 insertions(+), 51 deletions(-) (limited to 'java') diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java index 4254baece..17cab6db1 100644 --- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java +++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java @@ -17,7 +17,6 @@ package com.android.dialer.searchfragment.list; import android.content.Context; -import android.database.Cursor; import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.v7.widget.RecyclerView; @@ -28,15 +27,12 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import com.android.dialer.common.Assert; -import com.android.dialer.common.LogUtil; -import com.android.dialer.searchfragment.common.Projections; import com.android.dialer.searchfragment.common.RowClickListener; import com.android.dialer.searchfragment.common.SearchCursor; import com.android.dialer.searchfragment.cp2.SearchContactViewHolder; import com.android.dialer.searchfragment.list.SearchCursorManager.RowType; import com.android.dialer.searchfragment.nearbyplaces.NearbyPlaceViewHolder; import com.android.dialer.searchfragment.remote.RemoteContactViewHolder; -import com.android.dialer.searchfragment.remote.RemoteDirectoriesCursorLoader; import java.util.List; /** RecyclerView adapter for {@link NewSearchFragment}. */ @@ -107,23 +103,6 @@ public final class SearchAdapter extends RecyclerView.Adapter { } else if (holder instanceof NearbyPlaceViewHolder) { ((NearbyPlaceViewHolder) holder).bind(searchCursorManager.getCursor(position), query); } else if (holder instanceof RemoteContactViewHolder) { - Cursor cursor = searchCursorManager.getCursor(position); - // Temporary logging to identify cause of a bug: - if (cursor.getString(Projections.PHONE_NUMBER) == null) { - LogUtil.e( - "SearchAdapter.onBindViewHolder", "cursor class: %s", cursor.getClass().getName()); - LogUtil.e("SearchAdapter.onBindViewHolder", "position: %d", position); - LogUtil.e( - "SearchAdapter.onBindViewHolder", - "query length: %s", - query == null ? "null" : query.length()); - logDirectories(); - LogUtil.e( - "SearchAdapter.onBindViewHolder", - "directory id: %d", - ((SearchCursor) cursor).getDirectoryId()); - throw new IllegalStateException("Null phone number reading remote contact"); - } ((RemoteContactViewHolder) holder).bind(searchCursorManager.getCursor(position), query); } else if (holder instanceof HeaderViewHolder) { String header = @@ -142,21 +121,6 @@ public final class SearchAdapter extends RecyclerView.Adapter { } } - private void logDirectories() { - try (Cursor directories = new RemoteDirectoriesCursorLoader(context).loadInBackground()) { - if (directories.moveToFirst()) { - do { - LogUtil.e( - "SearchAdapter.logDirectories", - "directory: %s", - RemoteDirectoriesCursorLoader.readDirectory(directories)); - } while (directories.moveToNext()); - } else { - LogUtil.e("SearchAdapter.logDirectories", "no directories found"); - } - } - } - public void setContactsCursor(SearchCursor cursor) { if (searchCursorManager.setContactsCursor(cursor)) { // Since this is a new contacts cursor, we need to reapply the filter. diff --git a/java/com/android/dialer/searchfragment/remote/RemoteDirectoriesCursorLoader.java b/java/com/android/dialer/searchfragment/remote/RemoteDirectoriesCursorLoader.java index 3d16c4351..de71025cd 100644 --- a/java/com/android/dialer/searchfragment/remote/RemoteDirectoriesCursorLoader.java +++ b/java/com/android/dialer/searchfragment/remote/RemoteDirectoriesCursorLoader.java @@ -36,14 +36,12 @@ public final class RemoteDirectoriesCursorLoader extends CursorLoader { private static final int DISPLAY_NAME = 1; private static final int PHOTO_SUPPORT = 2; - private static final int AUTHORITY = 3; @VisibleForTesting static final String[] PROJECTION = { ContactsContract.Directory._ID, ContactsContract.Directory.DISPLAY_NAME, ContactsContract.Directory.PHOTO_SUPPORT, - ContactsContract.Directory.DIRECTORY_AUTHORITY, }; public RemoteDirectoriesCursorLoader(Context context) { @@ -53,10 +51,7 @@ public final class RemoteDirectoriesCursorLoader extends CursorLoader { /** @return current cursor row represented as a {@link Directory}. */ public static Directory readDirectory(Cursor cursor) { return Directory.create( - cursor.getInt(ID), - cursor.getString(DISPLAY_NAME), - cursor.getInt(PHOTO_SUPPORT) != 0, - cursor.getString(AUTHORITY)); + cursor.getInt(ID), cursor.getString(DISPLAY_NAME), cursor.getInt(PHOTO_SUPPORT) != 0); } private static Uri getContentUri() { @@ -68,14 +63,8 @@ public final class RemoteDirectoriesCursorLoader extends CursorLoader { /** POJO representing the results returned from {@link RemoteDirectoriesCursorLoader}. */ @AutoValue public abstract static class Directory { - public static Directory create( - int id, @Nullable String displayName, boolean supportsPhotos, @Nullable String authority) { - return new AutoValue_RemoteDirectoriesCursorLoader_Directory( - id, displayName, supportsPhotos, authority); - } - public static Directory create(int id, @Nullable String displayName, boolean supportsPhotos) { - return create(id, displayName, supportsPhotos, null); + return new AutoValue_RemoteDirectoriesCursorLoader_Directory(id, displayName, supportsPhotos); } public abstract int getId(); @@ -84,7 +73,5 @@ public final class RemoteDirectoriesCursorLoader extends CursorLoader { abstract @Nullable String getDisplayName(); abstract boolean supportsPhotos(); - - abstract @Nullable String authority(); } } -- cgit v1.2.3