diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-11-12 00:55:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-11-12 00:55:34 +0000 |
commit | 2b52d2a3cdcb0ac00d87d2c2cbd1d6b750ea036d (patch) | |
tree | c87ae220455edeac1c6fb5b12e033e37a07c9ed4 /java/com/android/dialer/searchfragment/list | |
parent | 5e20ba7b1c6a9644da034b345000b37856d78125 (diff) | |
parent | b7dba5aaa8c477d97121fc6e3411332e66cbabe8 (diff) |
Merge changes I0ed4fa1b,Ie03ce41e,If41868df,Iba2e9092
* changes:
Expose tab index to protected
Added temporary logging to debug problem with null phone numbers from remote contacts.
Hook up pre-call actions
Implement CallingAccountSelector and AssistedDialAction
Diffstat (limited to 'java/com/android/dialer/searchfragment/list')
3 files changed, 43 insertions, 6 deletions
diff --git a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java index c0a6700eb..e797a0390 100644 --- a/java/com/android/dialer/searchfragment/list/NewSearchFragment.java +++ b/java/com/android/dialer/searchfragment/list/NewSearchFragment.java @@ -58,6 +58,7 @@ import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.enrichedcall.EnrichedCallManager.CapabilitiesListener; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.precall.PreCall; import com.android.dialer.searchfragment.common.RowClickListener; import com.android.dialer.searchfragment.common.SearchCursor; import com.android.dialer.searchfragment.cp2.SearchContactsCursorLoader; @@ -483,12 +484,11 @@ public final class NewSearchFragment extends Fragment .setCharactersInSearchString(query == null ? 0 : query.length()) .setAllowAssistedDialing(allowAssistedDial) .build(); - Intent intent = + PreCall.start( + getContext(), new CallIntentBuilder(phoneNumber, callSpecificAppData) .setIsVideoCall(isVideoCall) - .setAllowAssistedDial(allowAssistedDial) - .build(); - DialerUtils.startActivityWithErrorToast(getActivity(), intent); + .setAllowAssistedDial(allowAssistedDial)); FragmentUtils.getParentUnsafe(this, SearchFragmentListener.class).onCallPlaced(); } diff --git a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java index 62e5c72b0..b557a8259 100644 --- a/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java +++ b/java/com/android/dialer/searchfragment/list/SearchActionViewHolder.java @@ -31,6 +31,7 @@ import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.common.Assert; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; +import com.android.dialer.precall.PreCall; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.IntentUtil; import java.lang.annotation.Retention; @@ -128,8 +129,8 @@ final class SearchActionViewHolder extends RecyclerView.ViewHolder implements On .setPositionOfSelectedSearchResult(position) .setCharactersInSearchString(query.length()) .build(); - intent = new CallIntentBuilder(query, callSpecificAppData).setIsVideoCall(true).build(); - DialerUtils.startActivityWithErrorToast(context, intent); + PreCall.start( + context, new CallIntentBuilder(query, callSpecificAppData).setIsVideoCall(true)); break; case Action.SEND_SMS: diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java index dc78953b5..cc090ac47 100644 --- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java +++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java @@ -17,6 +17,7 @@ package com.android.dialer.searchfragment.list; import android.content.Context; +import android.database.Cursor; import android.support.annotation.VisibleForTesting; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; @@ -26,12 +27,15 @@ 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}. */ @@ -99,6 +103,23 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { } 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 = @@ -114,6 +135,21 @@ public final class SearchAdapter extends RecyclerView.Adapter<ViewHolder> { } } + 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. |