Loading src/com/android/dialer/SpecialCharSequenceMgr.java +12 −26 Original line number Original line Diff line number Diff line Loading @@ -205,16 +205,16 @@ public class SpecialCharSequenceMgr { final TelecomManager telecomManager = final TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); List<PhoneAccountHandle> phoneAccountHandles = List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(context); PhoneAccountUtils.getSubscriptionPhoneAccounts(context); boolean hasUserSelectedDefault = hasDefaultSubscriptionAccount( boolean hasUserSelectedDefault = subscriptionAccountHandles.contains( telecomManager.getUserSelectedOutgoingPhoneAccount(), phoneAccountHandles); telecomManager.getUserSelectedOutgoingPhoneAccount()); if (phoneAccountHandles.size() == 1 || hasUserSelectedDefault) { if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) { Uri uri = telecomManager.getAdnUriForPhoneAccount(null); Uri uri = telecomManager.getAdnUriForPhoneAccount(null); handleAdnQuery(handler, sc, uri); handleAdnQuery(handler, sc, uri); } else if (phoneAccountHandles.size() > 1){ } else if (subscriptionAccountHandles.size() > 1){ SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { @Override @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, Loading @@ -229,7 +229,7 @@ public class SpecialCharSequenceMgr { }; }; SelectPhoneAccountDialogFragment.showAccountDialog( SelectPhoneAccountDialogFragment.showAccountDialog( ((Activity) context).getFragmentManager(), phoneAccountHandles, ((Activity) context).getFragmentManager(), subscriptionAccountHandles, listener); listener); } else { } else { return false; return false; Loading Loading @@ -268,16 +268,16 @@ public class SpecialCharSequenceMgr { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { final TelecomManager telecomManager = final TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); List<PhoneAccountHandle> phoneAccountHandles = List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(context); PhoneAccountUtils.getSubscriptionPhoneAccounts(context); boolean hasUserSelectedDefault = hasDefaultSubscriptionAccount( boolean hasUserSelectedDefault = subscriptionAccountHandles.contains( telecomManager.getUserSelectedOutgoingPhoneAccount(), phoneAccountHandles); telecomManager.getUserSelectedOutgoingPhoneAccount()); if (phoneAccountHandles.size() == 1 || hasUserSelectedDefault) { if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) { // Don't bring up the dialog for single-SIM or if the default outgoing account is // Don't bring up the dialog for single-SIM or if the default outgoing account is // a subscription account. // a subscription account. return telecomManager.handleMmi(input); return telecomManager.handleMmi(input); } else if (phoneAccountHandles.size() > 1){ } else if (subscriptionAccountHandles.size() > 1){ SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { @Override @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, Loading @@ -290,7 +290,7 @@ public class SpecialCharSequenceMgr { }; }; SelectPhoneAccountDialogFragment.showAccountDialog( SelectPhoneAccountDialogFragment.showAccountDialog( ((Activity) context).getFragmentManager(), phoneAccountHandles, ((Activity) context).getFragmentManager(), subscriptionAccountHandles, listener); listener); } } return true; return true; Loading @@ -298,20 +298,6 @@ public class SpecialCharSequenceMgr { return false; return false; } } /** * Check if the default outgoing phone account set is a subscription phone account. */ static private boolean hasDefaultSubscriptionAccount(PhoneAccountHandle defaultOutgoingAccount, List<PhoneAccountHandle> phoneAccountHandles) { for (PhoneAccountHandle accountHandle : phoneAccountHandles) { if (accountHandle.equals(defaultOutgoingAccount)) { return true; } } return false; } // TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a // TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a // hard-coded string. // hard-coded string. static boolean handleDeviceIdDisplay(Context context, String input) { static boolean handleDeviceIdDisplay(Context context, String input) { Loading src/com/android/dialer/dialpad/DialpadFragment.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.Contacts.PhonesColumns; import android.provider.Settings; import android.provider.Settings; import android.telecom.PhoneAccount; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener; Loading Loading @@ -77,6 +78,7 @@ import com.android.dialer.DialtactsActivity; import com.android.dialer.NeededForReflection; import com.android.dialer.NeededForReflection; import com.android.dialer.R; import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.DialerUtils; import com.android.phone.common.CallLogAsync; import com.android.phone.common.CallLogAsync; import com.android.phone.common.HapticFeedback; import com.android.phone.common.HapticFeedback; Loading @@ -87,6 +89,7 @@ import com.android.phone.common.dialpad.DialpadView; import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting; import java.util.HashSet; import java.util.HashSet; import java.util.List; /** /** * Fragment that displays a twelve-key phone dialpad. * Fragment that displays a twelve-key phone dialpad. Loading Loading @@ -908,7 +911,16 @@ public class DialpadFragment extends Fragment // We'll try to initiate voicemail and thus we want to remove irrelevant string. // We'll try to initiate voicemail and thus we want to remove irrelevant string. removePreviousDigitIfPossible(); removePreviousDigitIfPossible(); if (isVoicemailAvailable()) { List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity()); boolean hasUserSelectedDefault = subscriptionAccountHandles.contains( getTelecomManager().getUserSelectedOutgoingPhoneAccount()); boolean multiSim = subscriptionAccountHandles.size() > 1; if ((multiSim && !hasUserSelectedDefault) || isVoicemailAvailable()) { // On a multi-SIM phone, if the user has not selected a default // subscription, initiate a call to voicemail so they can select an account // from the "Call with" dialog. callVoicemail(); callVoicemail(); } else if (getActivity() != null) { } else if (getActivity() != null) { // Voicemail is unavailable maybe because Airplane mode is turned on. // Voicemail is unavailable maybe because Airplane mode is turned on. Loading Loading
src/com/android/dialer/SpecialCharSequenceMgr.java +12 −26 Original line number Original line Diff line number Diff line Loading @@ -205,16 +205,16 @@ public class SpecialCharSequenceMgr { final TelecomManager telecomManager = final TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); List<PhoneAccountHandle> phoneAccountHandles = List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(context); PhoneAccountUtils.getSubscriptionPhoneAccounts(context); boolean hasUserSelectedDefault = hasDefaultSubscriptionAccount( boolean hasUserSelectedDefault = subscriptionAccountHandles.contains( telecomManager.getUserSelectedOutgoingPhoneAccount(), phoneAccountHandles); telecomManager.getUserSelectedOutgoingPhoneAccount()); if (phoneAccountHandles.size() == 1 || hasUserSelectedDefault) { if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) { Uri uri = telecomManager.getAdnUriForPhoneAccount(null); Uri uri = telecomManager.getAdnUriForPhoneAccount(null); handleAdnQuery(handler, sc, uri); handleAdnQuery(handler, sc, uri); } else if (phoneAccountHandles.size() > 1){ } else if (subscriptionAccountHandles.size() > 1){ SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { @Override @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, Loading @@ -229,7 +229,7 @@ public class SpecialCharSequenceMgr { }; }; SelectPhoneAccountDialogFragment.showAccountDialog( SelectPhoneAccountDialogFragment.showAccountDialog( ((Activity) context).getFragmentManager(), phoneAccountHandles, ((Activity) context).getFragmentManager(), subscriptionAccountHandles, listener); listener); } else { } else { return false; return false; Loading Loading @@ -268,16 +268,16 @@ public class SpecialCharSequenceMgr { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { if ((input.startsWith("**04") || input.startsWith("**05")) && input.endsWith("#")) { final TelecomManager telecomManager = final TelecomManager telecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); List<PhoneAccountHandle> phoneAccountHandles = List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(context); PhoneAccountUtils.getSubscriptionPhoneAccounts(context); boolean hasUserSelectedDefault = hasDefaultSubscriptionAccount( boolean hasUserSelectedDefault = subscriptionAccountHandles.contains( telecomManager.getUserSelectedOutgoingPhoneAccount(), phoneAccountHandles); telecomManager.getUserSelectedOutgoingPhoneAccount()); if (phoneAccountHandles.size() == 1 || hasUserSelectedDefault) { if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) { // Don't bring up the dialog for single-SIM or if the default outgoing account is // Don't bring up the dialog for single-SIM or if the default outgoing account is // a subscription account. // a subscription account. return telecomManager.handleMmi(input); return telecomManager.handleMmi(input); } else if (phoneAccountHandles.size() > 1){ } else if (subscriptionAccountHandles.size() > 1){ SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { SelectPhoneAccountListener listener = new SelectPhoneAccountListener() { @Override @Override public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, public void onPhoneAccountSelected(PhoneAccountHandle selectedAccountHandle, Loading @@ -290,7 +290,7 @@ public class SpecialCharSequenceMgr { }; }; SelectPhoneAccountDialogFragment.showAccountDialog( SelectPhoneAccountDialogFragment.showAccountDialog( ((Activity) context).getFragmentManager(), phoneAccountHandles, ((Activity) context).getFragmentManager(), subscriptionAccountHandles, listener); listener); } } return true; return true; Loading @@ -298,20 +298,6 @@ public class SpecialCharSequenceMgr { return false; return false; } } /** * Check if the default outgoing phone account set is a subscription phone account. */ static private boolean hasDefaultSubscriptionAccount(PhoneAccountHandle defaultOutgoingAccount, List<PhoneAccountHandle> phoneAccountHandles) { for (PhoneAccountHandle accountHandle : phoneAccountHandles) { if (accountHandle.equals(defaultOutgoingAccount)) { return true; } } return false; } // TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a // TODO: Use TelephonyCapabilities.getDeviceIdLabel() to get the device id label instead of a // hard-coded string. // hard-coded string. static boolean handleDeviceIdDisplay(Context context, String input) { static boolean handleDeviceIdDisplay(Context context, String input) { Loading
src/com/android/dialer/dialpad/DialpadFragment.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -39,6 +39,7 @@ import android.provider.Contacts.Phones; import android.provider.Contacts.PhonesColumns; import android.provider.Contacts.PhonesColumns; import android.provider.Settings; import android.provider.Settings; import android.telecom.PhoneAccount; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telecom.TelecomManager; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.PhoneStateListener; Loading Loading @@ -77,6 +78,7 @@ import com.android.dialer.DialtactsActivity; import com.android.dialer.NeededForReflection; import com.android.dialer.NeededForReflection; import com.android.dialer.R; import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.calllog.PhoneAccountUtils; import com.android.dialer.util.DialerUtils; import com.android.dialer.util.DialerUtils; import com.android.phone.common.CallLogAsync; import com.android.phone.common.CallLogAsync; import com.android.phone.common.HapticFeedback; import com.android.phone.common.HapticFeedback; Loading @@ -87,6 +89,7 @@ import com.android.phone.common.dialpad.DialpadView; import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting; import java.util.HashSet; import java.util.HashSet; import java.util.List; /** /** * Fragment that displays a twelve-key phone dialpad. * Fragment that displays a twelve-key phone dialpad. Loading Loading @@ -908,7 +911,16 @@ public class DialpadFragment extends Fragment // We'll try to initiate voicemail and thus we want to remove irrelevant string. // We'll try to initiate voicemail and thus we want to remove irrelevant string. removePreviousDigitIfPossible(); removePreviousDigitIfPossible(); if (isVoicemailAvailable()) { List<PhoneAccountHandle> subscriptionAccountHandles = PhoneAccountUtils.getSubscriptionPhoneAccounts(getActivity()); boolean hasUserSelectedDefault = subscriptionAccountHandles.contains( getTelecomManager().getUserSelectedOutgoingPhoneAccount()); boolean multiSim = subscriptionAccountHandles.size() > 1; if ((multiSim && !hasUserSelectedDefault) || isVoicemailAvailable()) { // On a multi-SIM phone, if the user has not selected a default // subscription, initiate a call to voicemail so they can select an account // from the "Call with" dialog. callVoicemail(); callVoicemail(); } else if (getActivity() != null) { } else if (getActivity() != null) { // Voicemail is unavailable maybe because Airplane mode is turned on. // Voicemail is unavailable maybe because Airplane mode is turned on. Loading