File tree Expand file tree Collapse file tree 5 files changed +16
-2
lines changed
androidTest/java/im/vector/app/features/voice
debug/java/im/vector/app/features/debug/features
main/java/im/vector/app/features Expand file tree Collapse file tree 5 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -19,14 +19,15 @@ package im.vector.app.features.voice
1919import android.os.Build
2020import androidx.test.platform.app.InstrumentationRegistry
2121import im.vector.app.AndroidVersionTestOverrider
22+ import im.vector.app.features.DefaultVectorFeatures
2223import org.amshove.kluent.shouldBeInstanceOf
2324import org.junit.After
2425import org.junit.Test
2526
2627class VoiceRecorderProviderTests {
2728
2829 private val context = InstrumentationRegistry .getInstrumentation().targetContext
29- private val provider = VoiceRecorderProvider (context)
30+ private val provider = VoiceRecorderProvider (context, DefaultVectorFeatures () )
3031
3132 @After
3233 fun tearDown () {
Original file line number Diff line number Diff line change @@ -70,6 +70,11 @@ class DebugFeaturesStateFactory @Inject constructor(
7070 key = DebugFeatureKeys .allowExternalUnifiedPushDistributors,
7171 factory = VectorFeatures ::allowExternalUnifiedPushDistributors
7272 ),
73+ createBooleanFeature(
74+ label = " Force usage of OpusEncoder library" ,
75+ key = DebugFeatureKeys .forceUsageOfOpusEncoder,
76+ factory = VectorFeatures ::forceUsageOfOpusEncoder
77+ ),
7378 )
7479 )
7580 }
Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ class DebugVectorFeatures(
6666 override fun isScreenSharingEnabled (): Boolean = read(DebugFeatureKeys .screenSharing)
6767 ? : vectorFeatures.isScreenSharingEnabled()
6868
69+ override fun forceUsageOfOpusEncoder (): Boolean = read(DebugFeatureKeys .forceUsageOfOpusEncoder)
70+ ? : vectorFeatures.forceUsageOfOpusEncoder()
71+
6972 fun <T > override (value : T ? , key : Preferences .Key <T >) = updatePreferences {
7073 if (value == null ) {
7174 it.remove(key)
@@ -123,4 +126,5 @@ object DebugFeatureKeys {
123126 val allowExternalUnifiedPushDistributors = booleanPreferencesKey(" allow-external-unified-push-distributors" )
124127 val liveLocationSharing = booleanPreferencesKey(" live-location-sharing" )
125128 val screenSharing = booleanPreferencesKey(" screen-sharing" )
129+ val forceUsageOfOpusEncoder = booleanPreferencesKey(" force-usage-of-opus-encoder" )
126130}
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ interface VectorFeatures {
3030 fun isOnboardingCombinedLoginEnabled (): Boolean
3131 fun allowExternalUnifiedPushDistributors (): Boolean
3232 fun isScreenSharingEnabled (): Boolean
33+ fun forceUsageOfOpusEncoder (): Boolean
3334
3435 enum class OnboardingVariant {
3536 LEGACY ,
@@ -48,4 +49,5 @@ class DefaultVectorFeatures : VectorFeatures {
4849 override fun isOnboardingCombinedLoginEnabled () = false
4950 override fun allowExternalUnifiedPushDistributors (): Boolean = Config .ALLOW_EXTERNAL_UNIFIED_PUSH_DISTRIBUTORS
5051 override fun isScreenSharingEnabled (): Boolean = true
52+ override fun forceUsageOfOpusEncoder (): Boolean = false
5153}
Original file line number Diff line number Diff line change @@ -18,14 +18,16 @@ package im.vector.app.features.voice
1818
1919import android.content.Context
2020import android.os.Build
21+ import im.vector.app.features.VectorFeatures
2122import kotlinx.coroutines.Dispatchers
2223import javax.inject.Inject
2324
2425class VoiceRecorderProvider @Inject constructor(
2526 private val context : Context ,
27+ private val vectorFeatures : VectorFeatures ,
2628) {
2729 fun provideVoiceRecorder (): VoiceRecorder {
28- return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q ) {
30+ return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q && vectorFeatures.forceUsageOfOpusEncoder(). not () ) {
2931 VoiceRecorderQ (context)
3032 } else {
3133 VoiceRecorderL (context, Dispatchers .IO )
You can’t perform that action at this time.
0 commit comments