From 1c8077a7fe08ba6ac2d4001c2d86b6c8f9c097d4 Mon Sep 17 00:00:00 2001
From: Moxie Marlinspike <moxie@thoughtcrime.org>
Date: Mon, 19 Jun 2017 09:22:07 -0700
Subject: [PATCH] Switch from a hardware AEC whitelist back to a blacklist

Disabling OpenSL ES seems to make the hardware AEC "work" on
devices where it was previously causing problems.

Using the WebRTC-based software AEC *without* OpenSL ES seems to
be causing new problems.

Fixes #6737
Related #6432
Related #6241
// FREEBIE
---
 .../securesms/ApplicationContext.java          | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java
index 877431d8d0..b6daff2fc0 100644
--- a/src/org/thoughtcrime/securesms/ApplicationContext.java
+++ b/src/org/thoughtcrime/securesms/ApplicationContext.java
@@ -178,26 +178,22 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
   }
 
   private void initializeWebRtc() {
-    Set<String> HARDWARE_AEC_WHITELIST = new HashSet<String>() {{
-      add("D5803");
-      add("FP1");
-      add("SM-A500FU");
-      add("XT1092");
+    Set<String> HARDWARE_AEC_BLACKLIST = new HashSet<String>() {{
+      add("Pixel");
+      add("Pixel XL");
     }};
 
     Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{
+      add("Pixel");
+      add("Pixel XL");
     }};
 
     if (Build.VERSION.SDK_INT >= 11) {
-      if (HARDWARE_AEC_WHITELIST.contains(Build.MODEL)) {
-        WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false);
-      } else {
+      if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
         WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
       }
 
-      if (OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
-        WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false);
-      } else {
+      if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
         WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
       }