From 2f1c7586bcce334ca69022eb8dc6d8965ceb6a05 Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 19 Jun 2017 11:26:01 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/159428781. 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/159428781 (6/19/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: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030 --- .../android/dialer/oem/CequintCallerIdManager.java | 100 ++++++--------------- .../dialer/oem/MotorolaHiddenMenuKeySequence.java | 4 +- java/com/android/dialer/oem/MotorolaUtils.java | 27 +++++- .../res/values-mcc310-mnc000/motorola_config.xml | 17 +++- .../res/values-mcc310-mnc120/motorola_config.xml | 17 +++- .../res/values-mcc311-mnc490/motorola_config.xml | 17 +++- .../res/values-mcc311-mnc870/motorola_config.xml | 17 +++- .../res/values-mcc312-mnc530/motorola_config.xml | 17 +++- .../res/values-mcc316-mnc010/motorola_config.xml | 17 +++- .../dialer/oem/res/values/motorola_config.xml | 19 +++- 10 files changed, 167 insertions(+), 85 deletions(-) (limited to 'java/com/android/dialer/oem') diff --git a/java/com/android/dialer/oem/CequintCallerIdManager.java b/java/com/android/dialer/oem/CequintCallerIdManager.java index 095ee4e66..86097c41a 100644 --- a/java/com/android/dialer/oem/CequintCallerIdManager.java +++ b/java/com/android/dialer/oem/CequintCallerIdManager.java @@ -18,7 +18,6 @@ package com.android.dialer.oem; import android.annotation.TargetApi; import android.content.Context; import android.content.pm.PackageManager; -import android.database.ContentObserver; import android.database.Cursor; import android.net.Uri; import android.os.Build.VERSION_CODES; @@ -29,9 +28,8 @@ import android.support.annotation.WorkerThread; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import com.android.dialer.common.Assert; -import com.android.dialer.common.ConfigProviderBindings; import com.android.dialer.common.LogUtil; -import com.android.dialer.util.PermissionsUtil; +import com.android.dialer.configprovider.ConfigProviderBindings; import java.util.concurrent.ConcurrentHashMap; /** @@ -73,17 +71,12 @@ public class CequintCallerIdManager { private static final String IMAGE = "cid_pLogo"; private static final String DISPLAY_NAME = "cid_pDisplayName"; - // TODO: Revisit it and maybe remove it if it's not necessary. - private static final ConcurrentHashMap callLogCache = - new ConcurrentHashMap<>(); - private static final ConcurrentHashMap incallIncomingCallCache = - new ConcurrentHashMap<>(); - private static final ConcurrentHashMap incallOutgoingCallCache = - new ConcurrentHashMap<>(); - private static boolean hasRegisteredContentObserver; private static boolean hasAlreadyCheckedCequintCallerIdPackage; private static boolean isCequintCallerIdEnabled; + // TODO: Revisit it and maybe remove it if it's not necessary. + private final ConcurrentHashMap callLogCache; + /** Cequint caller id contact information. */ public static class CequintCallerIdContact { public final String name; @@ -117,27 +110,8 @@ public class CequintCallerIdManager { return isCequintCallerIdEnabled; } - @WorkerThread - @Nullable - public static CequintCallerIdContact getCequintCallerIdContact(Context context, String number) { - Assert.isWorkerThread(); - LogUtil.d( - "CequintCallerIdManager.getCequintCallerIdContact", - "number: %s", - LogUtil.sanitizePhoneNumber(number)); - if (callLogCache.containsKey(number)) { - return callLogCache.get(number); - } - CequintCallerIdContact cequintCallerIdContact = - lookup( - context, - CONTENT_URI, - PhoneNumberUtils.stripSeparators(number), - new String[] {"system"}); - if (cequintCallerIdContact != null) { - callLogCache.put(number, cequintCallerIdContact); - } - return cequintCallerIdContact; + public static CequintCallerIdManager createInstanceForCallLog() { + return new CequintCallerIdManager(); } @WorkerThread @@ -151,12 +125,6 @@ public class CequintCallerIdManager { LogUtil.sanitizePhoneNumber(number), LogUtil.sanitizePii(cnapName), isIncoming); - registerContentObserver(context); - if (isIncoming && incallIncomingCallCache.containsKey(number)) { - return incallIncomingCallCache.get(number); - } else if (!isIncoming && incallOutgoingCallCache.containsKey(number)) { - return incallOutgoingCallCache.get(number); - } int flag = 0; if (isIncoming) { flag |= CALLER_ID_LOOKUP_INCOMING_CALL; @@ -165,14 +133,28 @@ public class CequintCallerIdManager { flag |= CALLER_ID_LOOKUP_USER_PROVIDED_CID; } String[] flags = {cnapName, String.valueOf(flag)}; + return lookup(context, CONTENT_URI_FOR_INCALL, number, flags); + } + + @WorkerThread + @Nullable + public CequintCallerIdContact getCequintCallerIdContact(Context context, String number) { + Assert.isWorkerThread(); + LogUtil.d( + "CequintCallerIdManager.getCequintCallerIdContact", + "number: %s", + LogUtil.sanitizePhoneNumber(number)); + if (callLogCache.containsKey(number)) { + return callLogCache.get(number); + } CequintCallerIdContact cequintCallerIdContact = - lookup(context, CONTENT_URI_FOR_INCALL, number, flags); + lookup( + context, + CONTENT_URI, + PhoneNumberUtils.stripSeparators(number), + new String[] {"system"}); if (cequintCallerIdContact != null) { - if (isIncoming) { - incallIncomingCallCache.put(number, cequintCallerIdContact); - } else { - incallOutgoingCallCache.put(number, cequintCallerIdContact); - } + callLogCache.put(number, cequintCallerIdContact); } return cequintCallerIdContact; } @@ -285,33 +267,7 @@ public class CequintCallerIdManager { return geoDescription; } - private static synchronized void registerContentObserver(Context context) { - if (!PermissionsUtil.hasCequintPermissions(context)) { - LogUtil.i("CequintCallerIdManager.registerContentObserver", "no cequint permissions"); - return; - } - - if (hasRegisteredContentObserver) { - return; - } - ContentObserver contentObserver = - new ContentObserver(null) { - @Override - public void onChange(boolean selfChange) { - invalidateCache(); - } - }; - - context - .getContentResolver() - .registerContentObserver(CONTENT_URI_FOR_INCALL, true, contentObserver); - hasRegisteredContentObserver = true; - } - - private static void invalidateCache() { - incallIncomingCallCache.clear(); - incallOutgoingCallCache.clear(); + private CequintCallerIdManager() { + callLogCache = new ConcurrentHashMap<>(); } - - private CequintCallerIdManager() {} } diff --git a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java index 9cf145b7a..79abff08e 100644 --- a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java +++ b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java @@ -67,9 +67,7 @@ public class MotorolaHiddenMenuKeySequence { } private MotorolaHiddenMenuKeySequence(Context context) { - featureHiddenMenuEnabled = - MotorolaUtils.isSpnMatched(context) - && context.getResources().getBoolean(R.bool.motorola_feature_hidden_menu); + featureHiddenMenuEnabled = MotorolaUtils.isSupportingHiddenMenu(context); // 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 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) 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 index 7f63bee75..ac3397520 100644 --- 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 @@ -1,6 +1,21 @@ + + 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 index 39b72cdd1..c5cb0d1f7 100644 --- 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 @@ -1,5 +1,20 @@ + + 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 index 39b72cdd1..c5cb0d1f7 100644 --- 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 @@ -1,5 +1,20 @@ + + 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 index 39b72cdd1..c5cb0d1f7 100644 --- 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 @@ -1,5 +1,20 @@ + + 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 index 39b72cdd1..c5cb0d1f7 100644 --- 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 @@ -1,5 +1,20 @@ + + 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 index 39b72cdd1..c5cb0d1f7 100644 --- 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 @@ -1,5 +1,20 @@ + + true - true \ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values/motorola_config.xml b/java/com/android/dialer/oem/res/values/motorola_config.xml index f875d573d..46e7a16b6 100644 --- a/java/com/android/dialer/oem/res/values/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values/motorola_config.xml @@ -1,12 +1,25 @@ + + false - - false - -- cgit v1.2.3