From 9050823ccf6f512e06ad65c8a741cb17cbc4a833 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Fri, 24 Mar 2017 09:31:16 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/151128062 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/150756069 (3/21/2017) to cl/151128062 (3/24/2017). Notable this release: - Explicitly enumerate host and target dependencies. - Update proguard flag references. 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. Bug: 33210202 36511925 Addresses 33210202 - Proguard support 36511925 - Compiler warnings when building against platform sdk Change-Id: I448ec3b3f2358886859cf7a4ef76a8fcef3244ae --- .../dialer/oem/MotorolaHiddenMenuKeySequence.java | 3 +- java/com/android/dialer/oem/MotorolaUtils.java | 60 ++++++++++++++++++++-- .../res/values-mcc310-mnc000/motorola_config.xml | 6 +++ .../res/values-mcc310-mnc120/motorola_config.xml | 5 ++ .../res/values-mcc311-mnc490/motorola_config.xml | 5 ++ .../res/values-mcc311-mnc870/motorola_config.xml | 5 ++ .../res/values-mcc312-mnc530/motorola_config.xml | 5 ++ .../res/values-mcc316-mnc010/motorola_config.xml | 5 ++ 8 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml (limited to 'java/com/android/dialer/oem') diff --git a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java index 18f621e01..9cf145b7a 100644 --- a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java +++ b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java @@ -68,7 +68,8 @@ public class MotorolaHiddenMenuKeySequence { private MotorolaHiddenMenuKeySequence(Context context) { featureHiddenMenuEnabled = - context.getResources().getBoolean(R.bool.motorola_feature_hidden_menu); + MotorolaUtils.isSpnMatched(context) + && context.getResources().getBoolean(R.bool.motorola_feature_hidden_menu); // In case we do have a SPN from resource we need to match from service; otherwise we are // free to go if (featureHiddenMenuEnabled) { diff --git a/java/com/android/dialer/oem/MotorolaUtils.java b/java/com/android/dialer/oem/MotorolaUtils.java index e31ec98b8..d0589103d 100644 --- a/java/com/android/dialer/oem/MotorolaUtils.java +++ b/java/com/android/dialer/oem/MotorolaUtils.java @@ -16,23 +16,53 @@ 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.PackageUtils; /** Util class for Motorola OEM devices. */ public class MotorolaUtils { private static final String CONFIG_HD_CODEC_BLINKING_ICON_WHEN_CONNECTING_CALL_ENABLED = "hd_codec_blinking_icon_when_connecting_enabled"; + private static final String CONFIG_HD_CODEC_SHOW_ICON_IN_NOTIFICATION_ENABLED = + "hd_codec_show_icon_in_notification_enabled"; private static final String CONFIG_HD_CODEC_SHOW_ICON_IN_CALL_LOG_ENABLED = "hd_codec_show_icon_in_call_log_enabled"; + private static final String CONFIG_WIFI_CALL_SHOW_ICON_IN_CALL_LOG_ENABLED = + "wifi_call_show_icon_in_call_log_enabled"; // This is used to check if a Motorola device supports HD voice call feature, which comes from // system feature setting. private static final String HD_CALL_FEATRURE = "com.motorola.software.sprint.hd_call"; + // 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"; // Feature flag indicates it's a HD call, currently this is only used by Motorola system build. // TODO(b/35359461): Upstream and move it to android.provider.CallLog. private static final int FEATURES_HD_CALL = 0x10000000; + // Feature flag indicates it's a WiFi call, currently this is only used by Motorola system build. + private static final int FEATURES_WIFI = 0x80000000; + + private static boolean hasCheckedSprintWifiCall; + private static boolean supportSprintWifiCall; + + /** + * Returns true if SPN is specified and matched the current sim operator name. This is necessary + * since mcc310-mnc000 is not sufficient to identify Sprint network. + */ + static boolean isSpnMatched(Context context) { + try { + String spnResource = context.getResources().getString(R.string.motorola_enabled_spn); + return spnResource.equalsIgnoreCase( + context.getSystemService(TelephonyManager.class).getSimOperatorName()); + } catch (Resources.NotFoundException exception) { + // If SPN is not specified we consider as not necessary to enable/disable the feature. + return true; + } + } public static boolean shouldBlinkHdIconWhenConnectingCall(Context context) { return ConfigProviderBindings.get(context) @@ -40,11 +70,24 @@ public class MotorolaUtils { && isSupportingSprintHdCodec(context); } + public static boolean shouldShowHdIconInNotification(Context context) { + return ConfigProviderBindings.get(context) + .getBoolean(CONFIG_HD_CODEC_SHOW_ICON_IN_NOTIFICATION_ENABLED, true) + && isSupportingSprintHdCodec(context); + } + public static boolean shouldShowHdIconInCallLog(Context context, int features) { return ConfigProviderBindings.get(context) .getBoolean(CONFIG_HD_CODEC_SHOW_ICON_IN_CALL_LOG_ENABLED, true) - && isSupportingSprintHdCodec(context) - && (features & FEATURES_HD_CALL) == FEATURES_HD_CALL; + && (features & FEATURES_HD_CALL) == FEATURES_HD_CALL + && isSupportingSprintHdCodec(context); + } + + public static boolean shouldShowWifiIconInCallLog(Context context, int features) { + return ConfigProviderBindings.get(context) + .getBoolean(CONFIG_WIFI_CALL_SHOW_ICON_IN_CALL_LOG_ENABLED, true) + && (features & FEATURES_WIFI) == FEATURES_WIFI + && isSupportingSprintWifiCall(context); } /** @@ -60,7 +103,16 @@ public class MotorolaUtils { } private static boolean isSupportingSprintHdCodec(Context context) { - return context.getPackageManager().hasSystemFeature(HD_CALL_FEATRURE) - && context.getResources().getBoolean(R.bool.motorola_sprint_hd_codec); + return isSpnMatched(context) + && context.getResources().getBoolean(R.bool.motorola_sprint_hd_codec) + && context.getPackageManager().hasSystemFeature(HD_CALL_FEATRURE); + } + + private static boolean isSupportingSprintWifiCall(Context context) { + if (!hasCheckedSprintWifiCall) { + supportSprintWifiCall = PackageUtils.isPackageEnabled(WIFI_CALL_PACKAGE_NAME, context); + hasCheckedSprintWifiCall = true; + } + return supportSprintWifiCall; } } diff --git a/java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml new file mode 100644 index 000000000..7f63bee75 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml @@ -0,0 +1,6 @@ + + + true + true + Sprint + \ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml new file mode 100644 index 000000000..39b72cdd1 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml @@ -0,0 +1,5 @@ + + + true + true + \ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml new file mode 100644 index 000000000..39b72cdd1 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml @@ -0,0 +1,5 @@ + + + true + true + \ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml new file mode 100644 index 000000000..39b72cdd1 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml @@ -0,0 +1,5 @@ + + + true + true + \ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml new file mode 100644 index 000000000..39b72cdd1 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml @@ -0,0 +1,5 @@ + + + true + true + \ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml new file mode 100644 index 000000000..39b72cdd1 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml @@ -0,0 +1,5 @@ + + + true + true + \ No newline at end of file -- cgit v1.2.3