summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2014-09-02 14:48:47 -0700
committerTyler Gunn <tgunn@google.com>2014-09-02 14:48:47 -0700
commit7c5cee7e818e7447a248b7ca6cd17ebec28fcf10 (patch)
tree600789d1840a33c771ccf92653f8f14c5ef59341 /InCallUI
parente0635a6b20c639f505fa356b15b2b7d82e86ebf2 (diff)
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
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java8
-rw-r--r--InCallUI/src/com/android/incallui/SelectPhoneAccountDialogFragment.java23
2 files changed, 24 insertions, 7 deletions
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<PhoneAccountHandle> 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() {