From 7c5cee7e818e7447a248b7ca6cd17ebec28fcf10 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 2 Sep 2014 14:48:47 -0700 Subject: Add supported URI scheme to PhoneAccounts. (4/4) Modify SelectPhoneAccountDialogFragment to filter the PhoneAccounts to only those which can support the URI scheme of the call. Bug: 17140110 Change-Id: Iccf69fd7360ae05264cec0c19cc82ec34d3137ee --- .../src/com/android/incallui/InCallActivity.java | 8 ++++++-- .../incallui/SelectPhoneAccountDialogFragment.java | 23 +++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'InCallUI') diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index 95cc0d7db..db161a563 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -27,6 +27,7 @@ import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Point; +import android.net.Uri; import android.os.Bundle; import android.telephony.DisconnectCause; import android.text.TextUtils; @@ -491,9 +492,12 @@ public class InCallActivity extends Activity { mCallCardFragment.animateForNewOutgoingCall(touchPoint); } - if (CallList.getInstance().getWaitingForAccountCall() != null) { + Call pendingAccountSelectionCall = CallList.getInstance().getWaitingForAccountCall(); + if (pendingAccountSelectionCall != null) { mCallCardFragment.setVisible(false); - SelectPhoneAccountDialogFragment.show(getFragmentManager()); + Uri handle = pendingAccountSelectionCall.getHandle(); + SelectPhoneAccountDialogFragment.showAccountDialog(getFragmentManager(), + handle.getScheme()); } else { mCallCardFragment.setVisible(true); } diff --git a/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java b/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java index 0bc97eda8..d44047d67 100644 --- a/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java +++ b/InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java @@ -36,6 +36,7 @@ import android.widget.ListAdapter; import android.widget.TextView; import com.android.contacts.common.R; +import com.android.contacts.common.editor.SelectAccountDialogFragment; import java.util.List; @@ -46,19 +47,31 @@ public class SelectPhoneAccountDialogFragment extends DialogFragment { private List mAccountHandles; private boolean mIsSelected; private TelecommManager mTelecommManager; - - /* Preferred way to show this dialog */ - public static void show(FragmentManager fragmentManager) { - SelectPhoneAccountDialogFragment fragment = new SelectPhoneAccountDialogFragment(); + private final String mUriScheme; + + /** + * Shows the account selection dialog. + * This is the preferred way to show this dialog. + * + * @param fragmentManager The fragment manager. + * @param uriScheme The URI scheme of the call we need to choose an account for. + */ + public static void showAccountDialog(FragmentManager fragmentManager, String uriScheme) { + SelectPhoneAccountDialogFragment fragment = new SelectPhoneAccountDialogFragment(uriScheme); fragment.show(fragmentManager, "selectAccount"); } + public SelectPhoneAccountDialogFragment(String uriScheme) { + super(); + mUriScheme = uriScheme; + } + @Override public Dialog onCreateDialog(Bundle savedInstanceState) { mIsSelected = false; mTelecommManager = (TelecommManager) getActivity().getSystemService(Context.TELECOMM_SERVICE); - mAccountHandles = mTelecommManager.getEnabledPhoneAccounts(); + mAccountHandles = mTelecommManager.getPhoneAccountsSupportingScheme(mUriScheme); final DialogInterface.OnClickListener selectionListener = new DialogInterface.OnClickListener() { -- cgit v1.2.3