From 04ac93d3c9d2f3f4c157bfa1d23d225aa34db9df Mon Sep 17 00:00:00 2001 From: erfanian Date: Mon, 9 Oct 2017 15:12:22 -0700 Subject: Add assisted dialing to outbound calls that qualify. * Add missing assisted dialing to calls from contacts in the call log. * Add missing assisted dialing to calls from dialpad and normal search. Bug: 63995025,63995261 Test: unit test PiperOrigin-RevId: 171593967 Change-Id: I4e63ef1dcd7ee1b2b5cbb8ecb4d8da744d90bd66 --- .../dialer/searchfragment/list/SearchAdapter.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'java/com/android/dialer/searchfragment') diff --git a/java/com/android/dialer/searchfragment/list/SearchAdapter.java b/java/com/android/dialer/searchfragment/list/SearchAdapter.java index 22bfa6dbd..1ca29e072 100644 --- a/java/com/android/dialer/searchfragment/list/SearchAdapter.java +++ b/java/com/android/dialer/searchfragment/list/SearchAdapter.java @@ -21,11 +21,13 @@ import android.content.Intent; import android.support.annotation.VisibleForTesting; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; +import android.telephony.TelephonyManager; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import com.android.dialer.assisteddialing.ConcreteCreator; import com.android.dialer.callcomposer.CallComposerActivity; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; @@ -209,23 +211,32 @@ public final class SearchAdapter extends RecyclerView.Adapter @Override public void placeVoiceCall(String phoneNumber, int ranking) { - placeCall(phoneNumber, ranking, false); + placeCall(phoneNumber, ranking, false, true); } @Override public void placeVideoCall(String phoneNumber, int ranking) { - placeCall(phoneNumber, ranking, true); + placeCall(phoneNumber, ranking, true, false); } - private void placeCall(String phoneNumber, int position, boolean isVideoCall) { + private void placeCall( + String phoneNumber, int position, boolean isVideoCall, boolean allowAssistedDial) { CallSpecificAppData callSpecificAppData = CallSpecificAppData.newBuilder() .setCallInitiationType(callInitiationType) .setPositionOfSelectedSearchResult(position) .setCharactersInSearchString(query == null ? 0 : query.length()) + .setAllowAssistedDialing(allowAssistedDial) .build(); Intent intent = - new CallIntentBuilder(phoneNumber, callSpecificAppData).setIsVideoCall(isVideoCall).build(); + new CallIntentBuilder(phoneNumber, callSpecificAppData) + .setIsVideoCall(isVideoCall) + .setAllowAssistedDial( + allowAssistedDial, + ConcreteCreator.createNewAssistedDialingMediator( + activity.getSystemService(TelephonyManager.class), + activity.getApplicationContext())) + .build(); DialerUtils.startActivityWithErrorToast(activity, intent); } -- cgit v1.2.3