summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/com/android/dialer/SpecialCharSequenceMgr.java21
-rw-r--r--src/com/android/dialer/compat/DialerCompatUtils.java11
-rw-r--r--src/com/android/dialer/util/TelecomUtil.java21
3 files changed, 32 insertions, 21 deletions
diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java
index d9e293888..c212597f6 100644
--- a/src/com/android/dialer/SpecialCharSequenceMgr.java
+++ b/src/com/android/dialer/SpecialCharSequenceMgr.java
@@ -41,6 +41,7 @@ import android.widget.EditText;
import android.widget.Toast;
import com.android.common.io.MoreCloseables;
+import com.android.contacts.common.compat.CompatUtils;
import com.android.contacts.common.database.NoNullCursorAsyncQueryHandler;
import com.android.contacts.common.util.ContactDisplayUtils;
import com.android.contacts.common.widget.SelectPhoneAccountDialogFragment;
@@ -246,13 +247,14 @@ public class SpecialCharSequenceMgr {
List<PhoneAccountHandle> subscriptionAccountHandles =
PhoneAccountUtils.getSubscriptionPhoneAccounts(context);
-
Context applicationContext = context.getApplicationContext();
boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(
TelecomUtil.getDefaultOutgoingPhoneAccount(applicationContext,
PhoneAccount.SCHEME_TEL));
- if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) {
+ if (!CompatUtils.isMSIMCompatible()) {
+ handleAdnQuery(handler, sc, Uri.parse("content://icc/adn"));
+ } else if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) {
Uri uri = TelecomUtil.getAdnUriForPhoneAccount(applicationContext, null);
handleAdnQuery(handler, sc, uri);
} else if (subscriptionAccountHandles.size() > 1){
@@ -303,7 +305,8 @@ public class SpecialCharSequenceMgr {
boolean hasUserSelectedDefault = subscriptionAccountHandles.contains(
TelecomUtil.getDefaultOutgoingPhoneAccount(context, PhoneAccount.SCHEME_TEL));
- if (subscriptionAccountHandles.size() == 1 || hasUserSelectedDefault) {
+ if (!CompatUtils.isMSIMCompatible() || subscriptionAccountHandles.size() == 1
+ || hasUserSelectedDefault) {
// Don't bring up the dialog for single-SIM or if the default outgoing account is
// a subscription account.
return TelecomUtil.handleMmi(context, input, null);
@@ -332,10 +335,14 @@ public class SpecialCharSequenceMgr {
R.string.imei : R.string.meid;
List<String> deviceIds = new ArrayList<String>();
- for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) {
- String deviceId = telephonyManager.getDeviceId(slot);
- if (!TextUtils.isEmpty(deviceId)) {
- deviceIds.add(deviceId);
+ if (!CompatUtils.isMSIMCompatible()) {
+ deviceIds.add(telephonyManager.getDeviceId());
+ } else {
+ for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) {
+ String deviceId = telephonyManager.getDeviceId(slot);
+ if (!TextUtils.isEmpty(deviceId)) {
+ deviceIds.add(deviceId);
+ }
}
}
diff --git a/src/com/android/dialer/compat/DialerCompatUtils.java b/src/com/android/dialer/compat/DialerCompatUtils.java
index 07a279aa4..1bcdd14ad 100644
--- a/src/com/android/dialer/compat/DialerCompatUtils.java
+++ b/src/com/android/dialer/compat/DialerCompatUtils.java
@@ -21,17 +21,6 @@ import com.android.contacts.common.compat.SdkVersionOverride;
public final class DialerCompatUtils {
/**
- * Determines if this version is compatible with video calling. Can also force the version to be
- * lower through SdkVersionOverride.
- *
- * @return {@code true} if video calling is allowed, {@code false} otherwise.
- */
- public static boolean isVideoCompatible() {
- return SdkVersionOverride.getSdkVersion(Build.VERSION_CODES.LOLLIPOP)
- >= Build.VERSION_CODES.M;
- }
-
- /**
* Determines if this version is compatible with a default dialer. Can also force the version to
* be lower through SdkVersionOverride.
*
diff --git a/src/com/android/dialer/util/TelecomUtil.java b/src/com/android/dialer/util/TelecomUtil.java
index a0c833462..a617af6d2 100644
--- a/src/com/android/dialer/util/TelecomUtil.java
+++ b/src/com/android/dialer/util/TelecomUtil.java
@@ -25,9 +25,12 @@ import android.provider.CallLog.Calls;
import android.support.v4.content.ContextCompat;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+import android.telephony.PhoneNumberUtils;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
+import com.android.contacts.common.compat.CompatUtils;
import com.android.dialer.compat.DialerCompatUtils;
import java.util.ArrayList;
@@ -111,7 +114,7 @@ public class TelecomUtil {
}
public static List<PhoneAccountHandle> getCallCapablePhoneAccounts(Context context) {
- if (hasReadPhoneStatePermission(context)) {
+ if (hasReadPhoneStatePermission(context) && CompatUtils.isMSIMCompatible()) {
return getTelecomManager(context).getCallCapablePhoneAccounts();
}
return new ArrayList<>();
@@ -127,14 +130,22 @@ public class TelecomUtil {
public static boolean isVoicemailNumber(Context context, PhoneAccountHandle accountHandle,
String number) {
if (hasReadPhoneStatePermission(context)) {
- return getTelecomManager(context).isVoiceMailNumber(accountHandle, number);
+ if (CompatUtils.isMSIMCompatible()) {
+ return getTelecomManager(context).isVoiceMailNumber(accountHandle, number);
+ } else {
+ return PhoneNumberUtils.isVoiceMailNumber(number);
+ }
}
return false;
}
public static String getVoicemailNumber(Context context, PhoneAccountHandle accountHandle) {
if (hasReadPhoneStatePermission(context)) {
- return getTelecomManager(context).getVoiceMailNumber(accountHandle);
+ if (CompatUtils.isMSIMCompatible()) {
+ return getTelecomManager(context).getVoiceMailNumber(accountHandle);
+ } else {
+ return getTelephonyManager(context).getVoiceMailNumber();
+ }
}
return null;
}
@@ -210,4 +221,8 @@ public class TelecomUtil {
private static TelecomManager getTelecomManager(Context context) {
return (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
}
+
+ private static TelephonyManager getTelephonyManager(Context context) {
+ return (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
+ }
}