summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/oem/MotorolaUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/oem/MotorolaUtils.java')
-rw-r--r--java/com/android/dialer/oem/MotorolaUtils.java27
1 files changed, 26 insertions, 1 deletions
diff --git a/java/com/android/dialer/oem/MotorolaUtils.java b/java/com/android/dialer/oem/MotorolaUtils.java
index db2b8909a..ffab8ea23 100644
--- a/java/com/android/dialer/oem/MotorolaUtils.java
+++ b/java/com/android/dialer/oem/MotorolaUtils.java
@@ -18,8 +18,11 @@ package com.android.dialer.oem;
import android.content.Context;
import android.content.res.Resources;
import android.telephony.TelephonyManager;
-import com.android.dialer.common.ConfigProviderBindings;
+import com.android.dialer.common.LogUtil;
import com.android.dialer.common.PackageUtils;
+import com.android.dialer.configprovider.ConfigProviderBindings;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
/** Util class for Motorola OEM devices. */
public class MotorolaUtils {
@@ -39,6 +42,8 @@ public class MotorolaUtils {
// This is used to check if a Motorola device supports WiFi call feature, by checking if a certain
// package is enabled.
private static final String WIFI_CALL_PACKAGE_NAME = "com.motorola.sprintwfc";
+ // Thi is used to check if a Motorola device supports hidden menu feature.
+ private static final String HIDDEN_MENU_FEATURE = "com.motorola.software.sprint.hidden_menu";
// Feature flag indicates it's a HD call, currently this is only used by Motorola system build.
// TODO(b/35359461): Use reference to android.provider.CallLog once it's in new SDK.
@@ -64,6 +69,10 @@ public class MotorolaUtils {
}
}
+ static boolean isSupportingHiddenMenu(Context context) {
+ return context.getPackageManager().hasSystemFeature(HIDDEN_MENU_FEATURE);
+ }
+
public static boolean shouldBlinkHdIconWhenConnectingCall(Context context) {
return ConfigProviderBindings.get(context)
.getBoolean(CONFIG_HD_CODEC_BLINKING_ICON_WHEN_CONNECTING_CALL_ENABLED, true)
@@ -102,6 +111,22 @@ public class MotorolaUtils {
return MotorolaHiddenMenuKeySequence.handleCharSequence(context, input);
}
+ public static boolean isWifiCallingAvailable(Context context) {
+ if (!isSupportingSprintWifiCall(context)) {
+ return false;
+ }
+ TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class);
+ try {
+ Method method = TelephonyManager.class.getMethod("isWifiCallingAvailable");
+ boolean isWifiCallingAvailable = (boolean) method.invoke(telephonyManager);
+ LogUtil.d("MotorolaUtils.isWifiCallingAvailable", "%b", isWifiCallingAvailable);
+ return isWifiCallingAvailable;
+ } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
+ LogUtil.e("MotorolaUtils.isWifiCallingAvailable", "", e);
+ }
+ return false;
+ }
+
private static boolean isSupportingSprintHdCodec(Context context) {
return isSpnMatched(context)
&& context.getResources().getBoolean(R.bool.motorola_sprint_hd_codec)