summaryrefslogtreecommitdiff
path: root/java/com/android/contacts/common/compat/TelephonyManagerCompat.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-05 13:35:02 -0700
committerEric Erfanian <erfanian@google.com>2017-06-07 20:44:54 +0000
commit91ce7d2a476bd04fe525049a37a2f8b2824e9724 (patch)
treeb9bbc285430ffb5363a70eb27e382c38f5a85b7a /java/com/android/contacts/common/compat/TelephonyManagerCompat.java
parent75233ff03785f24789b32039ac2c208805b7e506 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/158012278. Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/152373142 (4/06/2017) to cl/158012278 (6/05/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: I4d3f14b5140e2e51bead9497bc118a205b3ebe76
Diffstat (limited to 'java/com/android/contacts/common/compat/TelephonyManagerCompat.java')
-rw-r--r--java/com/android/contacts/common/compat/TelephonyManagerCompat.java71
1 files changed, 3 insertions, 68 deletions
diff --git a/java/com/android/contacts/common/compat/TelephonyManagerCompat.java b/java/com/android/contacts/common/compat/TelephonyManagerCompat.java
index 7e4803ca5..4a16fb855 100644
--- a/java/com/android/contacts/common/compat/TelephonyManagerCompat.java
+++ b/java/com/android/contacts/common/compat/TelephonyManagerCompat.java
@@ -27,7 +27,6 @@ import android.telecom.PhoneAccountHandle;
import android.telephony.TelephonyManager;
import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
-import com.android.dialer.compat.CompatUtils;
import java.lang.reflect.InvocationTargetException;
public class TelephonyManagerCompat {
@@ -49,31 +48,6 @@ public class TelephonyManagerCompat {
private static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
/**
- * @param telephonyManager The telephony manager instance to use for method calls.
- * @return true if the current device is "voice capable".
- * <p>"Voice capable" means that this device supports circuit-switched (i.e. voice) phone
- * calls over the telephony network, and is allowed to display the in-call UI while a cellular
- * voice call is active. This will be false on "data only" devices which can't make voice
- * calls and don't support any in-call UI.
- * <p>Note: the meaning of this flag is subtly different from the
- * PackageManager.FEATURE_TELEPHONY system feature, which is available on any device with a
- * telephony radio, even if the device is data-only.
- */
- public static boolean isVoiceCapable(@Nullable TelephonyManager telephonyManager) {
- if (telephonyManager == null) {
- return false;
- }
- if (CompatUtils.isLollipopMr1Compatible()
- || CompatUtils.isMethodAvailable(TELEPHONY_MANAGER_CLASS, "isVoiceCapable")) {
- // isVoiceCapable was unhidden in L-MR1
- return telephonyManager.isVoiceCapable();
- }
- final int phoneType = telephonyManager.getPhoneType();
- return phoneType == TelephonyManager.PHONE_TYPE_CDMA
- || phoneType == TelephonyManager.PHONE_TYPE_GSM;
- }
-
- /**
* Returns the number of phones available. Returns 1 for Single standby mode (Single SIM
* functionality) Returns 2 for Dual standby mode.(Dual SIM functionality)
*
@@ -85,31 +59,7 @@ public class TelephonyManagerCompat {
if (telephonyManager == null) {
return 1;
}
- if (CompatUtils.isMarshmallowCompatible()
- || CompatUtils.isMethodAvailable(TELEPHONY_MANAGER_CLASS, "getPhoneCount")) {
- return telephonyManager.getPhoneCount();
- }
- return 1;
- }
-
- /**
- * Returns the unique device ID of a subscription, for example, the IMEI for GSM and the MEID for
- * CDMA phones. Return null if device ID is not available.
- *
- * <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
- *
- * @param telephonyManager The telephony manager instance to use for method calls.
- * @param slotId of which deviceID is returned
- */
- public static String getDeviceId(@Nullable TelephonyManager telephonyManager, int slotId) {
- if (telephonyManager == null) {
- return null;
- }
- if (CompatUtils.isMarshmallowCompatible()
- || CompatUtils.isMethodAvailable(TELEPHONY_MANAGER_CLASS, "getDeviceId", Integer.class)) {
- return telephonyManager.getDeviceId(slotId);
- }
- return null;
+ return telephonyManager.getPhoneCount();
}
/**
@@ -119,14 +69,7 @@ public class TelephonyManagerCompat {
* @return {@code true} if the device supports TTY mode, and {@code false} otherwise.
*/
public static boolean isTtyModeSupported(@Nullable TelephonyManager telephonyManager) {
- if (telephonyManager == null) {
- return false;
- }
- if (CompatUtils.isMarshmallowCompatible()
- || CompatUtils.isMethodAvailable(TELEPHONY_MANAGER_CLASS, "isTtyModeSupported")) {
- return telephonyManager.isTtyModeSupported();
- }
- return false;
+ return telephonyManager != null && telephonyManager.isTtyModeSupported();
}
/**
@@ -138,15 +81,7 @@ public class TelephonyManagerCompat {
*/
public static boolean isHearingAidCompatibilitySupported(
@Nullable TelephonyManager telephonyManager) {
- if (telephonyManager == null) {
- return false;
- }
- if (CompatUtils.isMarshmallowCompatible()
- || CompatUtils.isMethodAvailable(
- TELEPHONY_MANAGER_CLASS, "isHearingAidCompatibilitySupported")) {
- return telephonyManager.isHearingAidCompatibilitySupported();
- }
- return false;
+ return telephonyManager != null && telephonyManager.isHearingAidCompatibilitySupported();
}
/**