diff --git a/app/build.gradle b/app/build.gradle index 210e7d173a..65cab827a3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ android { targetSdkVersion 27 testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" - versionCode 12 - versionName "1.0.3" + versionCode 13 + versionName "1.0.4" // Enabling multidex support. multiDexEnabled true diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java index ddb21d87a5..354a254397 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.java @@ -32,6 +32,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -75,6 +76,7 @@ import com.nextcloud.talk.webrtc.MagicAudioManager; import com.nextcloud.talk.webrtc.MagicPeerConnectionWrapper; import com.nextcloud.talk.webrtc.MagicWebRTCUtils; +import com.nextcloud.talk.webrtc.MagicWebRtcLists; import org.apache.commons.lang3.StringEscapeUtils; import org.greenrobot.eventbus.EventBus; @@ -438,7 +440,8 @@ private void createCameraEnumerator() { if (camera2EnumeratorIsSupported) { cameraEnumerator = new Camera2Enumerator(this); } else { - cameraEnumerator = new Camera1Enumerator(true); + cameraEnumerator = new Camera1Enumerator(!MagicWebRtcLists.HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build + .MANUFACTURER.toLowerCase())); } } @@ -559,8 +562,10 @@ private void basicInitialization() { PeerConnectionFactory.Options options = new PeerConnectionFactory.Options(); peerConnectionFactory = new PeerConnectionFactory(options); - peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(), - rootEglBase.getEglBaseContext()); + if (!MagicWebRtcLists.HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build.MANUFACTURER.toLowerCase())) { + peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(), + rootEglBase.getEglBaseContext()); + } //Create MediaConstraints - Will be useful for specifying video and audio constraints. audioConstraints = new MediaConstraints(); @@ -1000,7 +1005,6 @@ private void hangup(boolean dueToNetworkChange) { } if (peerConnectionFactory != null) { - peerConnectionFactory.dispose(); peerConnectionFactory = null; } @@ -1115,6 +1119,8 @@ private void gotRemoteStream(MediaStream stream, String session) { Log.d(TAG, "Failed to create a new video view"); } } + + callControls.setZ(100.0f); } @Override @@ -1212,6 +1218,8 @@ private void removeMediaStream(String sessionId) { remoteRenderersLayout.invalidate(); } } + + callControls.setZ(100.0f); } @Subscribe(threadMode = ThreadMode.MAIN) diff --git a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java index 02a8d2036c..b7873680c4 100644 --- a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java +++ b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java @@ -40,6 +40,7 @@ import com.nextcloud.talk.jobs.PushRegistrationJob; import com.nextcloud.talk.jobs.creator.MagicJobCreator; import com.nextcloud.talk.utils.database.user.UserModule; +import com.nextcloud.talk.webrtc.MagicWebRtcLists; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; @@ -51,8 +52,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.GeneralSecurityException; -import java.util.HashSet; -import java.util.Set; import javax.inject.Singleton; @@ -109,52 +108,24 @@ private void useCompatVectorIfNeeded() { addDelegate.invoke(drawableManager, "vector", vdcInflateDelegate); } catch (ClassNotFoundException | NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException e) { - Log.d(TAG, "Failed to use reflection to enable proper vector scaling"); + Log.e(TAG, "Failed to use reflection to enable proper vector scaling"); } } } - /* - AEC blacklist and SL_ES_WHITELIST are borrowed from Signal - https://github.com/WhisperSystems/Signal-Android/blob/551470123d006b76a68d705d131bb12513a5e683/src/org/thoughtcrime/securesms/ApplicationContext.java - */ private void initializeWebRtc() { try { - Set HARDWARE_AEC_BLACKLIST = new HashSet() {{ - 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 - add("Pixel XL"); // Pixel XL - add("MI 4LTE"); // Xiami Mi4 - add("Redmi Note 3"); // Redmi Note 3 - add("Redmi Note 4"); // Redmi Note 4 - add("SM-G900F"); // Samsung Galaxy S5 - add("g3_kt_kr"); // LG G3 - add("SM-G930F"); // Samsung Galaxy S7 - add("Xperia SP"); // Sony Xperia SP - add("Nexus 6"); // Nexus 6 - add("ONE E1003"); // OnePlus X - add("One"); // OnePlus One - add("Moto G5"); - }}; - - Set OPEN_SL_ES_WHITELIST = new HashSet() {{ - add("Pixel"); - add("Pixel XL"); - }}; - - if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) { + if (MagicWebRtcLists.HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) { WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true); } - if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) { + if (!MagicWebRtcLists.OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) { WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true); } PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions.builder(this) - .setEnableVideoHwAcceleration(true) + .setEnableVideoHwAcceleration(!MagicWebRtcLists.HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build + .MANUFACTURER.toLowerCase())) .createInitializationOptions()); } catch (UnsatisfiedLinkError e) { Log.w(TAG, e); diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/MagicWebRtcLists.java b/app/src/main/java/com/nextcloud/talk/webrtc/MagicWebRtcLists.java new file mode 100644 index 0000000000..fd8b8e3856 --- /dev/null +++ b/app/src/main/java/com/nextcloud/talk/webrtc/MagicWebRtcLists.java @@ -0,0 +1,62 @@ +/* + * Nextcloud Talk application + * + * @author Mario Danic + * Copyright (C) 2017 Mario Danic + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.nextcloud.talk.webrtc; + +import java.util.HashSet; +import java.util.Set; + +public class MagicWebRtcLists { + /* + AEC blacklist and SL_ES_WHITELIST are borrowed from Signal + https://github.com/WhisperSystems/Signal-Android/blob/551470123d006b76a68d705d131bb12513a5e683/src/org/thoughtcrime/securesms/ApplicationContext.java + */ + public static Set HARDWARE_AEC_BLACKLIST = new HashSet() {{ + 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 + add("Pixel XL"); // Pixel XL + add("MI 4LTE"); // Xiami Mi4 + add("Redmi Note 3"); // Redmi Note 3 + add("Redmi Note 4"); // Redmi Note 4 + add("SM-G900F"); // Samsung Galaxy S5 + add("g3_kt_kr"); // LG G3 + add("SM-G930F"); // Samsung Galaxy S7 + add("Xperia SP"); // Sony Xperia SP + add("Nexus 6"); // Nexus 6 + add("ONE E1003"); // OnePlus X + add("One"); // OnePlus One + add("Moto G5"); + }}; + + public static Set OPEN_SL_ES_WHITELIST = new HashSet() {{ + add("Pixel"); + add("Pixel XL"); + }}; + + public static Set HARDWARE_ACCELERATION_DEVICE_BLACKLIST = new HashSet() {{ + }}; + + public static Set HARDWARE_ACCELERATION_VENDOR_BLACKLIST = new HashSet() {{ + add("samsung"); + }}; +}