Add Pixel, S5, Redmi Note 3, and Xiaomi Mi4 to AEC blacklist

Make these application-level changes

Helps #6241
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2017-03-21 10:23:16 -07:00
parent 6787a96d71
commit f4acaad407

View File

@ -42,12 +42,16 @@ import org.thoughtcrime.securesms.service.RotateSignedPreKeyListener;
import org.thoughtcrime.securesms.service.UpdateApkRefreshListener; import org.thoughtcrime.securesms.service.UpdateApkRefreshListener;
import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.webrtc.PeerConnectionFactory; import org.webrtc.PeerConnectionFactory;
import org.webrtc.voiceengine.WebRtcAudioManager;
import org.webrtc.voiceengine.WebRtcAudioUtils;
import org.whispersystems.jobqueue.JobManager; import org.whispersystems.jobqueue.JobManager;
import org.whispersystems.jobqueue.dependencies.DependencyInjector; import org.whispersystems.jobqueue.dependencies.DependencyInjector;
import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider; import org.whispersystems.jobqueue.requirements.NetworkRequirementProvider;
import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider; import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider;
import org.whispersystems.libsignal.util.AndroidSignalProtocolLogger; import org.whispersystems.libsignal.util.AndroidSignalProtocolLogger;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import dagger.ObjectGraph; import dagger.ObjectGraph;
@ -87,10 +91,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
initializePeriodicTasks(); initializePeriodicTasks();
initializeCircumvention(); initializeCircumvention();
initializeSetVideoCapable(); initializeSetVideoCapable();
initializeWebRtc();
if (Build.VERSION.SDK_INT >= 11) {
PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true);
}
} }
@Override @Override
@ -176,8 +177,38 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
} }
} }
private void initializeWebRtc() {
Set<String> HARDWARE_AEC_BLACKLIST = new HashSet<String>() {{
add("D6503"); // Sony Xperia Z2 D6503
add("ONE A2005"); // OnePlus 2
add("MotoG3"); // Moto G (3rd Generation)
add("Nexus 6P"); // Nexus 6p
add("Pixel"); // Pixel #6241
add("Pixel XL"); // Pixel XL #6241
add("MI 4LTE"); // Xiami Mi4 #6241
add("Redmi Note 3"); // Redmi Note 3 #6241
add("SM-G900F"); // Samsung Galaxy S5 #6241
}};
Set<String> OPEN_SL_ES_BLACKLIST = new HashSet<String>() {{
add("MI 4LTE"); // Xiami Mi4 #6241
}};
if (Build.VERSION.SDK_INT >= 11) {
if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
}
if (OPEN_SL_ES_BLACKLIST.contains(Build.MODEL)) {
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
}
PeerConnectionFactory.initializeAndroidGlobals(this, true, true, true);
}
}
private void initializeCircumvention() { private void initializeCircumvention() {
new AsyncTask<Void, Void, Void>() { AsyncTask<Void, Void, Void> task = new AsyncTask<Void, Void, Void>() {
@Override @Override
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
if (new SignalServiceNetworkAccess(ApplicationContext.this).isCensored(ApplicationContext.this)) { if (new SignalServiceNetworkAccess(ApplicationContext.this).isCensored(ApplicationContext.this)) {
@ -189,7 +220,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
} }
return null; return null;
} }
}.execute(); };
if (Build.VERSION.SDK_INT >= 11) task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else task.execute();
} }
} }