Make call to desugared classes from ApplicationContext indirect for API19.
Fixes #11185
This commit is contained in:
parent
96a80f0ed2
commit
53b6cc21b1
2 changed files with 50 additions and 24 deletions
|
@ -81,8 +81,6 @@ import org.webrtc.voiceengine.WebRtcAudioUtils;
|
||||||
import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider;
|
import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider;
|
||||||
|
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -322,31 +320,11 @@ public class ApplicationContext extends MultiDexApplication implements AppForegr
|
||||||
|
|
||||||
private void initializeRingRtc() {
|
private void initializeRingRtc() {
|
||||||
try {
|
try {
|
||||||
Set<String> HARDWARE_AEC_BLACKLIST = new HashSet<String>() {{
|
if (RtcDeviceLists.hardwareAECBlocked()) {
|
||||||
add("Pixel");
|
|
||||||
add("Pixel XL");
|
|
||||||
add("Moto G5");
|
|
||||||
add("Moto G (5S) Plus");
|
|
||||||
add("Moto G4");
|
|
||||||
add("TA-1053");
|
|
||||||
add("Mi A1");
|
|
||||||
add("Mi A2");
|
|
||||||
add("E5823"); // Sony z5 compact
|
|
||||||
add("Redmi Note 5");
|
|
||||||
add("FP2"); // Fairphone FP2
|
|
||||||
add("MI 5");
|
|
||||||
}};
|
|
||||||
|
|
||||||
Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{
|
|
||||||
add("Pixel");
|
|
||||||
add("Pixel XL");
|
|
||||||
}};
|
|
||||||
|
|
||||||
if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
|
|
||||||
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
|
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
|
if (!RtcDeviceLists.openSLESAllowed()) {
|
||||||
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Device hardware capability lists.
|
||||||
|
* <p>
|
||||||
|
* Moved outside of ApplicationContext as the indirection was important for API19 support with desugaring: https://issuetracker.google.com/issues/183419297
|
||||||
|
*/
|
||||||
|
final class RtcDeviceLists {
|
||||||
|
|
||||||
|
private RtcDeviceLists() {}
|
||||||
|
|
||||||
|
static Set<String> hardwareAECBlockList() {
|
||||||
|
return new HashSet<String>() {{
|
||||||
|
add("Pixel");
|
||||||
|
add("Pixel XL");
|
||||||
|
add("Moto G5");
|
||||||
|
add("Moto G (5S) Plus");
|
||||||
|
add("Moto G4");
|
||||||
|
add("TA-1053");
|
||||||
|
add("Mi A1");
|
||||||
|
add("Mi A2");
|
||||||
|
add("E5823"); // Sony z5 compact
|
||||||
|
add("Redmi Note 5");
|
||||||
|
add("FP2"); // Fairphone FP2
|
||||||
|
add("MI 5");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
static Set<String> openSlEsAllowList() {
|
||||||
|
return new HashSet<String>() {{
|
||||||
|
add("Pixel");
|
||||||
|
add("Pixel XL");
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean hardwareAECBlocked() {
|
||||||
|
return hardwareAECBlockList().contains(Build.MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean openSLESAllowed() {
|
||||||
|
return openSlEsAllowList().contains(Build.MODEL);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue