summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtem Borisov <dedsa2002@gmail.com>2018-09-19 17:02:06 +0300
committerMichael Bestas <mkbestas@lineageos.org>2019-12-23 19:09:38 +0200
commit676ba1c65f764cc8053e4656419f0be57a051f6b (patch)
tree5d31c014779b428177eef5173d0cd5900aca62b5
parente76288804cbdac297893622a3b3a1274455eb15e (diff)
downloadandroid_packages_services_Telephony-staging/lineage-17.0_merge-android-10.0.0_r9.tar.gz
android_packages_services_Telephony-staging/lineage-17.0_merge-android-10.0.0_r9.tar.bz2
android_packages_services_Telephony-staging/lineage-17.0_merge-android-10.0.0_r9.zip
Telephony: Support muting by RIL commandstaging/lineage-17.0_merge-android-10.0.0_r9
While almost everyone already moved to AudioManager years ago, some OEMs (cough Huawei) still use RIL for muting and don't promote the necessary calls in their audio HAL. Let's handle these odd cases too when it's necessary. Change-Id: Id916dec2574d6e57b6f809fbaf2b0959c0cc7256
-rw-r--r--res/values/config.xml2
-rw-r--r--src/com/android/services/telephony/TelephonyConnection.java11
2 files changed, 12 insertions, 1 deletions
diff --git a/res/values/config.xml b/res/values/config.xml
index 8bc1919db..e84a96581 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -96,7 +96,7 @@
<!-- Determine whether calls to mute the microphone in PhoneUtils
are routed through the android.media.AudioManager class (true) or through
the com.android.internal.telephony.Phone interface (false). -->
- <bool name="send_mic_mute_to_AudioManager">false</bool>
+ <bool name="send_mic_mute_to_AudioManager">true</bool>
<!-- Determines if device implements a noise suppression device for in call audio-->
<!-- DEPRECATED: Use CarrierConfigManager#KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL -->
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 996c8eac5..06dce1626 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -710,6 +710,11 @@ abstract class TelephonyConnection extends Connection implements Holdable {
private boolean mShowPreciseFailedCause;
/**
+ * Indicates whether this device supports muting via AudioManager.
+ */
+ private final boolean mSendMicMuteToAudioManager;
+
+ /**
* Listeners to our TelephonyConnection specific callbacks
*/
private final Set<TelephonyConnectionListener> mTelephonyListeners = Collections.newSetFromMap(
@@ -722,6 +727,9 @@ abstract class TelephonyConnection extends Connection implements Holdable {
if (originalConnection != null) {
setOriginalConnection(originalConnection);
}
+ Phone phone = getPhone();
+ mSendMicMuteToAudioManager = phone == null || phone.getContext().getResources().getBoolean(
+ R.bool.send_mic_mute_to_AudioManager);
}
/**
@@ -736,6 +744,9 @@ abstract class TelephonyConnection extends Connection implements Holdable {
// TODO: update TTY mode.
if (getPhone() != null) {
getPhone().setEchoSuppressionEnabled();
+ if (!mSendMicMuteToAudioManager) {
+ getPhone().setMute(audioState.isMuted());
+ }
}
}