summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/DialtactsActivity.java41
-rw-r--r--src/com/android/dialer/dialpad/DialpadFragment.java25
2 files changed, 27 insertions, 39 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index d48b28e72..5c2e17e29 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -37,6 +37,7 @@ import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents;
import android.speech.RecognizerIntent;
import android.support.v4.view.ViewPager;
+import android.telecomm.Subscription;
import android.telephony.TelephonyManager;
import android.text.Editable;
import android.text.TextUtils;
@@ -62,10 +63,11 @@ import android.widget.PopupMenu;
import android.widget.Toast;
import com.android.contacts.common.CallUtil;
+import com.android.contacts.common.SubscriptionManager;
import com.android.contacts.common.activity.TransactionSafeActivity;
import com.android.contacts.common.animation.AnimationListenerAdapter;
import com.android.contacts.common.dialog.ClearFrequentsDialog;
-import com.android.contacts.common.dialog.SelectSIMDialogFragment;
+import com.android.contacts.common.dialog.SelectSubscriptionDialogFragment;
import com.android.contacts.common.interactions.ImportExportDialogFragment;
import com.android.contacts.common.list.OnPhoneNumberPickerActionListener;
import com.android.contacts.common.widget.FloatingActionButtonController;
@@ -105,13 +107,15 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
OnDragDropListener,
OnPhoneNumberPickerActionListener,
PopupMenu.OnMenuItemClickListener,
- SelectSIMDialogFragment.OnClickOkListener,
ViewPager.OnPageChangeListener,
ActionBarController.ActivityUi {
private static final String TAG = "DialtactsActivity";
public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+ /** Temporary flag for disabling subscription selection menu */
+ public static final boolean ENABLE_SUBSCRIPTION_SELECT = false;
+
public static final String SHARED_PREFS_NAME = "com.android.dialer_preferences";
/** Used to open Call Setting */
@@ -140,11 +144,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1;
- /**
- * Constant to indicate there is only one service provider available.
- */
- private static final int NO_MULTI_SIM = -1;
-
private FrameLayout parentLayout;
/**
@@ -199,9 +198,9 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
private boolean mIsLandscape;
/**
- * Information about the currently selected SIM card.
+ * Information about the currently selected subscription.
*/
- private int mCurrentSimCard = NO_MULTI_SIM;
+ private SubscriptionManager mSubscriptionManager = null;
/**
* The position of the currently selected tab in the attached {@link ListsFragment}.
@@ -369,7 +368,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mActionBarController = new ActionBarController(this,
(SearchEditTextLayout) actionBar.getCustomView());
-
SearchEditTextLayout searchEditTextLayout =
(SearchEditTextLayout) actionBar.getCustomView();
searchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener);
@@ -390,6 +388,11 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
mIsLandscape = getResources().getConfiguration().orientation
== Configuration.ORIENTATION_LANDSCAPE;
+
+ if (getTelephonyManager().getSubscriptions().size() > 1 && ENABLE_SUBSCRIPTION_SELECT) {
+ mSubscriptionManager = new SubscriptionManager(getTelephonyManager());
+ }
+
final View floatingActionButtonContainer = findViewById(
R.id.floating_action_button_container);
mFloatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
@@ -597,22 +600,14 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
case R.id.menu_call_settings:
handleMenuSettings();
return true;
- case R.id.menu_select_sim:
- SelectSIMDialogFragment.show(getFragmentManager(), mCurrentSimCard);
+ case R.id.menu_select_subscription:
+ SelectSubscriptionDialogFragment.show(getFragmentManager(), mSubscriptionManager);
return true;
}
return false;
}
@Override
- public void passSimUpdate(int simId) {
- mCurrentSimCard = simId;
- if (mIsDialpadShown) {
- mDialpadFragment.setSimCard(simId);
- }
- }
-
- @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == ACTIVITY_REQUEST_CODE_VOICE_SEARCH) {
if (resultCode == RESULT_OK) {
@@ -642,7 +637,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
}
mIsDialpadShown = true;
mDialpadFragment.setAnimate(animate);
- mDialpadFragment.setSimCard(mCurrentSimCard);
+ mDialpadFragment.setSubscriptionManager(mSubscriptionManager);
final FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.show(mDialpadFragment);
@@ -780,8 +775,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O
final OptionsPopupMenu popupMenu = new OptionsPopupMenu(this, invoker);
popupMenu.inflate(R.menu.dialtacts_options);
final Menu menu = popupMenu.getMenu();
- final MenuItem selectSim = menu.findItem(R.id.menu_select_sim);
- selectSim.setVisible(mCurrentSimCard != NO_MULTI_SIM);
+ final MenuItem selectSubscription = menu.findItem(R.id.menu_select_subscription);
+ selectSubscription.setVisible(mSubscriptionManager != null);
popupMenu.setOnMenuItemClickListener(this);
return popupMenu;
}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index bb5880295..e7ae7ccad 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -71,7 +71,8 @@ import android.widget.TextView;
import com.android.contacts.common.CallUtil;
import com.android.contacts.common.GeoUtil;
-import com.android.contacts.common.dialog.SelectSIMDialogFragment;
+import com.android.contacts.common.SubscriptionManager;
+import com.android.contacts.common.dialog.SelectSubscriptionDialogFragment;
import com.android.contacts.common.dialpad.DialpadKeyButton;
import com.android.contacts.common.dialpad.DialpadView;
import com.android.contacts.common.util.PhoneNumberFormatter;
@@ -99,15 +100,7 @@ public class DialpadFragment extends Fragment
DialpadKeyButton.OnPressedListener {
private static final String TAG = DialpadFragment.class.getSimpleName();
- /**
- * Constant to indicate there is only a single service provider available
- */
- private static final int NO_MULTI_SIM = -1;
-
- /**
- * Information about the currently selected SIM card.
- */
- private int mCurrentSimCard = NO_MULTI_SIM;
+ private static SubscriptionManager mSubscriptionManager;
/**
* This interface allows the DialpadFragment to tell its hosting Activity when and when not
@@ -861,9 +854,9 @@ public class DialpadFragment extends Fragment
@Override
public void show() {
final Menu menu = getMenu();
- final MenuItem selectSim = menu.findItem(R.id.menu_select_sim);
+ final MenuItem selectSubscription = menu.findItem(R.id.menu_select_subscription);
final MenuItem sendMessage = menu.findItem(R.id.menu_send_message);
- selectSim.setVisible(mCurrentSimCard != NO_MULTI_SIM);
+ selectSubscription.setVisible(mSubscriptionManager != null);
sendMessage.setVisible(mSmsPackageComponentName != null);
boolean enable = !isDigitsEmpty();
@@ -1448,8 +1441,8 @@ public class DialpadFragment extends Fragment
smsIntent.setComponent(mSmsPackageComponentName);
DialerUtils.startActivityWithErrorToast(getActivity(), smsIntent);
}
- case R.id.menu_select_sim:
- SelectSIMDialogFragment.show(getFragmentManager(), mCurrentSimCard);
+ case R.id.menu_select_subscription:
+ SelectSubscriptionDialogFragment.show(getFragmentManager(), mSubscriptionManager);
return true;
default:
@@ -1621,8 +1614,8 @@ public class DialpadFragment extends Fragment
return mAnimate;
}
- public void setSimCard(int simId) {
- mCurrentSimCard = simId;
+ public void setSubscriptionManager(SubscriptionManager subscriptionManager) {
+ mSubscriptionManager = subscriptionManager;
}
public void setYFraction(float yFraction) {